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

Format of the progress bar display can now be changed.

parent e33b7a81
......@@ -321,7 +321,7 @@ void AlgorithmSelector::createProgressBars( int n )
m_CurrentToolProgress = new UIMultiProgressDialog( n, m_ToolContext.mainwin );
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)) );
}
}
......
......@@ -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_ProgressBars[n]->setFormat( format.isEmpty()? "%p%" : format );
m_ProgressBars[n]->setMaximum( maxValue );
m_ProgressBars[n]->setValue( 0 );
update();
QCoreApplication::processEvents();
}
......
......@@ -27,7 +27,7 @@ public:
UIMultiProgressDialog( unsigned int nProgressBar, QWidget *parent = NULL );
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 );
};
......
......@@ -72,10 +72,12 @@ public:
inline void deleteProgressBars() { emit notifyDeleteProgressBars(); }
/** Set up the label and maximum value of the specified progress bar. */
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,
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. */
inline void reportProgress( int value ) { emit notifyProgressValue( 0, value ); }
......@@ -84,7 +86,7 @@ public:
signals:
void notifyCreateProgressBars( int n );
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 );
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