Skip to content

Commit

Permalink
Merge 14137 via win_taskbar_progress-0.18+knots
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-jr committed May 2, 2019
2 parents 4bd6c3b + cb17a85 commit 98aa8e6
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 4 deletions.
4 changes: 4 additions & 0 deletions build-aux/m4/bitcoin_qt.m4
Expand Up @@ -390,6 +390,7 @@ AC_DEFUN([_BITCOIN_QT_FIND_STATIC_PLUGINS],[
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}FbSupport],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXFbSupport not found)))
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}DeviceDiscoverySupport],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXDeviceDiscoverySupport not found)))
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}AccessibilitySupport],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXAccessibilitySupport not found)))
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}WinExtras],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXWinExtras not found)))
QT_LIBS="$QT_LIBS -lversion -ldwmapi -luxtheme"
fi
fi
Expand Down Expand Up @@ -441,6 +442,9 @@ AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITHOUT_PKGCONFIG],[
BITCOIN_QT_CHECK([
if test "x$qt_include_path" != x; then
QT_INCLUDES="-I$qt_include_path -I$qt_include_path/QtCore -I$qt_include_path/QtGui -I$qt_include_path/QtWidgets -I$qt_include_path/QtNetwork -I$qt_include_path/QtTest -I$qt_include_path/QtDBus"
if test "x$TARGET_OS" = xwindows; then
QT_INCLUDES="$QT_INCLUDES -I$qt_include_path/QtWinExtras"
fi
CPPFLAGS="$QT_INCLUDES $CPPFLAGS"
fi
])
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Expand Up @@ -508,6 +508,7 @@ case $host in
AC_CHECK_LIB([shlwapi], [main],, AC_MSG_ERROR(libshlwapi missing))
AC_CHECK_LIB([iphlpapi], [main],, AC_MSG_ERROR(libiphlpapi missing))
AC_CHECK_LIB([crypt32], [main],, AC_MSG_ERROR(libcrypt32 missing))
AC_CHECK_LIB([dwmapi], [main],, AC_MSG_ERROR(libdwmapi missing))

# -static is interpreted by libtool, where it has a different meaning.
# In libtool-speak, it's -all-static.
Expand Down
3 changes: 2 additions & 1 deletion depends/Makefile
Expand Up @@ -159,7 +159,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
Expand Down
17 changes: 14 additions & 3 deletions depends/packages/qt.mk
Expand Up @@ -16,8 +16,12 @@ $(package)_qttranslations_sha256_hash=b36da7d93c3ab6fca56b32053bb73bc619c8b192bb
$(package)_qttools_file_name=qttools-$($(package)_suffix)
$(package)_qttools_sha256_hash=d62e0f70d99645d6704dbb8976fb2222443061743689943d40970c52c49367a1

$(package)_qtwinextras_file_name=qtwinextras-$($(package)_suffix)
$(package)_qtwinextras_sha256_hash=dda81076d4e17d64aa36b31f55d9c5eebc9bac1480d41f1f89cdd197e7d9a7a8

$(package)_extra_sources = $($(package)_qttranslations_file_name)
$(package)_extra_sources += $($(package)_qttools_file_name)
$(package)_extra_sources += $($(package)_qtwinextras_file_name)

define $(package)_set_vars
$(package)_config_opts_release = -release
Expand Down Expand Up @@ -117,21 +121,25 @@ 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)_qttools_file_name),$($(package)_qttools_file_name),$($(package)_qttools_sha256_hash))
$(call fetch_file,$(package),$($(package)_download_path),$($(package)_qttools_file_name),$($(package)_qttools_file_name),$($(package)_qttools_sha256_hash)) && \
$(call fetch_file,$(package),$($(package)_download_path),$($(package)_qtwinextras_file_name),$($(package)_qtwinextras_file_name),$($(package)_qtwinextras_sha256_hash))
endef

define $(package)_extract_cmds
mkdir -p $($(package)_extract_dir) && \
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 && \
tar --strip-components=1 -xf $($(package)_source) -C qtbase && \
mkdir qttranslations && \
tar --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttranslations_file_name) -C qttranslations && \
mkdir qttools && \
tar --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttools_file_name) -C qttools
tar --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttools_file_name) -C qttools && \
mkdir qtwinextras && \
tar --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qtwinextras_file_name) -C qtwinextras
endef

define $(package)_preprocess_cmds
Expand Down Expand Up @@ -175,6 +183,7 @@ define $(package)_config_cmds
$(MAKE) sub-src-clean && \
cd ../qttranslations && ../qtbase/bin/qmake qttranslations.pro -o Makefile && \
cd translations && ../../qtbase/bin/qmake translations.pro -o Makefile && cd ../.. && \
cd qtwinextras && ../qtbase/bin/qmake qtwinextras.pro -o Makefile && cd .. && \
cd qttools/src/linguist/lrelease/ && ../../../../qtbase/bin/qmake lrelease.pro -o Makefile && \
cd ../lupdate/ && ../../../../qtbase/bin/qmake lupdate.pro -o Makefile && cd ../../../..
endef
Expand All @@ -183,14 +192,16 @@ define $(package)_build_cmds
$(MAKE) -C src $(addprefix sub-,$($(package)_qt_libs)) && \
$(MAKE) -C ../qttools/src/linguist/lrelease && \
$(MAKE) -C ../qttools/src/linguist/lupdate && \
$(MAKE) -C ../qttranslations
$(MAKE) -C ../qttranslations && \
$(MAKE) -C ../qtwinextras
endef

define $(package)_stage_cmds
$(MAKE) -C src INSTALL_ROOT=$($(package)_staging_dir) $(addsuffix -install_subtargets,$(addprefix sub-,$($(package)_qt_libs))) && cd .. && \
$(MAKE) -C qttools/src/linguist/lrelease INSTALL_ROOT=$($(package)_staging_dir) install_target && \
$(MAKE) -C qttools/src/linguist/lupdate INSTALL_ROOT=$($(package)_staging_dir) install_target && \
$(MAKE) -C qttranslations INSTALL_ROOT=$($(package)_staging_dir) install_subtargets && \
$(MAKE) -C qtwinextras INSTALL_ROOT=$($(package)_staging_dir) install_subtargets && \
if `test -f qtbase/src/plugins/platforms/xcb/xcb-static/libxcb-static.a`; then \
cp qtbase/src/plugins/platforms/xcb/xcb-static/libxcb-static.a $($(package)_staging_prefix_dir)/lib; \
fi
Expand Down
17 changes: 17 additions & 0 deletions src/qt/bitcoingui.cpp
Expand Up @@ -29,6 +29,9 @@

#ifdef Q_OS_MAC
#include <qt/macdockiconhandler.h>
#elif defined Q_OS_WIN
#include <QWinTaskbarButton>
#include <QWinTaskbarProgress>
#endif

#include <chain.h>
Expand Down Expand Up @@ -214,6 +217,8 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty

#ifdef Q_OS_MAC
m_app_nap_inhibitor = new CAppNapInhibitor;
#elif defined Q_OS_WIN
m_taskbar_button = new QWinTaskbarButton(this);
#endif
}

Expand Down Expand Up @@ -1011,6 +1016,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(".<br>") + tooltip;
Expand All @@ -1026,6 +1036,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
{
Expand All @@ -1036,6 +1049,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(nVerificationProgress * 100.0 + 0.5);
taskbar_progress->setVisible(true);
#endif

tooltip = tr("Catching up...") + QString("<br>") + tooltip;
if(count != prevBlocks)
Expand Down
4 changes: 4 additions & 0 deletions src/qt/bitcoingui.h
Expand Up @@ -52,6 +52,7 @@ class QComboBox;
class QMenu;
class QProgressBar;
class QProgressDialog;
class QWinTaskbarButton;
QT_END_NAMESPACE

namespace GUIUtil {
Expand Down Expand Up @@ -167,6 +168,9 @@ class BitcoinGUI : public QMainWindow
HelpMessageDialog* helpMessageDialog = nullptr;
ModalOverlay* modalOverlay = nullptr;
MempoolStats* mempoolStats = nullptr;
#ifdef Q_OS_WIN
QWinTaskbarButton* m_taskbar_button = nullptr;
#endif

#ifdef Q_OS_MAC
CAppNapInhibitor* m_app_nap_inhibitor = nullptr;
Expand Down

0 comments on commit 98aa8e6

Please sign in to comment.