[Companion] Translation system improvements. (#4676)
* [Companion] I18N:
* Introduce new Translations class to centralize all related functionality;
* Add ability to search multiple locations for .qm translation binaries (local folders, resources, system paths);
* Add ability to reload translations dynamically w/out application restart;
* Improve support for loading Qt translations (if available);
* [build][i18n] Look for and include pre-built Qt translations with other translation resources; Generate translations.qrc dynamically with rest of build files; Add EN "translation" file (simpler UI string edits and possible abstractions); Rename ZH translation file to be country-specific.
* [build] Centralize finding all the Qt bits into root CMakeLists; Make sure QT_QMAKE_EXECUTABLE is defined; Disable dysfunctional simulator installer script generation.
* Cosmetics (unused includes).
* [Companion] Make language options menu dynamic based on available translations, and always show native language name; Allow changing language of some elements w/out restarting (esp. menus/toolbar buttons); Simplify menus/actions/handlers for themes and icon sizes.
* [build] Better way to generate translations.qrc using input file again (previous method was generating new qrc for each reconfig); Make sure common library is linked to other modules which may need it; Remove unused script.
This commit is contained in:
committed by
Bertrand Songis
parent
d5560d68f4
commit
dcdbff74b0
+25
-60
@@ -52,47 +52,32 @@ class MainWindow : public QMainWindow
|
||||
|
||||
public:
|
||||
MainWindow();
|
||||
|
||||
|
||||
signals:
|
||||
void FirmwareChanged();
|
||||
|
||||
protected:
|
||||
QString getCompanionUpdateBaseUrl();
|
||||
QString seekCodeString(const QByteArray & qba, const QString & label);
|
||||
|
||||
protected slots:
|
||||
void dowloadLastFirmwareUpdate();
|
||||
void startFirmwareDownload();
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dropEvent(QDropEvent *event);
|
||||
void setLanguage(const QString & langString);
|
||||
QString seekCodeString(const QByteArray & qba, const QString & label);
|
||||
virtual void closeEvent(QCloseEvent *event);
|
||||
virtual void changeEvent(QEvent *e);
|
||||
virtual void dragEnterEvent(QDragEnterEvent *event);
|
||||
virtual void dropEvent(QDropEvent *event);
|
||||
|
||||
private slots:
|
||||
void openDocURL();
|
||||
void retranslateUi();
|
||||
|
||||
void setSysLanguage() { setLanguage(""); };
|
||||
void setCZLanguage() { setLanguage("cs_CZ"); };
|
||||
void setDELanguage() { setLanguage("de_DE"); };
|
||||
void setENLanguage() { setLanguage("en"); };
|
||||
void setFILanguage() { setLanguage("fi_FI"); };
|
||||
void setFRLanguage() { setLanguage("fr_FR"); };
|
||||
void setITLanguage() { setLanguage("it_IT"); };
|
||||
void setPLLanguage() { setLanguage("pl_PL"); };
|
||||
void setESLanguage() { setLanguage("es_ES"); };
|
||||
void setSELanguage() { setLanguage("sv_SE"); };
|
||||
void setCNLanguage() { setLanguage("zh_CN"); };
|
||||
|
||||
void setLanguage(const QString & langString);
|
||||
void onLanguageChanged(QAction * act);
|
||||
void setTheme(int index);
|
||||
void setClassicTheme() {setTheme(0);};
|
||||
void setYericoTheme() {setTheme(1);};
|
||||
void setMonoWhiteTheme() {setTheme(2);};
|
||||
void setMonochromeTheme(){setTheme(3);};
|
||||
void setMonoBlueTheme() {setTheme(4);};
|
||||
|
||||
void onThemeChanged(QAction * act);
|
||||
void setIconThemeSize(int index);
|
||||
void setSmallIconThemeSize() {setIconThemeSize(0);};
|
||||
void setNormalIconThemeSize() {setIconThemeSize(1);};
|
||||
void setBigIconThemeSize() {setIconThemeSize(2);};
|
||||
void setHugeIconThemeSize() {setIconThemeSize(3);};
|
||||
void onIconSizeChanged(QAction * act);
|
||||
|
||||
void checkForUpdates();
|
||||
void checkForFirmwareUpdate();
|
||||
@@ -138,34 +123,34 @@ class MainWindow : public QMainWindow
|
||||
void fwPrefs();
|
||||
void updateMenus();
|
||||
void createProfile();
|
||||
MdiChild * createMdiChild();
|
||||
void setActiveSubWindow(QWidget *window);
|
||||
QMenu * createRecentFileMenu();
|
||||
QMenu * createProfilesMenu();
|
||||
void autoClose();
|
||||
|
||||
private:
|
||||
void closeUpdatesWaitDialog();
|
||||
void onUpdatesError();
|
||||
void openFile(const QString & fileName, bool updateLastUsedDir = false);
|
||||
|
||||
void createActions();
|
||||
private:
|
||||
QAction * addAct(const QString &, const QString &, const QString &, enum QKeySequence::StandardKey, const char *, QObject *slotObj=NULL);
|
||||
QAction * addAct(const QString &, const QString &, const QString &, const QKeySequence &, const char *, QObject *slotObj=NULL);
|
||||
QAction * addAct(QActionGroup *, const QString &, const QString &, const char *);
|
||||
QAction * addAct(const QString &, const QString &, const QString &, const char *);
|
||||
QAction * addActToGroup(QActionGroup * aGroup, const QString & sName, const QString & lName,
|
||||
const char * propName = 0, const QVariant & propValue = QVariant(), const QVariant & dfltValue = QVariant());
|
||||
|
||||
QMenu * createLanguageMenu(QWidget * parent = Q_NULLPTR);
|
||||
QMenu * createRecentFileMenu();
|
||||
QMenu * createProfilesMenu();
|
||||
|
||||
void createActions();
|
||||
void createMenus();
|
||||
void createToolBars();
|
||||
void createStatusBar();
|
||||
void updateRecentFileActions();
|
||||
void updateProfilesActions();
|
||||
void updateIconSizeActions();
|
||||
void updateLanguageActions();
|
||||
void updateIconThemeActions();
|
||||
void openFile(const QString & fileName, bool updateLastUsedDir = false);
|
||||
|
||||
QString strippedName(const QString & fullFileName);
|
||||
|
||||
MdiChild * createMdiChild();
|
||||
MdiChild * activeMdiChild();
|
||||
QMdiSubWindow * findMdiChild(const QString & fileName);
|
||||
|
||||
@@ -182,6 +167,8 @@ class MainWindow : public QMainWindow
|
||||
|
||||
QNetworkAccessManager *networkManager;
|
||||
|
||||
QVector<QAction *> actionsList;
|
||||
|
||||
QMenu *fileMenu;
|
||||
QMenu *editMenu;
|
||||
QMenu *settingsMenu;
|
||||
@@ -226,28 +213,6 @@ class MainWindow : public QMainWindow
|
||||
QAction *recentFileActs[MAX_RECENT];
|
||||
QAction *profileActs[MAX_PROFILES];
|
||||
QAction *createProfileAct;
|
||||
QAction *classicThemeAct;
|
||||
QAction *yericoThemeAct;
|
||||
QAction *monoThemeAct;
|
||||
QAction *monoBlueAct;
|
||||
QAction *monoWhiteAct;
|
||||
QAction *smallIconAct;
|
||||
QAction *normalIconAct;
|
||||
QAction *bigIconAct;
|
||||
QAction *hugeIconAct;
|
||||
|
||||
QAction *sysLangAct;
|
||||
QAction *czechLangAct;
|
||||
QAction *germanLangAct;
|
||||
QAction *englishLangAct;
|
||||
QAction *finnishLangAct;
|
||||
QAction *frenchLangAct;
|
||||
QAction *italianLangAct;
|
||||
QAction *polishLangAct;
|
||||
QAction *spanishLangAct;
|
||||
QAction *swedishLangAct;
|
||||
QAction *chineseLangAct;
|
||||
|
||||
QAction *openDocURLAct;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user