Retranslate communitypage.
--HG-- branch : feature
This commit is contained in:
parent
4e12484725
commit
b9f3e664dc
|
@ -38,9 +38,30 @@
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
CommunityPage::CommunityPage(QWidget *parent):
|
CommunityPage::CommunityPage(QWidget *parent):
|
||||||
QWidget(parent), server(nullptr), secureComm(nullptr), useProxy(nullptr), proxyAddress(nullptr),
|
QWidget(parent),
|
||||||
proxyPort(nullptr), proxyUser(nullptr), proxyPass(nullptr), username(nullptr), savePassword(nullptr),
|
serverGroup(nullptr),
|
||||||
userpassword(nullptr)
|
server(nullptr),
|
||||||
|
secureComm(nullptr),
|
||||||
|
serverNameLabel(nullptr),
|
||||||
|
secureConnectionLabel(nullptr),
|
||||||
|
proxyGroup(nullptr),
|
||||||
|
useProxy(nullptr),
|
||||||
|
proxyAddress(nullptr),
|
||||||
|
proxyPort(nullptr),
|
||||||
|
proxyUser(nullptr),
|
||||||
|
proxyPass(nullptr),
|
||||||
|
useProxyLabel(nullptr),
|
||||||
|
proxyAddressLabel(nullptr),
|
||||||
|
proxyPortLabel(nullptr),
|
||||||
|
proxyUserLabel(nullptr),
|
||||||
|
proxyPassLabel(nullptr),
|
||||||
|
userGroup(nullptr),
|
||||||
|
username(nullptr),
|
||||||
|
savePassword(nullptr),
|
||||||
|
userpassword(nullptr),
|
||||||
|
usernameLabel(nullptr),
|
||||||
|
savePasswordLabel(nullptr),
|
||||||
|
userpasswordLabel(nullptr)
|
||||||
{
|
{
|
||||||
QGroupBox *serverGroup = ServerGroup();
|
QGroupBox *serverGroup = ServerGroup();
|
||||||
QGroupBox *proxyGroup = ProxyGroup();
|
QGroupBox *proxyGroup = ProxyGroup();
|
||||||
|
@ -100,55 +121,75 @@ void CommunityPage::PasswordCheckChanged()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QGroupBox *CommunityPage::ServerGroup()
|
QGroupBox *CommunityPage::ServerGroup()
|
||||||
{
|
{
|
||||||
QGroupBox *ServerGroup = new QGroupBox(tr("Server"));
|
serverGroup = new QGroupBox(tr("Server"));
|
||||||
QFormLayout *serverLayout = new QFormLayout;
|
QFormLayout *serverLayout = new QFormLayout;
|
||||||
serverLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
serverLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||||
|
|
||||||
CommunityPage::add_lineedit(&this->server, serverLayout, qApp->ValentinaSettings()->GetServer(), tr("Server name/IP:"));
|
serverNameLabel = new QLabel(tr("Server name/IP:"));
|
||||||
|
secureConnectionLabel = new QLabel(tr("Secure connection"));
|
||||||
|
|
||||||
|
CommunityPage::add_lineedit(&this->server, serverLayout, qApp->ValentinaSettings()->GetServer(), serverNameLabel);
|
||||||
|
|
||||||
CommunityPage::add_checkbox(&this->secureComm, serverLayout, qApp->ValentinaSettings()->GetServerSecure(),
|
CommunityPage::add_checkbox(&this->secureComm, serverLayout, qApp->ValentinaSettings()->GetServerSecure(),
|
||||||
tr("Secure connection"));
|
secureConnectionLabel);
|
||||||
|
|
||||||
ServerGroup->setLayout(serverLayout);
|
serverGroup->setLayout(serverLayout);
|
||||||
return ServerGroup;
|
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)= new QCheckBox;
|
||||||
(*thebox)->setChecked(checked);
|
(*thebox)->setChecked(checked);
|
||||||
layout->addRow(labelbox, *thebox);
|
layout->addRow(label, *thebox);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void CommunityPage::add_lineedit(QLineEdit** theline, QFormLayout *layout, QString value, QString label)
|
void CommunityPage::add_lineedit(QLineEdit** theline, QFormLayout *layout, QString value, QLabel *label)
|
||||||
{
|
{
|
||||||
QLabel *labelbox = new QLabel(label);
|
|
||||||
(*theline)= new QLineEdit;
|
(*theline)= new QLineEdit;
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
|
||||||
(*theline)->setClearButtonEnabled(true);
|
(*theline)->setClearButtonEnabled(true);
|
||||||
#endif
|
#endif
|
||||||
(*theline)->setText(value);
|
(*theline)->setText(value);
|
||||||
layout->addRow(labelbox, *theline);
|
layout->addRow(label, *theline);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void CommunityPage::changeEvent(QEvent *event)
|
||||||
|
{
|
||||||
|
if (event->type() == QEvent::LanguageChange)
|
||||||
|
{
|
||||||
|
// retranslate designer form (single inheritance approach)
|
||||||
|
RetranslateUi();
|
||||||
|
}
|
||||||
|
|
||||||
|
// remember to call base class implementation
|
||||||
|
QWidget::changeEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QGroupBox *CommunityPage::ProxyGroup()
|
QGroupBox *CommunityPage::ProxyGroup()
|
||||||
{
|
{
|
||||||
QGroupBox *proxyGroup = new QGroupBox(tr("Proxy settings"));
|
proxyGroup = new QGroupBox(tr("Proxy settings"));
|
||||||
|
|
||||||
QFormLayout *proxyLayout = new QFormLayout;
|
QFormLayout *proxyLayout = new QFormLayout;
|
||||||
proxyLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
proxyLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||||
|
|
||||||
|
useProxyLabel = new QLabel(tr("Use Proxy"));
|
||||||
|
proxyAddressLabel = new QLabel(tr("Proxy address:"));
|
||||||
|
proxyPortLabel = new QLabel(tr("Proxy port:"));
|
||||||
|
proxyUserLabel = new QLabel(tr("Proxy user:"));
|
||||||
|
proxyPassLabel = new QLabel(tr("Proxy pass:"));
|
||||||
|
|
||||||
const VSettings *settings = qApp->ValentinaSettings();
|
const VSettings *settings = qApp->ValentinaSettings();
|
||||||
CommunityPage::add_checkbox(&this->useProxy, proxyLayout, settings->GetProxy(), tr("Use Proxy"));
|
CommunityPage::add_checkbox(&this->useProxy, proxyLayout, settings->GetProxy(), useProxyLabel);
|
||||||
CommunityPage::add_lineedit(&this->proxyAddress, proxyLayout, settings->GetProxyAddress(),
|
CommunityPage::add_lineedit(&this->proxyAddress, proxyLayout, settings->GetProxyAddress(),
|
||||||
tr("Proxy address:"));
|
proxyAddressLabel);
|
||||||
CommunityPage::add_lineedit(&this->proxyPort, proxyLayout, settings->GetProxyPort(), tr("Proxy port:"));
|
CommunityPage::add_lineedit(&this->proxyPort, proxyLayout, settings->GetProxyPort(), proxyPortLabel);
|
||||||
CommunityPage::add_lineedit(&this->proxyUser, proxyLayout, settings->GetProxyUser(), tr("Proxy user:"));
|
CommunityPage::add_lineedit(&this->proxyUser, proxyLayout, settings->GetProxyUser(), proxyUserLabel);
|
||||||
CommunityPage::add_lineedit(&this->proxyPass, proxyLayout, settings->GetProxyPass(), tr("Proxy pass:"));
|
CommunityPage::add_lineedit(&this->proxyPass, proxyLayout, settings->GetProxyPass(), proxyPassLabel);
|
||||||
connect(this->useProxy, &QCheckBox::stateChanged, this, &CommunityPage::ProxyCheckChanged);
|
connect(this->useProxy, &QCheckBox::stateChanged, this, &CommunityPage::ProxyCheckChanged);
|
||||||
this->ProxyCheckChanged();
|
this->ProxyCheckChanged();
|
||||||
|
|
||||||
|
@ -160,14 +201,18 @@ QGroupBox *CommunityPage::ProxyGroup()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QGroupBox *CommunityPage::UserGroup()
|
QGroupBox *CommunityPage::UserGroup()
|
||||||
{
|
{
|
||||||
QGroupBox *userGroup = new QGroupBox(tr("User settings"));
|
userGroup = new QGroupBox(tr("User settings"));
|
||||||
QFormLayout *userLayout = new QFormLayout;
|
QFormLayout *userLayout = new QFormLayout;
|
||||||
userLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
userLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||||
|
|
||||||
|
usernameLabel = new QLabel(tr("User Name:"));
|
||||||
|
savePasswordLabel = new QLabel(tr("Save password"));
|
||||||
|
userpasswordLabel = new QLabel(tr("Password:"));
|
||||||
|
|
||||||
const VSettings *settings = qApp->ValentinaSettings();
|
const VSettings *settings = qApp->ValentinaSettings();
|
||||||
CommunityPage::add_lineedit(&this->username, userLayout, settings->GetUsername(), tr("User Name:"));
|
CommunityPage::add_lineedit(&this->username, userLayout, settings->GetUsername(), usernameLabel);
|
||||||
CommunityPage::add_checkbox(&this->savePassword, userLayout, settings->GetSavePassword(), tr("Save password"));
|
CommunityPage::add_checkbox(&this->savePassword, userLayout, settings->GetSavePassword(), savePasswordLabel);
|
||||||
CommunityPage::add_lineedit(&this->userpassword, userLayout, settings->GetUserPassword(), tr("Password:"));
|
CommunityPage::add_lineedit(&this->userpassword, userLayout, settings->GetUserPassword(), userpasswordLabel);
|
||||||
|
|
||||||
connect(this->savePassword, &QCheckBox::stateChanged, this, &CommunityPage::PasswordCheckChanged);
|
connect(this->savePassword, &QCheckBox::stateChanged, this, &CommunityPage::PasswordCheckChanged);
|
||||||
this->PasswordCheckChanged();
|
this->PasswordCheckChanged();
|
||||||
|
@ -176,3 +221,23 @@ QGroupBox *CommunityPage::UserGroup()
|
||||||
|
|
||||||
return userGroup;
|
return userGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void CommunityPage::RetranslateUi()
|
||||||
|
{
|
||||||
|
serverGroup->setTitle(tr("Server"));
|
||||||
|
serverNameLabel->setText(tr("Server name/IP:"));
|
||||||
|
secureConnectionLabel->setText(tr("Secure connection"));
|
||||||
|
|
||||||
|
proxyGroup->setTitle(tr("Proxy settings"));
|
||||||
|
useProxyLabel->setText(tr("Use Proxy"));
|
||||||
|
proxyAddressLabel->setText(tr("Proxy address:"));
|
||||||
|
proxyPortLabel->setText(tr("Proxy port:"));
|
||||||
|
proxyUserLabel->setText(tr("Proxy user:"));
|
||||||
|
proxyPassLabel->setText(tr("Proxy pass:"));
|
||||||
|
|
||||||
|
userGroup->setTitle(tr("User settings"));
|
||||||
|
usernameLabel->setText(tr("User Name:"));
|
||||||
|
savePasswordLabel->setText(tr("Save password"));
|
||||||
|
userpasswordLabel->setText(tr("Password:"));
|
||||||
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
class QCheckBox;
|
class QCheckBox;
|
||||||
class QGroupBox;
|
class QGroupBox;
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
|
class QLabel;
|
||||||
|
|
||||||
class CommunityPage : public QWidget
|
class CommunityPage : public QWidget
|
||||||
{
|
{
|
||||||
|
@ -43,26 +44,43 @@ class CommunityPage : public QWidget
|
||||||
public:
|
public:
|
||||||
explicit CommunityPage(QWidget *parent = nullptr);
|
explicit CommunityPage(QWidget *parent = nullptr);
|
||||||
void Apply();
|
void Apply();
|
||||||
|
protected:
|
||||||
|
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(CommunityPage)
|
Q_DISABLE_COPY(CommunityPage)
|
||||||
// server name and https connection
|
// server name and https connection
|
||||||
|
QGroupBox *serverGroup;
|
||||||
QLineEdit *server;
|
QLineEdit *server;
|
||||||
QCheckBox *secureComm;
|
QCheckBox *secureComm;
|
||||||
|
QLabel *serverNameLabel;
|
||||||
|
QLabel *secureConnectionLabel;
|
||||||
|
|
||||||
// proxy stuff
|
// proxy stuff
|
||||||
|
QGroupBox *proxyGroup;
|
||||||
QCheckBox *useProxy;
|
QCheckBox *useProxy;
|
||||||
QLineEdit *proxyAddress;
|
QLineEdit *proxyAddress;
|
||||||
QLineEdit *proxyPort;
|
QLineEdit *proxyPort;
|
||||||
QLineEdit *proxyUser;
|
QLineEdit *proxyUser;
|
||||||
QLineEdit *proxyPass;
|
QLineEdit *proxyPass;
|
||||||
|
|
||||||
|
QLabel *useProxyLabel;
|
||||||
|
QLabel *proxyAddressLabel;
|
||||||
|
QLabel *proxyPortLabel;
|
||||||
|
QLabel *proxyUserLabel;
|
||||||
|
QLabel *proxyPassLabel;
|
||||||
|
|
||||||
// username and password
|
// username and password
|
||||||
|
QGroupBox *userGroup;
|
||||||
QLineEdit *username;
|
QLineEdit *username;
|
||||||
QCheckBox *savePassword;
|
QCheckBox *savePassword;
|
||||||
QLineEdit *userpassword;
|
QLineEdit *userpassword;
|
||||||
|
|
||||||
static void add_checkbox(QCheckBox** thebox, QFormLayout *layout, bool checked, QString label);
|
QLabel *usernameLabel;
|
||||||
static void add_lineedit(QLineEdit** theline, QFormLayout *layout, QString value, QString label);
|
QLabel *savePasswordLabel;
|
||||||
|
QLabel *userpasswordLabel;
|
||||||
|
|
||||||
|
static void 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 ProxyCheckChanged();
|
||||||
void PasswordCheckChanged();
|
void PasswordCheckChanged();
|
||||||
|
@ -70,6 +88,8 @@ private:
|
||||||
QGroupBox *ServerGroup();
|
QGroupBox *ServerGroup();
|
||||||
QGroupBox *ProxyGroup();
|
QGroupBox *ProxyGroup();
|
||||||
QGroupBox *UserGroup();
|
QGroupBox *UserGroup();
|
||||||
|
|
||||||
|
void RetranslateUi();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // COMMUNITYPAGE_H
|
#endif // COMMUNITYPAGE_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user