Merged in ValentinaZhuravska/valentina/feature (pull request #92)

Retranslate

--HG--
branch : develop
This commit is contained in:
Roman Telezhinskyi 2016-01-11 15:16:57 +02:00
commit 62b47197f7
21 changed files with 567 additions and 90 deletions

View File

@ -336,7 +336,7 @@ void TapeConfigurationPage::RetranslateUi()
langGroup->setTitle(tr("Language")); langGroup->setTitle(tr("Language"));
guiLabel->setText(tr("GUI language:")); guiLabel->setText(tr("GUI language:"));
separatorLabel->setText(tr("Decimal separator parts:")); separatorLabel->setText(tr("Decimal separator parts:"));
osOptionCheck = new QCheckBox(tr("With OS options (%1)").arg(QLocale::system().decimalPoint().toLatin1())); osOptionCheck->setText(tr("With OS options (%1)").arg(QLocale::system().decimalPoint().toLatin1()));
pmSystemGroup->setTitle(tr("Pattern making system")); pmSystemGroup->setTitle(tr("Pattern making system"));
systemLabel->setText(tr("Pattern making system:")); systemLabel->setText(tr("Pattern making system:"));

View File

@ -43,7 +43,7 @@ TapeConfigDialog::TapeConfigDialog(QWidget *parent)
configurationPage(nullptr), configurationPage(nullptr),
pathPage(nullptr), pathPage(nullptr),
applyButton(nullptr), applyButton(nullptr),
canselButton(nullptr), cancelButton(nullptr),
okButton(nullptr), okButton(nullptr),
isInitialized(false) isInitialized(false)
{ {
@ -66,14 +66,14 @@ TapeConfigDialog::TapeConfigDialog(QWidget *parent)
pagesWidget->addWidget(pathPage); pagesWidget->addWidget(pathPage);
applyButton = new QPushButton(tr("Apply")); applyButton = new QPushButton(tr("Apply"));
canselButton = new QPushButton(tr("&Cancel")); cancelButton = new QPushButton(tr("&Cancel"));
okButton = new QPushButton(tr("&Ok")); okButton = new QPushButton(tr("&Ok"));
createIcons(); createIcons();
connect(contentsWidget, &QListWidget::currentItemChanged, this, &TapeConfigDialog::changePage); connect(contentsWidget, &QListWidget::currentItemChanged, this, &TapeConfigDialog::changePage);
contentsWidget->setCurrentRow(0); contentsWidget->setCurrentRow(0);
connect(canselButton, &QPushButton::clicked, this, &TapeConfigDialog::close); connect(cancelButton, &QPushButton::clicked, this, &TapeConfigDialog::close);
connect(applyButton, &QPushButton::clicked, this, &TapeConfigDialog::Apply); connect(applyButton, &QPushButton::clicked, this, &TapeConfigDialog::Apply);
connect(okButton, &QPushButton::clicked, this, &TapeConfigDialog::Ok); connect(okButton, &QPushButton::clicked, this, &TapeConfigDialog::Ok);
@ -84,7 +84,7 @@ TapeConfigDialog::TapeConfigDialog(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;
@ -200,7 +200,7 @@ void TapeConfigDialog::Ok()
void TapeConfigDialog::RetranslateUi() void TapeConfigDialog::RetranslateUi()
{ {
applyButton->setText(tr("Apply")); applyButton->setText(tr("Apply"));
canselButton->setText(tr("&Cancel")); cancelButton->setText(tr("&Cancel"));
okButton->setText(tr("&Ok")); okButton->setText(tr("&Ok"));
setWindowTitle(tr("Config Dialog")); setWindowTitle(tr("Config Dialog"));
contentsWidget->item(0)->setText(tr("Configuration")); contentsWidget->item(0)->setText(tr("Configuration"));

View File

@ -57,7 +57,7 @@ private:
TapeConfigurationPage *configurationPage; TapeConfigurationPage *configurationPage;
TapePathPage *pathPage; TapePathPage *pathPage;
QPushButton *applyButton; QPushButton *applyButton;
QPushButton *canselButton; QPushButton *cancelButton;
QPushButton *okButton; QPushButton *okButton;
bool isInitialized; bool isInitialized;

View File

@ -38,13 +38,15 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
ConfigDialog::ConfigDialog(QWidget *parent) : ConfigDialog::ConfigDialog(QWidget *parent) :
QDialog(parent), contentsWidget(nullptr), pagesWidget(nullptr), configurationPage(nullptr), patternPage(nullptr), QDialog(parent), contentsWidget(nullptr), pagesWidget(nullptr), configurationPage(nullptr), patternPage(nullptr),
communityPage(nullptr), pathPage(nullptr), isInitialized(false) communityPage(nullptr), pathPage(nullptr), applyButton(nullptr), cancelButton(nullptr), okButton(nullptr),
isInitialized(false)
{ {
contentsWidget = new QListWidget; contentsWidget = new QListWidget;
contentsWidget->setViewMode(QListView::IconMode); contentsWidget->setViewMode(QListView::IconMode);
contentsWidget->setIconSize(QSize(96, 84)); contentsWidget->setIconSize(QSize(96, 84));
contentsWidget->setMovement(QListView::Static); contentsWidget->setMovement(QListView::Static);
contentsWidget->setMaximumWidth(128); contentsWidget->setMaximumWidth(128);
contentsWidget->setMinimumWidth(128);
contentsWidget->setMinimumHeight(500); contentsWidget->setMinimumHeight(500);
contentsWidget->setSpacing(12); contentsWidget->setSpacing(12);
@ -62,9 +64,9 @@ ConfigDialog::ConfigDialog(QWidget *parent) :
pathPage = new PathPage(); pathPage = new PathPage();
pagesWidget->addWidget(pathPage); pagesWidget->addWidget(pathPage);
QPushButton *applyButton = new QPushButton(tr("Apply")); applyButton = new QPushButton(tr("Apply"));
QPushButton *cancelButton = new QPushButton(tr("&Cancel")); cancelButton = new QPushButton(tr("&Cancel"));
QPushButton *okButton = new QPushButton(tr("&Ok")); okButton = new QPushButton(tr("&Ok"));
createIcons(); createIcons();
contentsWidget->setCurrentRow(0); contentsWidget->setCurrentRow(0);
@ -115,6 +117,19 @@ void ConfigDialog::closeEvent(QCloseEvent *event)
event->accept(); event->accept();
} }
//---------------------------------------------------------------------------------------------------------------------
void ConfigDialog::changeEvent(QEvent *event)
{
if (event->type() == QEvent::LanguageChange)
{
// retranslate designer form (single inheritance approach)
RetranslateUi();
}
// remember to call base class implementation
QDialog::changeEvent(event);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void ConfigDialog::showEvent(QShowEvent *event) void ConfigDialog::showEvent(QShowEvent *event)
{ {
@ -188,3 +203,17 @@ void ConfigDialog::Ok()
Apply(); Apply();
done(QDialog::Accepted); done(QDialog::Accepted);
} }
//---------------------------------------------------------------------------------------------------------------------
void ConfigDialog::RetranslateUi()
{
applyButton->setText(tr("Apply"));
cancelButton->setText(tr("&Cancel"));
okButton->setText(tr("&Ok"));
setWindowTitle(tr("Config Dialog"));
contentsWidget->item(0)->setText(tr("Configuration"));
contentsWidget->item(1)->setText(tr("Pattern"));
contentsWidget->item(2)->setText(tr("Community"));
contentsWidget->item(3)->setText(tr("Paths"));
}

View File

@ -47,6 +47,7 @@ signals:
void UpdateProperties(); void UpdateProperties();
protected: protected:
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE; virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE; virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
private: private:
Q_DISABLE_COPY(ConfigDialog) Q_DISABLE_COPY(ConfigDialog)
@ -56,11 +57,16 @@ private:
PatternPage *patternPage; PatternPage *patternPage;
CommunityPage *communityPage; CommunityPage *communityPage;
PathPage *pathPage; PathPage *pathPage;
QPushButton *applyButton;
QPushButton *cancelButton;
QPushButton *okButton;
bool isInitialized; bool isInitialized;
void createIcons(); void createIcons();
void createIcon(const QString &icon, const QString &text); void createIcon(const QString &icon, const QString &text);
void Apply(); void Apply();
void Ok(); void Ok();
void RetranslateUi();
}; };
#endif // CONFIGDIALOG_H #endif // CONFIGDIALOG_H

View File

@ -38,9 +38,30 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
CommunityPage::CommunityPage(QWidget *parent): CommunityPage::CommunityPage(QWidget *parent):
QWidget(parent), server(nullptr), secureComm(nullptr), useProxy(nullptr), proxyAddress(nullptr), QWidget(parent),
proxyPort(nullptr), proxyUser(nullptr), proxyPass(nullptr), username(nullptr), savePassword(nullptr), serverGroup(nullptr),
userpassword(nullptr) server(nullptr),
secureComm(nullptr),
serverNameLabel(nullptr),
secureConnectionLabel(nullptr),
proxyGroup(nullptr),
useProxy(nullptr),
proxyAddress(nullptr),
proxyPort(nullptr),
proxyUser(nullptr),
proxyPass(nullptr),
useProxyLabel(nullptr),
proxyAddressLabel(nullptr),
proxyPortLabel(nullptr),
proxyUserLabel(nullptr),
proxyPassLabel(nullptr),
userGroup(nullptr),
username(nullptr),
savePassword(nullptr),
userpassword(nullptr),
usernameLabel(nullptr),
savePasswordLabel(nullptr),
userpasswordLabel(nullptr)
{ {
QGroupBox *serverGroup = ServerGroup(); QGroupBox *serverGroup = ServerGroup();
QGroupBox *proxyGroup = ProxyGroup(); QGroupBox *proxyGroup = ProxyGroup();
@ -100,55 +121,75 @@ void CommunityPage::PasswordCheckChanged()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QGroupBox *CommunityPage::ServerGroup() QGroupBox *CommunityPage::ServerGroup()
{ {
QGroupBox *ServerGroup = new QGroupBox(tr("Server")); serverGroup = new QGroupBox(tr("Server"));
QFormLayout *serverLayout = new QFormLayout; QFormLayout *serverLayout = new QFormLayout;
serverLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); serverLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
CommunityPage::add_lineedit(&this->server, serverLayout, qApp->ValentinaSettings()->GetServer(), tr("Server name/IP:")); serverNameLabel = new QLabel(tr("Server name/IP:"));
secureConnectionLabel = new QLabel(tr("Secure connection"));
CommunityPage::add_checkbox(&this->secureComm, serverLayout, qApp->ValentinaSettings()->GetServerSecure(), CommunityPage::AddLineedit(&this->server, serverLayout, qApp->ValentinaSettings()->GetServer(), serverNameLabel);
tr("Secure connection"));
ServerGroup->setLayout(serverLayout); CommunityPage::AddCheckbox(&this->secureComm, serverLayout, qApp->ValentinaSettings()->GetServerSecure(),
return ServerGroup; secureConnectionLabel);
serverGroup->setLayout(serverLayout);
return serverGroup;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void CommunityPage::add_checkbox(QCheckBox** thebox, QFormLayout *layout, bool checked, QString label) void CommunityPage::AddCheckbox(QCheckBox** thebox, QFormLayout *layout, bool checked, QLabel *label)
{ {
QLabel *labelbox = new QLabel(label);
(*thebox)= new QCheckBox; (*thebox)= new QCheckBox;
(*thebox)->setChecked(checked); (*thebox)->setChecked(checked);
layout->addRow(labelbox, *thebox); layout->addRow(label, *thebox);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void CommunityPage::add_lineedit(QLineEdit** theline, QFormLayout *layout, QString value, QString label) void CommunityPage::AddLineedit(QLineEdit** theline, QFormLayout *layout, QString value, QLabel *label)
{ {
QLabel *labelbox = new QLabel(label);
(*theline)= new QLineEdit; (*theline)= new QLineEdit;
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0) #if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
(*theline)->setClearButtonEnabled(true); (*theline)->setClearButtonEnabled(true);
#endif #endif
(*theline)->setText(value); (*theline)->setText(value);
layout->addRow(labelbox, *theline); layout->addRow(label, *theline);
}
//---------------------------------------------------------------------------------------------------------------------
void CommunityPage::changeEvent(QEvent *event)
{
if (event->type() == QEvent::LanguageChange)
{
// retranslate designer form (single inheritance approach)
RetranslateUi();
}
// remember to call base class implementation
QWidget::changeEvent(event);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QGroupBox *CommunityPage::ProxyGroup() QGroupBox *CommunityPage::ProxyGroup()
{ {
QGroupBox *proxyGroup = new QGroupBox(tr("Proxy settings")); proxyGroup = new QGroupBox(tr("Proxy settings"));
QFormLayout *proxyLayout = new QFormLayout; QFormLayout *proxyLayout = new QFormLayout;
proxyLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); proxyLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
useProxyLabel = new QLabel(tr("Use Proxy"));
proxyAddressLabel = new QLabel(tr("Proxy address:"));
proxyPortLabel = new QLabel(tr("Proxy port:"));
proxyUserLabel = new QLabel(tr("Proxy user:"));
proxyPassLabel = new QLabel(tr("Proxy pass:"));
const VSettings *settings = qApp->ValentinaSettings(); const VSettings *settings = qApp->ValentinaSettings();
CommunityPage::add_checkbox(&this->useProxy, proxyLayout, settings->GetProxy(), tr("Use Proxy")); CommunityPage::AddCheckbox(&this->useProxy, proxyLayout, settings->GetProxy(), useProxyLabel);
CommunityPage::add_lineedit(&this->proxyAddress, proxyLayout, settings->GetProxyAddress(), CommunityPage::AddLineedit(&this->proxyAddress, proxyLayout, settings->GetProxyAddress(),
tr("Proxy address:")); proxyAddressLabel);
CommunityPage::add_lineedit(&this->proxyPort, proxyLayout, settings->GetProxyPort(), tr("Proxy port:")); CommunityPage::AddLineedit(&this->proxyPort, proxyLayout, settings->GetProxyPort(), proxyPortLabel);
CommunityPage::add_lineedit(&this->proxyUser, proxyLayout, settings->GetProxyUser(), tr("Proxy user:")); CommunityPage::AddLineedit(&this->proxyUser, proxyLayout, settings->GetProxyUser(), proxyUserLabel);
CommunityPage::add_lineedit(&this->proxyPass, proxyLayout, settings->GetProxyPass(), tr("Proxy pass:")); CommunityPage::AddLineedit(&this->proxyPass, proxyLayout, settings->GetProxyPass(), proxyPassLabel);
connect(this->useProxy, &QCheckBox::stateChanged, this, &CommunityPage::ProxyCheckChanged); connect(this->useProxy, &QCheckBox::stateChanged, this, &CommunityPage::ProxyCheckChanged);
this->ProxyCheckChanged(); this->ProxyCheckChanged();
@ -160,14 +201,18 @@ QGroupBox *CommunityPage::ProxyGroup()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QGroupBox *CommunityPage::UserGroup() QGroupBox *CommunityPage::UserGroup()
{ {
QGroupBox *userGroup = new QGroupBox(tr("User settings")); userGroup = new QGroupBox(tr("User settings"));
QFormLayout *userLayout = new QFormLayout; QFormLayout *userLayout = new QFormLayout;
userLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); userLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
usernameLabel = new QLabel(tr("User Name:"));
savePasswordLabel = new QLabel(tr("Save password"));
userpasswordLabel = new QLabel(tr("Password:"));
const VSettings *settings = qApp->ValentinaSettings(); const VSettings *settings = qApp->ValentinaSettings();
CommunityPage::add_lineedit(&this->username, userLayout, settings->GetUsername(), tr("User Name:")); CommunityPage::AddLineedit(&this->username, userLayout, settings->GetUsername(), usernameLabel);
CommunityPage::add_checkbox(&this->savePassword, userLayout, settings->GetSavePassword(), tr("Save password")); CommunityPage::AddCheckbox(&this->savePassword, userLayout, settings->GetSavePassword(), savePasswordLabel);
CommunityPage::add_lineedit(&this->userpassword, userLayout, settings->GetUserPassword(), tr("Password:")); CommunityPage::AddLineedit(&this->userpassword, userLayout, settings->GetUserPassword(), userpasswordLabel);
connect(this->savePassword, &QCheckBox::stateChanged, this, &CommunityPage::PasswordCheckChanged); connect(this->savePassword, &QCheckBox::stateChanged, this, &CommunityPage::PasswordCheckChanged);
this->PasswordCheckChanged(); this->PasswordCheckChanged();
@ -176,3 +221,23 @@ QGroupBox *CommunityPage::UserGroup()
return userGroup; return userGroup;
} }
//---------------------------------------------------------------------------------------------------------------------
void CommunityPage::RetranslateUi()
{
serverGroup->setTitle(tr("Server"));
serverNameLabel->setText(tr("Server name/IP:"));
secureConnectionLabel->setText(tr("Secure connection"));
proxyGroup->setTitle(tr("Proxy settings"));
useProxyLabel->setText(tr("Use Proxy"));
proxyAddressLabel->setText(tr("Proxy address:"));
proxyPortLabel->setText(tr("Proxy port:"));
proxyUserLabel->setText(tr("Proxy user:"));
proxyPassLabel->setText(tr("Proxy pass:"));
userGroup->setTitle(tr("User settings"));
usernameLabel->setText(tr("User Name:"));
savePasswordLabel->setText(tr("Save password"));
userpasswordLabel->setText(tr("Password:"));
}

View File

@ -36,6 +36,7 @@
class QCheckBox; class QCheckBox;
class QGroupBox; class QGroupBox;
class QLineEdit; class QLineEdit;
class QLabel;
class CommunityPage : public QWidget class CommunityPage : public QWidget
{ {
@ -43,26 +44,43 @@ class CommunityPage : public QWidget
public: public:
explicit CommunityPage(QWidget *parent = nullptr); explicit CommunityPage(QWidget *parent = nullptr);
void Apply(); void Apply();
protected:
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
private: private:
Q_DISABLE_COPY(CommunityPage) Q_DISABLE_COPY(CommunityPage)
// server name and https connection // server name and https connection
QGroupBox *serverGroup;
QLineEdit *server; QLineEdit *server;
QCheckBox *secureComm; QCheckBox *secureComm;
QLabel *serverNameLabel;
QLabel *secureConnectionLabel;
// proxy stuff // proxy stuff
QGroupBox *proxyGroup;
QCheckBox *useProxy; QCheckBox *useProxy;
QLineEdit *proxyAddress; QLineEdit *proxyAddress;
QLineEdit *proxyPort; QLineEdit *proxyPort;
QLineEdit *proxyUser; QLineEdit *proxyUser;
QLineEdit *proxyPass; QLineEdit *proxyPass;
QLabel *useProxyLabel;
QLabel *proxyAddressLabel;
QLabel *proxyPortLabel;
QLabel *proxyUserLabel;
QLabel *proxyPassLabel;
// username and password // username and password
QGroupBox *userGroup;
QLineEdit *username; QLineEdit *username;
QCheckBox *savePassword; QCheckBox *savePassword;
QLineEdit *userpassword; QLineEdit *userpassword;
static void add_checkbox(QCheckBox** thebox, QFormLayout *layout, bool checked, QString label); QLabel *usernameLabel;
static void add_lineedit(QLineEdit** theline, QFormLayout *layout, QString value, QString label); QLabel *savePasswordLabel;
QLabel *userpasswordLabel;
static void AddCheckbox(QCheckBox** thebox, QFormLayout *layout, bool checked, QLabel* label);
static void AddLineedit(QLineEdit** theline, QFormLayout *layout, QString value, QLabel *label);
void ProxyCheckChanged(); void ProxyCheckChanged();
void PasswordCheckChanged(); void PasswordCheckChanged();
@ -70,6 +88,8 @@ private:
QGroupBox *ServerGroup(); QGroupBox *ServerGroup();
QGroupBox *ProxyGroup(); QGroupBox *ProxyGroup();
QGroupBox *UserGroup(); QGroupBox *UserGroup();
void RetranslateUi();
}; };
#endif // COMMUNITYPAGE_H #endif // COMMUNITYPAGE_H

View File

@ -46,19 +46,50 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
ConfigurationPage::ConfigurationPage(QWidget *parent) ConfigurationPage::ConfigurationPage(QWidget *parent)
: QWidget(parent), autoSaveCheck(nullptr), autoTime(nullptr), langCombo(nullptr), labelCombo(nullptr), : QWidget(parent),
unitCombo(nullptr), osOptionCheck(nullptr), langChanged(false), unitChanged(false), labelLangChanged(false), autoSaveCheck(nullptr),
sendReportCheck(nullptr), askPointDeletionCheck(nullptr), toolBarStyleCheck(nullptr) autoTime(nullptr),
langCombo(nullptr),
labelCombo(nullptr),
unitCombo(nullptr),
osOptionCheck(nullptr),
langChanged(false),
systemChanged(),
unitChanged(false),
labelLangChanged(false),
sendReportCheck(nullptr),
askPointDeletionCheck(nullptr),
toolBarStyleCheck(nullptr),
saveGroup(nullptr),
intervalLabel(nullptr),
langGroup(nullptr),
guiLabel(nullptr),
separatorLabel(nullptr),
unitLabel(nullptr),
languageLabel(nullptr),
pmSystemGroup(nullptr),
systemLabel(nullptr),
systemCombo(nullptr),
systemAuthorLabel(nullptr),
systemBookLabel(nullptr),
systemAuthorValueLabel(nullptr),
systemBookValueLabel(nullptr),
sendGroup(nullptr),
description(nullptr),
drawGroup(nullptr),
toolBarGroup(nullptr)
{ {
QGroupBox *saveGroup = SaveGroup(); QGroupBox *saveGroup = SaveGroup();
QGroupBox *langGroup = LangGroup(); QGroupBox *langGroup = LangGroup();
QGroupBox *sendGroup = SendGroup(); QGroupBox *pmSystemGroup = PMSystemGroup();
QGroupBox *drawGroup = DrawGroup(); QGroupBox *sendGroup = SendGroup();
QGroupBox *toolBarGroup = ToolBarGroup(); QGroupBox *drawGroup = DrawGroup();
QGroupBox *toolBarGroup = ToolBarGroup();
QVBoxLayout *mainLayout = new QVBoxLayout; QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(saveGroup); mainLayout->addWidget(saveGroup);
mainLayout->addWidget(langGroup); mainLayout->addWidget(langGroup);
mainLayout->addWidget(pmSystemGroup);
mainLayout->addWidget(sendGroup); mainLayout->addWidget(sendGroup);
mainLayout->addWidget(drawGroup); mainLayout->addWidget(drawGroup);
mainLayout->addWidget(toolBarGroup); mainLayout->addWidget(toolBarGroup);
@ -83,14 +114,17 @@ void ConfigurationPage::Apply()
settings->SetConfirmItemDelete(askPointDeletionCheck->isChecked()); settings->SetConfirmItemDelete(askPointDeletionCheck->isChecked());
settings->SetToolBarStyle(toolBarStyleCheck->isChecked()); settings->SetToolBarStyle(toolBarStyleCheck->isChecked());
if (langChanged) if (langChanged || systemChanged)
{ {
const QString locale = qvariant_cast<QString>(langCombo->itemData(langCombo->currentIndex())); const QString locale = qvariant_cast<QString>(langCombo->itemData(langCombo->currentIndex()));
settings->SetLocale(locale); settings->SetLocale(locale);
langChanged = false; langChanged = false;
const QString text = tr("Setup user interface language updated and will be used the next time start") + " " +
QApplication::applicationName(); const QString code = qvariant_cast<QString>(systemCombo->itemData(systemCombo->currentIndex()));
QMessageBox::information(this, QApplication::applicationName(), text); settings->SetPMSystemCode(code);
systemChanged = false;
qApp->LoadTranslation(locale);
} }
if (this->unitChanged) if (this->unitChanged)
{ {
@ -129,7 +163,7 @@ void ConfigurationPage::LabelLangChanged()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QGroupBox *ConfigurationPage::SaveGroup() QGroupBox *ConfigurationPage::SaveGroup()
{ {
QGroupBox *saveGroup = new QGroupBox(tr("Save")); saveGroup = new QGroupBox(tr("Save"));
autoSaveCheck = new QCheckBox(tr("Auto-save modified pattern")); autoSaveCheck = new QCheckBox(tr("Auto-save modified pattern"));
autoSaveCheck->setChecked(qApp->ValentinaSettings()->GetAutosaveState()); autoSaveCheck->setChecked(qApp->ValentinaSettings()->GetAutosaveState());
@ -141,7 +175,8 @@ QGroupBox *ConfigurationPage::SaveGroup()
QHBoxLayout *autosaveLayout = new QHBoxLayout; QHBoxLayout *autosaveLayout = new QHBoxLayout;
autosaveLayout->addWidget(autoSaveCheck); autosaveLayout->addWidget(autoSaveCheck);
autosaveLayout->addWidget(new QLabel(tr("Interval:"))); intervalLabel = new QLabel(tr("Interval:"));
autosaveLayout->addWidget(intervalLabel);
autosaveLayout->addWidget(autoTime); autosaveLayout->addWidget(autoTime);
QVBoxLayout *saveLayout = new QVBoxLayout; QVBoxLayout *saveLayout = new QVBoxLayout;
@ -153,7 +188,8 @@ QGroupBox *ConfigurationPage::SaveGroup()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QGroupBox *ConfigurationPage::LangGroup() QGroupBox *ConfigurationPage::LangGroup()
{ {
QGroupBox *langGroup = new QGroupBox(tr("Language")); langGroup = new QGroupBox(tr("Language"));
guiLabel = new QLabel(tr("GUI language:"));
langCombo = new QComboBox; langCombo = new QComboBox;
QStringList fileNames; QStringList fileNames;
@ -200,12 +236,13 @@ QGroupBox *ConfigurationPage::LangGroup()
QFormLayout *langLayout = new QFormLayout; QFormLayout *langLayout = new QFormLayout;
langLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); langLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
langLayout->addRow(tr("GUI language:"), langCombo); langLayout->addRow(guiLabel, langCombo);
//-------------------- Decimal separator setup //-------------------- Decimal separator setup
osOptionCheck = new QCheckBox(tr("With OS options (%1)").arg(QLocale::system().decimalPoint().toLatin1())); separatorLabel = new QLabel(tr("Decimal separator parts:"));
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); langLayout->addRow(separatorLabel, osOptionCheck);
//----------------------- Unit setup //----------------------- Unit setup
this->unitCombo = new QComboBox; this->unitCombo = new QComboBox;
@ -222,7 +259,8 @@ 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);
langLayout->addRow(tr("Default unit:"), this->unitCombo); unitLabel = new QLabel(tr("Default unit:"));
langLayout->addRow(unitLabel, this->unitCombo);
//----------------------- Label language //----------------------- Label language
labelCombo = new QComboBox; labelCombo = new QComboBox;
@ -237,24 +275,68 @@ 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);
langLayout->addRow(tr("Label language:"), labelCombo); languageLabel = new QLabel(tr("Label language:"));
langLayout->addRow(languageLabel, labelCombo);
langGroup->setLayout(langLayout); langGroup->setLayout(langLayout);
return langGroup; return langGroup;
} }
//---------------------------------------------------------------------------------------------------------------------
QGroupBox *ConfigurationPage::PMSystemGroup()
{
pmSystemGroup = new QGroupBox(tr("Pattern making system"));
systemLabel = new QLabel(tr("Pattern making system:"));
systemCombo = new QComboBox;
InitPMSystems(systemCombo);
QFormLayout *pmSystemLayout = new QFormLayout;
pmSystemLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
pmSystemLayout->addRow(systemLabel, systemCombo);
//----
systemAuthorLabel = new QLabel(tr("Author:"));
systemAuthorValueLabel = new QLabel("");
pmSystemLayout->addRow(systemAuthorLabel, systemAuthorValueLabel);
//----
systemBookLabel = new QLabel(tr("Book:"));
systemBookValueLabel = new QPlainTextEdit("");
systemBookValueLabel->setReadOnly(true);
systemBookValueLabel->setFixedHeight(4 * QFontMetrics(systemBookValueLabel->font()).lineSpacing());
pmSystemLayout->addRow(systemBookLabel, systemBookValueLabel);
connect(systemCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&ConfigurationPage::SystemChanged);
// set default pattern making system
const VSettings *settings = qApp->ValentinaSettings();
const int index = systemCombo->findData(settings->GetPMSystemCode());
if (index != -1)
{
systemCombo->setCurrentIndex(index);
}
pmSystemGroup->setLayout(pmSystemLayout);
return pmSystemGroup;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QGroupBox *ConfigurationPage::SendGroup() QGroupBox *ConfigurationPage::SendGroup()
{ {
QGroupBox *sendGroup = new QGroupBox(tr("Send crash reports")); sendGroup = new QGroupBox(tr("Send crash reports"));
sendReportCheck = new QCheckBox(tr("Send crash reports (recommended)")); sendReportCheck = new QCheckBox(tr("Send crash reports (recommended)"));
sendReportCheck->setChecked(qApp->ValentinaSettings()->GetSendReportState()); sendReportCheck->setChecked(qApp->ValentinaSettings()->GetSendReportState());
QLabel *description = new QLabel(tr("After each crash Valentina collect information that may help us fix a " description = new QLabel(tr("After each crash Valentina collect information that may help us fix a "
"problem. We do not collect any personal information. Find more about what " "problem. We do not collect any personal information. Find more about what "
"<a href=\"https://bitbucket.org/dismine/valentina/wiki/manual/" "<a href=\"https://bitbucket.org/dismine/valentina/wiki/manual/"
"Crash_reports\">kind of information</a> we collect.")); "Crash_reports\">kind of information</a> we collect."));
description->setTextFormat(Qt::RichText); description->setTextFormat(Qt::RichText);
description->setTextInteractionFlags(Qt::TextBrowserInteraction); description->setTextInteractionFlags(Qt::TextBrowserInteraction);
description->setOpenExternalLinks(true); description->setOpenExternalLinks(true);
@ -271,7 +353,7 @@ QGroupBox *ConfigurationPage::SendGroup()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QGroupBox *ConfigurationPage::DrawGroup() QGroupBox *ConfigurationPage::DrawGroup()
{ {
QGroupBox *drawGroup = new QGroupBox(tr("Pattern Editing")); drawGroup = new QGroupBox(tr("Pattern Editing"));
askPointDeletionCheck = new QCheckBox(tr("Confirm item deletion")); askPointDeletionCheck = new QCheckBox(tr("Confirm item deletion"));
askPointDeletionCheck->setChecked(qApp->ValentinaSettings()->GetConfirmItemDelete()); askPointDeletionCheck->setChecked(qApp->ValentinaSettings()->GetConfirmItemDelete());
@ -286,7 +368,7 @@ QGroupBox *ConfigurationPage::DrawGroup()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QGroupBox *ConfigurationPage::ToolBarGroup() QGroupBox *ConfigurationPage::ToolBarGroup()
{ {
QGroupBox *toolBarGroup = new QGroupBox(tr("Toolbar")); toolBarGroup = new QGroupBox(tr("Toolbar"));
toolBarStyleCheck = new QCheckBox(tr("The text appears under the icon. (recommended for beginners.)")); toolBarStyleCheck = new QCheckBox(tr("The text appears under the icon. (recommended for beginners.)"));
toolBarStyleCheck->setChecked(qApp->ValentinaSettings()->GetToolBarStyle()); toolBarStyleCheck->setChecked(qApp->ValentinaSettings()->GetToolBarStyle());
@ -298,6 +380,26 @@ QGroupBox *ConfigurationPage::ToolBarGroup()
return toolBarGroup; return toolBarGroup;
} }
//---------------------------------------------------------------------------------------------------------------------
void ConfigurationPage::SystemChanged()
{
systemChanged = true;
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
QString text = qApp->TrVars()->PMSystemAuthor(systemCombo->itemData(systemCombo->currentIndex()).toString());
#else
QString text = qApp->TrVars()->PMSystemAuthor(systemCombo->currentData().toString());
#endif
systemAuthorValueLabel->setText(text);
systemAuthorValueLabel->setToolTip(text);
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
text = qApp->TrVars()->PMSystemBook(systemCombo->itemData(systemCombo->currentIndex()).toString());
#else
text = qApp->TrVars()->PMSystemBook(systemCombo->currentData().toString());
#endif
systemBookValueLabel->setPlainText(text);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void ConfigurationPage::SetLabelComboBox(const QStringList &list) void ConfigurationPage::SetLabelComboBox(const QStringList &list)
{ {
@ -307,3 +409,79 @@ void ConfigurationPage::SetLabelComboBox(const QStringList &list)
labelCombo->addItem(loc.nativeLanguageName(), list.at(i)); labelCombo->addItem(loc.nativeLanguageName(), list.at(i));
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void ConfigurationPage::changeEvent(QEvent *event)
{
if (event->type() == QEvent::LanguageChange)
{
// retranslate designer form (single inheritance approach)
RetranslateUi();
}
// remember to call base class implementation
QWidget::changeEvent(event);
}
//---------------------------------------------------------------------------------------------------------------------
void ConfigurationPage::RetranslateUi()
{
toolBarStyleCheck->setText(tr("The text appears under the icon. (recommended for beginners.)"));
askPointDeletionCheck->setText(tr("Confirm item deletion"));
saveGroup->setTitle(tr("Save"));
autoSaveCheck->setText(tr("Auto-save modified pattern"));
autoTime->setSuffix(tr("min"));
intervalLabel->setText(tr("Interval:"));
langGroup->setTitle(tr("Language"));
guiLabel->setText(tr("GUI language:"));
separatorLabel->setText(tr("Decimal separator parts:"));
osOptionCheck->setText(tr("With OS options (%1)").arg(QLocale::system().decimalPoint().toLatin1()));
unitLabel->setText(tr("Default unit:"));
this->unitCombo->setItemText(0, tr("Centimeters"));
this->unitCombo->setItemText(1, tr("Millimiters"));
this->unitCombo->setItemText(2, tr("Inches"));
languageLabel->setText(tr("Label language:"));
pmSystemGroup->setTitle(tr("Pattern making system"));
systemLabel->setText(tr("Pattern making system:"));
const int index = systemCombo->currentIndex();
systemCombo->blockSignals(true);
systemCombo->clear();
InitPMSystems(systemCombo);
systemCombo->setCurrentIndex(index);
systemCombo->blockSignals(false);
systemAuthorLabel->setText(tr("Author:"));
systemBookLabel->setText(tr("Book:"));
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
QString text = qApp->TrVars()->PMSystemAuthor(systemCombo->itemData(systemCombo->currentIndex()).toString());
#else
QString text = qApp->TrVars()->PMSystemAuthor(systemCombo->currentData().toString());
#endif
systemAuthorValueLabel->setText(text);
systemAuthorValueLabel->setToolTip(text);
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
text = qApp->TrVars()->PMSystemBook(systemCombo->itemData(systemCombo->currentIndex()).toString());
#else
text = qApp->TrVars()->PMSystemBook(systemCombo->currentData().toString());
#endif
systemBookValueLabel->setPlainText(text);
sendGroup->setTitle(tr("Send crash reports"));
sendReportCheck->setText(tr("Send crash reports (recommended)"));
description->setText(tr("After each crash Valentina collect information that may help us fix a "
"problem. We do not collect any personal information. Find more about what "
"<a href=\"https://bitbucket.org/dismine/valentina/wiki/manual/"
"Crash_reports\">kind of information</a> we collect."));
drawGroup->setTitle(tr("Pattern Editing"));
askPointDeletionCheck->setText(tr("Confirm item deletion"));
toolBarGroup->setTitle(tr("Toolbar"));
toolBarStyleCheck->setText(tr("The text appears under the icon. (recommended for beginners.)"));
}

View File

@ -30,12 +30,14 @@
#define CONFIGURATIONPAGE_H #define CONFIGURATIONPAGE_H
#include <QObject> #include <QObject>
#include <QPlainTextEdit>
#include <QWidget> #include <QWidget>
class QCheckBox; class QCheckBox;
class QSpinBox; class QSpinBox;
class QComboBox; class QComboBox;
class QGroupBox; class QGroupBox;
class QLabel;
class ConfigurationPage : public QWidget class ConfigurationPage : public QWidget
{ {
@ -45,8 +47,11 @@ public:
void Apply(); void Apply();
public slots: public slots:
void LangChanged(); void LangChanged();
void SystemChanged();
void UnitChanged(); void UnitChanged();
void LabelLangChanged(); void LabelLangChanged();
protected:
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
private: private:
Q_DISABLE_COPY(ConfigurationPage) Q_DISABLE_COPY(ConfigurationPage)
QCheckBox *autoSaveCheck; QCheckBox *autoSaveCheck;
@ -56,18 +61,44 @@ private:
QComboBox *unitCombo; QComboBox *unitCombo;
QCheckBox *osOptionCheck; QCheckBox *osOptionCheck;
bool langChanged; bool langChanged;
bool systemChanged;
bool unitChanged; bool unitChanged;
bool labelLangChanged; bool labelLangChanged;
QCheckBox *sendReportCheck; QCheckBox *sendReportCheck;
QCheckBox *askPointDeletionCheck; QCheckBox *askPointDeletionCheck;
QCheckBox *toolBarStyleCheck; QCheckBox *toolBarStyleCheck;
QGroupBox *saveGroup;
QLabel *intervalLabel;
QGroupBox *langGroup;
QLabel *guiLabel;
QLabel *separatorLabel;
QLabel *unitLabel;
QLabel *languageLabel;
QGroupBox *pmSystemGroup;
QLabel *systemLabel;
QComboBox *systemCombo;
QLabel *systemAuthorLabel;
QLabel *systemBookLabel;
QLabel *systemAuthorValueLabel;
QPlainTextEdit *systemBookValueLabel;
QGroupBox *sendGroup;
QLabel *description;
QGroupBox *drawGroup;
QGroupBox *toolBarGroup;
QGroupBox *SaveGroup(); QGroupBox *SaveGroup();
QGroupBox *LangGroup(); QGroupBox *LangGroup();
QGroupBox *PMSystemGroup();
QGroupBox *SendGroup(); QGroupBox *SendGroup();
QGroupBox *DrawGroup(); QGroupBox *DrawGroup();
QGroupBox *ToolBarGroup(); QGroupBox *ToolBarGroup();
void SetLabelComboBox(const QStringList &list); void SetLabelComboBox(const QStringList &list);
void RetranslateUi();
}; };
#endif // CONFIGURATIONPAGE_H #endif // CONFIGURATIONPAGE_H

View File

@ -48,7 +48,7 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
PathPage::PathPage(QWidget *parent) PathPage::PathPage(QWidget *parent)
: QWidget(parent), defaultButton(nullptr), editButton(nullptr), pathTable(nullptr) : QWidget(parent), defaultButton(nullptr), editButton(nullptr), pathTable(nullptr), pathGroup(nullptr)
{ {
QGroupBox *pathGroup = PathGroup(); QGroupBox *pathGroup = PathGroup();
SCASSERT(pathGroup != nullptr); SCASSERT(pathGroup != nullptr);
@ -148,10 +148,23 @@ void PathPage::EditPath()
item->setToolTip(dir); item->setToolTip(dir);
} }
//---------------------------------------------------------------------------------------------------------------------
void PathPage::changeEvent(QEvent *event)
{
if (event->type() == QEvent::LanguageChange)
{
// retranslate designer form (single inheritance approach)
RetranslateUi();
}
// remember to call base class implementation
QWidget::changeEvent(event);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QGroupBox *PathPage::PathGroup() QGroupBox *PathPage::PathGroup()
{ {
QGroupBox *pathGroup = new QGroupBox(tr("Path that use Valentina")); pathGroup = new QGroupBox(tr("Path that use Valentina"));
InitTable(); InitTable();
defaultButton = new QPushButton(tr("Default")); defaultButton = new QPushButton(tr("Default"));
@ -232,3 +245,20 @@ void PathPage::InitTable()
connect(pathTable, &QTableWidget::itemSelectionChanged, this, &PathPage::TableActivated); connect(pathTable, &QTableWidget::itemSelectionChanged, this, &PathPage::TableActivated);
} }
//---------------------------------------------------------------------------------------------------------------------
void PathPage::RetranslateUi()
{
pathGroup->setTitle(tr("Path that use Valentina"));
defaultButton->setText(tr("Default"));
editButton->setText(tr("Edit"));
const QStringList tableHeader = QStringList() << tr("Type") << tr("Path");
pathTable->setHorizontalHeaderLabels(tableHeader);
pathTable->item(0, 0)->setText(tr("Individual measurements"));
pathTable->item(1, 0)->setText(tr("Standard measurements"));
pathTable->item(2, 0)->setText(tr("Patterns"));
pathTable->item(3, 0)->setText(tr("Layout"));
pathTable->item(4, 0)->setText(tr("Templates"));
}

View File

@ -46,13 +46,18 @@ public slots:
void TableActivated(); void TableActivated();
void DefaultPath(); void DefaultPath();
void EditPath(); void EditPath();
protected:
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
private: private:
Q_DISABLE_COPY(PathPage) Q_DISABLE_COPY(PathPage)
QPushButton *defaultButton; QPushButton *defaultButton;
QPushButton *editButton; QPushButton *editButton;
QTableWidget *pathTable; QTableWidget *pathTable;
QGroupBox *pathGroup;
QGroupBox *PathGroup(); QGroupBox *PathGroup();
void InitTable(); void InitTable();
void RetranslateUi();
}; };
#endif // PATHPAGE_H #endif // PATHPAGE_H

View File

@ -42,7 +42,15 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
PatternPage::PatternPage(QWidget *parent): PatternPage::PatternPage(QWidget *parent):
QWidget(parent), userName(nullptr), graphOutputCheck(nullptr), undoCount(nullptr) QWidget(parent),
userGroup(nullptr),
userName(nullptr),
userNameLabel(nullptr),
graphOutputGroup(nullptr),
graphOutputCheck(nullptr),
undoGroup(nullptr),
undoCount(nullptr),
countStepsLabel(nullptr)
{ {
QGroupBox *userGroup = UserGroup(); QGroupBox *userGroup = UserGroup();
QGroupBox *graphOutputGroup = GraphOutputGroup(); QGroupBox *graphOutputGroup = GraphOutputGroup();
@ -73,10 +81,23 @@ void PatternPage::Apply()
settings->SetUndoCount(undoCount->value()); settings->SetUndoCount(undoCount->value());
} }
//---------------------------------------------------------------------------------------------------------------------
void PatternPage::changeEvent(QEvent *event)
{
if (event->type() == QEvent::LanguageChange)
{
// retranslate designer form (single inheritance approach)
RetranslateUi();
}
// remember to call base class implementation
QWidget::changeEvent(event);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QGroupBox *PatternPage::UserGroup() QGroupBox *PatternPage::UserGroup()
{ {
QGroupBox *userGroup = new QGroupBox(tr("User")); userGroup = new QGroupBox(tr("User"));
userName = new QLineEdit; userName = new QLineEdit;
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0) #if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
@ -85,8 +106,9 @@ QGroupBox *PatternPage::UserGroup()
userName->setText(qApp->ValentinaSettings()->GetUser()); userName->setText(qApp->ValentinaSettings()->GetUser());
QFormLayout *nameLayout = new QFormLayout; QFormLayout *nameLayout = new QFormLayout;
userNameLabel = new QLabel(tr("User name:"));
nameLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); nameLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
nameLayout->addRow(tr("User name:"), userName); nameLayout->addRow(userNameLabel, userName);
QVBoxLayout *userLayout = new QVBoxLayout; QVBoxLayout *userLayout = new QVBoxLayout;
userLayout->addLayout(nameLayout); userLayout->addLayout(nameLayout);
@ -97,7 +119,7 @@ QGroupBox *PatternPage::UserGroup()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QGroupBox *PatternPage::GraphOutputGroup() QGroupBox *PatternPage::GraphOutputGroup()
{ {
QGroupBox *graphOutputGroup = new QGroupBox(tr("Graphical output")); graphOutputGroup = new QGroupBox(tr("Graphical output"));
graphOutputCheck = new QCheckBox(tr("Use antialiasing")); graphOutputCheck = new QCheckBox(tr("Use antialiasing"));
graphOutputCheck->setChecked(qApp->ValentinaSettings()->GetGraphicalOutput()); graphOutputCheck->setChecked(qApp->ValentinaSettings()->GetGraphicalOutput());
@ -114,17 +136,29 @@ QGroupBox *PatternPage::GraphOutputGroup()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QGroupBox *PatternPage::UndoGroup() QGroupBox *PatternPage::UndoGroup()
{ {
QGroupBox *undoGroup = new QGroupBox(tr("Undo")); undoGroup = new QGroupBox(tr("Undo"));
undoCount = new QSpinBox; undoCount = new QSpinBox;
undoCount->setMinimum(0); undoCount->setMinimum(0);
undoCount->setValue(qApp->ValentinaSettings()->GetUndoCount()); undoCount->setValue(qApp->ValentinaSettings()->GetUndoCount());
QFormLayout *countLayout = new QFormLayout; QFormLayout *countLayout = new QFormLayout;
countStepsLabel = new QLabel(tr("Count steps (0 - no limit):"));
countLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); countLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
countLayout->addRow(tr("Count steps (0 - no limit):"), undoCount); countLayout->addRow(countStepsLabel, undoCount);
QVBoxLayout *undoLayout = new QVBoxLayout; QVBoxLayout *undoLayout = new QVBoxLayout;
undoLayout->addLayout(countLayout); undoLayout->addLayout(countLayout);
undoGroup->setLayout(undoLayout); undoGroup->setLayout(undoLayout);
return undoGroup; return undoGroup;
} }
//---------------------------------------------------------------------------------------------------------------------
void PatternPage::RetranslateUi()
{
userGroup->setTitle(tr("User"));
userNameLabel->setText(tr("User name:"));
graphOutputGroup->setTitle(tr("Graphical output"));
graphOutputCheck->setText(tr("Use antialiasing"));
undoGroup->setTitle(tr("Undo"));
countStepsLabel->setText(tr("Count steps (0 - no limit):"));
}

View File

@ -36,6 +36,7 @@ class QCheckBox;
class QSpinBox; class QSpinBox;
class QGroupBox; class QGroupBox;
class QLineEdit; class QLineEdit;
class QLabel;
class PatternPage : public QWidget class PatternPage : public QWidget
{ {
@ -43,14 +44,23 @@ class PatternPage : public QWidget
public: public:
explicit PatternPage(QWidget *parent = nullptr); explicit PatternPage(QWidget *parent = nullptr);
void Apply(); void Apply();
protected:
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
private: private:
Q_DISABLE_COPY(PatternPage) Q_DISABLE_COPY(PatternPage)
QGroupBox *userGroup;
QLineEdit *userName; QLineEdit *userName;
QLabel *userNameLabel;
QGroupBox *graphOutputGroup;
QCheckBox *graphOutputCheck; QCheckBox *graphOutputCheck;
QGroupBox *undoGroup;
QSpinBox *undoCount; QSpinBox *undoCount;
QLabel *countStepsLabel;
QGroupBox *UserGroup(); QGroupBox *UserGroup();
QGroupBox *GraphOutputGroup(); QGroupBox *GraphOutputGroup();
QGroupBox *UndoGroup(); QGroupBox *UndoGroup();
void RetranslateUi();
}; };
#endif // PATTERNPAGE_H #endif // PATTERNPAGE_H

View File

@ -502,3 +502,31 @@ void DialogHistory::closeEvent(QCloseEvent *event)
emit ShowHistoryTool(id, false); emit ShowHistoryTool(id, false);
DialogTool::closeEvent(event); DialogTool::closeEvent(event);
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogHistory::changeEvent(QEvent *event)
{
if (event->type() == QEvent::LanguageChange)
{
// retranslate designer form (single inheritance approach)
ui->retranslateUi(this);
RetranslateUi();
}
// remember to call base class implementation
QDialog::changeEvent(event);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogHistory::RetranslateUi()
{
qint32 currentRow = cursorRow;
UpdateHistory();
QTableWidgetItem *item = ui->tableWidget->item(cursorRow, 0);
SCASSERT(item != nullptr);
item->setIcon(QIcon(""));
cursorRow = currentRow;
cellClicked(cursorRow, 0);
}

View File

@ -68,6 +68,7 @@ signals:
void ShowHistoryTool(quint32 id, bool enable); void ShowHistoryTool(quint32 id, bool enable);
protected: protected:
virtual void closeEvent ( QCloseEvent * event ) Q_DECL_OVERRIDE; virtual void closeEvent ( QCloseEvent * event ) Q_DECL_OVERRIDE;
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
private: private:
Q_DISABLE_COPY(DialogHistory) Q_DISABLE_COPY(DialogHistory)
@ -89,6 +90,7 @@ private:
void ShowPoint(); void ShowPoint();
QString PointName(quint32 pointId); QString PointName(quint32 pointId);
quint32 AttrUInt(const QDomElement &domElement, const QString &name); quint32 AttrUInt(const QDomElement &domElement, const QString &name);
void RetranslateUi();
}; };
#endif // DIALOGHISTORY_H #endif // DIALOGHISTORY_H

View File

@ -428,16 +428,22 @@ void DialogIncrements::EnableDetails(bool enabled)
*/ */
void DialogIncrements::FullUpdateFromFile() void DialogIncrements::FullUpdateFromFile()
{ {
FillIncrements();
ui->tableWidgetLines->clearContents(); ui->tableWidgetLines->clearContents();
FillLengthsLines();
ui->tableWidgetSplines->clearContents(); ui->tableWidgetSplines->clearContents();
FillLengthsCurves();
ui->tableWidgetArcs->clearContents(); ui->tableWidgetArcs->clearContents();
ui->tableWidgetAnglesArcs->clearContents();
ui->tableWidgetAnglesCurves->clearContents();
ui->tableWidgetLinesAngles->clearContents();
ui->tableWidgetRadiusesArcs->clearContents();
FillIncrements();
FillLengthsLines();
FillLengthLinesAngles();
FillLengthsCurves();
FillLengthArcs(); FillLengthArcs();
FillRadiusesArcs();
FillAnglesArcs();
FillAnglesCurves();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -719,6 +725,19 @@ void DialogIncrements::closeEvent(QCloseEvent *event)
event->accept(); event->accept();
} }
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::changeEvent(QEvent *event)
{
if (event->type() == QEvent::LanguageChange)
{
// retranslate designer form (single inheritance approach)
ui->retranslateUi(this);
FullUpdateFromFile();
}
// remember to call base class implementation
QWidget::changeEvent(event);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::ShowIncrementDetails() void DialogIncrements::ShowIncrementDetails()
{ {

View File

@ -59,7 +59,7 @@ signals:
protected: protected:
virtual void closeEvent ( QCloseEvent * event ) Q_DECL_OVERRIDE; virtual void closeEvent ( QCloseEvent * event ) Q_DECL_OVERRIDE;
virtual void changeEvent ( QEvent * event) Q_DECL_OVERRIDE;
private slots: private slots:
void ShowIncrementDetails(); void ShowIncrementDetails();
void AddIncrement(); void AddIncrement();

View File

@ -66,9 +66,9 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat
connect(ui->buttonBox->button(QDialogButtonBox::Apply), &QPushButton::clicked, this, connect(ui->buttonBox->button(QDialogButtonBox::Apply), &QPushButton::clicked, this,
&DialogPatternProperties::Apply); &DialogPatternProperties::Apply);
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); QPushButton *bCancel = ui->buttonBox->button(QDialogButtonBox::Cancel);
SCASSERT(bCansel != nullptr); SCASSERT(bCancel != nullptr);
connect(bCansel, &QPushButton::clicked, this, &DialogPatternProperties::close); connect(bCancel, &QPushButton::clicked, this, &DialogPatternProperties::close);
ui->tabWidget->setCurrentIndex(0); ui->tabWidget->setCurrentIndex(0);
if (qApp->patternType() != MeasurementsType::Standard) if (qApp->patternType() != MeasurementsType::Standard)

View File

@ -100,8 +100,8 @@ MainWindow::MainWindow(QWidget *parent)
lastUsedTool(Tool::Arrow), sceneDraw(nullptr), sceneDetails(nullptr), lastUsedTool(Tool::Arrow), sceneDraw(nullptr), sceneDetails(nullptr),
mouseCoordinate(nullptr), helpLabel(nullptr), isInitialized(false), mChanges(false), dialogTable(nullptr), mouseCoordinate(nullptr), helpLabel(nullptr), isInitialized(false), mChanges(false), dialogTable(nullptr),
dialogTool(nullptr), dialogTool(nullptr),
dialogHistory(nullptr), comboBoxDraws(nullptr), mode(Draw::Calculation), currentDrawIndex(0), dialogHistory(nullptr), comboBoxDraws(nullptr), patternPieceLabel(nullptr), mode(Draw::Calculation),
currentToolBoxIndex(0), drawMode(true), recentFileActs(), currentDrawIndex(0), currentToolBoxIndex(0), drawMode(true), recentFileActs(),
separatorAct(nullptr), separatorAct(nullptr),
leftGoToStage(nullptr), rightGoToStage(nullptr), autoSaveTimer(nullptr), guiEnabled(true), leftGoToStage(nullptr), rightGoToStage(nullptr), autoSaveTimer(nullptr), guiEnabled(true),
gradationHeights(nullptr), gradationSizes(nullptr), gradationHeightsLabel(nullptr), gradationSizesLabel(nullptr), gradationHeights(nullptr), gradationSizes(nullptr), gradationHeightsLabel(nullptr), gradationSizesLabel(nullptr),
@ -1118,6 +1118,23 @@ void MainWindow::showEvent( QShowEvent *event )
isInitialized = true;//first show windows are held isInitialized = true;//first show windows are held
} }
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::changeEvent(QEvent *event)
{
if (event->type() == QEvent::LanguageChange)
{
// retranslate designer form (single inheritance approach)
ui->retranslateUi(this);
undoAction->setText(tr("&Undo"));
redoAction->setText(tr("&Redo"));
helpLabel->setText(QObject::tr("Changes applied."));
patternPieceLabel->setText(tr("Pattern Piece: "));
UpdateWindowTitle();
}
// remember to call base class implementation
QMainWindow::changeEvent(event);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief closeEvent handle after close window. * @brief closeEvent handle after close window.
@ -1491,7 +1508,8 @@ void MainWindow::ToolBarStages()
*/ */
void MainWindow::ToolBarDraws() void MainWindow::ToolBarDraws()
{ {
ui->toolBarDraws->addWidget(new QLabel(tr("Pattern Piece: "))); patternPieceLabel = new QLabel(tr("Pattern Piece: "));
ui->toolBarDraws->addWidget(patternPieceLabel);
// By using Qt UI Designer we can't add QComboBox to toolbar // By using Qt UI Designer we can't add QComboBox to toolbar
comboBoxDraws = new QComboBox; comboBoxDraws = new QComboBox;

View File

@ -158,6 +158,7 @@ signals:
protected: protected:
virtual void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE; virtual void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE; virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE; virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
virtual void customEvent(QEvent * event) Q_DECL_OVERRIDE; virtual void customEvent(QEvent * event) Q_DECL_OVERRIDE;
virtual void CleanLayout() Q_DECL_OVERRIDE; virtual void CleanLayout() Q_DECL_OVERRIDE;
@ -214,6 +215,7 @@ private:
/** @brief comboBoxDraws comboc who show name of pattern peaces. */ /** @brief comboBoxDraws comboc who show name of pattern peaces. */
QComboBox *comboBoxDraws; QComboBox *comboBoxDraws;
QLabel *patternPieceLabel;
/** @brief mode keep current draw mode. */ /** @brief mode keep current draw mode. */
Draw mode; Draw mode;

View File

@ -67,9 +67,9 @@ DialogDetail::DialogDetail(const VContainer *data, const quint32 &toolId, QWidge
bOk = ui.buttonBox->button(QDialogButtonBox::Ok); bOk = ui.buttonBox->button(QDialogButtonBox::Ok);
SCASSERT(bOk != nullptr); SCASSERT(bOk != nullptr);
connect(bOk, &QPushButton::clicked, this, &DialogTool::DialogAccepted); connect(bOk, &QPushButton::clicked, this, &DialogTool::DialogAccepted);
QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel); QPushButton *bCancel = ui.buttonBox->button(QDialogButtonBox::Cancel);
SCASSERT(bCansel != nullptr); SCASSERT(bCancel != nullptr);
connect(bCansel, &QPushButton::clicked, this, &DialogTool::DialogRejected); connect(bCancel, &QPushButton::clicked, this, &DialogTool::DialogRejected);
flagName = true;//We have default name of detail. flagName = true;//We have default name of detail.
ChangeColor(labelEditNamePoint, okColor); ChangeColor(labelEditNamePoint, okColor);