mirror of
https://github.com/transmission/transmission
synced 2025-03-03 02:05:19 +00:00
Use QtWinExtras instead of importing private Qt function to get QPixmap from HICON
This commit is contained in:
parent
4b397ebfc0
commit
c6bfe9de15
4 changed files with 15 additions and 9 deletions
|
@ -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)
|
||||
|
|
4
dist/msi/components/QtClient.wxs
vendored
4
dist/msi/components/QtClient.wxs
vendored
|
@ -100,6 +100,9 @@
|
|||
<Component Id="dll.qt5.widgets">
|
||||
<File DiskId="1" KeyPath="yes" Name="Qt5Widgets.dll" />
|
||||
</Component>
|
||||
<Component Id="dll.qt5.winextras">
|
||||
<File DiskId="1" KeyPath="yes" Name="Qt5WinExtras.dll" />
|
||||
</Component>
|
||||
|
||||
</DirectoryRef>
|
||||
<DirectoryRef Id="INSTALLDIR" FileSource="$(var.QtDir)\plugins">
|
||||
|
@ -132,6 +135,7 @@
|
|||
<ComponentRef Id="dll.qt5.gui" />
|
||||
<ComponentRef Id="dll.qt5.network" />
|
||||
<ComponentRef Id="dll.qt5.widgets" />
|
||||
<ComponentRef Id="dll.qt5.winextras" />
|
||||
<ComponentRef Id="dll.qt5.plugins.platforms.windows" />
|
||||
<ComponentRef Id="dll.dbus" />
|
||||
<ComponentRef Id="dll.expat" />
|
||||
|
|
15
qt/Utils.cc
15
qt/Utils.cc
|
@ -28,6 +28,10 @@
|
|||
#include <QSet>
|
||||
#include <QStyle>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <QtWin>
|
||||
#endif
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
#include <libtransmission/utils.h> // 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue