diff --git a/CMakeLists.txt b/CMakeLists.txt index 1eedaf28..a3c5ed9b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -349,12 +349,17 @@ else() set(Qt5Widgets_DIR "${CMAKE_PREFIX_PATH}/lib/cmake/Qt5Widgets") set(Qt5PrintSupport_DIR "${CMAKE_PREFIX_PATH}/lib/cmake/Qt5PrintSupport") set(Qt5Network_DIR "${CMAKE_PREFIX_PATH}/lib/cmake/Qt5Network") + set(Qt5WinExtras_DIR "${CMAKE_PREFIX_PATH}/lib/cmake/Qt5WinExtras") endif() find_package(Qt5Widgets) find_package(Qt5PrintSupport) find_package(Qt5Network) +if (WIN32) + find_package(Qt5WinExtras) +endif() + if(Qt5Widgets_FOUND) MESSAGE(STATUS "Found Qt ${Qt5Widgets_VERSION_STRING}") # FIX: Qt was built with -reduce-relocations @@ -371,7 +376,11 @@ add_custom_target( add_library(${LIB_GUI_PROJECT_NAME} ${LIB_GUI_FILES} ${CMAKE_BINARY_DIR}/src/lib_gui/version.h) -target_link_libraries(${LIB_GUI_PROJECT_NAME} Qt5::Widgets Qt5::Network) +if(UNIX) + target_link_libraries(${LIB_GUI_PROJECT_NAME} Qt5::Widgets Qt5::Network) +else() + target_link_libraries(${LIB_GUI_PROJECT_NAME} Qt5::Widgets Qt5::Network Qt5::WinExtras) +endif() # command for versioning script add_custom_command( diff --git a/deployment/windows/wixSetup/installDir.wxs b/deployment/windows/wixSetup/installDir.wxs index 5fafcc8d..9cb13772 100644 --- a/deployment/windows/wixSetup/installDir.wxs +++ b/deployment/windows/wixSetup/installDir.wxs @@ -48,6 +48,10 @@ + + + + diff --git a/deployment/windows/wixSetup/sourcetrail.wxs b/deployment/windows/wixSetup/sourcetrail.wxs index 4bd7cdb3..39dc67f9 100644 --- a/deployment/windows/wixSetup/sourcetrail.wxs +++ b/deployment/windows/wixSetup/sourcetrail.wxs @@ -175,6 +175,7 @@ + diff --git a/script/setup.sh b/script/setup.sh index 1d83948e..bc8fc54c 100755 --- a/script/setup.sh +++ b/script/setup.sh @@ -74,6 +74,7 @@ if [ $PLATFORM == "Windows" ]; then cp -u -r ${QT_WIN32_DIR}/bin/Qt5Guid.dll build/win32/Debug/app cp -u -r ${QT_WIN32_DIR}/bin/Qt5Networkd.dll build/win32/Debug/app cp -u -r ${QT_WIN32_DIR}/bin/Qt5Widgetsd.dll build/win32/Debug/app + cp -u -r ${QT_WIN32_DIR}/bin/Qt5WinExtrasd.dll build/win32/Debug/app cp -u -r ${QT_WIN32_DIR}/plugins/platforms/qwindowsd.dll build/win32/Debug/app/platforms cp -u -r ${QT_WIN32_DIR}/plugins/imageformats/qgifd.dll build/win32/Debug/app/imageformats cp -u -r ${QT_WIN32_DIR}/plugins/imageformats/qicnsd.dll build/win32/Debug/app/imageformats @@ -90,6 +91,7 @@ if [ $PLATFORM == "Windows" ]; then cp -u -r ${QT_WIN32_DIR}/bin/Qt5Gui.dll build/win32/Release/app cp -u -r ${QT_WIN32_DIR}/bin/Qt5Network.dll build/win32/Release/app cp -u -r ${QT_WIN32_DIR}/bin/Qt5Widgets.dll build/win32/Release/app + cp -u -r ${QT_WIN32_DIR}/bin/Qt5WinExtras.dll build/win32/Release/app cp -u -r ${QT_WIN32_DIR}/plugins/platforms/qwindows.dll build/win32/Release/app/platforms cp -u -r ${QT_WIN32_DIR}/plugins/imageformats/qgif.dll build/win32/Release/app/imageformats cp -u -r ${QT_WIN32_DIR}/plugins/imageformats/qicns.dll build/win32/Release/app/imageformats @@ -106,6 +108,7 @@ if [ $PLATFORM == "Windows" ]; then cp -u -r ${QT_WIN64_DIR}/bin/Qt5Guid.dll build/win64/Debug/app cp -u -r ${QT_WIN64_DIR}/bin/Qt5Networkd.dll build/win64/Debug/app cp -u -r ${QT_WIN64_DIR}/bin/Qt5Widgetsd.dll build/win64/Debug/app + cp -u -r ${QT_WIN64_DIR}/bin/Qt5WinExtrasd.dll build/win64/Debug/app cp -u -r ${QT_WIN64_DIR}/plugins/platforms/qwindowsd.dll build/win64/Debug/app/platforms cp -u -r ${QT_WIN64_DIR}/plugins/imageformats/qgifd.dll build/win64/Debug/app/imageformats cp -u -r ${QT_WIN64_DIR}/plugins/imageformats/qicnsd.dll build/win64/Debug/app/imageformats @@ -122,6 +125,7 @@ if [ $PLATFORM == "Windows" ]; then cp -u -r ${QT_WIN64_DIR}/bin/Qt5Gui.dll build/win64/Release/app cp -u -r ${QT_WIN64_DIR}/bin/Qt5Network.dll build/win64/Release/app cp -u -r ${QT_WIN64_DIR}/bin/Qt5Widgets.dll build/win64/Release/app + cp -u -r ${QT_WIN64_DIR}/bin/Qt5WinExtras.dll build/win64/Release/app cp -u -r ${QT_WIN64_DIR}/plugins/platforms/qwindows.dll build/win64/Release/app/platforms cp -u -r ${QT_WIN64_DIR}/plugins/imageformats/qgif.dll build/win64/Release/app/imageformats cp -u -r ${QT_WIN64_DIR}/plugins/imageformats/qicns.dll build/win64/Release/app/imageformats @@ -139,6 +143,7 @@ if [ $PLATFORM == "Windows" ]; then cp -u -r ${QT_WIN32_DIR}/bin/Qt5Guid.dll build/win32/Debug/test cp -u -r ${QT_WIN32_DIR}/bin/Qt5Networkd.dll build/win32/Debug/test cp -u -r ${QT_WIN32_DIR}/bin/Qt5Widgetsd.dll build/win32/Debug/test + cp -u -r ${QT_WIN32_DIR}/bin/Qt5WinExtrasd.dll build/win32/Debug/test cp -u -r ${QT_WIN32_DIR}/plugins/platforms/qwindowsd.dll build/win32/Debug/test/platforms cp -u -r ${QT_WIN32_DIR}/plugins/imageformats/qgifd.dll build/win32/Debug/test/imageformats cp -u -r ${QT_WIN32_DIR}/plugins/imageformats/qicnsd.dll build/win32/Debug/test/imageformats @@ -154,6 +159,7 @@ if [ $PLATFORM == "Windows" ]; then cp -u -r ${QT_WIN32_DIR}/bin/Qt5Gui.dll build/win32/Release/test cp -u -r ${QT_WIN32_DIR}/bin/Qt5Network.dll build/win32/Release/test cp -u -r ${QT_WIN32_DIR}/bin/Qt5Widgets.dll build/win32/Release/test + cp -u -r ${QT_WIN32_DIR}/bin/Qt5WinExtras.dll build/win32/Release/test cp -u -r ${QT_WIN32_DIR}/plugins/platforms/qwindows.dll build/win32/Release/test/platforms cp -u -r ${QT_WIN32_DIR}/plugins/imageformats/qgif.dll build/win32/Release/test/imageformats cp -u -r ${QT_WIN32_DIR}/plugins/imageformats/qicns.dll build/win32/Release/test/imageformats @@ -169,6 +175,7 @@ if [ $PLATFORM == "Windows" ]; then cp -u -r ${QT_WIN64_DIR}/bin/Qt5Guid.dll build/win64/Debug/test cp -u -r ${QT_WIN64_DIR}/bin/Qt5Networkd.dll build/win64/Debug/test cp -u -r ${QT_WIN64_DIR}/bin/Qt5Widgetsd.dll build/win64/Debug/test + cp -u -r ${QT_WIN64_DIR}/bin/Qt5WinExtrasd.dll build/win64/Debug/test cp -u -r ${QT_WIN64_DIR}/plugins/platforms/qwindowsd.dll build/win64/Debug/test/platforms cp -u -r ${QT_WIN64_DIR}/plugins/imageformats/qgifd.dll build/win64/Debug/test/imageformats cp -u -r ${QT_WIN64_DIR}/plugins/imageformats/qicnsd.dll build/win64/Debug/test/imageformats @@ -184,6 +191,7 @@ if [ $PLATFORM == "Windows" ]; then cp -u -r ${QT_WIN64_DIR}/bin/Qt5Gui.dll build/win64/Release/test cp -u -r ${QT_WIN64_DIR}/bin/Qt5Network.dll build/win64/Release/test cp -u -r ${QT_WIN64_DIR}/bin/Qt5Widgets.dll build/win64/Release/test + cp -u -r ${QT_WIN64_DIR}/bin/Qt5WinExtras.dll build/win64/Release/test cp -u -r ${QT_WIN64_DIR}/plugins/platforms/qwindows.dll build/win64/Release/test/platforms cp -u -r ${QT_WIN64_DIR}/plugins/imageformats/qgif.dll build/win64/Release/test/imageformats cp -u -r ${QT_WIN64_DIR}/plugins/imageformats/qicns.dll build/win64/Release/test/imageformats diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 31dcbdbf..b1ad27f3 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -279,8 +279,8 @@ add_files( data/TaskInjectStorage.h data/TaskMergeStorages.cpp data/TaskMergeStorages.h - data/TaskShowStatusDialog.cpp - data/TaskShowStatusDialog.h + data/TaskShowUnknownProgressDialog.cpp + data/TaskShowUnknownProgressDialog.h project/Project.cpp project/Project.h diff --git a/src/lib/data/TaskShowStatusDialog.cpp b/src/lib/data/TaskShowStatusDialog.cpp deleted file mode 100644 index b22b8077..00000000 --- a/src/lib/data/TaskShowStatusDialog.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "data/TaskShowStatusDialog.h" - -#include "component/view/DialogView.h" -#include "Application.h" - -TaskShowStatusDialog::TaskShowStatusDialog( - const std::string& title, - const std::string& message -) - : m_title(title) - , m_message(message) -{ -} - -TaskShowStatusDialog::~TaskShowStatusDialog() -{ -} - -void TaskShowStatusDialog::doEnter(std::shared_ptr blackboard) -{ -} - -Task::TaskState TaskShowStatusDialog::doUpdate(std::shared_ptr blackboard) -{ - Application::getInstance()->getDialogView()->showUnknownProgressDialog(m_title, m_message); - - return STATE_SUCCESS; -} - -void TaskShowStatusDialog::doExit(std::shared_ptr blackboard) -{ -} - -void TaskShowStatusDialog::doReset(std::shared_ptr blackboard) -{ -} diff --git a/src/lib/data/TaskShowUnknownProgressDialog.cpp b/src/lib/data/TaskShowUnknownProgressDialog.cpp new file mode 100644 index 00000000..231f7a52 --- /dev/null +++ b/src/lib/data/TaskShowUnknownProgressDialog.cpp @@ -0,0 +1,38 @@ +#include "data/TaskShowUnknownProgressDialog.h" + +#include "component/view/DialogView.h" +#include "Application.h" + +TaskShowUnknownProgressDialog::TaskShowUnknownProgressDialog( + const std::string& title, + const std::string& message +) + : m_title(title) + , m_message(message) +{ +} + +TaskShowUnknownProgressDialog::~TaskShowUnknownProgressDialog() +{ +} + +void TaskShowUnknownProgressDialog::doEnter(std::shared_ptr blackboard) +{ +} + +Task::TaskState TaskShowUnknownProgressDialog::doUpdate(std::shared_ptr blackboard) +{ + if (std::shared_ptr dialogView = Application::getInstance()->getDialogView()) + { + dialogView->showUnknownProgressDialog(m_title, m_message); + } + return STATE_SUCCESS; +} + +void TaskShowUnknownProgressDialog::doExit(std::shared_ptr blackboard) +{ +} + +void TaskShowUnknownProgressDialog::doReset(std::shared_ptr blackboard) +{ +} diff --git a/src/lib/data/TaskShowStatusDialog.h b/src/lib/data/TaskShowUnknownProgressDialog.h similarity index 65% rename from src/lib/data/TaskShowStatusDialog.h rename to src/lib/data/TaskShowUnknownProgressDialog.h index f779c9f1..5bd0700a 100644 --- a/src/lib/data/TaskShowStatusDialog.h +++ b/src/lib/data/TaskShowUnknownProgressDialog.h @@ -1,22 +1,20 @@ -#ifndef TASK_SHOW_STATUS_DIALOG_H -#define TASK_SHOW_STATUS_DIALOG_H +#ifndef TASK_SHOW_UNKNOWN_PROGRESS_DIALOG_H +#define TASK_SHOW_UNKNOWN_PROGRESS_DIALOG_H #include #include "utility/scheduling/Task.h" -class DialogView; - -class TaskShowStatusDialog +class TaskShowUnknownProgressDialog : public Task { public: - TaskShowStatusDialog( + TaskShowUnknownProgressDialog( const std::string& title, const std::string& message ); - virtual ~TaskShowStatusDialog(); + virtual ~TaskShowUnknownProgressDialog(); private: virtual void doEnter(std::shared_ptr blackboard); @@ -28,4 +26,4 @@ private: const std::string m_message; }; -#endif // TASK_SHOW_STATUS_DIALOG_H +#endif // TASK_SHOW_UNKNOWN_PROGRESS_DIALOG_H diff --git a/src/lib/project/Project.cpp b/src/lib/project/Project.cpp index bb2f476c..6216b4d9 100644 --- a/src/lib/project/Project.cpp +++ b/src/lib/project/Project.cpp @@ -12,7 +12,7 @@ #include "data/TaskFinishParsing.h" #include "data/TaskInjectStorage.h" #include "data/TaskMergeStorages.h" -#include "data/TaskShowStatusDialog.h" +#include "data/TaskShowUnknownProgressDialog.h" #include "project/SourceGroup.h" #include "project/SourceGroupFactory.h" #include "settings/ApplicationSettings.h" @@ -440,7 +440,7 @@ void Project::buildIndex(const RefreshInfo& info, DialogView* dialogView) ); // add task that notifies the user of what's going on taskSequential->addTask( // we don't need to hide this dialog again, because it's overridden by other dialogs later on. - std::make_shared("Finish Indexing", "Saving\nRemaining Data") + std::make_shared("Finish Indexing", "Saving\nRemaining Data") ); // add task that injects the remaining intermediate storages into the persistent storage diff --git a/src/lib_cxx/project/SourceGroupCxx.h b/src/lib_cxx/project/SourceGroupCxx.h index 764b2f25..8a3ae607 100644 --- a/src/lib_cxx/project/SourceGroupCxx.h +++ b/src/lib_cxx/project/SourceGroupCxx.h @@ -7,7 +7,8 @@ #include "project/SourceGroup.h" #include "settings/SourceGroupSettingsCxx.h" -class SourceGroupCxx: public SourceGroup +class SourceGroupCxx + : public SourceGroup { public: SourceGroupCxx(); diff --git a/src/lib_cxx/project/SourceGroupCxxCdb.h b/src/lib_cxx/project/SourceGroupCxxCdb.h index dbccfe8b..84156d47 100644 --- a/src/lib_cxx/project/SourceGroupCxxCdb.h +++ b/src/lib_cxx/project/SourceGroupCxxCdb.h @@ -7,7 +7,8 @@ #include "project/SourceGroupCxx.h" #include "settings/SourceGroupSettingsCxxCdb.h" -class SourceGroupCxxCdb: public SourceGroupCxx +class SourceGroupCxxCdb + : public SourceGroupCxx { public: SourceGroupCxxCdb(std::shared_ptr settings); @@ -22,7 +23,7 @@ public: private: virtual std::shared_ptr getSourceGroupSettingsCxx() override; virtual std::shared_ptr getSourceGroupSettingsCxx() const override; - virtual std::vector getAllSourcePaths() const; + virtual std::vector getAllSourcePaths() const override; std::shared_ptr m_settings; }; diff --git a/src/lib_gui/CMakeLists.txt b/src/lib_gui/CMakeLists.txt index bce5c4db..edba17b4 100644 --- a/src/lib_gui/CMakeLists.txt +++ b/src/lib_gui/CMakeLists.txt @@ -104,6 +104,8 @@ add_files( qt/utility/QtScrollSpeedChangeListener.cpp qt/utility/QtScrollSpeedChangeListener.h qt/utility/QtThreadedFunctor.h + qt/utility/QtWindowsTaskbarButton.cpp + qt/utility/QtWindowsTaskbarButton.h qt/utility/utilityQt.cpp qt/utility/utilityQt.h diff --git a/src/lib_gui/qt/utility/QtFileDialog.h b/src/lib_gui/qt/utility/QtFileDialog.h index fad93b0b..c468d734 100644 --- a/src/lib_gui/qt/utility/QtFileDialog.h +++ b/src/lib_gui/qt/utility/QtFileDialog.h @@ -1,5 +1,5 @@ -#ifndef QT_FILE_DIALOG -#define QT_FILE_DIALOG +#ifndef QT_FILE_DIALOG_H +#define QT_FILE_DIALOG_H class QString; class QStringList; @@ -20,4 +20,4 @@ private: static QString getDir(QString dir); }; -#endif // QT_FILE_DIALOG +#endif // QT_FILE_DIALOG_H diff --git a/src/lib_gui/qt/utility/QtWindowsTaskbarButton.cpp b/src/lib_gui/qt/utility/QtWindowsTaskbarButton.cpp new file mode 100644 index 00000000..23e430c5 --- /dev/null +++ b/src/lib_gui/qt/utility/QtWindowsTaskbarButton.cpp @@ -0,0 +1,45 @@ +#include "qt/utility/QtWindowsTaskbarButton.h" + +#ifdef _WIN32 +#include +#include +#endif + +#include "qt/window/QtMainWindow.h" + +QtWindowsTaskbarButton::QtWindowsTaskbarButton() +#ifdef _WIN32 + : m_taskbarProgress(nullptr) +#endif +{ +} + +void QtWindowsTaskbarButton::setWindow(QtMainWindow* mainWindow) +{ +#ifdef _WIN32 + QWinTaskbarButton* taskbarButton = new QWinTaskbarButton(mainWindow); + taskbarButton->setWindow(mainWindow->windowHandle()); + m_taskbarProgress = taskbarButton->progress(); +#endif +} + +void QtWindowsTaskbarButton::setProgress(float progress) +{ +#ifdef _WIN32 + if (m_taskbarProgress != nullptr) + { + m_taskbarProgress->show(); + m_taskbarProgress->setValue(std::max(0, std::min(100, 100 * progress))); + } +#endif +} + +void QtWindowsTaskbarButton::hideProgress() +{ +#ifdef _WIN32 + if (m_taskbarProgress != nullptr) + { + m_taskbarProgress->hide(); + } +#endif +} diff --git a/src/lib_gui/qt/utility/QtWindowsTaskbarButton.h b/src/lib_gui/qt/utility/QtWindowsTaskbarButton.h new file mode 100644 index 00000000..41410d0a --- /dev/null +++ b/src/lib_gui/qt/utility/QtWindowsTaskbarButton.h @@ -0,0 +1,23 @@ +#ifndef QT_WINDOWS_TASKBAR_BUTTON_H +#define QT_WINDOWS_TASKBAR_BUTTON_H + +class QWinTaskbarProgress; +class QtMainWindow; + +class QtWindowsTaskbarButton +{ +public: + QtWindowsTaskbarButton(); + void setWindow(QtMainWindow* mainWindow); + + void setProgress(float progress); + void hideProgress(); + +private: + +#ifdef _WIN32 + QWinTaskbarProgress* m_taskbarProgress; +#endif +}; + +#endif // QT_WINDOWS_TASKBAR_BUTTON_H diff --git a/src/lib_gui/qt/view/QtDialogView.cpp b/src/lib_gui/qt/view/QtDialogView.cpp index 907cacd4..d215a70e 100644 --- a/src/lib_gui/qt/view/QtDialogView.cpp +++ b/src/lib_gui/qt/view/QtDialogView.cpp @@ -217,6 +217,7 @@ void QtDialogView::updateIndexingDialog( window->updateIndexingProgress(finishedFileCount, totalFileCount, sourcePath); setUIBlocked(true); } + m_mainWindow->setWindowsTaskbarProgress(float(finishedFileCount) / totalFileCount); } ); } @@ -236,6 +237,7 @@ void QtDialogView::finishedIndexingDialog( window->updateErrorCount(errorInfo.total, errorInfo.fatal); setUIBlocked(false); + m_mainWindow->hideWindowsTaskbarProgress(); } ); } diff --git a/src/lib_gui/qt/window/QtMainWindow.cpp b/src/lib_gui/qt/window/QtMainWindow.cpp index 45413b62..a7628073 100644 --- a/src/lib_gui/qt/window/QtMainWindow.cpp +++ b/src/lib_gui/qt/window/QtMainWindow.cpp @@ -374,6 +374,21 @@ void QtMainWindow::refreshStyle() setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("main/main.css"))).c_str()); } +void QtMainWindow::setWindowsTaskbarProgress(float progress) +{ + m_windowsTaskbarButton.setProgress(progress); +} + +void QtMainWindow::hideWindowsTaskbarProgress() +{ + m_windowsTaskbarButton.hideProgress(); +} + +void QtMainWindow::showEvent(QShowEvent* e) +{ + m_windowsTaskbarButton.setWindow(this); +} + void QtMainWindow::keyPressEvent(QKeyEvent* event) { switch (event->key()) diff --git a/src/lib_gui/qt/window/QtMainWindow.h b/src/lib_gui/qt/window/QtMainWindow.h index 069916e6..19ad7b0f 100644 --- a/src/lib_gui/qt/window/QtMainWindow.h +++ b/src/lib_gui/qt/window/QtMainWindow.h @@ -9,6 +9,7 @@ #include "data/search/SearchMatch.h" #include "LicenseChecker.h" +#include "qt/utility/QtWindowsTaskbarButton.h" #include "qt/window/QtWindowStack.h" class Bookmark; @@ -80,15 +81,19 @@ public: void setContentEnabled(bool enabled); void refreshStyle(); + void setWindowsTaskbarProgress(float progress); + void hideWindowsTaskbarProgress(); + signals: void showScreenSearch(); void hideScreenSearch(); protected: - void keyPressEvent(QKeyEvent* event); - void contextMenuEvent(QContextMenuEvent* event); - void closeEvent(QCloseEvent* event); - void resizeEvent(QResizeEvent* event); + virtual void showEvent(QShowEvent* event) override; + virtual void keyPressEvent(QKeyEvent* event) override; + virtual void contextMenuEvent(QContextMenuEvent* event) override; + virtual void closeEvent(QCloseEvent* event) override; + virtual void resizeEvent(QResizeEvent* event) override; public slots: void about(); @@ -189,6 +194,8 @@ private: bool m_showDockWidgetTitleBars; QtWindowStack m_windowStack; + + QtWindowsTaskbarButton m_windowsTaskbarButton; }; #endif // QT_MAIN_WINDOW_H