Resolved issue #414. Add features from Qt Windows Extras.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-02-03 20:21:08 +02:00
parent 14d5cf25ad
commit f26087350d
5 changed files with 80 additions and 2 deletions

View File

@ -41,6 +41,7 @@
- [#392] Improve feature: Show progress bar while opening pattern file.
- [#732] Tape app. Improve Database dialog.
- [#804] New feature. Import measurements from CSV file in Tape app.
- [#414] Add features from Qt Windows Extras.
# Version 0.5.1
- [#683] Tool Seam allowance's dialog is off screen on small resolutions.

View File

@ -88,6 +88,11 @@
#include <QDoubleSpinBox>
#include <QProgressBar>
#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
#include <QWinTaskbarButton>
#include <QWinTaskbarProgress>
#endif
#if defined(Q_OS_MAC)
#include <QMimeData>
#include <QDrag>
@ -176,6 +181,9 @@ MainWindow::MainWindow(QWidget *parent)
InitToolButtons();
m_progressBar->setVisible(false);
#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
m_taskbarProgress->setVisible(false);
#endif
m_statusLabel->setText(tr("Create new pattern piece to start working."));
statusBar()->addPermanentWidget(m_statusLabel, 1);
statusBar()->addPermanentWidget(m_progressBar, 1);
@ -1456,6 +1464,10 @@ void MainWindow::showEvent( QShowEvent *event )
return;
}
#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
m_taskbarButton->setWindow(windowHandle());
#endif
if (isInitialized)
{
return;
@ -2982,6 +2994,9 @@ void MainWindow::Clear()
toolOptions->ClearPropertyBrowser();
toolOptions->itemClicked(nullptr);
m_progressBar->setVisible(false);
#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
m_taskbarProgress->setVisible(false);
#endif
m_statusLabel->setVisible(true);
}
@ -3457,7 +3472,11 @@ void MainWindow::ShowProgress()
{
if (m_progressBar->isVisible() && m_progressBar->value() + 1 <= m_progressBar->maximum())
{
m_progressBar->setValue(m_progressBar->value() + 1);
const int newValue = m_progressBar->value() + 1;
m_progressBar->setValue(newValue);
#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
m_taskbarProgress->setValue(newValue);
#endif
qApp->processEvents();
}
}
@ -4558,9 +4577,19 @@ bool MainWindow::LoadPattern(QString fileName, const QString& customMeasureFile)
m_progressBar->setVisible(true);
m_statusLabel->setVisible(false);
m_progressBar->setMaximum(doc->ElementsToParse());
const int elements = doc->ElementsToParse();
m_progressBar->setMaximum(elements);
#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
m_taskbarProgress->setVisible(true);
m_taskbarProgress->setMaximum(elements);
#endif
FullParseFile();
m_progressBar->setVisible(false);
#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
m_taskbarProgress->setVisible(false);
#endif
m_statusLabel->setVisible(true);
if (guiEnabled)

View File

@ -58,6 +58,11 @@
#include <QPrintDialog>
#include <QPrinterInfo>
#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
#include <QWinTaskbarButton>
#include <QWinTaskbarProgress>
#endif
#ifdef Q_OS_WIN
# define PDFTOPS "pdftops.exe"
#else
@ -134,12 +139,22 @@ MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent)
margins(),
paperSize(),
m_dialogSaveLayout(),
#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
m_taskbarButton(new QWinTaskbarButton(this)),
m_taskbarProgress(nullptr),
#endif
isTiled(false),
isAutoCrop(false),
isUnitePages(false),
layoutPrinterName()
{
InitTempLayoutScene();
#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
m_taskbarButton->setWindow(this->windowHandle());
m_taskbarProgress = m_taskbarButton->progress();
m_taskbarProgress->setMinimum(0);
#endif
}
//---------------------------------------------------------------------------------------------------------------------
@ -182,6 +197,12 @@ bool MainWindowsNoGUI::LayoutSettings(VLayoutGenerator& lGenerator)
DialogLayoutProgress progress(listDetails.count(), this);
if (VApplication::IsGUIMode())
{
#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
m_taskbarProgress->setVisible(true);
m_taskbarProgress->setValue(0);
m_taskbarProgress->setMaximum(listDetails.count());
connect(&lGenerator, &VLayoutGenerator::Arranged, m_taskbarProgress, &QWinTaskbarProgress::setValue);
#endif
connect(&lGenerator, &VLayoutGenerator::Start, &progress, &DialogLayoutProgress::Start);
connect(&lGenerator, &VLayoutGenerator::Arranged, &progress, &DialogLayoutProgress::Arranged);
connect(&lGenerator, &VLayoutGenerator::Error, &progress, &DialogLayoutProgress::Error);
@ -194,6 +215,13 @@ bool MainWindowsNoGUI::LayoutSettings(VLayoutGenerator& lGenerator)
}
lGenerator.Generate();
#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
if (VApplication::IsGUIMode())
{
m_taskbarProgress->setVisible(false);
}
#endif
switch (lGenerator.State())
{
case LayoutErrors::NoError:

View File

@ -42,6 +42,11 @@ class QGraphicsScene;
struct PosterData;
class QGraphicsRectItem;
#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
class QWinTaskbarButton;
class QWinTaskbarProgress;
#endif
class MainWindowsNoGUI : public VAbstractMainWindow
{
Q_OBJECT
@ -92,6 +97,11 @@ protected:
QSharedPointer<DialogSaveLayout> m_dialogSaveLayout;
#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
QWinTaskbarButton *m_taskbarButton;
QWinTaskbarProgress *m_taskbarProgress;
#endif
static QVector<VLayoutPiece> PrepareDetailsForLayout(const QHash<quint32, VPiece> &details);
void ExportData(const QVector<VLayoutPiece> &listDetails);

View File

@ -13,6 +13,11 @@ include(../../../common.pri)
# library in installer.
QT += core gui widgets xml svg printsupport xmlpatterns concurrent
# Use winextras only for Windows 7+
win32:greaterThan(QT_MAJOR_VERSION, 4):greaterThan(QT_MINOR_VERSION, 6) {
QT += winextras
}
# We want create executable file
TEMPLATE = app
@ -304,6 +309,11 @@ win32:*g++* {
$$[QT_INSTALL_BINS]/libstdc++-6.dll \
$$[QT_INSTALL_BINS]/libwinpthread-1.dll
# For support Windows 7+
greaterThan(QT_MAJOR_VERSION, 4):greaterThan(QT_MINOR_VERSION, 6) {
package.files += $$[QT_INSTALL_BINS]/Qt5WinExtras.dll
}
package.CONFIG = no_check_exist
INSTALLS += package