mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-27 08:19:30 +08:00
Remove QT_VERSION checks for 4.5.0
This commit is contained in:
parent
1bee9c6a9d
commit
0c279e0567
@ -35,7 +35,7 @@ IconProvider* IconProvider::m_instance = 0;
|
|||||||
|
|
||||||
IconProvider::IconProvider()
|
IconProvider::IconProvider()
|
||||||
{
|
{
|
||||||
#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0))
|
#if defined(Q_WS_X11)
|
||||||
m_useSystemTheme = Preferences().useSystemIconTheme();
|
m_useSystemTheme = Preferences().useSystemIconTheme();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -57,7 +57,7 @@ void IconProvider::drop()
|
|||||||
|
|
||||||
QIcon IconProvider::getIcon(const QString &iconId)
|
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) {
|
if (m_useSystemTheme) {
|
||||||
QIcon icon = QIcon::fromTheme(iconId, QIcon(":/Icons/oxygen/"+iconId+".png"));
|
QIcon icon = QIcon::fromTheme(iconId, QIcon(":/Icons/oxygen/"+iconId+".png"));
|
||||||
icon = generateDifferentSizes(icon);
|
icon = generateDifferentSizes(icon);
|
||||||
@ -67,7 +67,7 @@ QIcon IconProvider::getIcon(const QString &iconId)
|
|||||||
return QIcon(":/Icons/oxygen/"+iconId+".png");
|
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)
|
void IconProvider::useSystemIconTheme(bool enable)
|
||||||
{
|
{
|
||||||
m_useSystemTheme = enable;
|
m_useSystemTheme = enable;
|
||||||
@ -102,7 +102,7 @@ QIcon IconProvider::generateDifferentSizes(const QIcon &icon)
|
|||||||
|
|
||||||
QString IconProvider::getIconPath(const QString &iconId)
|
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) {
|
if (m_useSystemTheme) {
|
||||||
QString path = QDir::temp().absoluteFilePath(iconId+".png");
|
QString path = QDir::temp().absoluteFilePath(iconId+".png");
|
||||||
if (!QFile::exists(path)) {
|
if (!QFile::exists(path)) {
|
||||||
|
@ -48,7 +48,7 @@ public:
|
|||||||
QIcon getIcon(const QString& iconId);
|
QIcon getIcon(const QString& iconId);
|
||||||
QString getIconPath(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:
|
public:
|
||||||
void useSystemIconTheme(bool enable);
|
void useSystemIconTheme(bool enable);
|
||||||
|
|
||||||
|
@ -1077,7 +1077,7 @@ void MainWindow::loadPreferences(bool configure_session) {
|
|||||||
properties->reloadPreferences();
|
properties->reloadPreferences();
|
||||||
|
|
||||||
// Icon provider
|
// 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());
|
IconProvider::instance()->useSystemIconTheme(pref.useSystemIconTheme());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -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)
|
#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
|
||||||
UPDATE_CHECK,
|
UPDATE_CHECK,
|
||||||
#endif
|
#endif
|
||||||
#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0))
|
#if defined(Q_WS_X11)
|
||||||
USE_ICON_THEME,
|
USE_ICON_THEME,
|
||||||
#endif
|
#endif
|
||||||
CONFIRM_DELETE_TORRENT, TRACKER_EXCHANGE,
|
CONFIRM_DELETE_TORRENT, TRACKER_EXCHANGE,
|
||||||
@ -36,7 +36,7 @@ private:
|
|||||||
#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
|
#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
|
||||||
QCheckBox cb_update_check;
|
QCheckBox cb_update_check;
|
||||||
#endif
|
#endif
|
||||||
#if defined(Q_WS_X11) && (QT_VERSION >= QT_VERSION_CHECK(4,6,0))
|
#if defined(Q_WS_X11)
|
||||||
QCheckBox cb_use_icon_theme;
|
QCheckBox cb_use_icon_theme;
|
||||||
#endif
|
#endif
|
||||||
QCheckBox cb_announce_all_trackers;
|
QCheckBox cb_announce_all_trackers;
|
||||||
@ -105,7 +105,7 @@ public slots:
|
|||||||
pref.setUpdateCheckEnabled(cb_update_check.isChecked());
|
pref.setUpdateCheckEnabled(cb_update_check.isChecked());
|
||||||
#endif
|
#endif
|
||||||
// Icon theme
|
// 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());
|
pref.useSystemIconTheme(cb_use_icon_theme.isChecked());
|
||||||
#endif
|
#endif
|
||||||
pref.setConfirmTorrentDeletion(cb_confirm_torrent_deletion.isChecked());
|
pref.setConfirmTorrentDeletion(cb_confirm_torrent_deletion.isChecked());
|
||||||
@ -225,7 +225,7 @@ private slots:
|
|||||||
cb_update_check.setChecked(pref.isUpdateCheckEnabled());
|
cb_update_check.setChecked(pref.isUpdateCheckEnabled());
|
||||||
setRow(UPDATE_CHECK, tr("Check for software updates"), &cb_update_check);
|
setRow(UPDATE_CHECK, tr("Check for software updates"), &cb_update_check);
|
||||||
#endif
|
#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());
|
cb_use_icon_theme.setChecked(pref.useSystemIconTheme());
|
||||||
setRow(USE_ICON_THEME, tr("Use system icon theme"), &cb_use_icon_theme);
|
setRow(USE_ICON_THEME, tr("Use system icon theme"), &cb_use_icon_theme);
|
||||||
#endif
|
#endif
|
||||||
|
@ -99,11 +99,7 @@ options_imp::options_imp(QWidget *parent):
|
|||||||
|
|
||||||
// Load week days (scheduler)
|
// Load week days (scheduler)
|
||||||
for (uint i=1; i<=7; ++i) {
|
for (uint i=1; i<=7; ++i) {
|
||||||
#if QT_VERSION >= 0x040500
|
|
||||||
schedule_days->addItem(QDate::longDayName(i, QDate::StandaloneFormat));
|
schedule_days->addItem(QDate::longDayName(i, QDate::StandaloneFormat));
|
||||||
#else
|
|
||||||
schedule_days->addItem(QDate::longDayName(i));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load options
|
// Load options
|
||||||
|
@ -1043,7 +1043,7 @@ public:
|
|||||||
setValue(QString::fromUtf8("Preferences/Advanced/AnnounceToAllTrackers"), enabled);
|
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 {
|
bool useSystemIconTheme() const {
|
||||||
return value(QString::fromUtf8("Preferences/Advanced/useSystemIconTheme"), true).toBool();
|
return value(QString::fromUtf8("Preferences/Advanced/useSystemIconTheme"), true).toBool();
|
||||||
}
|
}
|
||||||
|
@ -71,17 +71,8 @@ SearchEngine::SearchEngine(MainWindow *parent) : QWidget(parent), mp_mainWindow(
|
|||||||
// new qCompleter to the search pattern
|
// new qCompleter to the search pattern
|
||||||
startSearchHistory();
|
startSearchHistory();
|
||||||
createCompleter();
|
createCompleter();
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(4,5,0))
|
|
||||||
tabWidget->setTabsClosable(true);
|
tabWidget->setTabsClosable(true);
|
||||||
connect(tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
|
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
|
// Boolean initialization
|
||||||
search_stopped = false;
|
search_stopped = false;
|
||||||
// Creating Search Process
|
// Creating Search Process
|
||||||
@ -197,9 +188,6 @@ SearchEngine::~SearchEngine() {
|
|||||||
downloader->waitForFinished();
|
downloader->waitForFinished();
|
||||||
delete downloader;
|
delete downloader;
|
||||||
}
|
}
|
||||||
#if QT_VERSION < 0x040500
|
|
||||||
delete closeTab_button;
|
|
||||||
#endif
|
|
||||||
delete searchTimeout;
|
delete searchTimeout;
|
||||||
delete searchProcess;
|
delete searchProcess;
|
||||||
delete supported_engines;
|
delete supported_engines;
|
||||||
@ -339,9 +327,6 @@ void SearchEngine::on_search_button_clicked() {
|
|||||||
tabName.replace(QRegExp("&{1}"), "&&");
|
tabName.replace(QRegExp("&{1}"), "&&");
|
||||||
tabWidget->addTab(currentSearchTab, tabName);
|
tabWidget->addTab(currentSearchTab, tabName);
|
||||||
tabWidget->setCurrentWidget(currentSearchTab);
|
tabWidget->setCurrentWidget(currentSearchTab);
|
||||||
#if QT_VERSION < 0x040500
|
|
||||||
closeTab_button->setEnabled(true);
|
|
||||||
#endif
|
|
||||||
// if the pattern is not in the pattern
|
// if the pattern is not in the pattern
|
||||||
QStringList wordList = searchHistory.stringList();
|
QStringList wordList = searchHistory.stringList();
|
||||||
if (wordList.indexOf(pattern) == -1) {
|
if (wordList.indexOf(pattern) == -1) {
|
||||||
@ -665,7 +650,6 @@ void SearchEngine::appendSearchResult(const QString &line) {
|
|||||||
goToDescBtn->setEnabled(true);
|
goToDescBtn->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION >= 0x040500
|
|
||||||
void SearchEngine::closeTab(int index) {
|
void SearchEngine::closeTab(int index) {
|
||||||
if (index == tabWidget->indexOf(currentSearchTab)) {
|
if (index == tabWidget->indexOf(currentSearchTab)) {
|
||||||
qDebug("Deleted current search Tab");
|
qDebug("Deleted current search Tab");
|
||||||
@ -684,31 +668,6 @@ void SearchEngine::closeTab(int index) {
|
|||||||
goToDescBtn->setEnabled(false);
|
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
|
// Download selected items in search results list
|
||||||
void SearchEngine::on_download_button_clicked() {
|
void SearchEngine::on_download_button_clicked() {
|
||||||
|
@ -94,11 +94,7 @@ protected slots:
|
|||||||
// Search slots
|
// Search slots
|
||||||
void tab_changed(int);//to prevent the use of the download button when the tab is empty
|
void tab_changed(int);//to prevent the use of the download button when the tab is empty
|
||||||
void on_search_button_clicked();
|
void on_search_button_clicked();
|
||||||
#if QT_VERSION < 0x040500
|
|
||||||
void closeTab_button_clicked();
|
|
||||||
#else
|
|
||||||
void closeTab(int index);
|
void closeTab(int index);
|
||||||
#endif
|
|
||||||
void appendSearchResult(const QString &line);
|
void appendSearchResult(const QString &line);
|
||||||
void searchFinished(int exitcode,QProcess::ExitStatus);
|
void searchFinished(int exitcode,QProcess::ExitStatus);
|
||||||
void readSearchOutput();
|
void readSearchOutput();
|
||||||
@ -137,9 +133,6 @@ private:
|
|||||||
SupportedEngines *supported_engines;
|
SupportedEngines *supported_engines;
|
||||||
QTimer *searchTimeout;
|
QTimer *searchTimeout;
|
||||||
QPointer<SearchTab> currentSearchTab;
|
QPointer<SearchTab> currentSearchTab;
|
||||||
#if QT_VERSION < 0x040500
|
|
||||||
QPushButton *closeTab_button;
|
|
||||||
#endif
|
|
||||||
QList<QPointer<SearchTab> > all_tab; // To store all tabs
|
QList<QPointer<SearchTab> > all_tab; // To store all tabs
|
||||||
const SearchCategories full_cat_names;
|
const SearchCategories full_cat_names;
|
||||||
MainWindow *mp_mainWindow;
|
MainWindow *mp_mainWindow;
|
||||||
|
Loading…
Reference in New Issue
Block a user