Optimization config dialog for Mac OS.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-12-01 22:53:29 +02:00
parent cf4e313862
commit 9f3e41a6f6
4 changed files with 34 additions and 47 deletions

View File

@ -63,13 +63,13 @@ ConfigDialog::ConfigDialog(QWidget *parent) :
pagesWidget->addWidget(pathPage); pagesWidget->addWidget(pathPage);
QPushButton *applyButton = new QPushButton(tr("Apply")); QPushButton *applyButton = new QPushButton(tr("Apply"));
QPushButton *canselButton = new QPushButton(tr("&Cancel")); QPushButton *cancelButton = new QPushButton(tr("&Cancel"));
QPushButton *okButton = new QPushButton(tr("&Ok")); QPushButton *okButton = new QPushButton(tr("&Ok"));
createIcons(); createIcons();
contentsWidget->setCurrentRow(0); contentsWidget->setCurrentRow(0);
connect(canselButton, &QPushButton::clicked, this, &ConfigDialog::close); connect(cancelButton, &QPushButton::clicked, this, &ConfigDialog::close);
connect(applyButton, &QPushButton::clicked, this, &ConfigDialog::Apply); connect(applyButton, &QPushButton::clicked, this, &ConfigDialog::Apply);
connect(okButton, &QPushButton::clicked, this, &ConfigDialog::Ok); connect(okButton, &QPushButton::clicked, this, &ConfigDialog::Ok);
@ -80,7 +80,7 @@ ConfigDialog::ConfigDialog(QWidget *parent) :
QHBoxLayout *buttonsLayout = new QHBoxLayout; QHBoxLayout *buttonsLayout = new QHBoxLayout;
buttonsLayout->addStretch(1); buttonsLayout->addStretch(1);
buttonsLayout->addWidget(applyButton); buttonsLayout->addWidget(applyButton);
buttonsLayout->addWidget(canselButton); buttonsLayout->addWidget(cancelButton);
buttonsLayout->addWidget(okButton); buttonsLayout->addWidget(okButton);
QVBoxLayout *mainLayout = new QVBoxLayout; QVBoxLayout *mainLayout = new QVBoxLayout;

View File

@ -102,8 +102,9 @@ QGroupBox *CommunityPage::ServerGroup()
{ {
QGroupBox *ServerGroup = new QGroupBox(tr("Server")); QGroupBox *ServerGroup = new QGroupBox(tr("Server"));
QFormLayout *serverLayout = new QFormLayout; QFormLayout *serverLayout = new QFormLayout;
serverLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
CommunityPage::add_lineedit(&this->server, serverLayout, qApp->ValentinaSettings()->GetServer(), tr("Server name/IP")); CommunityPage::add_lineedit(&this->server, serverLayout, qApp->ValentinaSettings()->GetServer(), tr("Server name/IP:"));
CommunityPage::add_checkbox(&this->secureComm, serverLayout, qApp->ValentinaSettings()->GetServerSecure(), CommunityPage::add_checkbox(&this->secureComm, serverLayout, qApp->ValentinaSettings()->GetServerSecure(),
tr("Secure connection")); tr("Secure connection"));
@ -126,6 +127,9 @@ void CommunityPage::add_lineedit(QLineEdit** theline, QFormLayout *layout, QStri
{ {
QLabel *labelbox = new QLabel(label); QLabel *labelbox = new QLabel(label);
(*theline)= new QLineEdit; (*theline)= new QLineEdit;
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
(*theline)->setClearButtonEnabled(true);
#endif
(*theline)->setText(value); (*theline)->setText(value);
layout->addRow(labelbox, *theline); layout->addRow(labelbox, *theline);
} }
@ -136,14 +140,15 @@ QGroupBox *CommunityPage::ProxyGroup()
QGroupBox *proxyGroup = new QGroupBox(tr("Proxy settings")); QGroupBox *proxyGroup = new QGroupBox(tr("Proxy settings"));
QFormLayout *proxyLayout = new QFormLayout; QFormLayout *proxyLayout = new QFormLayout;
proxyLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
const VSettings *settings = qApp->ValentinaSettings(); const VSettings *settings = qApp->ValentinaSettings();
CommunityPage::add_checkbox(&this->useProxy, proxyLayout, settings->GetProxy(), tr("Use Proxy")); CommunityPage::add_checkbox(&this->useProxy, proxyLayout, settings->GetProxy(), tr("Use Proxy"));
CommunityPage::add_lineedit(&this->proxyAddress, proxyLayout, settings->GetProxyAddress(), CommunityPage::add_lineedit(&this->proxyAddress, proxyLayout, settings->GetProxyAddress(),
tr("Proxy address")); tr("Proxy address:"));
CommunityPage::add_lineedit(&this->proxyPort, proxyLayout, settings->GetProxyPort(), tr("Proxy port")); CommunityPage::add_lineedit(&this->proxyPort, proxyLayout, settings->GetProxyPort(), tr("Proxy port:"));
CommunityPage::add_lineedit(&this->proxyUser, proxyLayout, settings->GetProxyUser(), tr("Proxy user")); CommunityPage::add_lineedit(&this->proxyUser, proxyLayout, settings->GetProxyUser(), tr("Proxy user:"));
CommunityPage::add_lineedit(&this->proxyPass, proxyLayout, settings->GetProxyPass(), tr("Proxy pass")); CommunityPage::add_lineedit(&this->proxyPass, proxyLayout, settings->GetProxyPass(), tr("Proxy pass:"));
connect(this->useProxy, &QCheckBox::stateChanged, this, &CommunityPage::ProxyCheckChanged); connect(this->useProxy, &QCheckBox::stateChanged, this, &CommunityPage::ProxyCheckChanged);
this->ProxyCheckChanged(); this->ProxyCheckChanged();
@ -157,11 +162,12 @@ QGroupBox *CommunityPage::UserGroup()
{ {
QGroupBox *userGroup = new QGroupBox(tr("User settings")); QGroupBox *userGroup = new QGroupBox(tr("User settings"));
QFormLayout *userLayout = new QFormLayout; QFormLayout *userLayout = new QFormLayout;
userLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
const VSettings *settings = qApp->ValentinaSettings(); const VSettings *settings = qApp->ValentinaSettings();
CommunityPage::add_lineedit(&this->username, userLayout, settings->GetUsername(), tr("User Name")); CommunityPage::add_lineedit(&this->username, userLayout, settings->GetUsername(), tr("User Name:"));
CommunityPage::add_checkbox(&this->savePassword, userLayout, settings->GetSavePassword(), tr("Save password")); CommunityPage::add_checkbox(&this->savePassword, userLayout, settings->GetSavePassword(), tr("Save password"));
CommunityPage::add_lineedit(&this->userpassword, userLayout, settings->GetUserPassword(), tr("Password")); CommunityPage::add_lineedit(&this->userpassword, userLayout, settings->GetUserPassword(), tr("Password:"));
connect(this->savePassword, &QCheckBox::stateChanged, this, &CommunityPage::PasswordCheckChanged); connect(this->savePassword, &QCheckBox::stateChanged, this, &CommunityPage::PasswordCheckChanged);
this->PasswordCheckChanged(); this->PasswordCheckChanged();

View File

@ -42,6 +42,7 @@
#include <QIcon> #include <QIcon>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QDirIterator> #include <QDirIterator>
#include <QFormLayout>
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
ConfigurationPage::ConfigurationPage(QWidget *parent) ConfigurationPage::ConfigurationPage(QWidget *parent)
@ -153,7 +154,6 @@ QGroupBox *ConfigurationPage::SaveGroup()
QGroupBox *ConfigurationPage::LangGroup() QGroupBox *ConfigurationPage::LangGroup()
{ {
QGroupBox *langGroup = new QGroupBox(tr("Language")); QGroupBox *langGroup = new QGroupBox(tr("Language"));
QLabel *guiLabel = new QLabel(tr("GUI language"));
langCombo = new QComboBox; langCombo = new QComboBox;
QStringList fileNames; QStringList fileNames;
@ -198,30 +198,23 @@ QGroupBox *ConfigurationPage::LangGroup()
connect(langCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, connect(langCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&ConfigurationPage::LangChanged); &ConfigurationPage::LangChanged);
QHBoxLayout *guiLangLayout = new QHBoxLayout; QFormLayout *langLayout = new QFormLayout;
guiLangLayout->addWidget(guiLabel); langLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
guiLangLayout->addWidget(langCombo); langLayout->addRow(tr("GUI language:"), langCombo);
//-------------------- Decimal separator setup //-------------------- Decimal separator setup
QLabel *separatorLabel = new QLabel(tr("Decimal separator parts"));
osOptionCheck = new QCheckBox(tr("With OS options (%1)").arg(QLocale::system().decimalPoint().toLatin1())); osOptionCheck = new QCheckBox(tr("With OS options (%1)").arg(QLocale::system().decimalPoint().toLatin1()));
osOptionCheck->setChecked(settings->GetOsSeparator()); osOptionCheck->setChecked(settings->GetOsSeparator());
langLayout->addRow(tr("Decimal separator parts:"), osOptionCheck);
QHBoxLayout *separatorLayout = new QHBoxLayout;
separatorLayout->addWidget(separatorLabel);
separatorLayout->addWidget(osOptionCheck);
//----------------------- Unit setup //----------------------- Unit setup
this->unitCombo = new QComboBox; this->unitCombo = new QComboBox;
QLabel *unitLabel = new QLabel(tr("Default unit"));
this->unitCombo->addItem(tr("Centimeters"), "cm"); this->unitCombo->addItem(tr("Centimeters"), "cm");
this->unitCombo->addItem(tr("Millimiters"), "mm"); this->unitCombo->addItem(tr("Millimiters"), "mm");
this->unitCombo->addItem(tr("Inches"), "in"); this->unitCombo->addItem(tr("Inches"), "in");
// set default unit // set default unit
qint32 indexUnit = this->unitCombo->findData(settings->GetUnit()); const qint32 indexUnit = this->unitCombo->findData(settings->GetUnit());
if (indexUnit != -1) if (indexUnit != -1)
{ {
this->unitCombo->setCurrentIndex(indexUnit); this->unitCombo->setCurrentIndex(indexUnit);
@ -229,13 +222,9 @@ QGroupBox *ConfigurationPage::LangGroup()
connect(this->unitCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, connect(this->unitCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&ConfigurationPage::UnitChanged); &ConfigurationPage::UnitChanged);
QHBoxLayout *UnitLayout = new QHBoxLayout; langLayout->addRow(tr("Default unit:"), this->unitCombo);
UnitLayout->addWidget(unitLabel);
UnitLayout->addWidget(this->unitCombo);
//----------------------- Label language //----------------------- Label language
QLabel *labelName = new QLabel(tr("Label language"));
labelCombo = new QComboBox; labelCombo = new QComboBox;
SetLabelComboBox(VApplication::LabelLanguages()); SetLabelComboBox(VApplication::LabelLanguages());
@ -248,19 +237,9 @@ QGroupBox *ConfigurationPage::LangGroup()
connect(labelCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, connect(labelCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&ConfigurationPage::LabelLangChanged); &ConfigurationPage::LabelLangChanged);
QHBoxLayout *labelLangLayout = new QHBoxLayout; langLayout->addRow(tr("Label language:"), labelCombo);
labelLangLayout->addWidget(labelName);
labelLangLayout->addWidget(labelCombo);
//-----------------------
QVBoxLayout *langLayout = new QVBoxLayout;
langLayout->addLayout(guiLangLayout);
langLayout->addLayout(separatorLayout);
langLayout->addLayout(UnitLayout);
langLayout->addLayout(labelLangLayout);
langGroup->setLayout(langLayout); langGroup->setLayout(langLayout);
return langGroup; return langGroup;
} }

View File

@ -38,6 +38,7 @@
#include <QSpinBox> #include <QSpinBox>
#include <QLineEdit> #include <QLineEdit>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QFormLayout>
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
PatternPage::PatternPage(QWidget *parent): PatternPage::PatternPage(QWidget *parent):
@ -76,14 +77,16 @@ void PatternPage::Apply()
QGroupBox *PatternPage::UserGroup() QGroupBox *PatternPage::UserGroup()
{ {
QGroupBox *userGroup = new QGroupBox(tr("User")); QGroupBox *userGroup = new QGroupBox(tr("User"));
QLabel *nameLabel = new QLabel(tr("User name"));
userName = new QLineEdit; userName = new QLineEdit;
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
userName->setClearButtonEnabled(true);
#endif
userName->setText(qApp->ValentinaSettings()->GetUser()); userName->setText(qApp->ValentinaSettings()->GetUser());
QHBoxLayout *nameLayout = new QHBoxLayout; QFormLayout *nameLayout = new QFormLayout;
nameLayout->addWidget(nameLabel); nameLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
nameLayout->addWidget(userName); nameLayout->addRow(tr("User name:"), userName);
QVBoxLayout *userLayout = new QVBoxLayout; QVBoxLayout *userLayout = new QVBoxLayout;
userLayout->addLayout(nameLayout); userLayout->addLayout(nameLayout);
@ -112,14 +115,13 @@ QGroupBox *PatternPage::GraphOutputGroup()
QGroupBox *PatternPage::UndoGroup() QGroupBox *PatternPage::UndoGroup()
{ {
QGroupBox *undoGroup = new QGroupBox(tr("Undo")); QGroupBox *undoGroup = new QGroupBox(tr("Undo"));
QLabel *undoLabel = new QLabel(tr("Count steps (0 - no limit)"));
undoCount = new QSpinBox; undoCount = new QSpinBox;
undoCount->setMinimum(0); undoCount->setMinimum(0);
undoCount->setValue(qApp->ValentinaSettings()->GetUndoCount()); undoCount->setValue(qApp->ValentinaSettings()->GetUndoCount());
QHBoxLayout *countLayout = new QHBoxLayout; QFormLayout *countLayout = new QFormLayout;
countLayout->addWidget(undoLabel); countLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
countLayout->addWidget(undoCount); countLayout->addRow(tr("Count steps (0 - no limit):"), undoCount);
QVBoxLayout *undoLayout = new QVBoxLayout; QVBoxLayout *undoLayout = new QVBoxLayout;
undoLayout->addLayout(countLayout); undoLayout->addLayout(countLayout);