From 2623af88811aeeec3db0991010d6940b3b811e94 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Wed, 6 Jan 2016 07:02:41 +0200 Subject: [PATCH 01/22] Retranslate mainwindow ui. --HG-- branch : feature --- src/app/valentina/mainwindow.cpp | 12 ++++++++++++ src/app/valentina/mainwindow.h | 1 + 2 files changed, 13 insertions(+) diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 3f44bfb21..800fc3af5 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -1118,6 +1118,18 @@ void MainWindow::showEvent( QShowEvent *event ) 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); + } + // remember to call base class implementation + QMainWindow::changeEvent(event); +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief closeEvent handle after close window. diff --git a/src/app/valentina/mainwindow.h b/src/app/valentina/mainwindow.h index 0aa106f60..a55bf6d92 100644 --- a/src/app/valentina/mainwindow.h +++ b/src/app/valentina/mainwindow.h @@ -158,6 +158,7 @@ signals: protected: virtual void keyPressEvent(QKeyEvent *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 customEvent(QEvent * event) Q_DECL_OVERRIDE; virtual void CleanLayout() Q_DECL_OVERRIDE; From 4e1248472502944d6a5b3aad97cb66c562f6dddc Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Wed, 6 Jan 2016 07:34:30 +0200 Subject: [PATCH 02/22] Retranslate configdialog. --HG-- branch : feature --- src/app/valentina/dialogs/configdialog.cpp | 36 +++++++++++++++++++--- src/app/valentina/dialogs/configdialog.h | 6 ++++ 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/src/app/valentina/dialogs/configdialog.cpp b/src/app/valentina/dialogs/configdialog.cpp index 684a94c5b..30825ea22 100644 --- a/src/app/valentina/dialogs/configdialog.cpp +++ b/src/app/valentina/dialogs/configdialog.cpp @@ -38,7 +38,8 @@ //--------------------------------------------------------------------------------------------------------------------- ConfigDialog::ConfigDialog(QWidget *parent) : 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->setViewMode(QListView::IconMode); @@ -62,9 +63,9 @@ ConfigDialog::ConfigDialog(QWidget *parent) : pathPage = new PathPage(); pagesWidget->addWidget(pathPage); - QPushButton *applyButton = new QPushButton(tr("Apply")); - QPushButton *cancelButton = new QPushButton(tr("&Cancel")); - QPushButton *okButton = new QPushButton(tr("&Ok")); + applyButton = new QPushButton(tr("Apply")); + cancelButton = new QPushButton(tr("&Cancel")); + okButton = new QPushButton(tr("&Ok")); createIcons(); contentsWidget->setCurrentRow(0); @@ -115,6 +116,19 @@ void ConfigDialog::closeEvent(QCloseEvent *event) 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) { @@ -188,3 +202,17 @@ void ConfigDialog::Ok() Apply(); 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")); +} + diff --git a/src/app/valentina/dialogs/configdialog.h b/src/app/valentina/dialogs/configdialog.h index 9f8d9556e..bb1932032 100644 --- a/src/app/valentina/dialogs/configdialog.h +++ b/src/app/valentina/dialogs/configdialog.h @@ -47,6 +47,7 @@ signals: void UpdateProperties(); protected: virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE; + virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE; virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(ConfigDialog) @@ -56,11 +57,16 @@ private: PatternPage *patternPage; CommunityPage *communityPage; PathPage *pathPage; + QPushButton *applyButton; + QPushButton *cancelButton; + QPushButton *okButton; bool isInitialized; void createIcons(); void createIcon(const QString &icon, const QString &text); void Apply(); void Ok(); + + void RetranslateUi(); }; #endif // CONFIGDIALOG_H From b9f3e664dca2a91282c541af7ef1469cfa07e7f4 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Wed, 6 Jan 2016 07:40:34 +0200 Subject: [PATCH 03/22] Retranslate communitypage. --HG-- branch : feature --- .../dialogs/configpages/communitypage.cpp | 113 ++++++++++++++---- .../dialogs/configpages/communitypage.h | 24 +++- 2 files changed, 111 insertions(+), 26 deletions(-) diff --git a/src/app/valentina/dialogs/configpages/communitypage.cpp b/src/app/valentina/dialogs/configpages/communitypage.cpp index b23b4e5a6..066915869 100644 --- a/src/app/valentina/dialogs/configpages/communitypage.cpp +++ b/src/app/valentina/dialogs/configpages/communitypage.cpp @@ -38,9 +38,30 @@ //--------------------------------------------------------------------------------------------------------------------- CommunityPage::CommunityPage(QWidget *parent): - QWidget(parent), server(nullptr), secureComm(nullptr), useProxy(nullptr), proxyAddress(nullptr), - proxyPort(nullptr), proxyUser(nullptr), proxyPass(nullptr), username(nullptr), savePassword(nullptr), - userpassword(nullptr) + QWidget(parent), + serverGroup(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 *proxyGroup = ProxyGroup(); @@ -100,55 +121,75 @@ void CommunityPage::PasswordCheckChanged() //--------------------------------------------------------------------------------------------------------------------- QGroupBox *CommunityPage::ServerGroup() { - QGroupBox *ServerGroup = new QGroupBox(tr("Server")); + serverGroup = new QGroupBox(tr("Server")); QFormLayout *serverLayout = new QFormLayout; 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_lineedit(&this->server, serverLayout, qApp->ValentinaSettings()->GetServer(), serverNameLabel); CommunityPage::add_checkbox(&this->secureComm, serverLayout, qApp->ValentinaSettings()->GetServerSecure(), - tr("Secure connection")); + secureConnectionLabel); - ServerGroup->setLayout(serverLayout); - return ServerGroup; + serverGroup->setLayout(serverLayout); + return serverGroup; } //--------------------------------------------------------------------------------------------------------------------- -void CommunityPage::add_checkbox(QCheckBox** thebox, QFormLayout *layout, bool checked, QString label) +void CommunityPage::add_checkbox(QCheckBox** thebox, QFormLayout *layout, bool checked, QLabel *label) { - QLabel *labelbox = new QLabel(label); (*thebox)= new QCheckBox; (*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::add_lineedit(QLineEdit** theline, QFormLayout *layout, QString value, QLabel *label) { - QLabel *labelbox = new QLabel(label); (*theline)= new QLineEdit; #if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0) (*theline)->setClearButtonEnabled(true); #endif (*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 *proxyGroup = new QGroupBox(tr("Proxy settings")); + proxyGroup = new QGroupBox(tr("Proxy settings")); QFormLayout *proxyLayout = new QFormLayout; 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(); - CommunityPage::add_checkbox(&this->useProxy, proxyLayout, settings->GetProxy(), tr("Use Proxy")); + CommunityPage::add_checkbox(&this->useProxy, proxyLayout, settings->GetProxy(), useProxyLabel); CommunityPage::add_lineedit(&this->proxyAddress, proxyLayout, settings->GetProxyAddress(), - tr("Proxy address:")); - 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->proxyPass, proxyLayout, settings->GetProxyPass(), tr("Proxy pass:")); + proxyAddressLabel); + CommunityPage::add_lineedit(&this->proxyPort, proxyLayout, settings->GetProxyPort(), proxyPortLabel); + CommunityPage::add_lineedit(&this->proxyUser, proxyLayout, settings->GetProxyUser(), proxyUserLabel); + CommunityPage::add_lineedit(&this->proxyPass, proxyLayout, settings->GetProxyPass(), proxyPassLabel); connect(this->useProxy, &QCheckBox::stateChanged, this, &CommunityPage::ProxyCheckChanged); this->ProxyCheckChanged(); @@ -160,14 +201,18 @@ QGroupBox *CommunityPage::ProxyGroup() //--------------------------------------------------------------------------------------------------------------------- QGroupBox *CommunityPage::UserGroup() { - QGroupBox *userGroup = new QGroupBox(tr("User settings")); + userGroup = new QGroupBox(tr("User settings")); QFormLayout *userLayout = new QFormLayout; 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(); - CommunityPage::add_lineedit(&this->username, userLayout, settings->GetUsername(), tr("User Name:")); - 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->username, userLayout, settings->GetUsername(), usernameLabel); + CommunityPage::add_checkbox(&this->savePassword, userLayout, settings->GetSavePassword(), savePasswordLabel); + CommunityPage::add_lineedit(&this->userpassword, userLayout, settings->GetUserPassword(), userpasswordLabel); connect(this->savePassword, &QCheckBox::stateChanged, this, &CommunityPage::PasswordCheckChanged); this->PasswordCheckChanged(); @@ -176,3 +221,23 @@ QGroupBox *CommunityPage::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:")); +} diff --git a/src/app/valentina/dialogs/configpages/communitypage.h b/src/app/valentina/dialogs/configpages/communitypage.h index 8d98bf75f..dc1baee83 100644 --- a/src/app/valentina/dialogs/configpages/communitypage.h +++ b/src/app/valentina/dialogs/configpages/communitypage.h @@ -36,6 +36,7 @@ class QCheckBox; class QGroupBox; class QLineEdit; +class QLabel; class CommunityPage : public QWidget { @@ -43,26 +44,43 @@ class CommunityPage : public QWidget public: explicit CommunityPage(QWidget *parent = nullptr); void Apply(); +protected: + virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(CommunityPage) // server name and https connection + QGroupBox *serverGroup; QLineEdit *server; QCheckBox *secureComm; + QLabel *serverNameLabel; + QLabel *secureConnectionLabel; // proxy stuff + QGroupBox *proxyGroup; QCheckBox *useProxy; QLineEdit *proxyAddress; QLineEdit *proxyPort; QLineEdit *proxyUser; QLineEdit *proxyPass; + QLabel *useProxyLabel; + QLabel *proxyAddressLabel; + QLabel *proxyPortLabel; + QLabel *proxyUserLabel; + QLabel *proxyPassLabel; + // username and password + QGroupBox *userGroup; QLineEdit *username; QCheckBox *savePassword; QLineEdit *userpassword; - static void add_checkbox(QCheckBox** thebox, QFormLayout *layout, bool checked, QString label); - static void add_lineedit(QLineEdit** theline, QFormLayout *layout, QString value, QString label); + QLabel *usernameLabel; + QLabel *savePasswordLabel; + QLabel *userpasswordLabel; + + static void add_checkbox(QCheckBox** thebox, QFormLayout *layout, bool checked, QLabel* label); + static void add_lineedit(QLineEdit** theline, QFormLayout *layout, QString value, QLabel *label); void ProxyCheckChanged(); void PasswordCheckChanged(); @@ -70,6 +88,8 @@ private: QGroupBox *ServerGroup(); QGroupBox *ProxyGroup(); QGroupBox *UserGroup(); + + void RetranslateUi(); }; #endif // COMMUNITYPAGE_H From ac899a4cf1bff0b20a6ea6d3c5c5b5378c1e859a Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Wed, 6 Jan 2016 07:55:05 +0200 Subject: [PATCH 04/22] Retranslate configurationpage. --HG-- branch : feature --- .../dialogs/configpages/configurationpage.cpp | 111 +++++++++++++++--- .../dialogs/configpages/configurationpage.h | 19 +++ 2 files changed, 112 insertions(+), 18 deletions(-) diff --git a/src/app/valentina/dialogs/configpages/configurationpage.cpp b/src/app/valentina/dialogs/configpages/configurationpage.cpp index 99e67432b..bde6b3838 100644 --- a/src/app/valentina/dialogs/configpages/configurationpage.cpp +++ b/src/app/valentina/dialogs/configpages/configurationpage.cpp @@ -46,9 +46,30 @@ //--------------------------------------------------------------------------------------------------------------------- ConfigurationPage::ConfigurationPage(QWidget *parent) - : QWidget(parent), autoSaveCheck(nullptr), autoTime(nullptr), langCombo(nullptr), labelCombo(nullptr), - unitCombo(nullptr), osOptionCheck(nullptr), langChanged(false), unitChanged(false), labelLangChanged(false), - sendReportCheck(nullptr), askPointDeletionCheck(nullptr), toolBarStyleCheck(nullptr) + : QWidget(parent), + autoSaveCheck(nullptr), + autoTime(nullptr), + langCombo(nullptr), + labelCombo(nullptr), + unitCombo(nullptr), + osOptionCheck(nullptr), + langChanged(false), + unitChanged(false), + labelLangChanged(false), + sendReportCheck(nullptr), + askPointDeletionCheck(nullptr), + toolBarStyleCheck(nullptr), + saveGroup(nullptr), + intervalLabel(nullptr), + langGroup(nullptr), + guiLabel(nullptr), + separatorLabel(nullptr), + unitLabel(nullptr), + languageLabel(nullptr), + sendGroup(nullptr), + description(nullptr), + drawGroup(nullptr), + toolBarGroup(nullptr) { QGroupBox *saveGroup = SaveGroup(); QGroupBox *langGroup = LangGroup(); @@ -88,9 +109,7 @@ void ConfigurationPage::Apply() const QString locale = qvariant_cast(langCombo->itemData(langCombo->currentIndex())); settings->SetLocale(locale); langChanged = false; - const QString text = tr("Setup user interface language updated and will be used the next time start") + " " + - QApplication::applicationName(); - QMessageBox::information(this, QApplication::applicationName(), text); + qApp->LoadTranslation(locale); } if (this->unitChanged) { @@ -129,7 +148,7 @@ void ConfigurationPage::LabelLangChanged() //--------------------------------------------------------------------------------------------------------------------- QGroupBox *ConfigurationPage::SaveGroup() { - QGroupBox *saveGroup = new QGroupBox(tr("Save")); + saveGroup = new QGroupBox(tr("Save")); autoSaveCheck = new QCheckBox(tr("Auto-save modified pattern")); autoSaveCheck->setChecked(qApp->ValentinaSettings()->GetAutosaveState()); @@ -141,7 +160,8 @@ QGroupBox *ConfigurationPage::SaveGroup() QHBoxLayout *autosaveLayout = new QHBoxLayout; autosaveLayout->addWidget(autoSaveCheck); - autosaveLayout->addWidget(new QLabel(tr("Interval:"))); + intervalLabel = new QLabel(tr("Interval:")); + autosaveLayout->addWidget(intervalLabel); autosaveLayout->addWidget(autoTime); QVBoxLayout *saveLayout = new QVBoxLayout; @@ -153,7 +173,8 @@ QGroupBox *ConfigurationPage::SaveGroup() //--------------------------------------------------------------------------------------------------------------------- QGroupBox *ConfigurationPage::LangGroup() { - QGroupBox *langGroup = new QGroupBox(tr("Language")); + langGroup = new QGroupBox(tr("Language")); + guiLabel = new QLabel(tr("GUI language:")); langCombo = new QComboBox; QStringList fileNames; @@ -200,12 +221,13 @@ QGroupBox *ConfigurationPage::LangGroup() QFormLayout *langLayout = new QFormLayout; langLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); - langLayout->addRow(tr("GUI language:"), langCombo); + langLayout->addRow(guiLabel, langCombo); //-------------------- 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()); - langLayout->addRow(tr("Decimal separator parts:"), osOptionCheck); + langLayout->addRow(separatorLabel, osOptionCheck); //----------------------- Unit setup this->unitCombo = new QComboBox; @@ -222,7 +244,8 @@ QGroupBox *ConfigurationPage::LangGroup() connect(this->unitCombo, static_cast(&QComboBox::currentIndexChanged), this, &ConfigurationPage::UnitChanged); - langLayout->addRow(tr("Default unit:"), this->unitCombo); + unitLabel = new QLabel(tr("Default unit:")); + langLayout->addRow(unitLabel, this->unitCombo); //----------------------- Label language labelCombo = new QComboBox; @@ -237,7 +260,8 @@ QGroupBox *ConfigurationPage::LangGroup() connect(labelCombo, static_cast(&QComboBox::currentIndexChanged), this, &ConfigurationPage::LabelLangChanged); - langLayout->addRow(tr("Label language:"), labelCombo); + languageLabel = new QLabel(tr("Label language:")); + langLayout->addRow(languageLabel, labelCombo); langGroup->setLayout(langLayout); return langGroup; @@ -246,12 +270,12 @@ QGroupBox *ConfigurationPage::LangGroup() //--------------------------------------------------------------------------------------------------------------------- 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->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 " "kind of information we collect.")); @@ -271,7 +295,7 @@ QGroupBox *ConfigurationPage::SendGroup() //--------------------------------------------------------------------------------------------------------------------- QGroupBox *ConfigurationPage::DrawGroup() { - QGroupBox *drawGroup = new QGroupBox(tr("Pattern Editing")); + drawGroup = new QGroupBox(tr("Pattern Editing")); askPointDeletionCheck = new QCheckBox(tr("Confirm item deletion")); askPointDeletionCheck->setChecked(qApp->ValentinaSettings()->GetConfirmItemDelete()); @@ -286,7 +310,7 @@ QGroupBox *ConfigurationPage::DrawGroup() //--------------------------------------------------------------------------------------------------------------------- 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->setChecked(qApp->ValentinaSettings()->GetToolBarStyle()); @@ -307,3 +331,54 @@ void ConfigurationPage::SetLabelComboBox(const QStringList &list) 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:")); + + 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 " + "kind of information 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.)")); + +} diff --git a/src/app/valentina/dialogs/configpages/configurationpage.h b/src/app/valentina/dialogs/configpages/configurationpage.h index 3b79b97c2..f63394981 100644 --- a/src/app/valentina/dialogs/configpages/configurationpage.h +++ b/src/app/valentina/dialogs/configpages/configurationpage.h @@ -36,6 +36,7 @@ class QCheckBox; class QSpinBox; class QComboBox; class QGroupBox; +class QLabel; class ConfigurationPage : public QWidget { @@ -47,6 +48,8 @@ public slots: void LangChanged(); void UnitChanged(); void LabelLangChanged(); +protected: + virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(ConfigurationPage) QCheckBox *autoSaveCheck; @@ -62,12 +65,28 @@ private: QCheckBox *askPointDeletionCheck; QCheckBox *toolBarStyleCheck; + QGroupBox *saveGroup; + QLabel *intervalLabel; + QGroupBox *langGroup; + QLabel *guiLabel; + QLabel *separatorLabel; + QLabel *unitLabel; + QLabel *languageLabel; + + QGroupBox *sendGroup; + QLabel *description; + + QGroupBox *drawGroup; + QGroupBox *toolBarGroup; + QGroupBox *SaveGroup(); QGroupBox *LangGroup(); QGroupBox *SendGroup(); QGroupBox *DrawGroup(); QGroupBox *ToolBarGroup(); void SetLabelComboBox(const QStringList &list); + + void RetranslateUi(); }; #endif // CONFIGURATIONPAGE_H From aa3197fbd362d3ba2e4504b2520354039f41421a Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Wed, 6 Jan 2016 07:55:51 +0200 Subject: [PATCH 05/22] Retranslate pathpage. --HG-- branch : feature --- .../dialogs/configpages/pathpage.cpp | 34 +++++++++++++++++-- .../valentina/dialogs/configpages/pathpage.h | 5 +++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/app/valentina/dialogs/configpages/pathpage.cpp b/src/app/valentina/dialogs/configpages/pathpage.cpp index 8915ded0b..d72a5c316 100644 --- a/src/app/valentina/dialogs/configpages/pathpage.cpp +++ b/src/app/valentina/dialogs/configpages/pathpage.cpp @@ -48,7 +48,7 @@ //--------------------------------------------------------------------------------------------------------------------- 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(); SCASSERT(pathGroup != nullptr); @@ -148,10 +148,23 @@ void PathPage::EditPath() 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 *pathGroup = new QGroupBox(tr("Path that use Valentina")); + pathGroup = new QGroupBox(tr("Path that use Valentina")); InitTable(); defaultButton = new QPushButton(tr("Default")); @@ -232,3 +245,20 @@ void PathPage::InitTable() 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")); +} diff --git a/src/app/valentina/dialogs/configpages/pathpage.h b/src/app/valentina/dialogs/configpages/pathpage.h index f050baf01..f89be0add 100644 --- a/src/app/valentina/dialogs/configpages/pathpage.h +++ b/src/app/valentina/dialogs/configpages/pathpage.h @@ -46,13 +46,18 @@ public slots: void TableActivated(); void DefaultPath(); void EditPath(); +protected: + virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(PathPage) QPushButton *defaultButton; QPushButton *editButton; QTableWidget *pathTable; + QGroupBox *pathGroup; + QGroupBox *PathGroup(); void InitTable(); + void RetranslateUi(); }; #endif // PATHPAGE_H From c4fe05df111db8181016a562eb337de5c9cf0038 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Wed, 6 Jan 2016 07:59:01 +0200 Subject: [PATCH 06/22] Retranslate patternpage. --HG-- branch : feature --- .../dialogs/configpages/patternpage.cpp | 46 ++++++++++++++++--- .../dialogs/configpages/patternpage.h | 10 ++++ 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/src/app/valentina/dialogs/configpages/patternpage.cpp b/src/app/valentina/dialogs/configpages/patternpage.cpp index da9092867..11edccf1d 100644 --- a/src/app/valentina/dialogs/configpages/patternpage.cpp +++ b/src/app/valentina/dialogs/configpages/patternpage.cpp @@ -42,7 +42,15 @@ //--------------------------------------------------------------------------------------------------------------------- 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 *graphOutputGroup = GraphOutputGroup(); @@ -73,10 +81,23 @@ void PatternPage::Apply() 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 *userGroup = new QGroupBox(tr("User")); + userGroup = new QGroupBox(tr("User")); userName = new QLineEdit; #if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0) @@ -85,8 +106,9 @@ QGroupBox *PatternPage::UserGroup() userName->setText(qApp->ValentinaSettings()->GetUser()); QFormLayout *nameLayout = new QFormLayout; + userNameLabel = new QLabel(tr("User name:")); nameLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); - nameLayout->addRow(tr("User name:"), userName); + nameLayout->addRow(userNameLabel, userName); QVBoxLayout *userLayout = new QVBoxLayout; userLayout->addLayout(nameLayout); @@ -97,7 +119,7 @@ QGroupBox *PatternPage::UserGroup() //--------------------------------------------------------------------------------------------------------------------- QGroupBox *PatternPage::GraphOutputGroup() { - QGroupBox *graphOutputGroup = new QGroupBox(tr("Graphical output")); + graphOutputGroup = new QGroupBox(tr("Graphical output")); graphOutputCheck = new QCheckBox(tr("Use antialiasing")); graphOutputCheck->setChecked(qApp->ValentinaSettings()->GetGraphicalOutput()); @@ -114,17 +136,29 @@ QGroupBox *PatternPage::GraphOutputGroup() //--------------------------------------------------------------------------------------------------------------------- QGroupBox *PatternPage::UndoGroup() { - QGroupBox *undoGroup = new QGroupBox(tr("Undo")); + undoGroup = new QGroupBox(tr("Undo")); undoCount = new QSpinBox; undoCount->setMinimum(0); undoCount->setValue(qApp->ValentinaSettings()->GetUndoCount()); QFormLayout *countLayout = new QFormLayout; + countStepsLabel = new QLabel(tr("Count steps (0 - no limit):")); countLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); - countLayout->addRow(tr("Count steps (0 - no limit):"), undoCount); + countLayout->addRow(countStepsLabel, undoCount); QVBoxLayout *undoLayout = new QVBoxLayout; undoLayout->addLayout(countLayout); undoGroup->setLayout(undoLayout); 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):")); +} diff --git a/src/app/valentina/dialogs/configpages/patternpage.h b/src/app/valentina/dialogs/configpages/patternpage.h index 4af994927..9aa2f49ae 100644 --- a/src/app/valentina/dialogs/configpages/patternpage.h +++ b/src/app/valentina/dialogs/configpages/patternpage.h @@ -36,6 +36,7 @@ class QCheckBox; class QSpinBox; class QGroupBox; class QLineEdit; +class QLabel; class PatternPage : public QWidget { @@ -43,14 +44,23 @@ class PatternPage : public QWidget public: explicit PatternPage(QWidget *parent = nullptr); void Apply(); +protected: + virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(PatternPage) + QGroupBox *userGroup; QLineEdit *userName; + QLabel *userNameLabel; + QGroupBox *graphOutputGroup; QCheckBox *graphOutputCheck; + QGroupBox *undoGroup; QSpinBox *undoCount; + QLabel *countStepsLabel; QGroupBox *UserGroup(); QGroupBox *GraphOutputGroup(); QGroupBox *UndoGroup(); + + void RetranslateUi(); }; #endif // PATTERNPAGE_H From 31aee635e4ca70d4680e71239cbca24b2fb79411 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Wed, 6 Jan 2016 08:05:41 +0200 Subject: [PATCH 07/22] Little optimization: change 'cansel' to 'cancel' --HG-- branch : feature --- src/app/tape/dialogs/tapeconfigdialog.cpp | 10 +++++----- src/app/tape/dialogs/tapeconfigdialog.h | 2 +- src/app/valentina/dialogs/dialogpatternproperties.cpp | 6 +++--- src/libs/vtools/dialogs/tools/dialogdetail.cpp | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/app/tape/dialogs/tapeconfigdialog.cpp b/src/app/tape/dialogs/tapeconfigdialog.cpp index 1af4ccd60..cb489ee24 100644 --- a/src/app/tape/dialogs/tapeconfigdialog.cpp +++ b/src/app/tape/dialogs/tapeconfigdialog.cpp @@ -43,7 +43,7 @@ TapeConfigDialog::TapeConfigDialog(QWidget *parent) configurationPage(nullptr), pathPage(nullptr), applyButton(nullptr), - canselButton(nullptr), + cancelButton(nullptr), okButton(nullptr), isInitialized(false) { @@ -66,14 +66,14 @@ TapeConfigDialog::TapeConfigDialog(QWidget *parent) pagesWidget->addWidget(pathPage); applyButton = new QPushButton(tr("Apply")); - canselButton = new QPushButton(tr("&Cancel")); + cancelButton = new QPushButton(tr("&Cancel")); okButton = new QPushButton(tr("&Ok")); createIcons(); connect(contentsWidget, &QListWidget::currentItemChanged, this, &TapeConfigDialog::changePage); 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(okButton, &QPushButton::clicked, this, &TapeConfigDialog::Ok); @@ -84,7 +84,7 @@ TapeConfigDialog::TapeConfigDialog(QWidget *parent) QHBoxLayout *buttonsLayout = new QHBoxLayout; buttonsLayout->addStretch(1); buttonsLayout->addWidget(applyButton); - buttonsLayout->addWidget(canselButton); + buttonsLayout->addWidget(cancelButton); buttonsLayout->addWidget(okButton); QVBoxLayout *mainLayout = new QVBoxLayout; @@ -200,7 +200,7 @@ void TapeConfigDialog::Ok() void TapeConfigDialog::RetranslateUi() { applyButton->setText(tr("Apply")); - canselButton->setText(tr("&Cancel")); + cancelButton->setText(tr("&Cancel")); okButton->setText(tr("&Ok")); setWindowTitle(tr("Config Dialog")); contentsWidget->item(0)->setText(tr("Configuration")); diff --git a/src/app/tape/dialogs/tapeconfigdialog.h b/src/app/tape/dialogs/tapeconfigdialog.h index 659b21613..b88a8c83f 100644 --- a/src/app/tape/dialogs/tapeconfigdialog.h +++ b/src/app/tape/dialogs/tapeconfigdialog.h @@ -57,7 +57,7 @@ private: TapeConfigurationPage *configurationPage; TapePathPage *pathPage; QPushButton *applyButton; - QPushButton *canselButton; + QPushButton *cancelButton; QPushButton *okButton; bool isInitialized; diff --git a/src/app/valentina/dialogs/dialogpatternproperties.cpp b/src/app/valentina/dialogs/dialogpatternproperties.cpp index 07d04d709..0ab17953a 100644 --- a/src/app/valentina/dialogs/dialogpatternproperties.cpp +++ b/src/app/valentina/dialogs/dialogpatternproperties.cpp @@ -66,9 +66,9 @@ DialogPatternProperties::DialogPatternProperties(VPattern *doc, VContainer *pat connect(ui->buttonBox->button(QDialogButtonBox::Apply), &QPushButton::clicked, this, &DialogPatternProperties::Apply); - QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); - SCASSERT(bCansel != nullptr); - connect(bCansel, &QPushButton::clicked, this, &DialogPatternProperties::close); + QPushButton *bCancel = ui->buttonBox->button(QDialogButtonBox::Cancel); + SCASSERT(bCancel != nullptr); + connect(bCancel, &QPushButton::clicked, this, &DialogPatternProperties::close); ui->tabWidget->setCurrentIndex(0); if (qApp->patternType() != MeasurementsType::Standard) diff --git a/src/libs/vtools/dialogs/tools/dialogdetail.cpp b/src/libs/vtools/dialogs/tools/dialogdetail.cpp index f69659b20..4ea1f7f0d 100644 --- a/src/libs/vtools/dialogs/tools/dialogdetail.cpp +++ b/src/libs/vtools/dialogs/tools/dialogdetail.cpp @@ -67,9 +67,9 @@ DialogDetail::DialogDetail(const VContainer *data, const quint32 &toolId, QWidge bOk = ui.buttonBox->button(QDialogButtonBox::Ok); SCASSERT(bOk != nullptr); connect(bOk, &QPushButton::clicked, this, &DialogTool::DialogAccepted); - QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel); - SCASSERT(bCansel != nullptr); - connect(bCansel, &QPushButton::clicked, this, &DialogTool::DialogRejected); + QPushButton *bCancel = ui.buttonBox->button(QDialogButtonBox::Cancel); + SCASSERT(bCancel != nullptr); + connect(bCancel, &QPushButton::clicked, this, &DialogTool::DialogRejected); flagName = true;//We have default name of detail. ChangeColor(labelEditNamePoint, okColor); From eabbcb2e2b7d0d61d6173e98c6a97499cb5f54a4 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Wed, 6 Jan 2016 08:11:51 +0200 Subject: [PATCH 08/22] Little fix: correct retranslate osOptionCheck --HG-- branch : feature --- src/app/tape/dialogs/configpages/tapeconfigurationpage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/tape/dialogs/configpages/tapeconfigurationpage.cpp b/src/app/tape/dialogs/configpages/tapeconfigurationpage.cpp index bc206d1a6..89de17347 100644 --- a/src/app/tape/dialogs/configpages/tapeconfigurationpage.cpp +++ b/src/app/tape/dialogs/configpages/tapeconfigurationpage.cpp @@ -336,7 +336,7 @@ void TapeConfigurationPage::RetranslateUi() langGroup->setTitle(tr("Language")); guiLabel->setText(tr("GUI language:")); 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")); systemLabel->setText(tr("Pattern making system:")); From 0575f40a2ad4245f3c9b278ecdc270a3ac2e1238 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Wed, 6 Jan 2016 08:49:44 +0200 Subject: [PATCH 09/22] We need to fixate size of the contentsWidget, because we don't need to change it during the retranslation --HG-- branch : feature --- src/app/valentina/dialogs/configdialog.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/valentina/dialogs/configdialog.cpp b/src/app/valentina/dialogs/configdialog.cpp index 30825ea22..bc88e25d0 100644 --- a/src/app/valentina/dialogs/configdialog.cpp +++ b/src/app/valentina/dialogs/configdialog.cpp @@ -46,6 +46,7 @@ ConfigDialog::ConfigDialog(QWidget *parent) : contentsWidget->setIconSize(QSize(96, 84)); contentsWidget->setMovement(QListView::Static); contentsWidget->setMaximumWidth(128); + contentsWidget->setMinimumWidth(128); contentsWidget->setMinimumHeight(500); contentsWidget->setSpacing(12); From 772836b51614a2d6e391bd0e3fbe6b7f366c534c Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Wed, 6 Jan 2016 09:03:40 +0200 Subject: [PATCH 10/22] Retranslate undo and redo buttons --HG-- branch : feature --- src/app/valentina/mainwindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 800fc3af5..121cd4c19 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -1125,6 +1125,8 @@ void MainWindow::changeEvent(QEvent *event) { // retranslate designer form (single inheritance approach) ui->retranslateUi(this); + undoAction->setText(tr("&Undo")); + redoAction->setText(tr("&Redo")); } // remember to call base class implementation QMainWindow::changeEvent(event); From be3e6e5498bed1209c9981daa620f6f81a34a1bc Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Wed, 6 Jan 2016 09:11:44 +0200 Subject: [PATCH 11/22] Retranslate helpLabel --HG-- branch : feature --- src/app/valentina/mainwindow.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 121cd4c19..a50c88163 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -1127,6 +1127,7 @@ void MainWindow::changeEvent(QEvent *event) ui->retranslateUi(this); undoAction->setText(tr("&Undo")); redoAction->setText(tr("&Redo")); + helpLabel->setText(QObject::tr("Create new pattern piece to start working.")); } // remember to call base class implementation QMainWindow::changeEvent(event); From b6466547e8a2737a915fbe841d6de1e0fbe0764b Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Wed, 6 Jan 2016 09:34:03 +0200 Subject: [PATCH 12/22] Retranslate patternPieceLabel --HG-- branch : feature --- src/app/valentina/mainwindow.cpp | 8 +++++--- src/app/valentina/mainwindow.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index a50c88163..9c54865a0 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -100,8 +100,8 @@ MainWindow::MainWindow(QWidget *parent) lastUsedTool(Tool::Arrow), sceneDraw(nullptr), sceneDetails(nullptr), mouseCoordinate(nullptr), helpLabel(nullptr), isInitialized(false), mChanges(false), dialogTable(nullptr), dialogTool(nullptr), - dialogHistory(nullptr), comboBoxDraws(nullptr), mode(Draw::Calculation), currentDrawIndex(0), - currentToolBoxIndex(0), drawMode(true), recentFileActs(), + dialogHistory(nullptr), comboBoxDraws(nullptr), patternPieceLabel(nullptr), mode(Draw::Calculation), + currentDrawIndex(0), currentToolBoxIndex(0), drawMode(true), recentFileActs(), separatorAct(nullptr), leftGoToStage(nullptr), rightGoToStage(nullptr), autoSaveTimer(nullptr), guiEnabled(true), gradationHeights(nullptr), gradationSizes(nullptr), gradationHeightsLabel(nullptr), gradationSizesLabel(nullptr), @@ -1128,6 +1128,7 @@ void MainWindow::changeEvent(QEvent *event) undoAction->setText(tr("&Undo")); redoAction->setText(tr("&Redo")); helpLabel->setText(QObject::tr("Create new pattern piece to start working.")); + patternPieceLabel->setText(tr("Pattern Piece: ")); } // remember to call base class implementation QMainWindow::changeEvent(event); @@ -1506,7 +1507,8 @@ void MainWindow::ToolBarStages() */ 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 comboBoxDraws = new QComboBox; diff --git a/src/app/valentina/mainwindow.h b/src/app/valentina/mainwindow.h index a55bf6d92..03eb6f7b6 100644 --- a/src/app/valentina/mainwindow.h +++ b/src/app/valentina/mainwindow.h @@ -215,6 +215,7 @@ private: /** @brief comboBoxDraws comboc who show name of pattern peaces. */ QComboBox *comboBoxDraws; + QLabel *patternPieceLabel; /** @brief mode keep current draw mode. */ Draw mode; From 31582e06da6046005a56c0c3b16e2956d8c2d3cf Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Wed, 6 Jan 2016 17:28:46 +0200 Subject: [PATCH 13/22] Fixed alignment --HG-- branch : feature --- .../dialogs/configpages/configurationpage.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/valentina/dialogs/configpages/configurationpage.cpp b/src/app/valentina/dialogs/configpages/configurationpage.cpp index bde6b3838..3ca0868c6 100644 --- a/src/app/valentina/dialogs/configpages/configurationpage.cpp +++ b/src/app/valentina/dialogs/configpages/configurationpage.cpp @@ -276,9 +276,9 @@ QGroupBox *ConfigurationPage::SendGroup() sendReportCheck->setChecked(qApp->ValentinaSettings()->GetSendReportState()); 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 " - "kind of information we collect.")); + "problem. We do not collect any personal information. Find more about what " + "kind of information we collect.")); description->setTextFormat(Qt::RichText); description->setTextInteractionFlags(Qt::TextBrowserInteraction); description->setOpenExternalLinks(true); @@ -372,9 +372,9 @@ void ConfigurationPage::RetranslateUi() 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 " - "kind of information we collect.")); + "problem. We do not collect any personal information. Find more about what " + "kind of information we collect.")); drawGroup->setTitle(tr("Pattern Editing")); askPointDeletionCheck->setText(tr("Confirm item deletion")); From b283fb2a76b5dc23c46e655d10324cacb711a321 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Fri, 8 Jan 2016 13:55:37 +0200 Subject: [PATCH 14/22] Retranslate history --HG-- branch : feature --- .../dialogs/configpages/configurationpage.cpp | 1 - src/app/valentina/dialogs/dialoghistory.cpp | 20 +++++++++++++++++++ src/app/valentina/dialogs/dialoghistory.h | 2 ++ src/app/valentina/mainwindow.cpp | 1 + 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/app/valentina/dialogs/configpages/configurationpage.cpp b/src/app/valentina/dialogs/configpages/configurationpage.cpp index 3ca0868c6..5d58394e6 100644 --- a/src/app/valentina/dialogs/configpages/configurationpage.cpp +++ b/src/app/valentina/dialogs/configpages/configurationpage.cpp @@ -380,5 +380,4 @@ void ConfigurationPage::RetranslateUi() askPointDeletionCheck->setText(tr("Confirm item deletion")); toolBarGroup->setTitle(tr("Toolbar")); toolBarStyleCheck->setText(tr("The text appears under the icon. (recommended for beginners.)")); - } diff --git a/src/app/valentina/dialogs/dialoghistory.cpp b/src/app/valentina/dialogs/dialoghistory.cpp index 828a7bf57..4c06a28d2 100644 --- a/src/app/valentina/dialogs/dialoghistory.cpp +++ b/src/app/valentina/dialogs/dialoghistory.cpp @@ -502,3 +502,23 @@ void DialogHistory::closeEvent(QCloseEvent *event) emit ShowHistoryTool(id, false); 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() +{ + UpdateHistory(); +} diff --git a/src/app/valentina/dialogs/dialoghistory.h b/src/app/valentina/dialogs/dialoghistory.h index 6d1d555d0..e306f8ebf 100644 --- a/src/app/valentina/dialogs/dialoghistory.h +++ b/src/app/valentina/dialogs/dialoghistory.h @@ -68,6 +68,7 @@ signals: void ShowHistoryTool(quint32 id, bool enable); protected: virtual void closeEvent ( QCloseEvent * event ) Q_DECL_OVERRIDE; + virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(DialogHistory) @@ -89,6 +90,7 @@ private: void ShowPoint(); QString PointName(quint32 pointId); quint32 AttrUInt(const QDomElement &domElement, const QString &name); + void RetranslateUi(); }; #endif // DIALOGHISTORY_H diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 9c54865a0..e2dcab1fb 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -1129,6 +1129,7 @@ void MainWindow::changeEvent(QEvent *event) redoAction->setText(tr("&Redo")); helpLabel->setText(QObject::tr("Create new pattern piece to start working.")); patternPieceLabel->setText(tr("Pattern Piece: ")); + UpdateWindowTitle(); } // remember to call base class implementation QMainWindow::changeEvent(event); From 4bb731a825ab37baef13358c6e66f99f3dc30fd8 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Fri, 8 Jan 2016 14:06:38 +0200 Subject: [PATCH 15/22] Retranslate tables of variables --HG-- branch : feature --- .../dialogs/configpages/configurationpage.cpp | 1 - src/app/valentina/dialogs/dialogincrements.cpp | 12 ++++++++++++ src/app/valentina/dialogs/dialogincrements.h | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/app/valentina/dialogs/configpages/configurationpage.cpp b/src/app/valentina/dialogs/configpages/configurationpage.cpp index 5d58394e6..d2caf82d3 100644 --- a/src/app/valentina/dialogs/configpages/configurationpage.cpp +++ b/src/app/valentina/dialogs/configpages/configurationpage.cpp @@ -340,7 +340,6 @@ void ConfigurationPage::changeEvent(QEvent *event) // retranslate designer form (single inheritance approach) RetranslateUi(); } - // remember to call base class implementation QWidget::changeEvent(event); } diff --git a/src/app/valentina/dialogs/dialogincrements.cpp b/src/app/valentina/dialogs/dialogincrements.cpp index 1a9118413..074203ff3 100644 --- a/src/app/valentina/dialogs/dialogincrements.cpp +++ b/src/app/valentina/dialogs/dialogincrements.cpp @@ -719,6 +719,18 @@ void DialogIncrements::closeEvent(QCloseEvent *event) event->accept(); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogIncrements::changeEvent(QEvent *event) +{ + if (event->type() == QEvent::LanguageChange) + { + // retranslate designer form (single inheritance approach) + ui->retranslateUi(this); + } + // remember to call base class implementation + QWidget::changeEvent(event); +} + //--------------------------------------------------------------------------------------------------------------------- void DialogIncrements::ShowIncrementDetails() { diff --git a/src/app/valentina/dialogs/dialogincrements.h b/src/app/valentina/dialogs/dialogincrements.h index c391ec7c5..18032ffe7 100644 --- a/src/app/valentina/dialogs/dialogincrements.h +++ b/src/app/valentina/dialogs/dialogincrements.h @@ -59,7 +59,7 @@ signals: protected: virtual void closeEvent ( QCloseEvent * event ) Q_DECL_OVERRIDE; - + virtual void changeEvent ( QEvent * event) Q_DECL_OVERRIDE; private slots: void ShowIncrementDetails(); void AddIncrement(); From e2cfd3f3f7f3e02c530d8ee9c57d5fb5cc17a843 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Fri, 8 Jan 2016 14:14:56 +0200 Subject: [PATCH 16/22] Fix names according to code style conventions --HG-- branch : feature --- .../dialogs/configpages/communitypage.cpp | 24 +++++++++---------- .../dialogs/configpages/communitypage.h | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/app/valentina/dialogs/configpages/communitypage.cpp b/src/app/valentina/dialogs/configpages/communitypage.cpp index 066915869..8b7206e91 100644 --- a/src/app/valentina/dialogs/configpages/communitypage.cpp +++ b/src/app/valentina/dialogs/configpages/communitypage.cpp @@ -128,9 +128,9 @@ QGroupBox *CommunityPage::ServerGroup() serverNameLabel = new QLabel(tr("Server name/IP:")); secureConnectionLabel = new QLabel(tr("Secure connection")); - CommunityPage::add_lineedit(&this->server, serverLayout, qApp->ValentinaSettings()->GetServer(), serverNameLabel); + CommunityPage::AddLineedit(&this->server, serverLayout, qApp->ValentinaSettings()->GetServer(), serverNameLabel); - CommunityPage::add_checkbox(&this->secureComm, serverLayout, qApp->ValentinaSettings()->GetServerSecure(), + CommunityPage::AddCheckbox(&this->secureComm, serverLayout, qApp->ValentinaSettings()->GetServerSecure(), secureConnectionLabel); serverGroup->setLayout(serverLayout); @@ -138,7 +138,7 @@ QGroupBox *CommunityPage::ServerGroup() } //--------------------------------------------------------------------------------------------------------------------- -void CommunityPage::add_checkbox(QCheckBox** thebox, QFormLayout *layout, bool checked, QLabel *label) +void CommunityPage::AddCheckbox(QCheckBox** thebox, QFormLayout *layout, bool checked, QLabel *label) { (*thebox)= new QCheckBox; (*thebox)->setChecked(checked); @@ -146,7 +146,7 @@ void CommunityPage::add_checkbox(QCheckBox** thebox, QFormLayout *layout, bool c } //--------------------------------------------------------------------------------------------------------------------- -void CommunityPage::add_lineedit(QLineEdit** theline, QFormLayout *layout, QString value, QLabel *label) +void CommunityPage::AddLineedit(QLineEdit** theline, QFormLayout *layout, QString value, QLabel *label) { (*theline)= new QLineEdit; #if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0) @@ -184,12 +184,12 @@ QGroupBox *CommunityPage::ProxyGroup() proxyPassLabel = new QLabel(tr("Proxy pass:")); const VSettings *settings = qApp->ValentinaSettings(); - CommunityPage::add_checkbox(&this->useProxy, proxyLayout, settings->GetProxy(), useProxyLabel); - CommunityPage::add_lineedit(&this->proxyAddress, proxyLayout, settings->GetProxyAddress(), + CommunityPage::AddCheckbox(&this->useProxy, proxyLayout, settings->GetProxy(), useProxyLabel); + CommunityPage::AddLineedit(&this->proxyAddress, proxyLayout, settings->GetProxyAddress(), proxyAddressLabel); - CommunityPage::add_lineedit(&this->proxyPort, proxyLayout, settings->GetProxyPort(), proxyPortLabel); - CommunityPage::add_lineedit(&this->proxyUser, proxyLayout, settings->GetProxyUser(), proxyUserLabel); - CommunityPage::add_lineedit(&this->proxyPass, proxyLayout, settings->GetProxyPass(), proxyPassLabel); + CommunityPage::AddLineedit(&this->proxyPort, proxyLayout, settings->GetProxyPort(), proxyPortLabel); + CommunityPage::AddLineedit(&this->proxyUser, proxyLayout, settings->GetProxyUser(), proxyUserLabel); + CommunityPage::AddLineedit(&this->proxyPass, proxyLayout, settings->GetProxyPass(), proxyPassLabel); connect(this->useProxy, &QCheckBox::stateChanged, this, &CommunityPage::ProxyCheckChanged); this->ProxyCheckChanged(); @@ -210,9 +210,9 @@ QGroupBox *CommunityPage::UserGroup() userpasswordLabel = new QLabel(tr("Password:")); const VSettings *settings = qApp->ValentinaSettings(); - CommunityPage::add_lineedit(&this->username, userLayout, settings->GetUsername(), usernameLabel); - CommunityPage::add_checkbox(&this->savePassword, userLayout, settings->GetSavePassword(), savePasswordLabel); - CommunityPage::add_lineedit(&this->userpassword, userLayout, settings->GetUserPassword(), userpasswordLabel); + CommunityPage::AddLineedit(&this->username, userLayout, settings->GetUsername(), usernameLabel); + CommunityPage::AddCheckbox(&this->savePassword, userLayout, settings->GetSavePassword(), savePasswordLabel); + CommunityPage::AddLineedit(&this->userpassword, userLayout, settings->GetUserPassword(), userpasswordLabel); connect(this->savePassword, &QCheckBox::stateChanged, this, &CommunityPage::PasswordCheckChanged); this->PasswordCheckChanged(); diff --git a/src/app/valentina/dialogs/configpages/communitypage.h b/src/app/valentina/dialogs/configpages/communitypage.h index dc1baee83..79b431bc7 100644 --- a/src/app/valentina/dialogs/configpages/communitypage.h +++ b/src/app/valentina/dialogs/configpages/communitypage.h @@ -79,8 +79,8 @@ private: QLabel *savePasswordLabel; QLabel *userpasswordLabel; - static void add_checkbox(QCheckBox** thebox, QFormLayout *layout, bool checked, QLabel* label); - static void add_lineedit(QLineEdit** theline, QFormLayout *layout, QString value, QLabel *label); + 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 PasswordCheckChanged(); From a4e1db90e805f0bc931b618aad85f5330aa645f0 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Sat, 9 Jan 2016 14:38:26 +0200 Subject: [PATCH 17/22] Change pattern making system in Valentina settings --HG-- branch : feature --- .../dialogs/configpages/configurationpage.cpp | 89 +++++++++++++++++-- .../dialogs/configpages/configurationpage.h | 12 +++ 2 files changed, 96 insertions(+), 5 deletions(-) diff --git a/src/app/valentina/dialogs/configpages/configurationpage.cpp b/src/app/valentina/dialogs/configpages/configurationpage.cpp index d2caf82d3..cc4e4d44d 100644 --- a/src/app/valentina/dialogs/configpages/configurationpage.cpp +++ b/src/app/valentina/dialogs/configpages/configurationpage.cpp @@ -54,6 +54,7 @@ ConfigurationPage::ConfigurationPage(QWidget *parent) unitCombo(nullptr), osOptionCheck(nullptr), langChanged(false), + systemChanged(), unitChanged(false), labelLangChanged(false), sendReportCheck(nullptr), @@ -66,20 +67,29 @@ ConfigurationPage::ConfigurationPage(QWidget *parent) 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 *langGroup = LangGroup(); - QGroupBox *sendGroup = SendGroup(); - QGroupBox *drawGroup = DrawGroup(); - QGroupBox *toolBarGroup = ToolBarGroup(); + QGroupBox *saveGroup = SaveGroup(); + QGroupBox *langGroup = LangGroup(); + QGroupBox *pmSystemGroup = PMSystemGroup(); + QGroupBox *sendGroup = SendGroup(); + QGroupBox *drawGroup = DrawGroup(); + QGroupBox *toolBarGroup = ToolBarGroup(); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(saveGroup); mainLayout->addWidget(langGroup); + mainLayout->addWidget(pmSystemGroup); mainLayout->addWidget(sendGroup); mainLayout->addWidget(drawGroup); mainLayout->addWidget(toolBarGroup); @@ -111,6 +121,12 @@ void ConfigurationPage::Apply() langChanged = false; qApp->LoadTranslation(locale); } + if (systemChanged) + { + const QString code = qvariant_cast(systemCombo->itemData(systemCombo->currentIndex())); + settings->SetPMSystemCode(code); + systemChanged = false; + } if (this->unitChanged) { const QString unit = qvariant_cast(this->unitCombo->itemData(this->unitCombo->currentIndex())); @@ -267,6 +283,49 @@ QGroupBox *ConfigurationPage::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(&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() { @@ -322,6 +381,26 @@ QGroupBox *ConfigurationPage::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) { diff --git a/src/app/valentina/dialogs/configpages/configurationpage.h b/src/app/valentina/dialogs/configpages/configurationpage.h index f63394981..69cdc308f 100644 --- a/src/app/valentina/dialogs/configpages/configurationpage.h +++ b/src/app/valentina/dialogs/configpages/configurationpage.h @@ -30,6 +30,7 @@ #define CONFIGURATIONPAGE_H #include +#include #include class QCheckBox; @@ -46,6 +47,7 @@ public: void Apply(); public slots: void LangChanged(); + void SystemChanged(); void UnitChanged(); void LabelLangChanged(); protected: @@ -59,6 +61,7 @@ private: QComboBox *unitCombo; QCheckBox *osOptionCheck; bool langChanged; + bool systemChanged; bool unitChanged; bool labelLangChanged; QCheckBox *sendReportCheck; @@ -73,6 +76,14 @@ private: QLabel *unitLabel; QLabel *languageLabel; + QGroupBox *pmSystemGroup; + QLabel *systemLabel; + QComboBox *systemCombo; + QLabel *systemAuthorLabel; + QLabel *systemBookLabel; + QLabel *systemAuthorValueLabel; + QPlainTextEdit *systemBookValueLabel; + QGroupBox *sendGroup; QLabel *description; @@ -81,6 +92,7 @@ private: QGroupBox *SaveGroup(); QGroupBox *LangGroup(); + QGroupBox *PMSystemGroup(); QGroupBox *SendGroup(); QGroupBox *DrawGroup(); QGroupBox *ToolBarGroup(); From 982a0172c552cdd75dcc9cee296317097a7b3997 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Sat, 9 Jan 2016 14:52:28 +0200 Subject: [PATCH 18/22] Retranslate pattern making system --HG-- branch : feature --- .../dialogs/configpages/configurationpage.cpp | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/app/valentina/dialogs/configpages/configurationpage.cpp b/src/app/valentina/dialogs/configpages/configurationpage.cpp index cc4e4d44d..38c4d844c 100644 --- a/src/app/valentina/dialogs/configpages/configurationpage.cpp +++ b/src/app/valentina/dialogs/configpages/configurationpage.cpp @@ -447,6 +447,33 @@ void ConfigurationPage::RetranslateUi() 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 " From c81724d42b3ed57d78f8163db5056ff977fb6b3d Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Mon, 11 Jan 2016 13:41:34 +0200 Subject: [PATCH 19/22] Restore selected row after retranslate --HG-- branch : feature --- src/app/valentina/dialogs/dialoghistory.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/app/valentina/dialogs/dialoghistory.cpp b/src/app/valentina/dialogs/dialoghistory.cpp index 4c06a28d2..f37847393 100644 --- a/src/app/valentina/dialogs/dialoghistory.cpp +++ b/src/app/valentina/dialogs/dialoghistory.cpp @@ -520,5 +520,13 @@ void DialogHistory::changeEvent(QEvent *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); } From c7696c9d2a761bc5618c99257f6770bec234d131 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Mon, 11 Jan 2016 14:17:41 +0200 Subject: [PATCH 20/22] Set translation in the helpLabel to "Changes applied". --HG-- branch : feature --- src/app/valentina/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index e2dcab1fb..b66dc7756 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -1127,7 +1127,7 @@ void MainWindow::changeEvent(QEvent *event) ui->retranslateUi(this); undoAction->setText(tr("&Undo")); redoAction->setText(tr("&Redo")); - helpLabel->setText(QObject::tr("Create new pattern piece to start working.")); + helpLabel->setText(QObject::tr("Changes applied.")); patternPieceLabel->setText(tr("Pattern Piece: ")); UpdateWindowTitle(); } From 3caee4a8df6204795054ca2a29a5252ed2699b62 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Mon, 11 Jan 2016 14:28:26 +0200 Subject: [PATCH 21/22] We need to call LoadTranslation when langChanged or systemChanged --HG-- branch : feature --- .../valentina/dialogs/configpages/configurationpage.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/app/valentina/dialogs/configpages/configurationpage.cpp b/src/app/valentina/dialogs/configpages/configurationpage.cpp index 38c4d844c..3291ad4be 100644 --- a/src/app/valentina/dialogs/configpages/configurationpage.cpp +++ b/src/app/valentina/dialogs/configpages/configurationpage.cpp @@ -114,18 +114,17 @@ void ConfigurationPage::Apply() settings->SetConfirmItemDelete(askPointDeletionCheck->isChecked()); settings->SetToolBarStyle(toolBarStyleCheck->isChecked()); - if (langChanged) + if (langChanged || systemChanged) { const QString locale = qvariant_cast(langCombo->itemData(langCombo->currentIndex())); settings->SetLocale(locale); langChanged = false; - qApp->LoadTranslation(locale); - } - if (systemChanged) - { + const QString code = qvariant_cast(systemCombo->itemData(systemCombo->currentIndex())); settings->SetPMSystemCode(code); systemChanged = false; + + qApp->LoadTranslation(locale); } if (this->unitChanged) { From 96add2113cd4eda0495832d5a1f46e9a11a87d2c Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Mon, 11 Jan 2016 15:11:33 +0200 Subject: [PATCH 22/22] Retranslate all variables inside tables --HG-- branch : feature --- .../valentina/dialogs/dialogincrements.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/app/valentina/dialogs/dialogincrements.cpp b/src/app/valentina/dialogs/dialogincrements.cpp index 074203ff3..a9cf5343c 100644 --- a/src/app/valentina/dialogs/dialogincrements.cpp +++ b/src/app/valentina/dialogs/dialogincrements.cpp @@ -428,16 +428,22 @@ void DialogIncrements::EnableDetails(bool enabled) */ void DialogIncrements::FullUpdateFromFile() { - FillIncrements(); - ui->tableWidgetLines->clearContents(); - FillLengthsLines(); - ui->tableWidgetSplines->clearContents(); - FillLengthsCurves(); - ui->tableWidgetArcs->clearContents(); + ui->tableWidgetAnglesArcs->clearContents(); + ui->tableWidgetAnglesCurves->clearContents(); + ui->tableWidgetLinesAngles->clearContents(); + ui->tableWidgetRadiusesArcs->clearContents(); + + FillIncrements(); + FillLengthsLines(); + FillLengthLinesAngles(); + FillLengthsCurves(); FillLengthArcs(); + FillRadiusesArcs(); + FillAnglesArcs(); + FillAnglesCurves(); } //--------------------------------------------------------------------------------------------------------------------- @@ -726,6 +732,7 @@ void DialogIncrements::changeEvent(QEvent *event) { // retranslate designer form (single inheritance approach) ui->retranslateUi(this); + FullUpdateFromFile(); } // remember to call base class implementation QWidget::changeEvent(event);