diff --git a/CMakeLists.txt b/CMakeLists.txt
index bc475085..20dccec5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -101,6 +101,7 @@ set(SQLB_FORMS
set(SQLB_RESOURCES
src/icons/icons.qrc
+ src/translations/flags/flags.qrc
)
set(SQLB_MISC
diff --git a/src/PreferencesDialog.cpp b/src/PreferencesDialog.cpp
index 584f0d61..c51bac14 100644
--- a/src/PreferencesDialog.cpp
+++ b/src/PreferencesDialog.cpp
@@ -255,7 +255,6 @@ void PreferencesDialog::removeExtension()
void PreferencesDialog::fillLanguageBox()
{
- // Use the path relative to the main executable
QDir translationsDir(QCoreApplication::applicationDirPath() + "/translations",
"sqlb_*.qm");
@@ -263,9 +262,17 @@ void PreferencesDialog::fillLanguageBox()
// Add default language
if (systemLocale.name() == "en_US")
- ui->languageComboBox->addItem("English (United States) [System Language]","en_US");
+ {
+ ui->languageComboBox->addItem(QIcon(":/flags/en_US"),
+ "English (United States) [System Language]",
+ "en_US");
+ }
else
- ui->languageComboBox->addItem("English (United States) [Default Language]","en_US");
+ {
+ ui->languageComboBox->addItem(QIcon(":/flags/en_US"),
+ "English (United States) [Default Language]",
+ "en_US");
+ }
foreach(const QFileInfo &file, translationsDir.entryInfoList())
{
@@ -281,7 +288,7 @@ void PreferencesDialog::fillLanguageBox()
if (locale == systemLocale)
language += " [System language]";
- ui->languageComboBox->addItem(language, locale.name());
+ ui->languageComboBox->addItem(QIcon(":/flags/" + locale.name()), language, locale.name());
}
ui->languageComboBox->model()->sort(0);
@@ -296,9 +303,10 @@ void PreferencesDialog::fillLanguageBox()
QString chosenLanguage = ui->languageComboBox->itemText(index);
QVariant chosenLocale = ui->languageComboBox->itemData(index);
+ QIcon chosenIcon = ui->languageComboBox->itemIcon(index);
// There's no "move" method, so we remove and add the chosen language again at the top
ui->languageComboBox->removeItem(index);
- ui->languageComboBox->insertItem(0, chosenLanguage, chosenLocale);
+ ui->languageComboBox->insertItem(0, chosenIcon, chosenLanguage, chosenLocale);
ui->languageComboBox->setCurrentIndex(0);
}
diff --git a/src/PreferencesDialog.ui b/src/PreferencesDialog.ui
index 7cc347c2..08a17c67 100644
--- a/src/PreferencesDialog.ui
+++ b/src/PreferencesDialog.ui
@@ -42,7 +42,7 @@
- 290
+ 316
0
@@ -83,11 +83,17 @@
- QComboBox::AdjustToMinimumContentsLength
+ QComboBox::AdjustToContents
35
+
+
+ 20
+ 15
+
+
diff --git a/src/src.pro b/src/src.pro
index 0e43b2e0..181a4fe6 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -71,7 +71,8 @@ SOURCES += \
Application.cpp \
CipherDialog.cpp
-RESOURCES += icons/icons.qrc
+RESOURCES += icons/icons.qrc \
+ translations/flags/flags.qrc
FORMS += \
MainWindow.ui \
diff --git a/src/translations/flags/cn.png b/src/translations/flags/cn.png
new file mode 100644
index 00000000..85434125
Binary files /dev/null and b/src/translations/flags/cn.png differ
diff --git a/src/translations/flags/de.png b/src/translations/flags/de.png
new file mode 100644
index 00000000..e1e87e0c
Binary files /dev/null and b/src/translations/flags/de.png differ
diff --git a/src/translations/flags/flags.qrc b/src/translations/flags/flags.qrc
new file mode 100644
index 00000000..a05c86ce
--- /dev/null
+++ b/src/translations/flags/flags.qrc
@@ -0,0 +1,9 @@
+
+
+ de.png
+ us.png
+ fr.png
+ ru.png
+ cn.png
+
+
diff --git a/src/translations/flags/fr.png b/src/translations/flags/fr.png
new file mode 100644
index 00000000..7a815dd0
Binary files /dev/null and b/src/translations/flags/fr.png differ
diff --git a/src/translations/flags/ru.png b/src/translations/flags/ru.png
new file mode 100644
index 00000000..744db41e
Binary files /dev/null and b/src/translations/flags/ru.png differ
diff --git a/src/translations/flags/us.png b/src/translations/flags/us.png
new file mode 100644
index 00000000..ddd6c612
Binary files /dev/null and b/src/translations/flags/us.png differ