summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkintel <kintel@b57f626f-c46c-0410-a088-ec61d464b74c>2010-02-12 15:43:56 (GMT)
committerkintel <kintel@b57f626f-c46c-0410-a088-ec61d464b74c>2010-02-12 15:43:56 (GMT)
commit594f22e26e74f09c9d9ca8cf4b9e43d5f7998409 (patch)
tree0e4dcc6cfa44fa0c40f36496082a60caa2143d6e /src
parent2f74b4abd01d6bd0ccaabfe77bf7ddfc8df4822a (diff)
Delay showing the progress bar with one second
git-svn-id: http://svn.clifford.at/openscad/trunk@438 b57f626f-c46c-0410-a088-ec61d464b74c
Diffstat (limited to 'src')
-rw-r--r--src/MainWindow.h3
-rw-r--r--src/ProgressWidget.cc2
-rw-r--r--src/ProgressWidget.h4
-rw-r--r--src/mainwin.cc11
4 files changed, 17 insertions, 3 deletions
diff --git a/src/MainWindow.h b/src/MainWindow.h
index 216b7e2..44f2a87 100644
--- a/src/MainWindow.h
+++ b/src/MainWindow.h
@@ -62,6 +62,9 @@ private slots:
void updateTVal();
void setFileName(const QString &filename);
void setFont(const QString &family, uint size);
+#ifdef USE_PROGRESSWIDGET
+ void showProgress();
+#endif
private:
void openFile(const QString &filename);
diff --git a/src/ProgressWidget.cc b/src/ProgressWidget.cc
index 0e98286..a386192 100644
--- a/src/ProgressWidget.cc
+++ b/src/ProgressWidget.cc
@@ -1,4 +1,5 @@
#include "ProgressWidget.h"
+#include <QTimer>
ProgressWidget::ProgressWidget(QWidget *parent)
:QWidget(parent)
@@ -6,6 +7,7 @@ ProgressWidget::ProgressWidget(QWidget *parent)
setupUi(this);
this->wascanceled = false;
connect(this->stopButton, SIGNAL(clicked()), this, SLOT(cancel()));
+ QTimer::singleShot(1000, this, SIGNAL(requestShow()));
}
bool ProgressWidget::wasCanceled() const
diff --git a/src/ProgressWidget.h b/src/ProgressWidget.h
index a609dbd..715272b 100644
--- a/src/ProgressWidget.h
+++ b/src/ProgressWidget.h
@@ -17,9 +17,11 @@ public slots:
void setValue(int progress);
void cancel();
+signals:
+ void requestShow();
+
private:
bool wascanceled;
-
};
#endif
diff --git a/src/mainwin.cc b/src/mainwin.cc
index d1a84d2..b277d1f 100644
--- a/src/mainwin.cc
+++ b/src/mainwin.cc
@@ -344,6 +344,13 @@ MainWindow::~MainWindow()
#endif
}
+#ifdef USE_PROGRESSWIDGET
+void MainWindow::showProgress()
+{
+ this->statusBar()->addPermanentWidget(qobject_cast<ProgressWidget*>(sender()));
+}
+#endif
+
static void report_func(const class AbstractNode*, void *vp, int mark)
{
#ifdef USE_PROGRESSWIDGET
@@ -651,7 +658,7 @@ void MainWindow::compileCSG(bool procevents)
ProgressWidget *pd = new ProgressWidget(this);
pd->setRange(0, 100);
pd->setValue(0);
- this->statusBar()->addPermanentWidget(pd);
+ connect(pd, SIGNAL(requestShow()), this, SLOT(showProgress()));
#else
QProgressDialog *pd = new QProgressDialog("Rendering CSG products...", "Cancel", 0, 100);
pd->setRange(0, 100);
@@ -1057,7 +1064,7 @@ void MainWindow::actionRenderCGAL()
ProgressWidget *pd = new ProgressWidget(this);
pd->setRange(0, 100);
pd->setValue(0);
- this->statusBar()->addPermanentWidget(pd);
+ connect(pd, SIGNAL(requestShow()), this, SLOT(showProgress()));
#else
QProgressDialog *pd = new QProgressDialog("Rendering Polygon Mesh using CGAL...", "Cancel", 0, 100);
pd->setRange(0, 100);
contact: Jan Huwald // Impressum