ui: Showing indexing progress in windows task bar
* implemented showing indexing progress in windows taskbar button * renamed TaskShowStatusDialog * added "Qt5WinExtras.dll" for windows builds
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
#include "qt/utility/QtWindowsTaskbarButton.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <QWinTaskbarButton>
|
||||
#include <QWinTaskbarProgress>
|
||||
#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<int>(100, 100 * progress)));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void QtWindowsTaskbarButton::hideProgress()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (m_taskbarProgress != nullptr)
|
||||
{
|
||||
m_taskbarProgress->hide();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -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
|
||||
@@ -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();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user