diff --git a/CMakeLists.txt b/CMakeLists.txt index bf90bebc7..11d3d1488 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -211,6 +211,10 @@ if(ENABLE_QT) set(QT5_REQUIRED_MODULES Core Gui Widgets Network LinguistTools) set(QT5_OPTIONAL_MODULES DBus AxContainer AxServer) + if(WIN32) + list(APPEND QT5_REQUIRED_MODULES WinExtras) + endif() + foreach(M ${QT5_REQUIRED_MODULES}) find_package(Qt5${M} ${QT5_MINIMUM} QUIET) if(Qt5${M}_FOUND) diff --git a/dist/msi/components/QtClient.wxs b/dist/msi/components/QtClient.wxs index 74e8f78d9..383faeeaf 100644 --- a/dist/msi/components/QtClient.wxs +++ b/dist/msi/components/QtClient.wxs @@ -100,6 +100,9 @@ + + + @@ -132,6 +135,7 @@ + diff --git a/qt/Utils.cc b/qt/Utils.cc index a599e0106..c7018d2ad 100644 --- a/qt/Utils.cc +++ b/qt/Utils.cc @@ -28,6 +28,10 @@ #include #include +#ifdef _WIN32 +#include +#endif + #include #include // tr_formatter @@ -37,11 +41,6 @@ **** ***/ -#if defined(_WIN32) -// Should be in QtWinExtras soon, but for now let's import it manually -extern QPixmap qt_pixmapFromWinHICON(HICON icon); -#endif - namespace { #ifdef _WIN32 @@ -65,7 +64,7 @@ namespace { if (shellFileInfo.hIcon != NULL) { - pixmap = qt_pixmapFromWinHICON (shellFileInfo.hIcon); + pixmap = QtWin::fromHICON (shellFileInfo.hIcon); ::DestroyIcon (shellFileInfo.hIcon); } } @@ -106,15 +105,13 @@ Utils::guessMimeIcon (const QString& filename) if (!icon.isNull ()) return icon; -#else +#endif QMimeDatabase mimeDb; QMimeType mimeType = mimeDb.mimeTypeForFile (filename, QMimeDatabase::MatchExtension); if (mimeType.isValid ()) return QIcon::fromTheme (mimeType.iconName (), QIcon::fromTheme (mimeType.genericIconName (), fallback)); -#endif - return fallback; } diff --git a/qt/qtr.pro b/qt/qtr.pro index 73fba9b7d..3735bdcdd 100644 --- a/qt/qtr.pro +++ b/qt/qtr.pro @@ -13,6 +13,7 @@ man.files = transmission-qt.1 CONFIG += qt thread debug link_pkgconfig c++11 warn_on QT += network dbus +win32:QT += winextras PKGCONFIG = fontconfig libcurl openssl libevent greaterThan(QT_MAJOR_VERSION, 4) {