SettingsDialog now also supports language
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#include "settingsdialog.h"
|
||||
#include "ui_settingsdialog.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "zeiterfassungsettings.h"
|
||||
|
||||
SettingsDialog::SettingsDialog(ZeiterfassungSettings &settings, QWidget *parent) :
|
||||
@@ -10,6 +12,10 @@ SettingsDialog::SettingsDialog(ZeiterfassungSettings &settings, QWidget *parent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->comboBoxLanguage->addItem(tr("English"), QLocale::English);
|
||||
ui->comboBoxLanguage->addItem(tr("German"), QLocale::German);
|
||||
|
||||
ui->comboBoxLanguage->setCurrentIndex(ui->comboBoxLanguage->findData(settings.language()));
|
||||
ui->lineEditBuchungStartBackgroundColor->setText(settings.buchungStartBackgroundColor());
|
||||
ui->lineEditBuchungEndBackgroundColor->setText(settings.buchungEndBackgroundColor());
|
||||
ui->lineEditBuchungOtherBackgroundColor->setText(settings.buchungOtherBackgroundColor());
|
||||
@@ -25,6 +31,11 @@ SettingsDialog::~SettingsDialog()
|
||||
|
||||
void SettingsDialog::submit()
|
||||
{
|
||||
if(ui->comboBoxLanguage->currentData().value<QLocale::Language>() != m_settings.language())
|
||||
{
|
||||
m_settings.setLanguage(ui->comboBoxLanguage->currentData().value<QLocale::Language>());
|
||||
QMessageBox::warning(this, tr("Restart required!"), tr("To apply the new language a restart is required!"));
|
||||
}
|
||||
if(ui->lineEditBuchungStartBackgroundColor->text() != m_settings.buchungStartBackgroundColor())
|
||||
m_settings.setBuchungStartBackgroundColor(ui->lineEditBuchungStartBackgroundColor->text());
|
||||
if(ui->lineEditBuchungEndBackgroundColor->text() != m_settings.buchungEndBackgroundColor())
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>647</width>
|
||||
<height>235</height>
|
||||
<height>0</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
@@ -35,6 +35,16 @@
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelLanguage">
|
||||
<property name="text">
|
||||
<string>language</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>comboBoxLanguage</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelbuchungStartBackgroundColor">
|
||||
<property name="text">
|
||||
<string>buchungStartBackgroundColor</string>
|
||||
@@ -44,7 +54,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelbuchungEndBackgroundColor">
|
||||
<property name="text">
|
||||
<string>buchungEndBackgroundColor</string>
|
||||
@@ -54,7 +64,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="labelbuchungOtherBackgroundColor">
|
||||
<property name="text">
|
||||
<string>buchungOtherBackgroundColor</string>
|
||||
@@ -64,7 +74,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="labelTimeAssignmentBackgroundColor">
|
||||
<property name="text">
|
||||
<string>timeAssignmentBackgroundColor</string>
|
||||
@@ -75,15 +85,18 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEditBuchungStartBackgroundColor"/>
|
||||
<widget class="QComboBox" name="comboBoxLanguage"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEditBuchungEndBackgroundColor"/>
|
||||
<widget class="QLineEdit" name="lineEditBuchungStartBackgroundColor"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineEditBuchungOtherBackgroundColor"/>
|
||||
<widget class="QLineEdit" name="lineEditBuchungEndBackgroundColor"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="lineEditBuchungOtherBackgroundColor"/>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="lineEditTimeAssignmentBackgroundColor"/>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -94,7 +107,7 @@
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel</set>
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Save</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@@ -402,6 +402,26 @@ Buchung ID: %1</source>
|
||||
<source>timeAssignmentBackgroundColor</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>language</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>English</source>
|
||||
<translation>Englisch</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>German</source>
|
||||
<translation>Deutsch</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Restart required!</source>
|
||||
<translation>Neustart erforderlich!</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>To apply the new language a restart is required!</source>
|
||||
<translation>Um die neue Sprache anzuwenden ist ein Neustart erforderlich!</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>TimeAssignmentDialog</name>
|
||||
|
@@ -402,6 +402,26 @@ Buchung ID: %1</source>
|
||||
<source>timeAssignmentBackgroundColor</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>language</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>English</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>German</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Restart required!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>To apply the new language a restart is required!</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>TimeAssignmentDialog</name>
|
||||
|
Reference in New Issue
Block a user