#include <LaunchThreadItem.h>
Public Slots | |
| void | refresh () |
Public Member Functions | |
| virtual int | columnCount (const QModelIndex &parent=QModelIndex()) const |
| virtual QVariant | data (const QModelIndex &index, int role) const |
| virtual Qt::ItemFlags | flags (const QModelIndex &) const |
| virtual QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const |
| virtual QModelIndex | index (int, int column, const QModelIndex &parent=QModelIndex()) const |
| LaunchThreadItem (QObject *parent=0) | |
| virtual QModelIndex | parent (const QModelIndex &index) const |
| virtual int | rowCount (const QModelIndex &parent=QModelIndex()) const |
| virtual bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) |
| ~LaunchThreadItem () | |
| LaunchThreadItem::LaunchThreadItem | ( | QObject * | parent = 0 | ) |
| int LaunchThreadItem::columnCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const [virtual] |
| QVariant LaunchThreadItem::data | ( | const QModelIndex & | index, |
| int | role | ||
| ) | const [virtual] |
References dinverGui, InversionThread::giveUp(), InversionThread::nr(), InversionThread::ns(), InversionThread::ns0(), InversionThread::nw(), TRACE, TRACE_BUG, TRACE_BUG_INT, TRACE_BUG_N, and TRACE_BUG_POINTER.
{
TRACE;
// Bug 1120, need more documentation
TRACE_BUG;
TRACE_BUG_POINTER(dinverGui);
if(index.isValid()) {
TRACE_BUG_INT(index.row());
}
TRACE_BUG_INT(dinverGui->threads().count());
if( !index.isValid() || index.row() >= dinverGui->threads().count()) return QVariant();
InversionThread * t=dinverGui->threads().at(index.row());
TRACE_BUG_N(1);
TRACE_BUG_POINTER(t);
switch (role) {
case Qt::DisplayRole:
switch (index.column()) {
case 0: return t->objectName();
case 1: return t->ns0();
case 2: return t->ns();
case 3: return t->nr();
case 4: return 100.0*t->giveUp();
case 5: return t->nw();
default: return QVariant();
}
default:
return QVariant();
}
}
| Qt::ItemFlags LaunchThreadItem::flags | ( | const QModelIndex & | ) | const [virtual] |
{
return Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled;
}
| QVariant LaunchThreadItem::headerData | ( | int | section, |
| Qt::Orientation | orientation, | ||
| int | role = Qt::DisplayRole |
||
| ) | const [virtual] |
References QGpCoreTools::tr(), and TRACE.
{
TRACE;
switch (role) {
case Qt::DisplayRole:
if(orientation==Qt::Horizontal) {
switch (section) {
case 0: return tr( "Run name" );
case 1: return tr( "Ns0" );
case 2: return tr( "Ns" );
case 3: return tr( "Nr" );
case 4: return tr( "GiveUp" );
case 5: return tr( "Nw" );
default: return QVariant();
}
} else {
return section + 1;
}
case Qt::ToolTipRole:
if(orientation==Qt::Horizontal) {
switch (section) {
case 0: return tr( "A user name, must be unique inside an environment." );
case 1: return tr( "Number of models generated randomly (Monte-Carlo)." );
case 2: return tr( "Number of models generated with Neighborhood." );
case 3: return tr( "Number of best solution models to consider when resampling (higher is more explorative)." );
case 4: return tr( "When it is difficult to generate new models (misfit computation fails), it is possible to discard "
"some cells after un certain number of fails relative to the number of success." );
case 5: return tr( "Number of Markov-chain walks to generate one model (1 or 2 is ok)." );
default: return QVariant();
}
} else {
return QVariant();
}
default:
return QVariant();
}
}
| QModelIndex LaunchThreadItem::index | ( | int | row, |
| int | column, | ||
| const QModelIndex & | parent = QModelIndex() |
||
| ) | const [virtual] |
References dinverGui, rowCount(), and TRACE.
{
TRACE;
if(column < 0 || row < 0 || row >= rowCount(parent) ) return QModelIndex();
InversionThread * t=dinverGui->threads().at(row);
return createIndex(row, column, t);
}
| QModelIndex LaunchThreadItem::parent | ( | const QModelIndex & | index | ) | const [virtual] |
| void LaunchThreadItem::refresh | ( | ) | [slot] |
| int LaunchThreadItem::rowCount | ( | const QModelIndex & | parent = QModelIndex() | ) | const [virtual] |
| bool LaunchThreadItem::setData | ( | const QModelIndex & | index, |
| const QVariant & | value, | ||
| int | role = Qt::EditRole |
||
| ) | [virtual] |
References dinverGui, QGpCoreTools::endl(), InversionThread::setGiveUp(), InversionThread::setNr(), InversionThread::setNs(), InversionThread::setNs0(), InversionThread::setNw(), InversionThread::setObjectName(), QGpCoreTools::tr(), and TRACE.
{
TRACE;
if( !index.isValid() || index.row() >= dinverGui->threads().count()) return false;
InversionThread * t=static_cast<InversionThread *>(index.internalPointer());
switch (role) {
case Qt::EditRole:
switch (index.column()) {
case 0:
t->setObjectName(value.toString());
dinverGui->logs()->setViewName(t, value.toString());
App::stream(t) << tr("Renaming to %1").arg(value.toString()) << endl;
emit dataChanged(index, index);
return true;
case 1:
t->setNs0(value.toInt());
emit dataChanged(index, index);
return true;
case 2:
t->setNs(value.toInt());
emit dataChanged(index, index);
return true;
case 3:
t->setNr(value.toInt());
emit dataChanged(index, index);
return true;
case 4:
t->setGiveUp(value.toInt()/100.0);
emit dataChanged(index, index);
return true;
case 5:
t->setNw(value.toInt());
emit dataChanged(index, index);
return true;
default:
return false;
}
default:
return false;
}
}