aboutsummaryrefslogtreecommitdiff
path: root/src/qt/optionsdialog.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2012-05-08 23:03:41 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2012-05-09 07:45:47 +0200
commit5ac114c7566b7d3aa32b93124ccb5e5e364edc25 (patch)
tree2ef59f40ec0827a957255efb1eaa7fa1e05a12aa /src/qt/optionsdialog.cpp
parent6ddf861078e465dcb89e14e8cad6229c7abf64bb (diff)
Make it possible to set user interface language from options dialog
Diffstat (limited to 'src/qt/optionsdialog.cpp')
-rw-r--r--src/qt/optionsdialog.cpp39
1 files changed, 38 insertions, 1 deletions
diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp
index 56dc87c8fa..6b4e037cc5 100644
--- a/src/qt/optionsdialog.cpp
+++ b/src/qt/optionsdialog.cpp
@@ -19,6 +19,8 @@
#include <QDoubleValidator>
#include <QRegExpValidator>
#include <QDialogButtonBox>
+#include <QDir>
+#include <QMessageBox>
class OptionsPage: public QWidget
{
@@ -66,8 +68,12 @@ public:
virtual void setMapper(MonitoredDataMapper *mapper);
private:
+ QValueComboBox *lang;
QValueComboBox *unit;
QCheckBox *display_addresses;
+ bool restart_warning_displayed;
+private slots:
+ void showRestartWarning();
};
class NetworkOptionsPage: public OptionsPage
@@ -230,12 +236,33 @@ void MainOptionsPage::setMapper(MonitoredDataMapper *mapper)
/* Display options */
DisplayOptionsPage::DisplayOptionsPage(QWidget *parent):
- OptionsPage(parent)
+ OptionsPage(parent), restart_warning_displayed(false)
{
setWindowTitle(tr("Display"));
QVBoxLayout *layout = new QVBoxLayout();
+ QHBoxLayout *lang_hbox = new QHBoxLayout();
+ lang_hbox->addSpacing(18);
+ QLabel *lang_label = new QLabel(tr("User Interface &Language: "));
+ lang_hbox->addWidget(lang_label);
+ lang = new QValueComboBox(this);
+ // Make list of languages
+ QDir translations(":translations");
+ lang->addItem("(default)", QVariant(""));
+ foreach(const QString &langStr, translations.entryList())
+ {
+ lang->addItem(langStr, QVariant(langStr));
+ }
+
+ lang->setToolTip(tr("The user interface language can be set here. This setting will only take effect after restarting Bitcoin."));
+ connect(lang, SIGNAL(activated(int)), this, SLOT(showRestartWarning()));
+
+ lang_label->setBuddy(lang);
+ lang_hbox->addWidget(lang);
+
+ layout->addLayout(lang_hbox);
+
QHBoxLayout *unit_hbox = new QHBoxLayout();
unit_hbox->addSpacing(18);
QLabel *unit_label = new QLabel(tr("&Unit to show amounts in: "));
@@ -259,10 +286,20 @@ DisplayOptionsPage::DisplayOptionsPage(QWidget *parent):
void DisplayOptionsPage::setMapper(MonitoredDataMapper *mapper)
{
+ mapper->addMapping(lang, OptionsModel::Language);
mapper->addMapping(unit, OptionsModel::DisplayUnit);
mapper->addMapping(display_addresses, OptionsModel::DisplayAddresses);
}
+void DisplayOptionsPage::showRestartWarning()
+{
+ if(!restart_warning_displayed)
+ {
+ QMessageBox::warning(this, tr("Warning"), tr("This setting will take effect after restarting Bitcoin."), QMessageBox::Ok);
+ restart_warning_displayed = true;
+ }
+}
+
/* Window options */
WindowOptionsPage::WindowOptionsPage(QWidget *parent):
OptionsPage(parent)