23 #include "taskbarprogress.h" 32 #if (QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)) && defined(Q_OS_WIN32) 37 #include <QWinTaskbarProgress> 40 DClass<TaskbarProgress>
44 QWinTaskbarProgress *progress;
47 bool isAllowedOsVersion()
const 50 return QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7;
62 d->progress =
nullptr;
63 assert(d->isAllowedOsVersion());
64 if (d->isAllowedOsVersion())
65 d->progress = progress;
72 TaskbarProgress::TaskbarProgress(QObject *parent)
76 d->progress =
nullptr;
77 if (d->isAllowedOsVersion())
78 d->progress =
new QWinTaskbarProgress(
this);
84 void TaskbarProgress::construct()
87 if (d->progress !=
nullptr)
89 this->connect(d->progress, SIGNAL(maximumChanged(
int)), SIGNAL(maximumChanged(
int)));
90 this->connect(d->progress, SIGNAL(minimumChanged(
int)), SIGNAL(minimumChanged(
int)));
91 this->connect(d->progress, SIGNAL(valueChanged(
int)), SIGNAL(valueChanged(
int)));
92 this->connect(d->progress, SIGNAL(visibilityChanged(
bool)), SIGNAL(visibilityChanged(
bool)));
97 bool TaskbarProgress::isPaused()
const 100 if (d->progress !=
nullptr)
101 return d->progress->isPaused();
107 bool TaskbarProgress::isStopped()
const 110 if (d->progress !=
nullptr)
111 return d->progress->isStopped();
117 bool TaskbarProgress::isVisible()
const 120 if (d->progress !=
nullptr)
121 return d->progress->isVisible();
127 int TaskbarProgress::maximum()
const 130 if (d->progress !=
nullptr)
131 return d->progress->maximum();
137 int TaskbarProgress::minimum()
const 140 if (d->progress !=
nullptr)
141 return d->progress->minimum();
147 int TaskbarProgress::value()
const 150 if (d->progress !=
nullptr)
151 return d->progress->value();
157 void TaskbarProgress::hide()
160 if (d->progress !=
nullptr)
166 void TaskbarProgress::pause()
169 if (d->progress !=
nullptr)
170 d->progress->pause();
175 void TaskbarProgress::reset()
178 if (d->progress !=
nullptr)
179 d->progress->reset();
184 void TaskbarProgress::resume()
187 if (d->progress !=
nullptr)
188 d->progress->resume();
193 void TaskbarProgress::setMaximum(
int maximum)
196 if (d->progress !=
nullptr)
197 d->progress->setMaximum(maximum);
203 void TaskbarProgress::setMinimum(
int minimum)
206 if (d->progress !=
nullptr)
207 d->progress->setMinimum(minimum);
213 void TaskbarProgress::setPaused(
bool paused)
216 if (d->progress !=
nullptr)
217 d->progress->setPaused(paused);
223 void TaskbarProgress::setRange(
int minimum,
int maximum)
226 if (d->progress !=
nullptr)
227 d->progress->setRange(minimum, maximum);
234 void TaskbarProgress::setValue(
int value)
237 if (d->progress !=
nullptr)
238 d->progress->setValue(value);
244 void TaskbarProgress::setVisible(
bool visible)
247 if (d->progress !=
nullptr)
248 d->progress->setVisible(visible);
254 void TaskbarProgress::show()
257 if (d->progress !=
nullptr)
263 void TaskbarProgress::stop()
266 if (d->progress !=
nullptr)
Platform-agnostic wrapper for QWinTaskbarProgress.