From 8f4fae7fda60b8aa60f3e9f55ba72c9b495c9f2f Mon Sep 17 00:00:00 2001 From: lordmulder Date: Sun, 2 Jan 2011 20:47:26 +0100 Subject: [PATCH] Try to detect "Disable visual themes" + four new strings to translate --- LameXP.vcproj | 6 ++-- etc/Translation/Blank.ts | 19 ++++++++++++ etc/Translation/LameXP_DE.ts | 20 +++++++++++++ res/localization/LameXP_DE.qm | Bin 40989 -> 41212 bytes res/localization/LameXP_DE.qm.txt | 2 +- res/localization/LameXP_FR.qm.txt | 2 +- res/localization/LameXP_IT.qm.txt | 2 +- src/Config.h | 2 +- src/Dialog_MainWindow.cpp | 48 +++++++++++++++++++----------- src/Global.cpp | 23 ++++++++++++++ src/Global.h | 1 + src/Model_FileList.cpp | 4 +-- src/Model_Settings.cpp | 9 +++--- 13 files changed, 107 insertions(+), 31 deletions(-) diff --git a/LameXP.vcproj b/LameXP.vcproj index 24e011c3..d0061435 100644 --- a/LameXP.vcproj +++ b/LameXP.vcproj @@ -1711,7 +1711,7 @@ @@ -1722,7 +1722,7 @@ @@ -1733,7 +1733,7 @@ diff --git a/etc/Translation/Blank.ts b/etc/Translation/Blank.ts index 6fad31c2..08f81243 100644 --- a/etc/Translation/Blank.ts +++ b/etc/Translation/Blank.ts @@ -166,6 +166,17 @@ + + FileListModel + + Title + + + + Full Path + + + LogViewDialog @@ -707,6 +718,14 @@ Do you really want to disable the update reminder? + + Yes + + + + No + + The update reminder has been disabled. diff --git a/etc/Translation/LameXP_DE.ts b/etc/Translation/LameXP_DE.ts index 0dd5179d..cd55c977 100644 --- a/etc/Translation/LameXP_DE.ts +++ b/etc/Translation/LameXP_DE.ts @@ -166,6 +166,18 @@ (Rechts-klicken um die DropBox zu schließen) + + FileListModel + + Title + Titel + Titel + + + Full Path + Datei Pfad + + LogViewDialog @@ -811,6 +823,14 @@ Already Running Wird Bereits Ausgeführt + + Yes + Ja + + + No + Nein + MetaInfo diff --git a/res/localization/LameXP_DE.qm b/res/localization/LameXP_DE.qm index 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Enabled((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) >= QSysInfo::WV_XP); - actionStyleWindowsVista->setEnabled((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) >= QSysInfo::WV_VISTA); + actionStyleWindowsXP->setEnabled((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) >= QSysInfo::WV_XP && lamexp_themes_enabled()); + actionStyleWindowsVista->setEnabled((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) >= QSysInfo::WV_VISTA && lamexp_themes_enabled()); connect(m_styleActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(styleActionActivated(QAction*))); styleActionActivated(NULL); @@ -947,21 +947,33 @@ void MainWindow::styleActionActivated(QAction *action) switch(m_settings->interfaceStyle()) { case 1: - actionStyleCleanlooks->setChecked(true); - QApplication::setStyle(new QCleanlooksStyle()); - break; + if(actionStyleCleanlooks->isEnabled()) + { + actionStyleCleanlooks->setChecked(true); + QApplication::setStyle(new QCleanlooksStyle()); + break; + } case 2: - actionStyleWindowsVista->setChecked(true); - QApplication::setStyle(new QWindowsVistaStyle()); - break; + if(actionStyleWindowsVista->isEnabled()) + { + actionStyleWindowsVista->setChecked(true); + QApplication::setStyle(new QWindowsVistaStyle()); + break; + } case 3: - actionStyleWindowsXP->setChecked(true); - QApplication::setStyle(new QWindowsXPStyle()); - break; + if(actionStyleWindowsXP->isEnabled()) + { + actionStyleWindowsXP->setChecked(true); + QApplication::setStyle(new QWindowsXPStyle()); + break; + } case 4: - actionStyleWindowsClassic->setChecked(true); - QApplication::setStyle(new QWindowsStyle()); - break; + if(actionStyleWindowsClassic->isEnabled()) + { + actionStyleWindowsClassic->setChecked(true); + QApplication::setStyle(new QWindowsStyle()); + break; + } default: actionStylePlastique->setChecked(true); QApplication::setStyle(new QPlastiqueStyle()); @@ -1615,7 +1627,7 @@ void MainWindow::disableUpdateReminderActionTriggered(bool checked) { if(checked) { - if(QMessageBox::Yes == QMessageBox::question(this, tr("Disable Update Reminder"), tr("Do you really want to disable the update reminder?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No)) + if(0 == QMessageBox::question(this, tr("Disable Update Reminder"), tr("Do you really want to disable the update reminder?"), tr("Yes"), tr("No"), QString(), 1)) { QMessageBox::information(this, tr("Update Reminder"), QString("%1
%2").arg(tr("The update reminder has been disabled."), tr("Please remember to check for updates at regular intervals!"))); m_settings->autoUpdateEnabled(false); @@ -1641,7 +1653,7 @@ void MainWindow::disableSoundsActionTriggered(bool checked) { if(checked) { - if(QMessageBox::Yes == QMessageBox::question(this, tr("Disable Sound Effects"), tr("Do you really want to disable all sound effects?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No)) + if(0 == QMessageBox::question(this, tr("Disable Sound Effects"), tr("Do you really want to disable all sound effects?"), tr("Yes"), tr("No"), QString(), 1)) { QMessageBox::information(this, tr("Sound Effects"), tr("All sound effects have been disabled.")); m_settings->soundsEnabled(false); @@ -1667,7 +1679,7 @@ void MainWindow::disableNeroAacNotificationsActionTriggered(bool checked) { if(checked) { - if(QMessageBox::Yes == QMessageBox::question(this, tr("Nero AAC Notifications"), tr("Do you really want to disable all Nero AAC Encoder notifications?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No)) + if(0 == QMessageBox::question(this, tr("Nero AAC Notifications"), tr("Do you really want to disable all Nero AAC Encoder notifications?"), tr("Yes"), tr("No"), QString(), 1)) { QMessageBox::information(this, tr("Nero AAC Notifications"), tr("All Nero AAC Encoder notifications have been disabled.")); m_settings->neroAacNotificationsEnabled(false); @@ -1693,7 +1705,7 @@ void MainWindow::disableWmaDecoderNotificationsActionTriggered(bool checked) { if(checked) { - if(QMessageBox::Yes == QMessageBox::question(this, tr("WMA Decoder Notifications"), tr("Do you really want to disable all WMA Decoder notifications?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No)) + if(0 == QMessageBox::question(this, tr("WMA Decoder Notifications"), tr("Do you really want to disable all WMA Decoder notifications?"), tr("Yes"), tr("No"), QString(), 1)) { QMessageBox::information(this, tr("WMA Decoder Notifications"), tr("All WMA Decoder notifications have been disabled.")); m_settings->wmaDecoderNotificationsEnabled(false); diff --git a/src/Global.cpp b/src/Global.cpp index fdaa4c42..c6f20608 100644 --- a/src/Global.cpp +++ b/src/Global.cpp @@ -1081,6 +1081,29 @@ bool lamexp_remove_file(const QString &filename) } } +/* + * Check if visual themes are enabled (WinXP and later) + */ +bool lamexp_themes_enabled(void) +{ + typedef int (WINAPI *IsAppThemedFun)(void); + + bool isAppThemed = false; + QLibrary uxTheme(QString("%1/UxTheme.dll").arg(lamexp_known_folder(lamexp_folder_systemfolder))); + IsAppThemedFun IsAppThemedPtr = (IsAppThemedFun) uxTheme.resolve("IsAppThemed"); + + if(IsAppThemedPtr) + { + isAppThemed = IsAppThemedPtr(); + if(!isAppThemed) + { + qWarning("Theme support is disabled for this process!"); + } + } + + return isAppThemed; +} + /* * Get number of free bytes on disk */ diff --git a/src/Global.h b/src/Global.h index 1869b2fd..926f9bf9 100644 --- a/src/Global.h +++ b/src/Global.h @@ -105,6 +105,7 @@ const QString lamexp_version2string(const QString &pattern, unsigned int version QString lamexp_known_folder(lamexp_known_folder_t folder_id); __int64 lamexp_free_diskspace(const QString &path); bool lamexp_remove_file(const QString &filename); +bool lamexp_themes_enabled(void); //Debug-only functions SIZE_T lamexp_dbg_private_bytes(void); diff --git a/src/Model_FileList.cpp b/src/Model_FileList.cpp index ba366e3c..546be17e 100644 --- a/src/Model_FileList.cpp +++ b/src/Model_FileList.cpp @@ -87,10 +87,10 @@ QVariant FileListModel::headerData(int section, Qt::Orientation orientation, int switch(section) { case 0: - return QVariant("Title"); + return QVariant(tr("Title")); break; case 1: - return QVariant("Full Path"); + return QVariant(tr("Full Path")); break; default: return QVariant(); diff --git a/src/Model_Settings.cpp b/src/Model_Settings.cpp index 81dbd143..21664c3b 100644 --- a/src/Model_Settings.cpp +++ b/src/Model_Settings.cpp @@ -29,6 +29,7 @@ #include #include #include +#include //Constants static const char *g_settingsId_versionNumber = "VersionNumber"; @@ -122,7 +123,7 @@ void SettingsModel::validate(void) if(!lamexp_query_translations().contains(this->currentLanguage(), Qt::CaseInsensitive)) { - qWarning("Current language is unknown, reverting to default language!"); + qWarning("Current language \"%s\" is unknown, reverting to default language!", this->currentLanguage().toLatin1().constData()); this->currentLanguage(defaultLanguage()); } } @@ -139,8 +140,8 @@ QString SettingsModel::defaultLanguage(void) } //Check if we can use the default translation - WORD systemLangId = PRIMARYLANGID(GetUserDefaultLangID()); - if(systemLangId == LANG_ENGLISH) + QLocale systemLanguage= QLocale::system(); + if(systemLanguage.language() == QLocale::English || systemLanguage.language() == QLocale::C) { m_defaultLanguage = new QString(LAMEXP_DEFAULT_LANGID); return LAMEXP_DEFAULT_LANGID; @@ -151,7 +152,7 @@ QString SettingsModel::defaultLanguage(void) while(!languages.isEmpty()) { QString currentLangId = languages.takeFirst(); - if(lamexp_translation_sysid(currentLangId) == systemLangId) + if(lamexp_translation_sysid(currentLangId) == systemLanguage.language()) { m_defaultLanguage = new QString(currentLangId); return currentLangId;