Commit 7066ecf5 authored by Frédéric Larue's avatar Frédéric Larue
Browse files

Format of the progress bar display can now be changed.

parent e33b7a81
...@@ -321,7 +321,7 @@ void AlgorithmSelector::createProgressBars( int n ) ...@@ -321,7 +321,7 @@ void AlgorithmSelector::createProgressBars( int n )
m_CurrentToolProgress = new UIMultiProgressDialog( n, m_ToolContext.mainwin ); m_CurrentToolProgress = new UIMultiProgressDialog( n, m_ToolContext.mainwin );
m_CurrentToolProgress->setWindowTitle( m_SelectedTool->plugin->name(m_SelectedTool->id) ); m_CurrentToolProgress->setWindowTitle( m_SelectedTool->plugin->name(m_SelectedTool->id) );
connect( m_SelectedTool->plugin, SIGNAL(notifyProgressBar(unsigned int,QString,int)), m_CurrentToolProgress, SLOT(setBar(unsigned int,QString,int)) ); connect( m_SelectedTool->plugin, SIGNAL(notifyProgressBar(unsigned int,QString,int,QString)), m_CurrentToolProgress, SLOT(setBar(unsigned int,QString,int,QString)) );
connect( m_SelectedTool->plugin, SIGNAL(notifyProgressValue(unsigned int,int)), m_CurrentToolProgress, SLOT(setProgress(unsigned int,int)) ); connect( m_SelectedTool->plugin, SIGNAL(notifyProgressValue(unsigned int,int)), m_CurrentToolProgress, SLOT(setProgress(unsigned int,int)) );
} }
} }
......
...@@ -50,10 +50,12 @@ UIMultiProgressDialog::UIMultiProgressDialog( unsigned int nProgressBar, QWidget ...@@ -50,10 +50,12 @@ UIMultiProgressDialog::UIMultiProgressDialog( unsigned int nProgressBar, QWidget
} }
void UIMultiProgressDialog::setBar( unsigned int n, const QString& label, int maxValue ) void UIMultiProgressDialog::setBar( unsigned int n, const QString& label, int maxValue, const QString& format )
{ {
m_Labels[n]->setText( label ); m_Labels[n]->setText( label );
m_ProgressBars[n]->setFormat( format.isEmpty()? "%p%" : format );
m_ProgressBars[n]->setMaximum( maxValue ); m_ProgressBars[n]->setMaximum( maxValue );
m_ProgressBars[n]->setValue( 0 );
update(); update();
QCoreApplication::processEvents(); QCoreApplication::processEvents();
} }
......
...@@ -27,7 +27,7 @@ public: ...@@ -27,7 +27,7 @@ public:
UIMultiProgressDialog( unsigned int nProgressBar, QWidget *parent = NULL ); UIMultiProgressDialog( unsigned int nProgressBar, QWidget *parent = NULL );
public slots: public slots:
void setBar( unsigned int n, const QString& label, int maxValue ); void setBar( unsigned int n, const QString& label, int maxValue, const QString& format = QString() );
void setProgress( unsigned int n, int value ); void setProgress( unsigned int n, int value );
}; };
......
...@@ -72,10 +72,12 @@ public: ...@@ -72,10 +72,12 @@ public:
inline void deleteProgressBars() { emit notifyDeleteProgressBars(); } inline void deleteProgressBars() { emit notifyDeleteProgressBars(); }
/** Set up the label and maximum value of the specified progress bar. */ /** Set up the label and maximum value of the specified progress bar. */
inline void setProgressBar( const QString& label, inline void setProgressBar( const QString& label,
int maxValue ) { emit notifyProgressBar( 0, label, maxValue ); } int maxValue,
const QString& format = QString() ) { emit notifyProgressBar( 0, label, maxValue, format ); }
inline void setProgressBar( unsigned int n, inline void setProgressBar( unsigned int n,
const QString& label, const QString& label,
int maxValue ) { emit notifyProgressBar( n, label, maxValue ); } int maxValue,
const QString& format = QString() ) { emit notifyProgressBar( n, label, maxValue, format ); }
/** Set the current progress value of the specified progress bar. */ /** Set the current progress value of the specified progress bar. */
inline void reportProgress( int value ) { emit notifyProgressValue( 0, value ); } inline void reportProgress( int value ) { emit notifyProgressValue( 0, value ); }
...@@ -84,7 +86,7 @@ public: ...@@ -84,7 +86,7 @@ public:
signals: signals:
void notifyCreateProgressBars( int n ); void notifyCreateProgressBars( int n );
void notifyDeleteProgressBars(); void notifyDeleteProgressBars();
void notifyProgressBar( unsigned int n, const QString& label, int maxValue ); void notifyProgressBar( unsigned int n, const QString& label, int maxValue, const QString& format );
void notifyProgressValue( unsigned int n, int value ); void notifyProgressValue( unsigned int n, int value );
public slots: public slots:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment