Added modules

This commit is contained in:
Valentino Orlandi 2022-10-23 16:45:48 +02:00
parent 59160d608e
commit 1a1b517f16
Signed by: elB4RTO
GPG Key ID: 1719E976DB2D4E71
6 changed files with 656 additions and 0 deletions

View File

@ -0,0 +1,36 @@
#include "dialogbool.h"
#include "ui_dialogbool.h"
DialogBool::DialogBool( const QString& title, const QString& text, QWidget *parent ) :
QDialog(parent),
ui(new Ui::DialogBool)
{
ui->setupUi(this);
// insert the given title and text
this->ui->label_Title->setText( title );
this->ui->label_Message->setText( text );
// adjust the initial size
this->adjustSize();
}
DialogBool::~DialogBool()
{
delete ui;
}
void DialogBool::on_button_NO_clicked()
{
this->done( 0 );
}
void DialogBool::on_button_YES_clicked()
{
this->done( 1 );
}

View File

@ -0,0 +1,28 @@
#ifndef DIALOGBOOL_H
#define DIALOGBOOL_H
#include <QDialog>
namespace Ui {
class DialogBool;
}
class DialogBool : public QDialog
{
Q_OBJECT
public:
explicit DialogBool( const QString& title, const QString& text, QWidget *parent=nullptr );
~DialogBool();
private slots:
void on_button_NO_clicked();
void on_button_YES_clicked();
private:
Ui::DialogBool *ui;
};
#endif // DIALOGBOOL_H

View File

@ -0,0 +1,210 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogBool</class>
<widget class="QDialog" name="DialogBool">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>512</width>
<height>256</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>512</width>
<height>192</height>
</size>
</property>
<property name="font">
<font>
<family>Metropolis</family>
<pointsize>13</pointsize>
</font>
</property>
<property name="windowIcon">
<iconset resource="../../resources/resources.qrc">
<normaloff>:/logo/logo/logdoctor.svg</normaloff>:/logo/logo/logdoctor.svg</iconset>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QFrame" name="frame_Message">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0" rowspan="3">
<widget class="QLabel" name="label_Icon">
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="pixmap">
<pixmap resource="../../resources/resources.qrc">:/icons/quest</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_Title">
<property name="minimumSize">
<size>
<width>0</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>64</height>
</size>
</property>
<property name="font">
<font>
<family>Metropolis</family>
<pointsize>13</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="indent">
<number>8</number>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="label_Message">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>24</height>
</size>
</property>
<property name="font">
<font>
<family>Metropolis</family>
<pointsize>13</pointsize>
</font>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>4</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_Buttons">
<property name="minimumSize">
<size>
<width>0</width>
<height>48</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>48</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>333</width>
<height>27</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="button_YES">
<property name="minimumSize">
<size>
<width>96</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>96</width>
<height>32</height>
</size>
</property>
<property name="text">
<string>Yes</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="button_NO">
<property name="minimumSize">
<size>
<width>96</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>96</width>
<height>32</height>
</size>
</property>
<property name="text">
<string>No</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../../resources/resources.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,92 @@
#include "dialogmsg.h"
#include "ui_dialogmsg.h"
#include <QIcon>
#include <QPixmap>
#include <QFont>
#include <QFontDatabase>
DialogMsg::DialogMsg(const QString& title, const QString& text, const QString& additional, const int& type, QWidget* parent ) :
QDialog(parent),
ui(new Ui::DialogMsg)
{
ui->setupUi(this);
// icon
switch (type) {
case 0:
// info message
this->ui->label_Icon->setPixmap( QPixmap(":/icons/info") );
break;
case 1:
// warning message
this->ui->label_Icon->setPixmap( QPixmap(":/icons/warn") );
break;
case 2:
// error message
this->ui->label_Icon->setPixmap( QPixmap(":/icons/err") );
break;
default:
// shouldn't be here
throw ("Unexpected dialog type: "+ std::to_string(type));
}
// insert the given text
this->ui->label_Title->setText( title );
this->ui->label_Message->setText( text );
// additional info, hide by default
this->ui->frame_Additional->setVisible( false );
if ( additional.size() == 0 ) {
this->ui->button_ShowAdditional->setEnabled( false );
this->ui->button_ShowAdditional->setVisible( false );
} else {
this->ui->text_Additional->setText( additional );
this->ui->text_Additional->setFont(
QFont(
QFontDatabase::applicationFontFamilies(
QFontDatabase::addApplicationFont(":/fonts/3270")).at(0),
11 ));
}
// adjust the initial size
this->adjustSize();
}
DialogMsg::~DialogMsg()
{
delete ui;
}
void DialogMsg::on_button_ShowAdditional_clicked()
{
this->additional_shown = ! this->additional_shown;
// set additional info visibility
this->ui->frame_Additional->setVisible( this->additional_shown );
// set the icon
QIcon icon;
if ( this->additional_shown ) {
icon = QIcon(":/icons/up");
// resize
this->initial_height = this->height();
if ( this->additional_height > 0 ) {
this->resize( this->width(), this->additional_height );
} else {
this->resize( this->width(), this->height()+100 );
}
} else {
icon = QIcon(":/icons/down");
this->additional_height = this->height();
this->resize( this->width(), this->initial_height );
}
this->ui->button_ShowAdditional->setIcon( icon );
}
void DialogMsg::on_button_Ok_clicked()
{
this->done( 1 );
}

View File

@ -0,0 +1,33 @@
#ifndef DIALOGMSG_H
#define DIALOGMSG_H
#include <QDialog>
namespace Ui {
class DialogMsg;
}
class DialogMsg : public QDialog
{
Q_OBJECT
public:
explicit DialogMsg( const QString& title, const QString& text, const QString& additional, const int& type, QWidget *parent=nullptr );
~DialogMsg();
private slots:
void on_button_ShowAdditional_clicked();
void on_button_Ok_clicked();
private:
Ui::DialogMsg *ui;
bool additional_shown = false;
int initial_height = 0;
int additional_height = 0;
};
#endif // DIALOGMSG_H

View File

@ -0,0 +1,257 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogMsg</class>
<widget class="QDialog" name="DialogMsg">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>512</width>
<height>256</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>512</width>
<height>192</height>
</size>
</property>
<property name="font">
<font>
<family>Metropolis</family>
<pointsize>13</pointsize>
</font>
</property>
<property name="windowIcon">
<iconset resource="../../resources/resources.qrc">
<normaloff>:/logo/logo/logdoctor.svg</normaloff>:/logo/logo/logdoctor.svg</iconset>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QFrame" name="frame_Message">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0" rowspan="3">
<widget class="QLabel" name="label_Icon">
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="pixmap">
<pixmap resource="../../resources/resources.qrc">:/icons/err</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_Title">
<property name="minimumSize">
<size>
<width>0</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>64</height>
</size>
</property>
<property name="font">
<font>
<family>Metropolis</family>
<pointsize>13</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="indent">
<number>8</number>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="label_Message">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>24</height>
</size>
</property>
<property name="font">
<font>
<family>Metropolis</family>
<pointsize>13</pointsize>
</font>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>4</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_Additional">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QTextBrowser" name="text_Additional">
<property name="minimumSize">
<size>
<width>0</width>
<height>24</height>
</size>
</property>
<property name="font">
<font>
<family>Metropolis</family>
<pointsize>11</pointsize>
</font>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<property name="openLinks">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_Buttons">
<property name="minimumSize">
<size>
<width>0</width>
<height>48</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>48</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="button_ShowAdditional">
<property name="minimumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<property name="icon">
<iconset resource="../../resources/resources.qrc">
<normaloff>:/icons/down</normaloff>:/icons/down</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>333</width>
<height>27</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="button_Ok">
<property name="minimumSize">
<size>
<width>96</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>96</width>
<height>32</height>
</size>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<property name="text">
<string>Ok</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../../resources/resources.qrc"/>
</resources>
<connections/>
</ui>