diff --git a/build-aux/m4/bitcoin_qt.m4 b/build-aux/m4/bitcoin_qt.m4 index 7498127860..cd8bf304fd 100644 --- a/build-aux/m4/bitcoin_qt.m4 +++ b/build-aux/m4/bitcoin_qt.m4 @@ -253,6 +253,22 @@ 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_MSG_RESULT([no, not building GUI]) + ]) + AC_SUBST(QT_PIE_FLAGS) AC_SUBST(QT_INCLUDES) AC_SUBST(QT_LIBS) @@ -371,4 +387,14 @@ 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], [ + have_qt_winextras=yes + ],[ + have_qt_winextras=no + ]) + fi + ]) ]) diff --git a/build_msvc/common.qt.init.vcxproj b/build_msvc/common.qt.init.vcxproj index dabbec707f..713ed7051e 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 d9cdbfdb8a..e210f6e21e 100644 --- a/configure.ac +++ b/configure.ac @@ -675,6 +675,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], [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/depends/Makefile b/depends/Makefile index 52a9a14e56..8b6834ac26 100644 --- a/depends/Makefile +++ b/depends/Makefile @@ -259,7 +259,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 c19d353a34..17b7654e05 100644 --- a/depends/packages/qt.mk +++ b/depends/packages/qt.mk @@ -1,6 +1,6 @@ package=qt $(package)_version=5.15.16 -$(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=b04815058c18058b6ba837206756a2c87d1391f07a0dcb0dd314f970fd041592 @@ -35,6 +35,10 @@ $(package)_qttools_sha256_hash=1cab11887faca54af59f4995ee435c9ad98d194e9e6889c84 $(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=8e7a3b0d03b0f726b10bb050f560659fa7babaa45273e174e9fcc3bb9c169a4e +$(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 @@ -192,6 +196,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 @@ -200,11 +205,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 @@ -237,6 +245,7 @@ define $(package)_preprocess_cmds patch -p1 -i $($(package)_patch_dir)/guix_cross_lib_path.patch && \ patch -p1 -i $($(package)_patch_dir)/windows_lto.patch && \ patch -p1 -i $($(package)_patch_dir)/darwin_no_libm.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 && \ @@ -266,6 +275,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) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 0bbbb7b10a..dbf2cc95f9 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -33,6 +33,10 @@ #ifdef Q_OS_MACOS #include #endif +#ifdef BITCOIN_QT_WIN_TASKBAR +#include +#include +#endif #include #include @@ -226,6 +230,9 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty #ifdef Q_OS_MACOS m_app_nap_inhibitor = new CAppNapInhibitor; #endif +#ifdef BITCOIN_QT_WIN_TASKBAR + m_taskbar_button = new QWinTaskbarButton(this); +#endif GUIUtil::handleCloseWindowShortcut(this); } @@ -1219,6 +1226,11 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer tooltip = tr("Processed %n block(s) of transaction history.", "", count); +#ifdef BITCOIN_QT_WIN_TASKBAR + 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; @@ -1234,6 +1246,9 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer progressBarLabel->setVisible(false); progressBar->setVisible(false); +#ifdef BITCOIN_QT_WIN_TASKBAR + taskbar_progress->setVisible(false); +#endif } else { @@ -1244,6 +1259,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 BITCOIN_QT_WIN_TASKBAR + 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 86414fbeaa..6a1550029a 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 { @@ -178,6 +179,9 @@ private: GuiNetWatch* NetWatch = nullptr; RPCConsole* rpcConsole = nullptr; HelpMessageDialog* helpMessageDialog = nullptr; +#ifdef BITCOIN_QT_WIN_TASKBAR + QWinTaskbarButton* m_taskbar_button = nullptr; +#endif ModalOverlay* modalOverlay = nullptr; MempoolStats* mempoolStats = nullptr;