mirror of https://github.com/vitalif/openscad
Switch between progress widget and status label.
parent
3d9b66cf0f
commit
5dc88d0eed
|
@ -71,6 +71,7 @@ public:
|
|||
QAction *actionRecentFile[UIUtils::maxRecentFiles];
|
||||
QMap<QString, QString> knownFileExtensions;
|
||||
|
||||
QLabel *versionLabel;
|
||||
QWidget *editorDockTitleWidget;
|
||||
QWidget *consoleDockTitleWidget;
|
||||
|
||||
|
@ -116,6 +117,7 @@ private:
|
|||
void show_examples();
|
||||
void setDockWidgetTitle(QDockWidget *dockWidget, QString prefix, bool topLevel);
|
||||
void addKeyboardShortCut(const QList<QAction *> &actions);
|
||||
void updateStatusBar(class ProgressWidget *progressWidget);
|
||||
|
||||
EditorInterface *editor;
|
||||
|
||||
|
|
|
@ -181,8 +181,8 @@ MainWindow::MainWindow(const QString &filename)
|
|||
this->consoleDock->setConfigKey("view/hideConsole");
|
||||
this->consoleDock->setAction(this->viewActionHideConsole);
|
||||
|
||||
QLabel *versionLabel = new QLabel(openscad_version.c_str());
|
||||
this->statusbar->addPermanentWidget(versionLabel);
|
||||
this->versionLabel = NULL; // must be initialized before calling updateStatusBar()
|
||||
updateStatusBar(NULL);
|
||||
|
||||
QSettings settings;
|
||||
editortype = settings.value("editor/editortype").toString();
|
||||
|
@ -683,7 +683,7 @@ MainWindow::~MainWindow()
|
|||
|
||||
void MainWindow::showProgress()
|
||||
{
|
||||
this->statusBar()->addPermanentWidget(qobject_cast<ProgressWidget*>(sender()));
|
||||
updateStatusBar(qobject_cast<ProgressWidget*>(sender()));
|
||||
}
|
||||
|
||||
void MainWindow::report_func(const class AbstractNode*, void *vp, int mark)
|
||||
|
@ -1056,9 +1056,7 @@ void MainWindow::compileCSG(bool procevents)
|
|||
PRINT("CSG generation cancelled.");
|
||||
}
|
||||
progress_report_fin();
|
||||
this->statusBar()->removeWidget(this->progresswidget);
|
||||
delete this->progresswidget;
|
||||
this->progresswidget = NULL;
|
||||
updateStatusBar(NULL);
|
||||
|
||||
PRINT("Compiling design (CSG Products normalization)...");
|
||||
if (procevents) QApplication::processEvents();
|
||||
|
@ -1796,15 +1794,47 @@ void MainWindow::actionRenderDone(shared_ptr<const Geometry> root_geom)
|
|||
PRINT("WARNING: No top level geometry to render");
|
||||
}
|
||||
|
||||
this->statusBar()->removeWidget(this->progresswidget);
|
||||
delete this->progresswidget;
|
||||
this->progresswidget = NULL;
|
||||
updateStatusBar(NULL);
|
||||
|
||||
this->contentschanged = false;
|
||||
compileEnded();
|
||||
}
|
||||
|
||||
#endif /* ENABLE_CGAL */
|
||||
|
||||
/**
|
||||
* Switch version label and progress widget. When switching to the progress
|
||||
* widget, the new instance is passed by the caller.
|
||||
* In case of resetting back to the version label, NULL will be passed and
|
||||
* multiple calls can happen. So this method must guard against adding the
|
||||
* version label multiple times.
|
||||
*
|
||||
* @param progressWidget a pointer to the progress widget to show or NULL in
|
||||
* case the display should switch back to the version label.
|
||||
*/
|
||||
void MainWindow::updateStatusBar(ProgressWidget *progressWidget)
|
||||
{
|
||||
QStatusBar *sb = this->statusBar();
|
||||
if (progressWidget == NULL) {
|
||||
if (this->progresswidget != NULL) {
|
||||
sb->removeWidget(this->progresswidget);
|
||||
delete this->progresswidget;
|
||||
this->progresswidget = NULL;
|
||||
}
|
||||
if (versionLabel == NULL) {
|
||||
versionLabel = new QLabel(openscad_version.c_str());
|
||||
sb->addPermanentWidget(this->versionLabel);
|
||||
}
|
||||
} else {
|
||||
if (this->versionLabel != NULL) {
|
||||
sb->removeWidget(this->versionLabel);
|
||||
delete this->versionLabel;
|
||||
this->versionLabel = NULL;
|
||||
}
|
||||
sb->addPermanentWidget(progressWidget);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::actionDisplayAST()
|
||||
{
|
||||
setCurrentOutput();
|
||||
|
|
Loading…
Reference in New Issue