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"));
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:"));

View File

@ -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"));

View File

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

View File

@ -38,13 +38,15 @@
//---------------------------------------------------------------------------------------------------------------------
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);
contentsWidget->setIconSize(QSize(96, 84));
contentsWidget->setMovement(QListView::Static);
contentsWidget->setMaximumWidth(128);
contentsWidget->setMinimumWidth(128);
contentsWidget->setMinimumHeight(500);
contentsWidget->setSpacing(12);
@ -62,9 +64,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 +117,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 +203,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"));
}

View File

@ -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

View File

@ -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_checkbox(&this->secureComm, serverLayout, qApp->ValentinaSettings()->GetServerSecure(),
tr("Secure connection"));
CommunityPage::AddLineedit(&this->server, serverLayout, qApp->ValentinaSettings()->GetServer(), serverNameLabel);
ServerGroup->setLayout(serverLayout);
return ServerGroup;
CommunityPage::AddCheckbox(&this->secureComm, serverLayout, qApp->ValentinaSettings()->GetServerSecure(),
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)->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;
#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_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:"));
CommunityPage::AddCheckbox(&this->useProxy, proxyLayout, settings->GetProxy(), useProxyLabel);
CommunityPage::AddLineedit(&this->proxyAddress, proxyLayout, settings->GetProxyAddress(),
proxyAddressLabel);
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();
@ -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::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();
@ -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:"));
}

View File

@ -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 AddCheckbox(QCheckBox** thebox, QFormLayout *layout, bool checked, QLabel* label);
static void AddLineedit(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

View File

@ -46,19 +46,50 @@
//---------------------------------------------------------------------------------------------------------------------
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),
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 *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);
@ -83,14 +114,17 @@ void ConfigurationPage::Apply()
settings->SetConfirmItemDelete(askPointDeletionCheck->isChecked());
settings->SetToolBarStyle(toolBarStyleCheck->isChecked());
if (langChanged)
if (langChanged || systemChanged)
{
const QString locale = qvariant_cast<QString>(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);
const QString code = qvariant_cast<QString>(systemCombo->itemData(systemCombo->currentIndex()));
settings->SetPMSystemCode(code);
systemChanged = false;
qApp->LoadTranslation(locale);
}
if (this->unitChanged)
{
@ -129,7 +163,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 +175,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 +188,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 +236,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 +259,8 @@ QGroupBox *ConfigurationPage::LangGroup()
connect(this->unitCombo, static_cast<void (QComboBox::*)(int)>(&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,24 +275,68 @@ QGroupBox *ConfigurationPage::LangGroup()
connect(labelCombo, static_cast<void (QComboBox::*)(int)>(&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;
}
//---------------------------------------------------------------------------------------------------------------------
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 *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 "
"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."));
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 "
"<a href=\"https://bitbucket.org/dismine/valentina/wiki/manual/"
"Crash_reports\">kind of information</a> we collect."));
description->setTextFormat(Qt::RichText);
description->setTextInteractionFlags(Qt::TextBrowserInteraction);
description->setOpenExternalLinks(true);
@ -271,7 +353,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 +368,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());
@ -298,6 +380,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)
{
@ -307,3 +409,79 @@ 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:"));
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
#include <QObject>
#include <QPlainTextEdit>
#include <QWidget>
class QCheckBox;
class QSpinBox;
class QComboBox;
class QGroupBox;
class QLabel;
class ConfigurationPage : public QWidget
{
@ -45,8 +47,11 @@ public:
void Apply();
public slots:
void LangChanged();
void SystemChanged();
void UnitChanged();
void LabelLangChanged();
protected:
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(ConfigurationPage)
QCheckBox *autoSaveCheck;
@ -56,18 +61,44 @@ private:
QComboBox *unitCombo;
QCheckBox *osOptionCheck;
bool langChanged;
bool systemChanged;
bool unitChanged;
bool labelLangChanged;
QCheckBox *sendReportCheck;
QCheckBox *askPointDeletionCheck;
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 *LangGroup();
QGroupBox *PMSystemGroup();
QGroupBox *SendGroup();
QGroupBox *DrawGroup();
QGroupBox *ToolBarGroup();
void SetLabelComboBox(const QStringList &list);
void RetranslateUi();
};
#endif // CONFIGURATIONPAGE_H

View File

@ -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"));
}

View File

@ -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

View File

@ -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):"));
}

View File

@ -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

View File

@ -502,3 +502,31 @@ 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()
{
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);
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

View File

@ -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();
}
//---------------------------------------------------------------------------------------------------------------------
@ -719,6 +725,19 @@ 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);
FullUpdateFromFile();
}
// remember to call base class implementation
QWidget::changeEvent(event);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::ShowIncrementDetails()
{

View File

@ -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();

View File

@ -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)

View File

@ -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),
@ -1118,6 +1118,23 @@ 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);
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.
@ -1491,7 +1508,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;

View File

@ -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;
@ -214,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;

View File

@ -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);