Skip to content
Browse files

Add progress bar for rendering

  • Loading branch information...
1 parent 2a408e0 commit b4068ea6489a6c1cf4176fa0548a831320c2b65b @SokoloffA SokoloffA committed Feb 28, 2013
Showing with 49 additions and 1 deletion.
  1. +42 −1 gui/mainwindow.cpp
  2. +7 −0 gui/mainwindow.h
View
43 gui/mainwindow.cpp
@@ -69,6 +69,7 @@ MainWindow::MainWindow(PsProject *project, QWidget *parent):
ui->setupUi(this);
ui->preview->setRender(mRender);
+ delete ui->menuPreferences;
setWindowIcon(findIcon("document-print", ":/images/print-48x48"));
setWindowTitle(tr("Boomaga"));
@@ -125,9 +126,12 @@ MainWindow::MainWindow(PsProject *project, QWidget *parent):
connect(mProject, SIGNAL(fileMoved()), mRender, SLOT(refresh()));
connect(mProject, SIGNAL(fileMoved()), this, SLOT(updateCurrentSheet()));
-
connect(mRender, SIGNAL(finished()), this, SLOT(updateWidgets()));
+ connect(mRender, SIGNAL(started()), this, SLOT(showProgressBar()));
+ connect(mRender, SIGNAL(changed(int)), this, SLOT(updateProgressBar(int)));
+ connect(mRender, SIGNAL(finished()), this, SLOT(hideProgressBar()));
+
connect(ui->preview, SIGNAL(whellScrolled(int)), this, SLOT(psViewWhell(int)));
mRender->refresh();
@@ -239,6 +243,14 @@ void MainWindow::initStatusBar()
ui->statusbar->addPermanentWidget(&mStatusBarSheetsLabel);
mStatusBarSheetsLabel.setMinimumWidth(200);
mStatusBarSheetsLabel.setAlignment(Qt::AlignRight);
+
+ ui->statusbar->addWidget(&mProgressBar);
+ mProgressBar.setFixedWidth(200);
+ mProgressBar.setSizePolicy(mProgressBar.sizePolicy().horizontalPolicy(),
+ QSizePolicy::Maximum);
+
+ mProgressBar.setFormat(tr("%v of %m"));
+ mProgressBar.hide();
}
@@ -545,4 +557,33 @@ void MainWindow::showAboutDialog()
}
+/************************************************
+
+ ************************************************/
+void MainWindow::showProgressBar()
+{
+ mProgressBar.setValue(0);
+ mProgressBar.setMaximum(mProject->previewSheetCount());
+ mProgressBar.show();
+}
+
+
+/************************************************
+
+ ************************************************/
+void MainWindow::updateProgressBar(int value)
+{
+ mProgressBar.setValue(value);
+}
+
+
+/************************************************
+
+ ************************************************/
+void MainWindow::hideProgressBar()
+{
+ mProgressBar.hide();
+}
+
+
View
7 gui/mainwindow.h
@@ -29,6 +29,7 @@
#include <QMainWindow>
#include <QLabel>
+#include <QProgressBar>
class PsProject;
class PsRender;
@@ -75,6 +76,10 @@ private slots:
void showAboutDialog();
+ void showProgressBar();
+ void updateProgressBar(int value);
+ void hideProgressBar();
+
private:
Ui::MainWindow *ui;
PsProject *mProject;
@@ -86,6 +91,8 @@ private slots:
QLabel mStatusBarSheetsLabel;
QLabel mStatusBarCurrentSheetLabel;
+ QProgressBar mProgressBar;
+
void initActions();
void initStatusBar();

0 comments on commit b4068ea

Please sign in to comment.
Something went wrong with that request. Please try again.