Public Slots | Public Member Functions

ImportFileProcessorModel Class Reference

Extension of ImportFileModel which uses the Processor. More...

#include <importfilemodel.h>

Inheritance diagram for ImportFileProcessorModel:
Inheritance graph
[legend]
Collaboration diagram for ImportFileProcessorModel:
Collaboration graph
[legend]

List of all members.

Public Slots

void slot_syncProcessorWithTagContainer (int column, TagContainer::ColumnTag tag, QVariant data)
void slot_maxColumns_changed (int oldValue, int newValue)

Public Member Functions

 ImportFileProcessorModel (QObject *parent=0)
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const

Detailed Description

Extension of ImportFileModel which uses the Processor.


Constructor & Destructor Documentation

ImportFileProcessorModel::ImportFileProcessorModel ( QObject parent = 0  ) 

                                                                             : ImportFileModel(parent)
{
    connect(this, SIGNAL(signal_maxColumns_changed(int,int)),
            this, SLOT(slot_maxColumns_changed(int,int)));
};


Member Function Documentation

QVariant ImportFileProcessorModel::data ( const QModelIndex index,
int  role = Qt::DisplayRole 
) const

Reimplemented from ImportFileModel.

{
    if (role == Qt::DisplayRole){
        Q_ASSERT(index.column() >= 0 && index.column() < processors.size());
        return processors[index.column()](ImportFileModel::data(index, role));
    } else
        return ImportFileModel::data(index, role);
}

void ImportFileProcessorModel::slot_maxColumns_changed ( int  oldValue,
int  newValue 
) [slot]

Referenced by ImportFileProcessorModel().

{
    // This is temporary, and still a bit hackish. Problem is that I don't have
    // the time yet to implement loadFile() in a decent way, with possibly a fetchMore(),
    // or simply the model as a mediator between the textstream and the view (i.e. without caching.
    if (newValue > processors.size()){
        processorCountAdjust(newValue);
    }
}

void ImportFileProcessorModel::slot_syncProcessorWithTagContainer ( int  column,
TagContainer::ColumnTag  tag,
QVariant  data 
) [slot]

{
    //qDebug() << "Syncing Strategy with TagContaienr: " << column << tag << data;
    if (processors.size() <= column) processorCountAdjust(column);
    switch(tag){
    case TagContainer::ColumnTagDataUnitId:{
            processors[column].setStrategyFormat(data, Strategy::FormatUnitIdFrom);
        } break;
    case TagContainer::ColumnTagTreeId:{
            processors[column].setStrategyFormat(data, Strategy::FormatTreeId);
        } break;
    case TagContainer::ColumnTagName:{
        } break;
    case TagContainer::ColumnTagTimestampFormat:{
            processors[column].setStrategyFormat(data, Strategy::FormatTimestamp);
        } break;
    case TagContainer::ColumnTagType:{
            switch(static_cast<TagContainer::ColumnType>(data.toInt())){
            case TagContainer::ColumnTypeData:{
                    processors[column].setStrategy(Strategy::StrategySensorSqlData);
                } break;
            case TagContainer::ColumnTypeTimestamp:{
                    processors[column].setStrategy(Strategy::StrategyTimestamp);
                } break;
            case TagContainer::ColumnTypeNone /* = 0 */:{
                    processors[column].setStrategy(Strategy::StrategyNone);
                } break;
            } break;
        }
    case TagContainer::ColumnTagToolTip:{
        } break;
    }
    // model must emit that it's data has been changed.
    emit dataChanged(index(0, column), index(rowCount(), column));
}


The documentation for this class was generated from the following files: