Example #1
0
QVariant ADLSModel::data(const QModelIndex &index, int role) const
{
    if (!index.isValid())
        return QVariant();

    if (index.column() > columnCount(QModelIndex()))
        return QVariant();

    ADLSItem *item = static_cast<ADLSItem*>(index.internalPointer());

    switch(role) {
        case Qt::DecorationRole: // icon
            break;
        case Qt::DisplayRole:
            if (index.column() != COLUMN_CHECK)
                return item->data(index.column());
            break;
        case Qt::TextAlignmentRole:
            break;
        case Qt::ForegroundRole:
            break;
        case Qt::ToolTipRole:
            break;
        case Qt::CheckStateRole:
            if (index.column() == COLUMN_CHECK)
                return item->data(COLUMN_CHECK);
            break;
    }

    return QVariant();
}
Example #2
0
void ADLS::slotChangeButtonClicked(){
    ADLSItem *item = getItem();

    if (!item)
        return;

    StrMap mapcheck;
    mapcheck["SSTRING"] = item->data(COLUMN_SSTRING).toString();
    mapcheck["DIRECTORY"] = item->data(COLUMN_DIRECTORY).toString();
    VectorSize i = findEntry(mapcheck);
    ADLSEditor editor;
    ADLSearchManager::SearchCollection &collection = ADLSearchManager::getInstance()->collection;
    ADLSearch search = collection[i];

        StrMap map;

        getParams(search, map);
        initEditor(editor, map);

        if (editor.exec() == QDialog::Accepted){
            getParams(editor, map);
            updateItem(item, map);
            updateEntry(search, map);
            if (i < collection.size())
                collection[i] = search;

        }

}
Example #3
0
void ADLS::slotRemoveButtonClicked(){
    ADLSItem *item = getItem();

    if (!item)
        return;
    StrMap mapcheck;
    mapcheck["SSTRING"] = item->data(COLUMN_SSTRING).toString();
    mapcheck["DIRECTORY"] = item->data(COLUMN_DIRECTORY).toString();
    VectorSize i = findEntry(mapcheck);
    ADLSearchManager::SearchCollection &collection = ADLSearchManager::getInstance()->collection;
        if (i < collection.size()) {
            collection.erase(collection.begin() + i);
            model->removeItem(item);
        }
}
Example #4
0
void ADLS::slotClicked(const QModelIndex &index){
    if (!index.isValid() || index.column() != COLUMN_CHECK || !index.internalPointer())
        return;

    ADLSItem *item = reinterpret_cast<ADLSItem*>(index.internalPointer());
    ADLSearchManager::SearchCollection &collection = ADLSearchManager::getInstance()->collection;
    StrMap mapcheck;
    mapcheck["SSTRING"] = item->data(COLUMN_SSTRING).toString();
    mapcheck["DIRECTORY"] = item->data(COLUMN_DIRECTORY).toString();
    VectorSize i = findEntry(mapcheck);
    ADLSearch entry = collection[i];

        bool check = !item->data(COLUMN_CHECK).toBool();

        entry.isActive = check;
        item->updateColumn(COLUMN_CHECK, check);
        if (i < collection.size())
            collection[i] = entry;
        model->repaint();

        ADLSearchManager::getInstance()->Save();
}