Gui: [skip-ci] rename Sequencer to SequencerBar
This commit is contained in:
@@ -326,7 +326,7 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f)
|
||||
d->sizeLabel = new QLabel(tr("Dimension"), statusBar());
|
||||
d->sizeLabel->setMinimumWidth(120);
|
||||
statusBar()->addWidget(d->actionLabel, 1);
|
||||
QProgressBar* progressBar = Gui::Sequencer::instance()->getProgressBar(statusBar());
|
||||
QProgressBar* progressBar = Gui::SequencerBar::instance()->getProgressBar(statusBar());
|
||||
statusBar()->addPermanentWidget(progressBar, 0);
|
||||
statusBar()->addPermanentWidget(d->sizeLabel, 0);
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ using namespace Gui;
|
||||
|
||||
|
||||
namespace Gui {
|
||||
struct SequencerPrivate
|
||||
struct SequencerBarPrivate
|
||||
{
|
||||
ProgressBar* bar;
|
||||
WaitCursor* waitCursor;
|
||||
@@ -74,33 +74,33 @@ struct ProgressBarPrivate
|
||||
};
|
||||
}
|
||||
|
||||
Sequencer* Sequencer::_pclSingleton = 0;
|
||||
SequencerBar* SequencerBar::_pclSingleton = 0;
|
||||
|
||||
Sequencer* Sequencer::instance()
|
||||
SequencerBar* SequencerBar::instance()
|
||||
{
|
||||
// not initialized?
|
||||
if (!_pclSingleton)
|
||||
{
|
||||
_pclSingleton = new Sequencer();
|
||||
_pclSingleton = new SequencerBar();
|
||||
}
|
||||
|
||||
return _pclSingleton;
|
||||
}
|
||||
|
||||
Sequencer::Sequencer ()
|
||||
SequencerBar::SequencerBar()
|
||||
{
|
||||
d = new SequencerPrivate;
|
||||
d = new SequencerBarPrivate;
|
||||
d->bar = 0;
|
||||
d->waitCursor = 0;
|
||||
d->guiThread = true;
|
||||
}
|
||||
|
||||
Sequencer::~Sequencer ()
|
||||
SequencerBar::~SequencerBar()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
void Sequencer::pause()
|
||||
void SequencerBar::pause()
|
||||
{
|
||||
QThread *currentThread = QThread::currentThread();
|
||||
QThread *thr = d->bar->thread(); // this is the main thread
|
||||
@@ -113,7 +113,7 @@ void Sequencer::pause()
|
||||
QApplication::setOverrideCursor(Qt::ArrowCursor);
|
||||
}
|
||||
|
||||
void Sequencer::resume()
|
||||
void SequencerBar::resume()
|
||||
{
|
||||
QThread *currentThread = QThread::currentThread();
|
||||
QThread *thr = d->bar->thread(); // this is the main thread
|
||||
@@ -126,7 +126,7 @@ void Sequencer::resume()
|
||||
d->bar->enterControlEvents(); // grab again
|
||||
}
|
||||
|
||||
void Sequencer::startStep()
|
||||
void SequencerBar::startStep()
|
||||
{
|
||||
QThread *currentThread = QThread::currentThread();
|
||||
QThread *thr = d->bar->thread(); // this is the main thread
|
||||
@@ -150,8 +150,9 @@ void Sequencer::startStep()
|
||||
}
|
||||
}
|
||||
|
||||
void Sequencer::checkAbort() {
|
||||
if(d->bar->thread() != QThread::currentThread())
|
||||
void SequencerBar::checkAbort()
|
||||
{
|
||||
if (d->bar->thread() != QThread::currentThread())
|
||||
return;
|
||||
if (!wasCanceled()) {
|
||||
if(d->checkAbortTime.elapsed() < 500)
|
||||
@@ -174,7 +175,7 @@ void Sequencer::checkAbort() {
|
||||
}
|
||||
}
|
||||
|
||||
void Sequencer::nextStep(bool canAbort)
|
||||
void SequencerBar::nextStep(bool canAbort)
|
||||
{
|
||||
QThread *currentThread = QThread::currentThread();
|
||||
QThread *thr = d->bar->thread(); // this is the main thread
|
||||
@@ -203,13 +204,13 @@ void Sequencer::nextStep(bool canAbort)
|
||||
}
|
||||
}
|
||||
|
||||
void Sequencer::setProgress(size_t step)
|
||||
void SequencerBar::setProgress(size_t step)
|
||||
{
|
||||
d->bar->show();
|
||||
setValue((int)step);
|
||||
}
|
||||
|
||||
void Sequencer::setValue(int step)
|
||||
void SequencerBar::setValue(int step)
|
||||
{
|
||||
QThread *currentThread = QThread::currentThread();
|
||||
QThread *thr = d->bar->thread(); // this is the main thread
|
||||
@@ -251,7 +252,7 @@ void Sequencer::setValue(int step)
|
||||
}
|
||||
}
|
||||
|
||||
void Sequencer::showRemainingTime()
|
||||
void SequencerBar::showRemainingTime()
|
||||
{
|
||||
QThread *currentThread = QThread::currentThread();
|
||||
QThread *thr = d->bar->thread(); // this is the main thread
|
||||
@@ -285,7 +286,7 @@ void Sequencer::showRemainingTime()
|
||||
}
|
||||
}
|
||||
|
||||
void Sequencer::resetData()
|
||||
void SequencerBar::resetData()
|
||||
{
|
||||
QThread *currentThread = QThread::currentThread();
|
||||
QThread *thr = d->bar->thread(); // this is the main thread
|
||||
@@ -318,7 +319,7 @@ void Sequencer::resetData()
|
||||
SequencerBase::resetData();
|
||||
}
|
||||
|
||||
void Sequencer::abort()
|
||||
void SequencerBar::abort()
|
||||
{
|
||||
//resets
|
||||
resetData();
|
||||
@@ -326,7 +327,7 @@ void Sequencer::abort()
|
||||
throw exc;
|
||||
}
|
||||
|
||||
void Sequencer::setText (const char* pszTxt)
|
||||
void SequencerBar::setText (const char* pszTxt)
|
||||
{
|
||||
QThread *currentThread = QThread::currentThread();
|
||||
QThread *thr = d->bar->thread(); // this is the main thread
|
||||
@@ -344,12 +345,12 @@ void Sequencer::setText (const char* pszTxt)
|
||||
}
|
||||
}
|
||||
|
||||
bool Sequencer::isBlocking() const
|
||||
bool SequencerBar::isBlocking() const
|
||||
{
|
||||
return d->guiThread;
|
||||
}
|
||||
|
||||
QProgressBar* Sequencer::getProgressBar(QWidget* parent)
|
||||
QProgressBar* SequencerBar::getProgressBar(QWidget* parent)
|
||||
{
|
||||
if (!d->bar)
|
||||
d->bar = new ProgressBar(this, parent);
|
||||
@@ -360,7 +361,7 @@ QProgressBar* Sequencer::getProgressBar(QWidget* parent)
|
||||
|
||||
/* TRANSLATOR Gui::ProgressBar */
|
||||
|
||||
ProgressBar::ProgressBar (Sequencer* s, QWidget * parent)
|
||||
ProgressBar::ProgressBar (SequencerBar* s, QWidget * parent)
|
||||
: QProgressBar(parent), sequencer(s)
|
||||
{
|
||||
#ifdef QT_WINEXTRAS_LIB
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
namespace Gui {
|
||||
|
||||
struct SequencerPrivate;
|
||||
struct SequencerBarPrivate;
|
||||
struct ProgressBarPrivate;
|
||||
class ProgressBar;
|
||||
|
||||
@@ -90,11 +90,11 @@ class ProgressBar;
|
||||
* just a busy indicator instead of percentage steps.
|
||||
* @author Werner Mayer
|
||||
*/
|
||||
class GuiExport Sequencer : public Base::SequencerBase
|
||||
class GuiExport SequencerBar : public Base::SequencerBase
|
||||
{
|
||||
public:
|
||||
/** Returns the sequencer object. */
|
||||
static Sequencer* instance();
|
||||
static SequencerBar* instance();
|
||||
/** This restores the last overridden cursor and release the keyboard while the progress bar
|
||||
* is running. This is useful e.g. if a modal dialog appears while a long operation is performed
|
||||
* to indicate that the user can click on the dialog. Every pause() must eventually be followed
|
||||
@@ -111,9 +111,9 @@ public:
|
||||
|
||||
protected:
|
||||
/** Construction */
|
||||
Sequencer ();
|
||||
SequencerBar();
|
||||
/** Destruction */
|
||||
~Sequencer ();
|
||||
~SequencerBar();
|
||||
|
||||
/** Puts text to the status bar */
|
||||
void setText (const char* pszTxt) override;
|
||||
@@ -134,8 +134,8 @@ private:
|
||||
/** Throws an exception to stop the pending operation. */
|
||||
void abort();
|
||||
//@}
|
||||
SequencerPrivate* d;
|
||||
static Sequencer* _pclSingleton;
|
||||
SequencerBarPrivate* d;
|
||||
static SequencerBar* _pclSingleton;
|
||||
|
||||
friend class ProgressBar;
|
||||
};
|
||||
@@ -146,7 +146,7 @@ class ProgressBar : public QProgressBar
|
||||
|
||||
public:
|
||||
/** Construction */
|
||||
ProgressBar (Sequencer* s, QWidget * parent=0);
|
||||
ProgressBar (SequencerBar* s, QWidget * parent=0);
|
||||
/** Destruction */
|
||||
~ProgressBar ();
|
||||
|
||||
@@ -196,15 +196,15 @@ private:
|
||||
|
||||
//@}
|
||||
ProgressBarPrivate* d;
|
||||
Sequencer* sequencer;
|
||||
|
||||
SequencerBar* sequencer;
|
||||
|
||||
#ifdef QT_WINEXTRAS_LIB
|
||||
/* Set up the taskbar progress in windows */
|
||||
void setupTaskBarProgress(void);
|
||||
QWinTaskbarProgress* m_taskbarProgress;
|
||||
QWinTaskbarButton* m_taskbarButton;
|
||||
#endif
|
||||
friend class Sequencer;
|
||||
friend class SequencerBar;
|
||||
};
|
||||
|
||||
} // namespace Gui
|
||||
|
||||
@@ -683,7 +683,7 @@ QUrl BrowserView::url() const
|
||||
|
||||
void BrowserView::onLoadStarted()
|
||||
{
|
||||
QProgressBar* bar = Gui::Sequencer::instance()->getProgressBar();
|
||||
QProgressBar* bar = Gui::SequencerBar::instance()->getProgressBar();
|
||||
bar->setRange(0, 100);
|
||||
bar->show();
|
||||
Gui::getMainWindow()->showMessage(tr("Loading %1...").arg(view->url().toString()));
|
||||
@@ -692,14 +692,14 @@ void BrowserView::onLoadStarted()
|
||||
|
||||
void BrowserView::onLoadProgress(int step)
|
||||
{
|
||||
QProgressBar* bar = Gui::Sequencer::instance()->getProgressBar();
|
||||
QProgressBar* bar = Gui::SequencerBar::instance()->getProgressBar();
|
||||
bar->setValue(step);
|
||||
}
|
||||
|
||||
void BrowserView::onLoadFinished(bool ok)
|
||||
{
|
||||
if (ok) {
|
||||
QProgressBar* bar = Sequencer::instance()->getProgressBar();
|
||||
QProgressBar* bar = SequencerBar::instance()->getProgressBar();
|
||||
bar->setValue(100);
|
||||
bar->hide();
|
||||
getMainWindow()->showMessage(QString());
|
||||
|
||||
Reference in New Issue
Block a user