GUI: If QWinTaskbarButton is missing, just build without it

This commit is contained in:
Luke Dashjr 2020-12-11 02:13:14 +00:00
parent 8e126fbb3d
commit 89206d8109
4 changed files with 25 additions and 10 deletions

View File

@ -253,6 +253,20 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[
AC_MSG_RESULT([$bitcoin_enable_qt])
fi
AC_MSG_CHECKING([whether to build with QWinTaskbarProgress support])
BITCOIN_QT_CHECK([
if test "x$have_qt_winextras" != xyes; then
AC_MSG_RESULT([no, ${qt_lib_prefix}WinExtras $qt_version not found])
elif test "x$have_dwmapi" != xyes; then
AC_MSG_RESULT([no, dwmapi missing])
else
AC_MSG_RESULT([yes])
QT_INCLUDES="$QT_INCLUDES $QT_WINEXTRAS_CFLAGS"
QT_LIBS="$QT_LIBS $QT_WINEXTRAS_LIBS"
AC_DEFINE(BITCOIN_QT_WIN_TASKBAR, 1, [Define this symbol if building with QWinTaskbarProgress])
fi
])
AC_SUBST(QT_PIE_FLAGS)
AC_SUBST(QT_INCLUDES)
AC_SUBST(QT_LIBS)
@ -375,10 +389,9 @@ AC_DEFUN([_BITCOIN_QT_FIND_LIBS],[
BITCOIN_QT_CHECK([
if test "x$TARGET_OS" = xwindows; then
PKG_CHECK_MODULES([QT_WINEXTRAS], [${qt_lib_prefix}WinExtras $qt_version], [
QT_INCLUDES="$QT_INCLUDES $QT_WINEXTRAS_CFLAGS"
QT_LIBS="$QT_LIBS $QT_WINEXTRAS_LIBS"
have_qt_winextras=yes
],[
BITCOIN_QT_FAIL([${qt_lib_prefix}WinExtras $qt_version not found])
have_qt_winextras=no
])
fi
])

View File

@ -634,7 +634,7 @@ case $host in
AC_CHECK_LIB([ws2_32], [WSAStartup], [], [AC_MSG_ERROR([libws2_32 missing])])
AC_CHECK_LIB([shlwapi], [PathRemoveFileSpecW], [], [AC_MSG_ERROR([libshlwapi missing])])
AC_CHECK_LIB([iphlpapi], [GetAdaptersAddresses], [], [AC_MSG_ERROR([libiphlpapi missing])])
AC_CHECK_LIB([dwmapi], [main], [], [AC_MSG_ERROR([libdwmapi missing])])
AC_CHECK_LIB([dwmapi], [main], [have_dwmapi=yes], [have_dwmapi=no])
dnl -static is interpreted by libtool, where it has a different meaning.
dnl In libtool-speak, it's -all-static.

View File

@ -30,7 +30,8 @@
#ifdef Q_OS_MACOS
#include <qt/macdockiconhandler.h>
#elif defined Q_OS_WIN
#endif
#ifdef BITCOIN_QT_WIN_TASKBAR
#include <QWinTaskbarButton>
#include <QWinTaskbarProgress>
#endif
@ -225,7 +226,8 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
#ifdef Q_OS_MACOS
m_app_nap_inhibitor = new CAppNapInhibitor;
#elif defined Q_OS_WIN
#endif
#ifdef BITCOIN_QT_WIN_TASKBAR
m_taskbar_button = new QWinTaskbarButton(this);
#endif
@ -1159,7 +1161,7 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
tooltip = tr("Processed %n block(s) of transaction history.", "", count);
#ifdef Q_OS_WIN
#ifdef BITCOIN_QT_WIN_TASKBAR
m_taskbar_button->setWindow(windowHandle());
QWinTaskbarProgress* taskbar_progress = m_taskbar_button->progress();
#endif
@ -1179,7 +1181,7 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
progressBarLabel->setVisible(false);
progressBar->setVisible(false);
#ifdef Q_OS_WIN
#ifdef BITCOIN_QT_WIN_TASKBAR
taskbar_progress->setVisible(false);
#endif
}
@ -1192,7 +1194,7 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
progressBar->setMaximum(1000000000);
progressBar->setValue(nVerificationProgress * 1000000000.0 + 0.5);
progressBar->setVisible(true);
#ifdef Q_OS_WIN
#ifdef BITCOIN_QT_WIN_TASKBAR
taskbar_progress->setValue(qRound(nVerificationProgress * 100.0));
taskbar_progress->setVisible(true);
#endif

View File

@ -173,7 +173,7 @@ private:
Notificator* notificator = nullptr;
RPCConsole* rpcConsole = nullptr;
HelpMessageDialog* helpMessageDialog = nullptr;
#ifdef Q_OS_WIN
#ifdef BITCOIN_QT_WIN_TASKBAR
QWinTaskbarButton* m_taskbar_button = nullptr;
#endif
ModalOverlay* modalOverlay = nullptr;