From 9856bff4386bc43016a33a1f0d06bc8aadab3078 Mon Sep 17 00:00:00 2001 From: Martchus Date: Fri, 5 Feb 2016 20:31:45 +0100 Subject: [PATCH] fixes - support QT_VERSION < 0x050400 - "Explore download dir" (under Windows) --- gui/addmultipledownloadswizard.h | 8 +++----- gui/downloadinteraction.h | 6 ++---- gui/mainwindow.cpp | 3 ++- network/vimeodownload.cpp | 16 +++++++++++++--- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/gui/addmultipledownloadswizard.h b/gui/addmultipledownloadswizard.h index 429accb..2e0662c 100644 --- a/gui/addmultipledownloadswizard.h +++ b/gui/addmultipledownloadswizard.h @@ -5,11 +5,9 @@ #include #include -QT_BEGIN_NAMESPACE -class QCheckBox; -class QTreeView; -class QItemSelection; -QT_END_NAMESPACE +QT_FORWARD_DECLARE_CLASS(QCheckBox) +QT_FORWARD_DECLARE_CLASS(QTreeView) +QT_FORWARD_DECLARE_CLASS(QItemSelection) namespace Widgets { class ClearLineEdit; diff --git a/gui/downloadinteraction.h b/gui/downloadinteraction.h index ce17003..42a6afb 100644 --- a/gui/downloadinteraction.h +++ b/gui/downloadinteraction.h @@ -4,10 +4,8 @@ #include #include -QT_BEGIN_NAMESPACE -class QWidget; -class QString; -QT_END_NAMESPACE +QT_FORWARD_DECLARE_CLASS(QString) +QT_FORWARD_DECLARE_CLASS(QWidget) namespace Network { class Download; diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 8201f86..e97906c 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -753,7 +754,7 @@ void MainWindow::exploreDownloadsDir() QMessageBox::warning(this, windowTitle(), tr("There is no download target selected.")); } else { if(QDir(GeneralTargetOptionPage::targetDirectory()).exists()) { - QDesktopServices::openUrl(QUrl(QStringLiteral("file://%1").arg(GeneralTargetOptionPage::targetDirectory()), QUrl::TolerantMode)); + DesktopUtils::openLocalFileOrDir(GeneralTargetOptionPage::targetDirectory()); } else { QMessageBox::warning(this, windowTitle(), tr("The selected download directory doesn't exist anymore.")); } diff --git a/network/vimeodownload.cpp b/network/vimeodownload.cpp index 5056811..86249ea 100644 --- a/network/vimeodownload.cpp +++ b/network/vimeodownload.cpp @@ -31,15 +31,25 @@ VimeoDownload::VimeoDownload(const QString &id, QObject *parent) : Download *VimeoDownload::infoRequestDownload(bool &success, QString &reasonForFail) { - const auto pathParts = initialUrl().path(QUrl::FullyDecoded).splitRef(QChar('/'), QString::SkipEmptyParts); + const auto pathParts = initialUrl().path(QUrl::FullyDecoded). +#if QT_VERSION >= 0x050400 + splitRef +#else + split +#endif + (QChar('/'), QString::SkipEmptyParts); if(pathParts.size() < 2) { const auto &id = pathParts.back(); bool isInt; id.toULongLong(&isInt); if(isInt) { - setId(id.toString()); + setId(id +#if QT_VERSION >= 0x050400 + .toString() +#endif + ); success = true; - return new HttpDownload(QUrl(QStringLiteral("https://player.vimeo.com/video/%1/config").arg(id.toString()))); + return new HttpDownload(QUrl(QStringLiteral("https://player.vimeo.com/video/%1/config").arg(this->id()))); } } success = false;