From 804aba7418586e55257df4bb81718ca1d28f4407 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Tue, 31 Mar 2020 17:07:25 +0000 Subject: [PATCH 1/4] Add QtWinExtras optional dependency Co-authored-by: Chun Kuan Lee --- build-aux/m4/bitcoin_qt.m4 | 11 +++++++++++ build_msvc/common.qt.init.vcxproj | 2 +- configure.ac | 1 + depends/Makefile | 3 ++- depends/packages/qt.mk | 12 +++++++++++- depends/patches/qt/qt.pro | 3 ++- 6 files changed, 28 insertions(+), 4 deletions(-) diff --git a/build-aux/m4/bitcoin_qt.m4 b/build-aux/m4/bitcoin_qt.m4 index a716cd9a27..daac543448 100644 --- a/build-aux/m4/bitcoin_qt.m4 +++ b/build-aux/m4/bitcoin_qt.m4 @@ -394,4 +394,15 @@ AC_DEFUN([_BITCOIN_QT_FIND_LIBS],[ PKG_CHECK_MODULES([QT_DBUS], [${qt_lib_prefix}DBus $qt_version], [QT_DBUS_INCLUDES="$QT_DBUS_CFLAGS"; have_qt_dbus=yes], [have_qt_dbus=no]) fi ]) + + 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" + ],[ + BITCOIN_QT_FAIL([${qt_lib_prefix}WinExtras $qt_version not found]) + ]) + fi + ]) ]) diff --git a/build_msvc/common.qt.init.vcxproj b/build_msvc/common.qt.init.vcxproj index cc8063e545..6303196f09 100644 --- a/build_msvc/common.qt.init.vcxproj +++ b/build_msvc/common.qt.init.vcxproj @@ -6,7 +6,7 @@ $(QtBaseDir)\plugins $(QtBaseDir)\lib $(QtBaseDir)\include - $(QtIncludeDir);$(QtIncludeDir)\QtNetwork;$(QtIncludeDir)\QtCore;$(QtIncludeDir)\QtWidgets;$(QtIncludeDir)\QtGui; + $(QtIncludeDir);$(QtIncludeDir)\QtNetwork;$(QtIncludeDir)\QtCore;$(QtIncludeDir)\QtWidgets;$(QtIncludeDir)\QtGui;$(QtIncludeDir)\QtWinExtras; .\QtGeneratedFiles\qt $(QtBaseDir)\bin $(QtPluginsLibraryDir)\platforms\qminimal.lib;$(QtPluginsLibraryDir)\platforms\qwindows.lib;$(QtPluginsLibraryDir)\styles\qwindowsvistastyle.lib;$(QtLibraryDir)\Qt5WindowsUIAutomationSupport.lib;$(QtLibraryDir)\qtfreetype.lib;$(QtLibraryDir)\qtharfbuzz.lib;$(QtLibraryDir)\qtlibpng.lib;$(QtLibraryDir)\qtpcre2.lib;$(QtLibraryDir)\Qt5AccessibilitySupport.lib;$(QtLibraryDir)\Qt5Core.lib;$(QtLibraryDir)\Qt5Concurrent.lib;$(QtLibraryDir)\Qt5EventDispatcherSupport.lib;$(QtLibraryDir)\Qt5FontDatabaseSupport.lib;$(QtLibraryDir)\Qt5Gui.lib;$(QtLibraryDir)\Qt5Network.lib;$(QtLibraryDir)\Qt5PlatformCompositorSupport.lib;$(QtLibraryDir)\Qt5ThemeSupport.lib;$(QtLibraryDir)\Qt5Widgets.lib;$(QtLibraryDir)\Qt5WinExtras.lib;$(QtLibraryDir)\qtmain.lib;Wtsapi32.lib;userenv.lib;netapi32.lib;imm32.lib;Dwmapi.lib;version.lib;winmm.lib;UxTheme.lib diff --git a/configure.ac b/configure.ac index 5fcb4212ff..31c10405ee 100644 --- a/configure.ac +++ b/configure.ac @@ -697,6 +697,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])]) dnl -static is interpreted by libtool, where it has a different meaning. dnl In libtool-speak, it's -all-static. diff --git a/depends/Makefile b/depends/Makefile index 3169117633..2a9c509188 100644 --- a/depends/Makefile +++ b/depends/Makefile @@ -269,7 +269,8 @@ endef define check_or_remove_sources mkdir -p $($(package)_source_dir); cd $($(package)_source_dir); \ - test -f $($(package)_fetched) && ( $(build_SHA256SUM) -c $($(package)_fetched) >/dev/null 2>/dev/null || \ + test -f $($(package)_fetched) && ( test `cat $($(package)_fetched) | wc -l` -eq $(words $($(package)_all_sources)) && \ + $(build_SHA256SUM) -c $($(package)_fetched) >/dev/null 2>/dev/null || \ ( echo "Checksum missing or mismatched for $(package) source. Forcing re-download."; \ rm -f $($(package)_all_sources) $($(1)_fetched))) || true endef diff --git a/depends/packages/qt.mk b/depends/packages/qt.mk index 7b4ee64776..f0ded37226 100644 --- a/depends/packages/qt.mk +++ b/depends/packages/qt.mk @@ -1,6 +1,6 @@ package=qt $(package)_version=5.15.5 -$(package)_download_path=https://download.qt.io/official_releases/qt/5.15/$($(package)_version)/submodules +$(package)_download_path=https://download.qt.io/archive/qt/5.15/$($(package)_version)/submodules $(package)_suffix=everywhere-opensource-src-$($(package)_version).tar.xz $(package)_file_name=qtbase-$($(package)_suffix) $(package)_sha256_hash=0c42c799aa7c89e479a07c451bf5a301e291266ba789e81afc18f95049524edc @@ -34,6 +34,10 @@ $(package)_qttools_sha256_hash=6d0778b71b2742cb527561791d1d3d255366163d54a10f78c $(package)_extra_sources = $($(package)_qttranslations_file_name) $(package)_extra_sources += $($(package)_qttools_file_name) +$(package)_qtwinextras_file_name=qtwinextras-$($(package)_suffix) +$(package)_qtwinextras_sha256_hash=6f15d1f65506c3ecce0ae62b16bff4e4c4b082ab7df9569ccecf0ee0783f3e77 +$(package)_extra_sources += $($(package)_qtwinextras_file_name) + define $(package)_set_vars $(package)_config_env = QT_MAC_SDK_NO_VERSION_CHECK=1 $(package)_config_opts_release = -release @@ -208,6 +212,7 @@ endef define $(package)_fetch_cmds $(call fetch_file,$(package),$($(package)_download_path),$($(package)_download_file),$($(package)_file_name),$($(package)_sha256_hash)) && \ $(call fetch_file,$(package),$($(package)_download_path),$($(package)_qttranslations_file_name),$($(package)_qttranslations_file_name),$($(package)_qttranslations_sha256_hash)) && \ +$(call fetch_file,$(package),$($(package)_download_path),$($(package)_qtwinextras_file_name),$($(package)_qtwinextras_file_name),$($(package)_qtwinextras_sha256_hash)) && \ $(call fetch_file,$(package),$($(package)_download_path),$($(package)_qttools_file_name),$($(package)_qttools_file_name),$($(package)_qttools_sha256_hash)) endef @@ -216,11 +221,14 @@ define $(package)_extract_cmds echo "$($(package)_sha256_hash) $($(package)_source)" > $($(package)_extract_dir)/.$($(package)_file_name).hash && \ echo "$($(package)_qttranslations_sha256_hash) $($(package)_source_dir)/$($(package)_qttranslations_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \ echo "$($(package)_qttools_sha256_hash) $($(package)_source_dir)/$($(package)_qttools_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \ + echo "$($(package)_qtwinextras_sha256_hash) $($(package)_source_dir)/$($(package)_qtwinextras_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \ $(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \ mkdir qtbase && \ $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source) -C qtbase && \ mkdir qttranslations && \ $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttranslations_file_name) -C qttranslations && \ + mkdir qtwinextras && \ + $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qtwinextras_file_name) -C qtwinextras && \ mkdir qttools && \ $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttools_file_name) -C qttools endef @@ -254,6 +262,7 @@ define $(package)_preprocess_cmds patch -p1 -i $($(package)_patch_dir)/duplicate_lcqpafonts.patch && \ patch -p1 -i $($(package)_patch_dir)/fast_fixed_dtoa_no_optimize.patch && \ patch -p1 -i $($(package)_patch_dir)/guix_cross_lib_path.patch && \ + sed -i.old -e '/qwinjumplist/d' qtwinextras/src/winextras/winextras.pro && \ mkdir -p qtbase/mkspecs/macx-clang-linux &&\ cp -f qtbase/mkspecs/macx-clang/qplatformdefs.h qtbase/mkspecs/macx-clang-linux/ &&\ cp -f $($(package)_patch_dir)/mac-qmake.conf qtbase/mkspecs/macx-clang-linux/qmake.conf && \ @@ -283,6 +292,7 @@ endef define $(package)_stage_cmds $(MAKE) -C qtbase/src INSTALL_ROOT=$($(package)_staging_dir) $(addsuffix -install_subtargets,$(addprefix sub-,$($(package)_qt_libs))) && \ $(MAKE) -C qttools/src/linguist INSTALL_ROOT=$($(package)_staging_dir) $(addsuffix -install_subtargets,$(addprefix sub-,$($(package)_linguist_tools))) && \ + $(MAKE) -C qtwinextras INSTALL_ROOT=$($(package)_staging_dir) install_subtargets && \ $(MAKE) -C qttranslations INSTALL_ROOT=$($(package)_staging_dir) install_subtargets endef diff --git a/depends/patches/qt/qt.pro b/depends/patches/qt/qt.pro index 8f2e900a84..f5a59f329e 100644 --- a/depends/patches/qt/qt.pro +++ b/depends/patches/qt/qt.pro @@ -8,9 +8,10 @@ CONFIG += $$prl cache(CONFIG, add stash, prl) TEMPLATE = subdirs -SUBDIRS = qtbase qttools qttranslations +SUBDIRS = qtbase qttools qttranslations qtwinextras qttools.depends = qtbase qttranslations.depends = qttools +qtwinextras.depends = qtbase load(qt_configure) From 473ce6be25e6ff3290fef39b6d5218cd699fd08e Mon Sep 17 00:00:00 2001 From: Chun Kuan Lee Date: Mon, 3 Sep 2018 11:14:44 +0800 Subject: [PATCH 2/4] gui: Add Windows taskbar progress --- src/qt/bitcoingui.cpp | 17 +++++++++++++++++ src/qt/bitcoingui.h | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index a8452e815f..b2aecbfa15 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -28,6 +28,9 @@ #ifdef Q_OS_MACOS #include +#elif defined Q_OS_WIN +#include +#include #endif #include @@ -222,6 +225,8 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty #ifdef Q_OS_MACOS m_app_nap_inhibitor = new CAppNapInhibitor; +#elif defined Q_OS_WIN + m_taskbar_button = new QWinTaskbarButton(this); #endif GUIUtil::handleCloseWindowShortcut(this); @@ -1117,6 +1122,11 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer tooltip = tr("Processed %n block(s) of transaction history.", "", count); +#ifdef Q_OS_WIN + m_taskbar_button->setWindow(windowHandle()); + QWinTaskbarProgress* taskbar_progress = m_taskbar_button->progress(); +#endif + // Set icon state: spinning if catching up, tick otherwise if (secs < MAX_BLOCK_TIME_GAP) { tooltip = tr("Up to date") + QString(".
") + tooltip; @@ -1132,6 +1142,9 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer progressBarLabel->setVisible(false); progressBar->setVisible(false); +#ifdef Q_OS_WIN + taskbar_progress->setVisible(false); +#endif } else { @@ -1142,6 +1155,10 @@ 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 + taskbar_progress->setValue(qRound(nVerificationProgress * 100.0)); + taskbar_progress->setVisible(true); +#endif tooltip = tr("Catching up…") + QString("
") + tooltip; if(count != prevBlocks) diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 92b889263b..23d8d2d1fc 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -55,6 +55,7 @@ class QComboBox; class QDateTime; class QProgressBar; class QProgressDialog; +class QWinTaskbarButton; QT_END_NAMESPACE namespace GUIUtil { @@ -172,6 +173,9 @@ private: Notificator* notificator = nullptr; RPCConsole* rpcConsole = nullptr; HelpMessageDialog* helpMessageDialog = nullptr; +#ifdef Q_OS_WIN + QWinTaskbarButton* m_taskbar_button = nullptr; +#endif ModalOverlay* modalOverlay = nullptr; QMenu* m_network_context_menu = new QMenu(this); From 7cb7eb792ab4828453de41a462c2b8ad9501475f Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Fri, 11 Dec 2020 02:13:14 +0000 Subject: [PATCH 3/4] GUI: If QWinTaskbarButton is missing, just build without it --- build-aux/m4/bitcoin_qt.m4 | 19 ++++++++++++++++--- configure.ac | 2 +- src/qt/bitcoingui.cpp | 12 +++++++----- src/qt/bitcoingui.h | 2 +- 4 files changed, 25 insertions(+), 10 deletions(-) diff --git a/build-aux/m4/bitcoin_qt.m4 b/build-aux/m4/bitcoin_qt.m4 index daac543448..ac1e90adda 100644 --- a/build-aux/m4/bitcoin_qt.m4 +++ b/build-aux/m4/bitcoin_qt.m4 @@ -273,6 +273,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) @@ -398,10 +412,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 ]) diff --git a/configure.ac b/configure.ac index 31c10405ee..a47973a4d1 100644 --- a/configure.ac +++ b/configure.ac @@ -697,7 +697,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. diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index b2aecbfa15..283119360b 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -28,7 +28,8 @@ #ifdef Q_OS_MACOS #include -#elif defined Q_OS_WIN +#endif +#ifdef BITCOIN_QT_WIN_TASKBAR #include #include #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 @@ -1122,7 +1124,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 @@ -1142,7 +1144,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 } @@ -1155,7 +1157,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 diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 23d8d2d1fc..4f377f53f1 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -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; From f19a0baa8cbcb284a55a0798f3996cb9b1e0ec7f Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Thu, 12 May 2022 23:26:33 +0000 Subject: [PATCH 4/4] Bugfix: configure: Add missing result for QWinTaskbarProgress support when not building the GUI --- build-aux/m4/bitcoin_qt.m4 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build-aux/m4/bitcoin_qt.m4 b/build-aux/m4/bitcoin_qt.m4 index ac1e90adda..d6581d339a 100644 --- a/build-aux/m4/bitcoin_qt.m4 +++ b/build-aux/m4/bitcoin_qt.m4 @@ -285,6 +285,8 @@ AC_DEFUN([BITCOIN_QT_CONFIGURE],[ QT_LIBS="$QT_LIBS $QT_WINEXTRAS_LIBS" AC_DEFINE(BITCOIN_QT_WIN_TASKBAR, 1, [Define this symbol if building with QWinTaskbarProgress]) fi + ],[ + AC_MSG_RESULT([no, not building GUI]) ]) AC_SUBST(QT_PIE_FLAGS)