Remove QT_VERSION checks for 4.5.0

This commit is contained in:
Christophe Dumez 2012-02-25 20:20:11 +02:00
parent 1bee9c6a9d
commit 0c279e0567
8 changed files with 11 additions and 63 deletions

View File

@ -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)) {

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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();
}

View File

@ -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() {

View File

@ -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<SearchTab> currentSearchTab;
#if QT_VERSION < 0x040500
QPushButton *closeTab_button;
#endif
QList<QPointer<SearchTab> > all_tab; // To store all tabs
const SearchCategories full_cat_names;
MainWindow *mp_mainWindow;