summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/rbutilqt')
-rw-r--r--rbutil/rbutilqt/configure.cpp44
-rw-r--r--rbutil/rbutilqt/configure.h1
-rw-r--r--rbutil/rbutilqt/createvoicewindow.cpp10
-rw-r--r--rbutil/rbutilqt/createvoicewindow.h1
-rw-r--r--rbutil/rbutilqt/installtalkwindow.cpp10
-rw-r--r--rbutil/rbutilqt/installtalkwindow.h3
-rw-r--r--rbutil/rbutilqt/installwindow.cpp8
-rw-r--r--rbutil/rbutilqt/installwindow.h1
-rw-r--r--rbutil/rbutilqt/main.cpp6
-rw-r--r--rbutil/rbutilqt/preview.cpp10
-rw-r--r--rbutil/rbutilqt/preview.h1
-rw-r--r--rbutil/rbutilqt/rbutilqt.cpp12
-rw-r--r--rbutil/rbutilqt/rbutilqt.h6
-rw-r--r--rbutil/rbutilqt/sysinfo.cpp9
-rw-r--r--rbutil/rbutilqt/sysinfo.h5
-rw-r--r--rbutil/rbutilqt/systrace.cpp10
-rw-r--r--rbutil/rbutilqt/systrace.h3
-rw-r--r--rbutil/rbutilqt/themesinstallwindow.cpp10
-rw-r--r--rbutil/rbutilqt/themesinstallwindow.h1
-rw-r--r--rbutil/rbutilqt/uninstallwindow.cpp10
-rw-r--r--rbutil/rbutilqt/uninstallwindow.h2
21 files changed, 151 insertions, 12 deletions
diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp
index 4a6fb67a43..d1a5faee24 100644
--- a/rbutil/rbutilqt/configure.cpp
+++ b/rbutil/rbutilqt/configure.cpp
@@ -39,6 +39,7 @@
39#include <tchar.h> 39#include <tchar.h>
40#include <windows.h> 40#include <windows.h>
41#endif 41#endif
42#include "rbutilqt.h"
42 43
43#define DEFAULT_LANG "English (en)" 44#define DEFAULT_LANG "English (en)"
44#define DEFAULT_LANG_CODE "en" 45#define DEFAULT_LANG_CODE "en"
@@ -147,13 +148,6 @@ void Config::accept()
147 else proxyType = "manual"; 148 else proxyType = "manual";
148 RbSettings::setValue(RbSettings::ProxyType, proxyType); 149 RbSettings::setValue(RbSettings::ProxyType, proxyType);
149 150
150 // language
151 if(RbSettings::value(RbSettings::Language).toString() != language
152 && !language.isEmpty()) {
153 QMessageBox::information(this, tr("Language changed"),
154 tr("You need to restart the application for the changed language "
155 "to take effect."));
156 }
157 RbSettings::setValue(RbSettings::Language, language); 151 RbSettings::setValue(RbSettings::Language, language);
158 152
159 // mountpoint 153 // mountpoint
@@ -563,10 +557,36 @@ QString Config::languageName(const QString &qmFile)
563void Config::updateLanguage() 557void Config::updateLanguage()
564{ 558{
565 qDebug() << "[Config] update selected language"; 559 qDebug() << "[Config] update selected language";
560
561 // remove all old translators
562 for(int i = 0; i < RbUtilQt::translators.size(); ++i) {
563 qApp->removeTranslator(RbUtilQt::translators.at(i));
564 // do not delete old translators, this confuses Qt.
565 }
566 RbUtilQt::translators.clear();
566 QList<QListWidgetItem*> a = ui.listLanguages->selectedItems(); 567 QList<QListWidgetItem*> a = ui.listLanguages->selectedItems();
567 if(a.size() > 0) 568 if(a.size() > 0)
568 language = lang.value(a.at(0)->text()); 569 language = lang.value(a.at(0)->text());
569 qDebug() << "[Config] new language:" << language; 570 qDebug() << "[Config] new language:" << language;
571
572 QString applang = QLocale::system().name();
573 QTranslator *translator = new QTranslator(qApp);
574 QTranslator *qttrans = new QTranslator(qApp);
575 QString absolutePath = QCoreApplication::instance()->applicationDirPath();
576
577 if(!translator->load("rbutil_" + language, absolutePath))
578 translator->load("rbutil_" + language, ":/lang");
579 if(!qttrans->load("qt_" + language,
580 QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
581 qttrans->load("qt_" + language, ":/lang");
582
583 qApp->installTranslator(translator);
584 qApp->installTranslator(qttrans);
585 RbUtilQt::translators.append(translator);
586 RbUtilQt::translators.append(qttrans);
587
588 QLocale::setDefault(language);
589
570} 590}
571 591
572 592
@@ -878,3 +898,13 @@ void Config::configEnc()
878 updateEncState(); 898 updateEncState();
879} 899}
880 900
901
902void Config::changeEvent(QEvent *e)
903{
904 if(e->type() == QEvent::LanguageChange) {
905 ui.retranslateUi(this);
906 } else {
907 QWidget::changeEvent(e);
908 }
909}
910
diff --git a/rbutil/rbutilqt/configure.h b/rbutil/rbutilqt/configure.h
index fcfa9cbe7d..13451952ac 100644
--- a/rbutil/rbutilqt/configure.h
+++ b/rbutil/rbutilqt/configure.h
@@ -52,6 +52,7 @@ class Config : public QDialog
52 QUrl proxy; 52 QUrl proxy;
53 QString mountpoint; 53 QString mountpoint;
54 void updateCacheInfo(QString); 54 void updateCacheInfo(QString);
55 void changeEvent(QEvent *event);
55 56
56 private slots: 57 private slots:
57 void setNoProxy(bool); 58 void setNoProxy(bool);
diff --git a/rbutil/rbutilqt/createvoicewindow.cpp b/rbutil/rbutilqt/createvoicewindow.cpp
index 7d51b90805..40f0457cbe 100644
--- a/rbutil/rbutilqt/createvoicewindow.cpp
+++ b/rbutil/rbutilqt/createvoicewindow.cpp
@@ -132,3 +132,13 @@ void CreateVoiceWindow::saveSettings(void)
132 ui.wavtrimthreshold->value()); 132 ui.wavtrimthreshold->value());
133 RbSettings::sync(); 133 RbSettings::sync();
134} 134}
135
136void CreateVoiceWindow::changeEvent(QEvent *e)
137{
138 if(e->type() == QEvent::LanguageChange) {
139 ui.retranslateUi(this);
140 } else {
141 QWidget::changeEvent(e);
142 }
143}
144
diff --git a/rbutil/rbutilqt/createvoicewindow.h b/rbutil/rbutilqt/createvoicewindow.h
index 9294004676..7223fce9aa 100644
--- a/rbutil/rbutilqt/createvoicewindow.h
+++ b/rbutil/rbutilqt/createvoicewindow.h
@@ -46,6 +46,7 @@ class CreateVoiceWindow : public QDialog
46 void settingsUpdated(void); 46 void settingsUpdated(void);
47 47
48 private: 48 private:
49 void changeEvent(QEvent *event);
49 VoiceFileCreator* voicecreator; 50 VoiceFileCreator* voicecreator;
50 Ui::CreateVoiceFrm ui; 51 Ui::CreateVoiceFrm ui;
51 ProgressLoggerGui* logger; 52 ProgressLoggerGui* logger;
diff --git a/rbutil/rbutilqt/installtalkwindow.cpp b/rbutil/rbutilqt/installtalkwindow.cpp
index da4389bb78..19a974ab57 100644
--- a/rbutil/rbutilqt/installtalkwindow.cpp
+++ b/rbutil/rbutilqt/installtalkwindow.cpp
@@ -145,3 +145,13 @@ void InstallTalkWindow::updateSettings(void)
145 emit settingsUpdated(); 145 emit settingsUpdated();
146} 146}
147 147
148
149void InstallTalkWindow::changeEvent(QEvent *e)
150{
151 if(e->type() == QEvent::LanguageChange) {
152 ui.retranslateUi(this);
153 } else {
154 QWidget::changeEvent(e);
155 }
156}
157
diff --git a/rbutil/rbutilqt/installtalkwindow.h b/rbutil/rbutilqt/installtalkwindow.h
index e723f29af8..030f2553ed 100644
--- a/rbutil/rbutilqt/installtalkwindow.h
+++ b/rbutil/rbutilqt/installtalkwindow.h
@@ -33,7 +33,7 @@ class InstallTalkWindow : public QDialog
33 Q_OBJECT 33 Q_OBJECT
34 public: 34 public:
35 InstallTalkWindow(QWidget *parent = 0); 35 InstallTalkWindow(QWidget *parent = 0);
36 36
37 public slots: 37 public slots:
38 void accept(void); 38 void accept(void);
39 void change(void); 39 void change(void);
@@ -46,6 +46,7 @@ class InstallTalkWindow : public QDialog
46 void settingsUpdated(void); 46 void settingsUpdated(void);
47 47
48 private: 48 private:
49 void changeEvent(QEvent *event);
49 TalkFileCreator* talkcreator; 50 TalkFileCreator* talkcreator;
50 Ui::InstallTalkFrm ui; 51 Ui::InstallTalkFrm ui;
51 ProgressLoggerGui* logger; 52 ProgressLoggerGui* logger;
diff --git a/rbutil/rbutilqt/installwindow.cpp b/rbutil/rbutilqt/installwindow.cpp
index c619bb5208..68217aa002 100644
--- a/rbutil/rbutilqt/installwindow.cpp
+++ b/rbutil/rbutilqt/installwindow.cpp
@@ -317,4 +317,12 @@ void InstallWindow::setDetailsArchived(bool show)
317} 317}
318 318
319 319
320void InstallWindow::changeEvent(QEvent *e)
321{
322 if(e->type() == QEvent::LanguageChange) {
323 ui.retranslateUi(this);
324 } else {
325 QWidget::changeEvent(e);
326 }
327}
320 328
diff --git a/rbutil/rbutilqt/installwindow.h b/rbutil/rbutilqt/installwindow.h
index 9fae7b5b4e..a74f47d5f3 100644
--- a/rbutil/rbutilqt/installwindow.h
+++ b/rbutil/rbutilqt/installwindow.h
@@ -46,6 +46,7 @@ class InstallWindow : public QDialog
46 ZipInstaller* installer; 46 ZipInstaller* installer;
47 QString m_backupName; 47 QString m_backupName;
48 void resizeEvent(QResizeEvent*); 48 void resizeEvent(QResizeEvent*);
49 void changeEvent(QEvent *event);
49 50
50 void changeBackupPath(QString); 51 void changeBackupPath(QString);
51 void updateBackupLocation(void); 52 void updateBackupLocation(void);
diff --git a/rbutil/rbutilqt/main.cpp b/rbutil/rbutilqt/main.cpp
index 02c1e51d32..16767fc481 100644
--- a/rbutil/rbutilqt/main.cpp
+++ b/rbutil/rbutilqt/main.cpp
@@ -71,7 +71,13 @@ int main( int argc, char ** argv ) {
71 if(QObject::tr("LTR") == "RTL") 71 if(QObject::tr("LTR") == "RTL")
72 app.setLayoutDirection(Qt::RightToLeft); 72 app.setLayoutDirection(Qt::RightToLeft);
73 73
74 // keep a list of installed translators. Needed to be able uninstalling them
75 // later again (in case of translation changes)
76 QList<QTranslator*> translators;
77 translators.append(&translator);
78 translators.append(&qttrans);
74 RbUtilQt window(0); 79 RbUtilQt window(0);
80 RbUtilQt::translators = translators;
75 window.show(); 81 window.show();
76 82
77// app.connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) ); 83// app.connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );
diff --git a/rbutil/rbutilqt/preview.cpp b/rbutil/rbutilqt/preview.cpp
index be1430c6a1..57b590966c 100644
--- a/rbutil/rbutilqt/preview.cpp
+++ b/rbutil/rbutilqt/preview.cpp
@@ -54,6 +54,16 @@ void PreviewDlg::leaveEvent(QEvent * event)
54 this->close(); 54 this->close();
55} 55}
56 56
57
58void PreviewDlg::changeEvent(QEvent *e)
59{
60 if(e->type() == QEvent::LanguageChange) {
61 ui.retranslateUi(this);
62 } else {
63 QWidget::changeEvent(e);
64 }
65}
66
57PreviewLabel::PreviewLabel(QWidget * parent, Qt::WindowFlags f) 67PreviewLabel::PreviewLabel(QWidget * parent, Qt::WindowFlags f)
58 :QLabel(parent,f) 68 :QLabel(parent,f)
59{ 69{
diff --git a/rbutil/rbutilqt/preview.h b/rbutil/rbutilqt/preview.h
index 14714af089..13f74360ee 100644
--- a/rbutil/rbutilqt/preview.h
+++ b/rbutil/rbutilqt/preview.h
@@ -36,6 +36,7 @@ public:
36 void setText(QString text); 36 void setText(QString text);
37 37
38private slots: 38private slots:
39 void changeEvent(QEvent *event);
39 void mouseMoveEvent(QMouseEvent * event); 40 void mouseMoveEvent(QMouseEvent * event);
40 void leaveEvent(QEvent * event); 41 void leaveEvent(QEvent * event);
41 42
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp
index b8ae77b91a..8be69287ac 100644
--- a/rbutil/rbutilqt/rbutilqt.cpp
+++ b/rbutil/rbutilqt/rbutilqt.cpp
@@ -57,6 +57,8 @@
57#include <windows.h> 57#include <windows.h>
58#endif 58#endif
59 59
60QList<QTranslator*> RbUtilQt::translators;
61
60RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent) 62RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
61{ 63{
62 // startup log 64 // startup log
@@ -1380,3 +1382,13 @@ void RbUtilQt::downloadUpdateDone(bool error)
1380 } 1382 }
1381} 1383}
1382 1384
1385
1386void RbUtilQt::changeEvent(QEvent *e)
1387{
1388 if(e->type() == QEvent::LanguageChange) {
1389 ui.retranslateUi(this);
1390 } else {
1391 QMainWindow::changeEvent(e);
1392 }
1393}
1394
diff --git a/rbutil/rbutilqt/rbutilqt.h b/rbutil/rbutilqt/rbutilqt.h
index 42656540e6..869eb98f44 100644
--- a/rbutil/rbutilqt/rbutilqt.h
+++ b/rbutil/rbutilqt/rbutilqt.h
@@ -25,6 +25,8 @@
25 25
26#include <QSettings> 26#include <QSettings>
27#include <QTemporaryFile> 27#include <QTemporaryFile>
28#include <QList>
29#include <QTranslator>
28 30
29#include "ui_rbutilqtfrm.h" 31#include "ui_rbutilqtfrm.h"
30#include "httpget.h" 32#include "httpget.h"
@@ -38,10 +40,12 @@ class RbUtilQt : public QMainWindow
38 40
39 public: 41 public:
40 RbUtilQt(QWidget *parent = 0); 42 RbUtilQt(QWidget *parent = 0);
43 static QList<QTranslator*> translators;
41 44
42 private: 45 private:
43 Ui::RbUtilQtFrm ui; 46 Ui::RbUtilQtFrm ui;
44 47
48 void changeEvent(QEvent *e);
45 void initDeviceNames(void); 49 void initDeviceNames(void);
46 QString deviceName(QString); 50 QString deviceName(QString);
47 QString platform; 51 QString platform;
@@ -110,7 +114,7 @@ class RbUtilQt : public QMainWindow
110 void installPortable(void); 114 void installPortable(void);
111 void updateInfo(void); 115 void updateInfo(void);
112 void updateTabs(int); 116 void updateTabs(int);
113 117
114 void checkUpdate(void); 118 void checkUpdate(void);
115 void downloadUpdateDone(bool errror); 119 void downloadUpdateDone(bool errror);
116}; 120};
diff --git a/rbutil/rbutilqt/sysinfo.cpp b/rbutil/rbutilqt/sysinfo.cpp
index 1b2f44923b..864cc5788c 100644
--- a/rbutil/rbutilqt/sysinfo.cpp
+++ b/rbutil/rbutilqt/sysinfo.cpp
@@ -81,3 +81,12 @@ QString Sysinfo::getInfo()
81} 81}
82 82
83 83
84void Sysinfo::changeEvent(QEvent *e)
85{
86 if(e->type() == QEvent::LanguageChange) {
87 ui.retranslateUi(this);
88 } else {
89 QWidget::changeEvent(e);
90 }
91}
92
diff --git a/rbutil/rbutilqt/sysinfo.h b/rbutil/rbutilqt/sysinfo.h
index 5195113643..e59c98df12 100644
--- a/rbutil/rbutilqt/sysinfo.h
+++ b/rbutil/rbutilqt/sysinfo.h
@@ -31,13 +31,14 @@ class Sysinfo : public QDialog
31 31
32 public: 32 public:
33 Sysinfo(QWidget *parent = 0); 33 Sysinfo(QWidget *parent = 0);
34 34
35 static QString getInfo(); 35 static QString getInfo();
36 private: 36 private:
37 void changeEvent(QEvent *event);
37 Ui::SysinfoFrm ui; 38 Ui::SysinfoFrm ui;
38 39
39 private slots: 40 private slots:
40 void updateSysinfo(void); 41 void updateSysinfo(void);
41 42
42}; 43};
43 44
diff --git a/rbutil/rbutilqt/systrace.cpp b/rbutil/rbutilqt/systrace.cpp
index 5600eb042b..b9bc8ec04f 100644
--- a/rbutil/rbutilqt/systrace.cpp
+++ b/rbutil/rbutilqt/systrace.cpp
@@ -121,3 +121,13 @@ void SysTrace::flush(void)
121 } 121 }
122} 122}
123 123
124
125void SysTrace::changeEvent(QEvent *e)
126{
127 if(e->type() == QEvent::LanguageChange) {
128 ui.retranslateUi(this);
129 } else {
130 QWidget::changeEvent(e);
131 }
132}
133
diff --git a/rbutil/rbutilqt/systrace.h b/rbutil/rbutilqt/systrace.h
index f15e33c149..71aed0bd48 100644
--- a/rbutil/rbutilqt/systrace.h
+++ b/rbutil/rbutilqt/systrace.h
@@ -35,6 +35,7 @@ class SysTrace : public QDialog
35 static void save(QString filename = ""); 35 static void save(QString filename = "");
36 private: 36 private:
37 static void flush(void); 37 static void flush(void);
38 void changeEvent(QEvent *event);
38 Ui::SysTraceFrm ui; 39 Ui::SysTraceFrm ui;
39 static QString debugbuffer; 40 static QString debugbuffer;
40 static QString lastmessage; 41 static QString lastmessage;
@@ -44,7 +45,7 @@ class SysTrace : public QDialog
44 void saveCurrentTrace(void); 45 void saveCurrentTrace(void);
45 void savePreviousTrace(void); 46 void savePreviousTrace(void);
46 void refresh(void); 47 void refresh(void);
47 48
48}; 49};
49 50
50#endif 51#endif
diff --git a/rbutil/rbutilqt/themesinstallwindow.cpp b/rbutil/rbutilqt/themesinstallwindow.cpp
index cb06b47b1f..272a7b3dca 100644
--- a/rbutil/rbutilqt/themesinstallwindow.cpp
+++ b/rbutil/rbutilqt/themesinstallwindow.cpp
@@ -359,3 +359,13 @@ void ThemesInstallWindow::accept()
359 359
360} 360}
361 361
362
363void ThemesInstallWindow::changeEvent(QEvent *e)
364{
365 if(e->type() == QEvent::LanguageChange) {
366 ui.retranslateUi(this);
367 } else {
368 QWidget::changeEvent(e);
369 }
370}
371
diff --git a/rbutil/rbutilqt/themesinstallwindow.h b/rbutil/rbutilqt/themesinstallwindow.h
index 949ffce4d5..e46a14453b 100644
--- a/rbutil/rbutilqt/themesinstallwindow.h
+++ b/rbutil/rbutilqt/themesinstallwindow.h
@@ -49,6 +49,7 @@ class ThemesInstallWindow : public QDialog
49 HttpGet igetter; 49 HttpGet igetter;
50 QTemporaryFile themesInfo; 50 QTemporaryFile themesInfo;
51 void resizeEvent(QResizeEvent*); 51 void resizeEvent(QResizeEvent*);
52 void changeEvent(QEvent *event);
52 QByteArray imgData; 53 QByteArray imgData;
53 ProgressLoggerGui *logger; 54 ProgressLoggerGui *logger;
54 ZipInstaller *installer; 55 ZipInstaller *installer;
diff --git a/rbutil/rbutilqt/uninstallwindow.cpp b/rbutil/rbutilqt/uninstallwindow.cpp
index fc47840b78..ab25fd2179 100644
--- a/rbutil/rbutilqt/uninstallwindow.cpp
+++ b/rbutil/rbutilqt/uninstallwindow.cpp
@@ -89,3 +89,13 @@ void UninstallWindow::UninstallMethodChanged(bool complete)
89 ui.smartGroupBox->setEnabled(true); 89 ui.smartGroupBox->setEnabled(true);
90} 90}
91 91
92
93void UninstallWindow::changeEvent(QEvent *e)
94{
95 if(e->type() == QEvent::LanguageChange) {
96 ui.retranslateUi(this);
97 } else {
98 QWidget::changeEvent(e);
99 }
100}
101
diff --git a/rbutil/rbutilqt/uninstallwindow.h b/rbutil/rbutilqt/uninstallwindow.h
index 7ac20b4d1e..2bdd4a653e 100644
--- a/rbutil/rbutilqt/uninstallwindow.h
+++ b/rbutil/rbutilqt/uninstallwindow.h
@@ -40,7 +40,9 @@ class UninstallWindow : public QDialog
40 private slots: 40 private slots:
41 void selectionChanged(); 41 void selectionChanged();
42 void UninstallMethodChanged(bool complete); 42 void UninstallMethodChanged(bool complete);
43
43 private: 44 private:
45 void changeEvent(QEvent *event);
44 Uninstaller* uninstaller; 46 Uninstaller* uninstaller;
45 Ui::UninstallFrm ui; 47 Ui::UninstallFrm ui;
46 ProgressLoggerGui* logger; 48 ProgressLoggerGui* logger;