Commit f176cded authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] - now percentage is limited to precision of 0 and the data modules...

[CHANGE] - now percentage is limited to precision of 0 and the data modules now show the stripped filename again
parent ea398eeb
......@@ -27,6 +27,16 @@
WQtDatasetTreeItem::WQtDatasetTreeItem( QTreeWidgetItem * parent, boost::shared_ptr< WModule > module )
: WQtTreeItem( parent, 1, module )
{
// replace the name by the filename
m_name = module->getProperties()->getValue< std::string >( "filename" );
// remove the path up to the file name
if ( m_name != "" )
{
m_name = string_utils::tokenize( m_name, "/" ).back();
}
setText( 0, m_name.c_str() );
}
WQtDatasetTreeItem::~WQtDatasetTreeItem()
......
......@@ -41,15 +41,5 @@ WQtDatasetTreeItem* WQtSubjectTreeItem::addDatasetItem( boost::shared_ptr< WModu
{
WQtDatasetTreeItem* ds = new WQtDatasetTreeItem( this, module );
std::string name = module->getProperties()->getValueString( "Name" );
// remove the path up to the file name
if ( name != "" )
{
name = string_utils::tokenize( name, "/" ).back();
}
ds->setText( 0, QString( name.c_str() ) );
return ds;
}
......@@ -33,6 +33,7 @@ WQtTreeItem::WQtTreeItem( QTreeWidgetItem * parent, int type, boost::shared_ptr<
QTreeWidgetItem( parent, type )
{
m_module = module;
m_name = module->getName();
if ( module->getProperties()->getValue< bool > ( "active" ) )
{
......@@ -47,7 +48,7 @@ WQtTreeItem::WQtTreeItem( QTreeWidgetItem * parent, int type, boost::shared_ptr<
m_updateTimer = boost::shared_ptr< QTimer >( new QTimer() );
connect( m_updateTimer.get(), SIGNAL( timeout() ), this, SLOT( update() ) );
m_updateTimer->start( 500 );
m_updateTimer->start( 250 );
}
WQtTreeItem::~WQtTreeItem()
......@@ -59,7 +60,17 @@ boost::shared_ptr< WModule > WQtTreeItem::getModule()
return m_module;
}
std::string WQtTreeItem::getName()
{
return m_name;
}
void WQtTreeItem::update()
{
updateState();
}
void WQtTreeItem::updateState()
{
boost::shared_ptr< WProgressCombiner> p = m_module->getRootProgressCombiner();
......@@ -70,11 +81,11 @@ void WQtTreeItem::update()
if ( p->isPending() )
{
std::ostringstream title;
title << m_module->getName();
title << m_name;
if ( p->isDetermined() )
{
title << " - " << p->getProgress() << "%";
title << " - " << std::setprecision(0) << p->getProgress() << "%";
}
else
{
......@@ -85,7 +96,7 @@ void WQtTreeItem::update()
}
else
{
setText( 0, m_module->getName().c_str() );
setText( 0, m_name.c_str() );
}
}
......@@ -60,6 +60,13 @@ public:
*/
boost::shared_ptr< WModule >getModule();
/**
* Returns the name used for this tree item.
*
* \return the name.
*/
std::string getName();
public slots:
/**
......@@ -69,11 +76,21 @@ public slots:
protected:
/**
* Updates the state of the tree item basing on the module's state.
*/
virtual void updateState();
/**
* Updates this item in regular intervals.
*/
boost::shared_ptr< QTimer > m_updateTimer;
/**
* Name of the tree item.
*/
std::string m_name;
private:
/**
......
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