From 6da9eb6a771f6c4fc153b4dc0eb10db84b674808 Mon Sep 17 00:00:00 2001 From: Oliver Gloth Date: Tue, 10 Jul 2012 09:29:12 +0200 Subject: [PATCH] added progress bar --- src/libengrid/guimainwindow.cpp | 23 +++++++++++++++++++++++ src/libengrid/guimainwindow.h | 32 +++++++++++++++++++------------- 2 files changed, 42 insertions(+), 13 deletions(-) diff --git a/src/libengrid/guimainwindow.cpp b/src/libengrid/guimainwindow.cpp index cade652..e4cd081 100644 --- a/src/libengrid/guimainwindow.cpp +++ b/src/libengrid/guimainwindow.cpp @@ -131,6 +131,13 @@ void GuiMainWindow::setupGuiMainWindow() setWindowTitle(m_CurrentFilename + " - enGrid - " + QString("%1").arg(m_CurrentOperation) ); setUnsaved(true); + m_StatusInfoLabel = new QLabel(this); + statusBar()->addWidget(m_StatusInfoLabel); + m_StatusInfoLabel->setText(""); + + m_StatusProgressBar = new QProgressBar(this); + statusBar()->addWidget(m_StatusProgressBar); + m_StatusLabel = new QLabel(this); statusBar()->addWidget(m_StatusLabel); @@ -2376,3 +2383,19 @@ void GuiMainWindow::onEsc() updateActors(true); updateStatusBar(); } + +void GuiMainWindow::resetProgress(QString info_text, int p_max) +{ + m_StatusInfoLabel->setText(info_text); + m_StatusProgressBar->setMaximum(p_max); + m_StatusProgressBar->setValue(0); + QApplication::processEvents(); +} + +void GuiMainWindow::setProgress(int p) +{ + m_StatusProgressBar->setValue(p); + for (int i = 0; i < 3; ++i) { + QApplication::processEvents(); + } +} diff --git a/src/libengrid/guimainwindow.h b/src/libengrid/guimainwindow.h index 23e5a62..9bd1508 100644 --- a/src/libengrid/guimainwindow.h +++ b/src/libengrid/guimainwindow.h @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -164,20 +165,22 @@ class CLASS_LIBENGRID_DLL GuiMainWindow : public QMainWindow, public EgVtkObject vtkPointPicker* m_PointPicker; ///< VTK PointPicker to pick points for various user interactions int m_PickedObject; ///< 0=none, 1=node, 2=cell - QString m_CurrentFilename; ///< The current file name of the grid. - int m_CurrentOperation; ///< The current operation number. (used for undo/redo) - bool m_undo_redo_enabled; ///< if true, undo/redo operations will be usable. - int m_LastOperation; ///< The last operation number. (used for undo/redo) - QString m_LogDir; ///< the log directory - QLabel* m_StatusLabel; ///< Label for the information in the status bar - QSet m_DisplayBoundaryCodes; ///< A QList with all active boundary codes. - QSet m_AllBoundaryCodes; ///< A QList with all boundary codes. - bool m_Busy; ///< flag to indicate that enGrid is busy with an operation - QString m_LogFileName; ///< log file to collect program output for display in the output window - long int m_N_chars; ///< number of lines that have been read from the log file + QString m_CurrentFilename; ///< The current file name of the grid. + int m_CurrentOperation; ///< The current operation number. (used for undo/redo) + bool m_undo_redo_enabled; ///< if true, undo/redo operations will be usable. + int m_LastOperation; ///< The last operation number. (used for undo/redo) + QString m_LogDir; ///< the log directory + QLabel* m_StatusLabel; ///< Label for the information in the status bar + QLabel* m_StatusInfoLabel; + QProgressBar* m_StatusProgressBar; + QSet m_DisplayBoundaryCodes; ///< A QList with all active boundary codes. + QSet m_AllBoundaryCodes; ///< A QList with all boundary codes. + bool m_Busy; ///< flag to indicate that enGrid is busy with an operation + QString m_LogFileName; ///< log file to collect program output for display in the output window + long int m_N_chars; ///< number of lines that have been read from the log file #if defined( __linux__ ) //for Linux - int m_SystemStdout; - int m_LogFileStdout; + int m_SystemStdout; + int m_LogFileStdout; fpos_t m_SystemStdout_pos; fpos_t m_LogFileStdout_pos; #elif defined( _WIN32 ) //for Windows @@ -398,6 +401,9 @@ class CLASS_LIBENGRID_DLL GuiMainWindow : public QMainWindow, public EgVtkObject void setSystemOutput(); void setLogFileOutput(); + void resetProgress(QString info_text, int p_max); + void setProgress(int p); + public slots: void setUseVTKInteractor( int a_UseVTKInteractor ); -- 2.11.4.GIT