unified dialog style sheet, removed hard coded colors

This commit is contained in:
Martchus 2015-09-26 20:34:09 +02:00
parent ff4ffafefd
commit 04852b9a18
3 changed files with 28 additions and 59 deletions

View File

@ -38,6 +38,7 @@
using namespace std; using namespace std;
using namespace IoUtilities; using namespace IoUtilities;
using namespace Io; using namespace Io;
using namespace Dialogs;
namespace QtGui { namespace QtGui {
@ -110,7 +111,7 @@ MainWindow::MainWindow(QWidget *parent) :
// setup ui // setup ui
m_ui->setupUi(this); m_ui->setupUi(this);
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
setStyleSheet(QStringLiteral("* { font: 9pt \"Segoe UI\", \"Sans\"; } QMessageBox QLabel, QInputDialog QLabel { font-size: 12pt; color: #003399; } #statusBar { border-top: 1px solid #919191; padding-top: 1px; } #splitter QWidget { background-color: #FFF; } #assumePushButton { font-weight: bold; } #splitter #treeButtonsWidget, #splitter #listButtonsWidget { background-color: #F0F0F0; border-top: 1px solid #DFDFDF; } #leftWidget { border-right: 1px solid #DFDFDF; } #splitter QWidget *, #splitter QWidget * { background-color: none; }")); setStyleSheet(QStringLiteral("%1 #splitter QWidget { background-color: palette(base); color: palette(text); } #splitter QWidget *, #splitter QWidget * { background-color: none; } #leftWidget { border-right: 1px solid %2; }").arg(dialogStyle(), windowFrameColor().name()));
#endif #endif
// set default values // set default values
setSomethingChanged(false); setSomethingChanged(false);

View File

@ -4,6 +4,8 @@
#include <passwordfile/io/cryptoexception.h> #include <passwordfile/io/cryptoexception.h>
#include <qtutilities/misc/dialogutils.h>
#include <c++utilities/conversion/binaryconversion.h> #include <c++utilities/conversion/binaryconversion.h>
#include <openssl/rand.h> #include <openssl/rand.h>
@ -19,6 +21,7 @@
using namespace std; using namespace std;
using namespace Io; using namespace Io;
using namespace Util; using namespace Util;
using namespace Dialogs;
namespace QtGui { namespace QtGui {
@ -51,20 +54,19 @@ PasswordGeneratorDialog::PasswordGeneratorDialog(QWidget *parent) :
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
setStyleSheet(QStringLiteral("* { font: 9pt \"Segoe UI\", \"Sans\"; } #mainFrame { border: none; background: white; } #bottomFrame { background-color: #F0F0F0; border-top: 1px solid #DFDFDF; } #mainFrame #captionNameLabel, QMessageBox QLabel, QCommandLinkButton { font-size: 12pt; color: #003399; font-weight: normal; } #atLeastOneOfEachCategoryFrame { border-top: 1px solid #eee; }")); setStyleSheet(QStringLiteral("%1 QCommandLinkButton { font-size: 12pt; color: %2; font-weight: normal; }").arg(dialogStyle(), instructionTextColor().name()));
#else
setStyleSheet(QStringLiteral("#mainFrame #captionNameLabel { font-weight: bold; }"));
#endif #endif
setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint);
connect(m_ui->copyPasswordCommandLinkButton, SIGNAL(clicked()), this, SLOT(copyPassword())); connect(m_ui->copyPasswordCommandLinkButton, &QCommandLinkButton::clicked, this, &PasswordGeneratorDialog::copyPassword);
connect(m_ui->generatePassowordCommandLinkButton, SIGNAL(clicked()), this, SLOT(generateNewPassword())); connect(m_ui->generatePassowordCommandLinkButton, &QCommandLinkButton::clicked, this, &PasswordGeneratorDialog::generateNewPassword);
connect(m_ui->useCapitalLettersCheckBox, SIGNAL(stateChanged(int)), this, SLOT(handleCheckedCategoriesChanged())); connect(m_ui->useCapitalLettersCheckBox, &QCheckBox::stateChanged, this, &PasswordGeneratorDialog::handleCheckedCategoriesChanged);
connect(m_ui->useDigitsCheckBox, SIGNAL(stateChanged(int)), this, SLOT(handleCheckedCategoriesChanged())); connect(m_ui->useCapitalLettersCheckBox, &QCheckBox::stateChanged, this, &PasswordGeneratorDialog::handleCheckedCategoriesChanged);
connect(m_ui->otherCharsLineEdit, SIGNAL(editingFinished()), this, SLOT(handleCheckedCategoriesChanged())); connect(m_ui->useSmallLettersCheckBox, &QCheckBox::stateChanged, this, &PasswordGeneratorDialog::handleCheckedCategoriesChanged);
connect(m_ui->useSmallLettersCheckBox, SIGNAL(stateChanged(int)), this, SLOT(handleCheckedCategoriesChanged())); connect(m_ui->useDigitsCheckBox, &QCheckBox::stateChanged, this, &PasswordGeneratorDialog::handleCheckedCategoriesChanged);
connect(m_ui->passwordLineEdit, SIGNAL(textChanged(QString)), this, SLOT(handlePasswordChanged())); connect(m_ui->otherCharsLineEdit, &QLineEdit::textChanged, this, &PasswordGeneratorDialog::handleCheckedCategoriesChanged);
connect(m_ui->passwordLineEdit, &QLineEdit::textChanged, this, &PasswordGeneratorDialog::handlePasswordChanged);
connect(m_ui->closePushButton, &QPushButton::clicked, this, &PasswordGeneratorDialog::close);
handlePasswordChanged(); handlePasswordChanged();
} }

View File

@ -61,7 +61,7 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QFrame" name="mainFrame"> <widget class="QWidget" name="mainWidget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
@ -79,19 +79,10 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QFrame" name="informationFrame"> <widget class="QWidget" name="informationWidget" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<widget class="QFrame" name="checkboxFrame"> <widget class="QWidget" name="checkboxWidget" native="true">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
@ -145,13 +136,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QFrame" name="lengthFrame"> <widget class="QWidget" name="lengthWidget" native="true">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QFormLayout" name="formLayout"> <layout class="QFormLayout" name="formLayout">
<property name="horizontalSpacing"> <property name="horizontalSpacing">
<number>9</number> <number>9</number>
@ -209,13 +194,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QFrame" name="passwordFrame"> <widget class="QWidget" name="passwordWidget" native="true">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QFormLayout" name="formLayout_2"> <layout class="QFormLayout" name="formLayout_2">
<property name="topMargin"> <property name="topMargin">
<number>5</number> <number>5</number>
@ -231,7 +210,11 @@
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QLineEdit" name="passwordLineEdit"/> <widget class="QLineEdit" name="passwordLineEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
@ -272,7 +255,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QFrame" name="bottomFrame"> <widget class="QWidget" name="bottomWidget" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -297,7 +280,7 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QPushButton" name="closePushbutton"> <widget class="QPushButton" name="closePushButton">
<property name="font"> <property name="font">
<font> <font>
<family>Segoe UI,Sans</family> <family>Segoe UI,Sans</family>
@ -328,22 +311,5 @@
<resources> <resources>
<include location="../resources/icons.qrc"/> <include location="../resources/icons.qrc"/>
</resources> </resources>
<connections> <connections/>
<connection>
<sender>closePushbutton</sender>
<signal>clicked()</signal>
<receiver>QtGui::PasswordGeneratorDialog</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>464</x>
<y>278</y>
</hint>
<hint type="destinationlabel">
<x>255</x>
<y>149</y>
</hint>
</hints>
</connection>
</connections>
</ui> </ui>