From 9564b0a5a9537ad3e358488a16be9ad8f6a7b31c Mon Sep 17 00:00:00 2001 From: nowrep Date: Wed, 28 Dec 2011 13:16:04 +0100 Subject: [PATCH] Cleaned #ifdefs, Preferences in menu on all platforms. Closes #96 --- src/app/mainapplication.cpp | 24 ++++++++++-------------- src/app/qupzilla.cpp | 4 ++-- src/downloads/downloadmanager.cpp | 15 ++++++++------- src/preferences/preferences.cpp | 24 ++++++++++-------------- src/preferences/thememanager.cpp | 14 +++++++------- src/webview/tabbar.cpp | 3 +++ translations/cs_CZ.ts | 24 ++++++++++++------------ translations/de_DE.ts | 24 ++++++++++++------------ translations/el_GR.ts | 24 ++++++++++++------------ translations/empty.ts | 24 ++++++++++++------------ translations/es_ES.ts | 24 ++++++++++++------------ translations/fr_FR.ts | 24 ++++++++++++------------ translations/it_IT.ts | 24 ++++++++++++------------ translations/nl_NL.ts | 24 ++++++++++++------------ translations/pl_PL.ts | 24 ++++++++++++------------ translations/ru_RU.ts | 24 ++++++++++++------------ translations/zh_CN.ts | 24 ++++++++++++------------ 17 files changed, 172 insertions(+), 176 deletions(-) diff --git a/src/app/mainapplication.cpp b/src/app/mainapplication.cpp index 6dbe7e50d..a461957b7 100644 --- a/src/app/mainapplication.cpp +++ b/src/app/mainapplication.cpp @@ -44,6 +44,14 @@ #include "speeddial.h" #include "webpage.h" +#ifdef Q_WS_WIN +#define DEFAULT_CHECK_UPDATES true +#define DEFAULT_THEME_NAME "windows" +#else +#define DEFAULT_CHECK_UPDATES false +#define DEFAULT_THEME_NAME "linux" +#endif + MainApplication::MainApplication(const QList &cmdActions, int &argc, char** argv) : QtSingleApplication("QupZillaWebBrowser", argc, argv) , m_cookiemanager(0) @@ -179,13 +187,7 @@ MainApplication::MainApplication(const QList &cm AutoSaver* saver = new AutoSaver(); connect(saver, SIGNAL(saveApp()), this, SLOT(saveStateSlot())); - if (settings2.value("Web-Browser-Settings/CheckUpdates", -#ifdef Q_WS_WIN - true -#else - false -#endif - ).toBool()) { + if (settings2.value("Web-Browser-Settings/CheckUpdates", DEFAULT_CHECK_UPDATES).toBool()) { m_updater = new Updater(qupzilla); } @@ -206,13 +208,7 @@ void MainApplication::loadSettings() { QSettings settings(m_activeProfil + "settings.ini", QSettings::IniFormat); settings.beginGroup("Themes"); - QString activeTheme = settings.value("activeTheme", -#ifdef Q_WS_X11 - "linux" -#else - "windows" -#endif - ).toString(); + QString activeTheme = settings.value("activeTheme", DEFAULT_THEME_NAME).toString(); settings.endGroup(); m_activeThemePath = THEMESDIR + activeTheme + "/"; QFile cssFile(m_activeThemePath + "main.css"); diff --git a/src/app/qupzilla.cpp b/src/app/qupzilla.cpp index 513a00764..ec1382d59 100644 --- a/src/app/qupzilla.cpp +++ b/src/app/qupzilla.cpp @@ -309,7 +309,7 @@ void QupZilla::setupMenu() m_menuEdit->addAction(QIcon::fromTheme("edit-select-all"), tr("Select &All"), this, SLOT(selectAll()))->setShortcut(QKeySequence("Ctrl+A")); m_menuEdit->addAction(QIcon::fromTheme("edit-find"), tr("&Find"), this, SLOT(searchOnPage()))->setShortcut(QKeySequence("Ctrl+F")); m_menuEdit->addSeparator(); -#ifdef Q_WS_X11 +#ifndef Q_WS_WIN m_menuEdit->addAction(QIcon(":/icons/faenza/settings.png"), tr("Pr&eferences"), this, SLOT(showPreferences()))->setShortcut(QKeySequence("Ctrl+P")); #endif menuBar()->addMenu(m_menuEdit); @@ -844,7 +844,7 @@ void QupZilla::aboutToHideEditMenu() } m_menuEdit->actions().at(9)->setEnabled(true); -#ifdef Q_WS_X11 +#ifndef Q_WS_WIN m_menuEdit->actions().at(11)->setEnabled(true); #endif } diff --git a/src/downloads/downloadmanager.cpp b/src/downloads/downloadmanager.cpp index fc295bcfc..88c530241 100644 --- a/src/downloads/downloadmanager.cpp +++ b/src/downloads/downloadmanager.cpp @@ -28,6 +28,13 @@ #include "webpage.h" #include "downloadfilehelper.h" +#ifdef Q_WS_WIN +#define DEFAULT_USE_NATIVE_DIALOG false +#else +#define DEFAULT_USE_NATIVE_DIALOG true + +#endif + DownloadManager::DownloadManager(QWidget* parent) : QWidget(parent) , ui(new Ui::DownloadManager) @@ -63,13 +70,7 @@ void DownloadManager::loadSettings() m_downloadPath = settings.value("defaultDownloadPath", "").toString(); m_lastDownloadPath = settings.value("lastDownloadPath", QDir::homePath() + "/").toString(); m_closeOnFinish = settings.value("CloseManagerOnFinish", false).toBool(); - m_useNativeDialog = settings.value("useNativeDialog", -#ifdef Q_WS_WIN - false -#else - true -#endif - ).toBool(); + m_useNativeDialog = settings.value("useNativeDialog", DEFAULT_USE_NATIVE_DIALOG).toBool(); settings.endGroup(); } diff --git a/src/preferences/preferences.cpp b/src/preferences/preferences.cpp index d0edcd9ad..5d81c791a 100644 --- a/src/preferences/preferences.cpp +++ b/src/preferences/preferences.cpp @@ -40,6 +40,14 @@ #include "globalfunctions.h" #include "autofillmodel.h" +#ifdef Q_WS_WIN +#define DEFAULT_CHECK_UPDATES true +#define DEFAULT_USE_NATIVE_DIALOG false +#else +#define DEFAULT_CHECK_UPDATES false +#define DEFAULT_USE_NATIVE_DIALOG true +#endif + bool removeFile(const QString &fullFileName) { QFile f(fullFileName); @@ -116,13 +124,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent) int afterLaunch = settings.value("afterLaunch", 1).toInt(); settings.endGroup(); ui->afterLaunch->setCurrentIndex(afterLaunch); - ui->checkUpdates->setChecked(settings.value("Web-Browser-Settings/CheckUpdates", -#ifdef Q_WS_WIN - true -#else - false -#endif - ).toBool()); + ui->checkUpdates->setChecked(settings.value("Web-Browser-Settings/CheckUpdates", DEFAULT_CHECK_UPDATES).toBool()); ui->newTabFrame->setVisible(false); if (m_newTabUrl.isEmpty()) { @@ -268,13 +270,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent) settings.beginGroup("DownloadManager"); ui->downLoc->setText(settings.value("defaultDownloadPath", "").toString()); ui->closeDownManOnFinish->setChecked(settings.value("CloseManagerOnFinish", false).toBool()); - ui->downlaodNativeSystemDialog->setChecked(settings.value("useNativeDialog", -#ifdef Q_WS_WIN - false -#else - true -#endif - ).toBool()); + ui->downlaodNativeSystemDialog->setChecked(settings.value("useNativeDialog", DEFAULT_USE_NATIVE_DIALOG).toBool()); if (ui->downLoc->text().isEmpty()) { ui->askEverytime->setChecked(true); } diff --git a/src/preferences/thememanager.cpp b/src/preferences/thememanager.cpp index 6673e8a7f..59eeddbd3 100644 --- a/src/preferences/thememanager.cpp +++ b/src/preferences/thememanager.cpp @@ -20,6 +20,12 @@ #include "mainapplication.h" #include "globalfunctions.h" +#ifdef Q_WS_WIN +#define DEFAULT_THEME_NAME "windows" +#else +#define DEFAULT_THEME_NAME "linux" +#endif + ThemeManager::ThemeManager(QWidget* parent) : QWidget() , ui(new Ui::ThemeManager) @@ -28,13 +34,7 @@ ThemeManager::ThemeManager(QWidget* parent) ui->license->hide(); QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat); settings.beginGroup("Themes"); - m_activeTheme = settings.value("activeTheme", -#ifdef Q_WS_X11 - "linux" -#else - "windows" -#endif - ).toString(); + m_activeTheme = settings.value("activeTheme", DEFAULT_THEME_NAME).toString(); settings.endGroup(); QDir themeDir(mApp->THEMESDIR); diff --git a/src/webview/tabbar.cpp b/src/webview/tabbar.cpp index be7a8319f..fd7305c28 100644 --- a/src/webview/tabbar.cpp +++ b/src/webview/tabbar.cpp @@ -24,8 +24,11 @@ #define MAXIMUM_TAB_WIDTH 250 #define MINIMUM_TAB_WIDTH 50 + #ifdef Q_WS_WIN #define PINNED_TAB_WIDTH 38 +#elif defined(KDE) +#define PINNED_TAB_WIDTH 24 #else #define PINNED_TAB_WIDTH 31 #endif diff --git a/translations/cs_CZ.ts b/translations/cs_CZ.ts index b7b6ce211..7765405d8 100644 --- a/translations/cs_CZ.ts +++ b/translations/cs_CZ.ts @@ -1713,12 +1713,12 @@ nebyl nalezen! MainApplication - + Last session crashed Poslední relace spadla - + <b>QupZilla crashed :-(</b><br/>Oops, the last session of QupZilla was interrupted unexpectedly. We apologize for this. Would you like to try restoring the last saved state? <b>QupZilla spadla :-(</b><br/>Oops, poslední relace QupZilly skončila jejím pádem. Velice se omlouváme. Přejete si obnovit uložený stav? @@ -3319,32 +3319,32 @@ nebyl nalezen! Překladatelé - + Speed Dial Rychlá volba - + Add New Page Přidat novou stránku - + Apply Uložit - + Load title from page Načíst titulek ze stránky - + Edit Upravit - + Remove Odstranit @@ -3354,22 +3354,22 @@ nebyl nalezen! E-mail je nepovinný<br/><b>Poznámka: </b>Používejte prosím pouze anglický jazyk. - + Reload Načíst znovu - + Url Adresa - + Title Titulek - + New Page Nová stránka diff --git a/translations/de_DE.ts b/translations/de_DE.ts index 698ec9ca0..47e84b751 100644 --- a/translations/de_DE.ts +++ b/translations/de_DE.ts @@ -1705,12 +1705,12 @@ MainApplication - + Last session crashed Die letzte Sitzung wurde unerwartet beendet - + <b>QupZilla crashed :-(</b><br/>Oops, the last session of QupZilla was interrupted unexpectedly. We apologize for this. Would you like to try restoring the last saved state? <b>QupZilla ist abgestürzt :-(</b><br/>Hoppla,die letzte Sitzung wurde unerwartet beendet. Verzeihung. Möchten Sie den letzten Status wiederherstellen? @@ -3245,52 +3245,52 @@ Übersetzer - + Speed Dial Schnellwahl - + Add New Page Neue Seite hinzufügen - + Apply - + Load title from page - + Edit Bearbeiten - + Remove Entfernen - + Reload Neu laden - + Url Url - + Title Titel - + New Page Neue Seite diff --git a/translations/el_GR.ts b/translations/el_GR.ts index c1f8da34b..c0b7c5954 100644 --- a/translations/el_GR.ts +++ b/translations/el_GR.ts @@ -1649,12 +1649,12 @@ MainApplication - + Last session crashed Η τελευταία συνεδρία κατέρρευσε - + <b>QupZilla crashed :-(</b><br/>Oops, the last session of QupZilla was interrupted unexpectedly. We apologize for this. Would you like to try restoring the last saved state? Το <b>QupZilla κατέρρευσε :-(</b><br/>Ούπς, η τελευταία συνεδρία του QupZilla διακόπηκε απροσδόκητα. Ζητάμε συγνώμη για αυτό. Θα θέλατε να δοκιμάσετε την επαναφορά στην ποιο πρόσφατα αποθηκευμένη κατάσταση; @@ -3229,32 +3229,32 @@ Μεταφραστές - + Speed Dial Γρήγορη κλήση - + Add New Page Προσθήκη νέας σελίδας - + Apply Εφαρμογή - + Load title from page Φόρτωση τίτλου από σελίδα - + Edit Επεξεργασία - + Remove Αφαίρεση @@ -3264,22 +3264,22 @@ Το e-mail είναι προαιρετικό<br/><b>Σημείωση: </b>Παρακαλώ χρησιμοποιείστε μόνο Αγγλική γλώσσα. - + Reload Ανανέωση - + Url Url - + Title Τίτλος - + New Page Νέα σελίδα diff --git a/translations/empty.ts b/translations/empty.ts index 3d820115f..c07cecc81 100644 --- a/translations/empty.ts +++ b/translations/empty.ts @@ -1646,12 +1646,12 @@ MainApplication - + Last session crashed - + <b>QupZilla crashed :-(</b><br/>Oops, the last session of QupZilla was interrupted unexpectedly. We apologize for this. Would you like to try restoring the last saved state? @@ -3221,32 +3221,32 @@ - + Speed Dial - + Add New Page - + Apply - + Load title from page - + Edit - + Remove @@ -3256,22 +3256,22 @@ - + Reload - + Url - + Title - + New Page diff --git a/translations/es_ES.ts b/translations/es_ES.ts index 8a3caaa68..e37edca32 100644 --- a/translations/es_ES.ts +++ b/translations/es_ES.ts @@ -1704,12 +1704,12 @@ MainApplication - + Last session crashed La última sesión se cerró inesperadamente - + <b>QupZilla crashed :-(</b><br/>Oops, the last session of QupZilla was interrupted unexpectedly. We apologize for this. Would you like to try restoring the last saved state? <b>QupZilla se cerró inesperadamente :-(</b><br/>Lo sentimos, la última sesión de QupZilla terminó inesperadamente. ¿Le gustaría intentar restaurar la última sesión? @@ -3308,32 +3308,32 @@ Traductores - + Speed Dial Speed Dial - + Add New Page Añadir página nueva - + Apply Aplicar - + Load title from page Cargar título desde la página - + Edit Editar - + Remove Eliminar @@ -3343,22 +3343,22 @@ El correo electrónico es opcional<br/><b>Nota: </b>Por favor, usen únicamente el inglés. - + Reload Recargar - + Url Dirección - + Title Nombre - + New Page Página nueva diff --git a/translations/fr_FR.ts b/translations/fr_FR.ts index 2869f7850..0c876e65f 100644 --- a/translations/fr_FR.ts +++ b/translations/fr_FR.ts @@ -1699,12 +1699,12 @@ n'a pas été trouvé! MainApplication - + Last session crashed La dernière session a planté - + <b>QupZilla crashed :-(</b><br/>Oops, the last session of QupZilla was interrupted unexpectedly. We apologize for this. Would you like to try restoring the last saved state? <b>QupZilla a planté :-(</b><br/>Oops, la dernière session de QupZilla s'est terminée par un incident. Nous sommes vraiment désolé. Voulez-vous essayer de restaurer la dernière session? @@ -3291,33 +3291,33 @@ n'a pas été trouvé! Traducteurs - + Speed Dial Speed Dial - + Add New Page Ajouter une nouvelle page - + Apply Appliquer - + Load title from page ??? Charger le titre de la page - + Edit Modifier - + Remove Supprimer @@ -3327,22 +3327,22 @@ n'a pas été trouvé! - + Reload Actualiser - + Url URL - + Title Titre - + New Page Nouvelle Page diff --git a/translations/it_IT.ts b/translations/it_IT.ts index 8627ae35c..496dfad5e 100644 --- a/translations/it_IT.ts +++ b/translations/it_IT.ts @@ -1696,12 +1696,12 @@ MainApplication - + Last session crashed Ultima sessione chiusa - + <b>QupZilla crashed :-(</b><br/>Oops, the last session of QupZilla was interrupted unexpectedly. We apologize for this. Would you like to try restoring the last saved state? @@ -3303,32 +3303,32 @@ Traduttori - + Speed Dial - + Add New Page - + Apply - + Load title from page - + Edit Modifica - + Remove @@ -3338,22 +3338,22 @@ - + Reload Ricarica - + Url - + Title Titolo - + New Page diff --git a/translations/nl_NL.ts b/translations/nl_NL.ts index 67bd9e0de..07039025b 100644 --- a/translations/nl_NL.ts +++ b/translations/nl_NL.ts @@ -1705,12 +1705,12 @@ werd niet gevonden! MainApplication - + Last session crashed Laatste sessie gecrashed - + <b>QupZilla crashed :-(</b><br/>Oops, the last session of QupZilla was interrupted unexpectedly. We apologize for this. Would you like to try restoring the last saved state? <b>QupZilla crashte :-(</b><br/>Oeps, de laatste sessie van QupZilla eindigde met een crash. We verontschuldigen ons. Wilt u proberen om de opgeslagen status te herstellen? @@ -3311,32 +3311,32 @@ werd niet gevonden! Vertalers - + Speed Dial Speed Dial - + Add New Page Voeg nieuwe pagina toe - + Apply - + Load title from page - + Edit Bewerk - + Remove Verwijder @@ -3346,22 +3346,22 @@ werd niet gevonden! - + Reload Herlaad - + Url URL - + Title Titel - + New Page Nieuwe pagina diff --git a/translations/pl_PL.ts b/translations/pl_PL.ts index 007e20ffe..a44cd485c 100644 --- a/translations/pl_PL.ts +++ b/translations/pl_PL.ts @@ -1774,12 +1774,12 @@ p, li { white-space: pre-wrap; } MainApplication - + Last session crashed Wystąpił błąd w ostatniej sesji - + <b>QupZilla crashed :-(</b><br/>Oops, the last session of QupZilla was interrupted unexpectedly. We apologize for this. Would you like to try restoring the last saved state? @@ -3451,32 +3451,32 @@ p, li { white-space: pre-wrap; } - + Speed Dial - + Add New Page - + Apply - + Load title from page - + Edit Edytuj - + Remove Usuń @@ -3486,22 +3486,22 @@ p, li { white-space: pre-wrap; } - + Reload Odświerz - + Url Adres - + Title - + New Page diff --git a/translations/ru_RU.ts b/translations/ru_RU.ts index b13d68004..031d72955 100644 --- a/translations/ru_RU.ts +++ b/translations/ru_RU.ts @@ -1653,12 +1653,12 @@ MainApplication - + Last session crashed Последняя сессия завершилась неудачно - + <b>QupZilla crashed :-(</b><br/>Oops, the last session of QupZilla was interrupted unexpectedly. We apologize for this. Would you like to try restoring the last saved state? <b>QupZilla упал :-(</b><br/>К сожалению, последняя сессия QupZilla была завершена неудачно. Вы хотите попробовать восстановить её? @@ -3236,32 +3236,32 @@ Переводчики - + Speed Dial Страница быстрого доступа - + Add New Page Добавить новую страницу - + Apply Применить - + Load title from page Загрузить назвние из страницы - + Edit Изменить - + Remove Удалить @@ -3271,22 +3271,22 @@ E-mail необязателен<br/><b>Примечание:</b> Пожалуйста, используйте только английский язык. - + Reload Обновить - + Url Url - + Title Название - + New Page Новая страница diff --git a/translations/zh_CN.ts b/translations/zh_CN.ts index 327ca0a23..1bf4f2938 100644 --- a/translations/zh_CN.ts +++ b/translations/zh_CN.ts @@ -1702,12 +1702,12 @@ MainApplication - + Last session crashed 会话崩溃 - + <b>QupZilla crashed :-(</b><br/>Oops, the last session of QupZilla was interrupted unexpectedly. We apologize for this. Would you like to try restoring the last saved state? QupZilla上次结束时崩溃,我们非常遗憾。您要还原保存的状态吗? @@ -3306,32 +3306,32 @@ 翻译 - + Speed Dial 快速拨号 - + Add New Page 添加新网页 - + Apply - + Load title from page - + Edit 编辑 - + Remove 删除 @@ -3341,22 +3341,22 @@ - + Reload 刷新 - + Url 地址 - + Title 标题 - + New Page 新网页