From 0c279e056792fbe60a78c6cde7b083df3b1f721f Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sat, 25 Feb 2012 20:20:11 +0200 Subject: [PATCH] Remove QT_VERSION checks for 4.5.0 --- src/iconprovider.cpp | 8 +++--- src/iconprovider.h | 2 +- src/mainwindow.cpp | 2 +- src/preferences/advancedsettings.h | 8 +++--- src/preferences/options_imp.cpp | 4 --- src/preferences/preferences.h | 2 +- src/searchengine/searchengine.cpp | 41 ------------------------------ src/searchengine/searchengine.h | 7 ----- 8 files changed, 11 insertions(+), 63 deletions(-) diff --git a/src/iconprovider.cpp b/src/iconprovider.cpp index 08a536470..980f879d5 100644 --- a/src/iconprovider.cpp +++ b/src/iconprovider.cpp @@ -35,7 +35,7 @@ IconProvider* IconProvider::m_instance = 0; IconProvider::IconProvider() { -#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0)) +#if defined(Q_WS_X11) m_useSystemTheme = Preferences().useSystemIconTheme(); #endif } @@ -57,7 +57,7 @@ void IconProvider::drop() QIcon IconProvider::getIcon(const QString &iconId) { -#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0)) +#if defined(Q_WS_X11) if (m_useSystemTheme) { QIcon icon = QIcon::fromTheme(iconId, QIcon(":/Icons/oxygen/"+iconId+".png")); icon = generateDifferentSizes(icon); @@ -67,7 +67,7 @@ QIcon IconProvider::getIcon(const QString &iconId) return QIcon(":/Icons/oxygen/"+iconId+".png"); } -#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0)) +#if defined(Q_WS_X11) void IconProvider::useSystemIconTheme(bool enable) { m_useSystemTheme = enable; @@ -102,7 +102,7 @@ QIcon IconProvider::generateDifferentSizes(const QIcon &icon) QString IconProvider::getIconPath(const QString &iconId) { -#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0)) +#if defined(Q_WS_X11) if (m_useSystemTheme) { QString path = QDir::temp().absoluteFilePath(iconId+".png"); if (!QFile::exists(path)) { diff --git a/src/iconprovider.h b/src/iconprovider.h index eec415330..280cb46af 100644 --- a/src/iconprovider.h +++ b/src/iconprovider.h @@ -48,7 +48,7 @@ public: QIcon getIcon(const QString& iconId); QString getIconPath(const QString &iconId); -#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0)) +#if defined(Q_WS_X11) public: void useSystemIconTheme(bool enable); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 6037cbd4b..067c98c1d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1077,7 +1077,7 @@ void MainWindow::loadPreferences(bool configure_session) { properties->reloadPreferences(); // Icon provider -#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0)) +#if defined(Q_WS_X11) IconProvider::instance()->useSystemIconTheme(pref.useSystemIconTheme()); #endif diff --git a/src/preferences/advancedsettings.h b/src/preferences/advancedsettings.h index 1fc54b9d5..496ab2764 100644 --- a/src/preferences/advancedsettings.h +++ b/src/preferences/advancedsettings.h @@ -17,7 +17,7 @@ enum AdvSettingsRows {DISK_CACHE, OUTGOING_PORT_MIN, OUTGOING_PORT_MAX, IGNORE_L #if defined(Q_WS_WIN) || defined(Q_WS_MAC) UPDATE_CHECK, #endif - #if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0)) + #if defined(Q_WS_X11) USE_ICON_THEME, #endif CONFIRM_DELETE_TORRENT, TRACKER_EXCHANGE, @@ -36,7 +36,7 @@ private: #if defined(Q_WS_WIN) || defined(Q_WS_MAC) QCheckBox cb_update_check; #endif -#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0)) +#if defined(Q_WS_X11) QCheckBox cb_use_icon_theme; #endif QCheckBox cb_announce_all_trackers; @@ -105,7 +105,7 @@ public slots: pref.setUpdateCheckEnabled(cb_update_check.isChecked()); #endif // Icon theme -#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0)) +#if defined(Q_WS_X11) pref.useSystemIconTheme(cb_use_icon_theme.isChecked()); #endif pref.setConfirmTorrentDeletion(cb_confirm_torrent_deletion.isChecked()); @@ -225,7 +225,7 @@ private slots: cb_update_check.setChecked(pref.isUpdateCheckEnabled()); setRow(UPDATE_CHECK, tr("Check for software updates"), &cb_update_check); #endif -#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0)) +#if defined(Q_WS_X11) cb_use_icon_theme.setChecked(pref.useSystemIconTheme()); setRow(USE_ICON_THEME, tr("Use system icon theme"), &cb_use_icon_theme); #endif diff --git a/src/preferences/options_imp.cpp b/src/preferences/options_imp.cpp index 1bf55895d..fcddb8e1d 100644 --- a/src/preferences/options_imp.cpp +++ b/src/preferences/options_imp.cpp @@ -99,11 +99,7 @@ options_imp::options_imp(QWidget *parent): // Load week days (scheduler) for (uint i=1; i<=7; ++i) { -#if QT_VERSION >= 0x040500 schedule_days->addItem(QDate::longDayName(i, QDate::StandaloneFormat)); -#else - schedule_days->addItem(QDate::longDayName(i)); -#endif } // Load options diff --git a/src/preferences/preferences.h b/src/preferences/preferences.h index 5ee162026..8cbe7baae 100644 --- a/src/preferences/preferences.h +++ b/src/preferences/preferences.h @@ -1043,7 +1043,7 @@ public: setValue(QString::fromUtf8("Preferences/Advanced/AnnounceToAllTrackers"), enabled); } -#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0)) +#if defined(Q_WS_X11) bool useSystemIconTheme() const { return value(QString::fromUtf8("Preferences/Advanced/useSystemIconTheme"), true).toBool(); } diff --git a/src/searchengine/searchengine.cpp b/src/searchengine/searchengine.cpp index 5381168c2..39954a997 100644 --- a/src/searchengine/searchengine.cpp +++ b/src/searchengine/searchengine.cpp @@ -71,17 +71,8 @@ SearchEngine::SearchEngine(MainWindow *parent) : QWidget(parent), mp_mainWindow( // new qCompleter to the search pattern startSearchHistory(); createCompleter(); -#if (QT_VERSION >= QT_VERSION_CHECK(4,5,0)) tabWidget->setTabsClosable(true); connect(tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int))); -#else - // Add close tab button - closeTab_button = new QPushButton(); - closeTab_button->setIcon(IconProvider::instance()->getIcon("tab-close")); - closeTab_button->setFlat(true); - tabWidget->setCornerWidget(closeTab_button); - connect(closeTab_button, SIGNAL(clicked()), this, SLOT(closeTab_button_clicked())); -#endif // Boolean initialization search_stopped = false; // Creating Search Process @@ -197,9 +188,6 @@ SearchEngine::~SearchEngine() { downloader->waitForFinished(); delete downloader; } -#if QT_VERSION < 0x040500 - delete closeTab_button; -#endif delete searchTimeout; delete searchProcess; delete supported_engines; @@ -339,9 +327,6 @@ void SearchEngine::on_search_button_clicked() { tabName.replace(QRegExp("&{1}"), "&&"); tabWidget->addTab(currentSearchTab, tabName); tabWidget->setCurrentWidget(currentSearchTab); -#if QT_VERSION < 0x040500 - closeTab_button->setEnabled(true); -#endif // if the pattern is not in the pattern QStringList wordList = searchHistory.stringList(); if (wordList.indexOf(pattern) == -1) { @@ -665,7 +650,6 @@ void SearchEngine::appendSearchResult(const QString &line) { goToDescBtn->setEnabled(true); } -#if QT_VERSION >= 0x040500 void SearchEngine::closeTab(int index) { if (index == tabWidget->indexOf(currentSearchTab)) { qDebug("Deleted current search Tab"); @@ -684,31 +668,6 @@ void SearchEngine::closeTab(int index) { goToDescBtn->setEnabled(false); } } -#else -// Clear search results list -void SearchEngine::closeTab_button_clicked() { - if (all_tab.size()) { - qDebug("currentTab rank: %d", tabWidget->currentIndex()); - qDebug("currentSearchTab rank: %d", tabWidget->indexOf(currentSearchTab)); - if (tabWidget->currentIndex() == tabWidget->indexOf(currentSearchTab)) { - qDebug("Deleted current search Tab"); - if (searchProcess->state() != QProcess::NotRunning) { - searchProcess->terminate(); - } - if (searchTimeout->isActive()) { - searchTimeout->stop(); - } - search_stopped = true; - currentSearchTab = 0; - } - delete all_tab.takeAt(tabWidget->currentIndex()); - if (!all_tab.size()) { - closeTab_button->setEnabled(false); - download_button->setEnabled(false); - } - } -} -#endif // Download selected items in search results list void SearchEngine::on_download_button_clicked() { diff --git a/src/searchengine/searchengine.h b/src/searchengine/searchengine.h index ef92427b3..2545eec56 100644 --- a/src/searchengine/searchengine.h +++ b/src/searchengine/searchengine.h @@ -94,11 +94,7 @@ protected slots: // Search slots void tab_changed(int);//to prevent the use of the download button when the tab is empty void on_search_button_clicked(); -#if QT_VERSION < 0x040500 - void closeTab_button_clicked(); -#else void closeTab(int index); -#endif void appendSearchResult(const QString &line); void searchFinished(int exitcode,QProcess::ExitStatus); void readSearchOutput(); @@ -137,9 +133,6 @@ private: SupportedEngines *supported_engines; QTimer *searchTimeout; QPointer currentSearchTab; -#if QT_VERSION < 0x040500 - QPushButton *closeTab_button; -#endif QList > all_tab; // To store all tabs const SearchCategories full_cat_names; MainWindow *mp_mainWindow;