Ejemplo n.º 1
0
void SoundThemeSelector::fillModel(const SoundTheme &theme)
{
	QStringList headers;
	headers.append(QT_TRANSLATE_NOOP("Notifications", "Type"));
	headers.append(QT_TRANSLATE_NOOP("SoundTheme", "Preview"));
	m_model->setHorizontalHeaderLabels(headers);

	for (int i = 0; i <= Notification::LastType; ++i) {
		Notification::Type type = static_cast<Notification::Type>(i);
		QList<QStandardItem *> items;

		QStandardItem *item = new QStandardItem(Notification::typeString(type));
		item->setToolTip(QT_TRANSLATE_NOOP("SoundTheme","Type"));
		item->setSelectable(false);
		items << item;

		item = new QStandardItem();
		item->setEditable(false);
		item->setIcon(Icon("media-playback-start"));
		item->setToolTip(QT_TRANSLATE_NOOP("SoundTheme","Play"));
		item->setEnabled(!theme.path(type).isNull());
		item->setSelectable(false);
		items << item;

		m_model->appendRow(items);
	}
	ui->treeView->header()->setSectionResizeMode(0, QHeaderView::Stretch);
}
Ejemplo n.º 2
0
    virtual QList<QStandardItem *> valueWalker(ExtcapValueList list, QStringList &defaults)
    {
        ExtcapValueList::iterator iter = list.begin();
        QList<QStandardItem *> items;

        while ( iter != list.end() )
        {
            QStandardItem * item = new QStandardItem((*iter).value());
            if ( (*iter).enabled() == false )
            {
                item->setSelectable(false);
            }
            else
                item->setSelectable(true);

            item->setData((*iter).call(), Qt::UserRole);
            if ((*iter).isDefault())
                defaults << (*iter).call();

            item->setEditable(false);
            QList<QStandardItem *> childs = valueWalker((*iter).children(), defaults);
            if ( childs.length() > 0 )
                item->appendRows(childs);

            items << item;
            ++iter;
        }

        return items;
    }
Ejemplo n.º 3
0
void NetworkUsageWindow::refresh()
{
    for (int i = 0; i < TOTAL_COUNTERS; i++)
    {
        DataCounters::CounterType counter = (DataCounters::CounterType) i;
        QString counterLabel;
        switch (counter)
        {
        case DataCounters::Messages:
            counterLabel = "Messages";
            break;
        case DataCounters::MessageBytes:
            counterLabel = "Messages bytes";
            break;
        case DataCounters::ImageBytes:
            counterLabel = "Images bytes";
            break;
        case DataCounters::VideoBytes:
            counterLabel = "Videos bytes";
            break;
        case DataCounters::AudioBytes:
            counterLabel = "Audio bytes";
            break;
        case DataCounters::ProfileBytes:
            counterLabel = "Profile pictures bytes";
            break;
        case DataCounters::SyncBytes:
            counterLabel = "Synchronization bytes";
            break;
        case DataCounters::ProtocolBytes:
            counterLabel = "Protocol bytes";
            break;
        case DataCounters::Total:
            counterLabel = "Total bytes";
            break;
        }

        int column = 0;
        QStandardItem *item = new QStandardItem(counterLabel);
        model->setItem(i, column++, item);
        item->setSelectable(false);
        qint64 bytes = Client::dataCounters.getReceivedBytes(i);
        QString str = (i > 0) ? Utilities::formatBytes(bytes)
                      : QString::number(bytes);
        item = new QStandardItem(str);
        item->setSelectable(false);
        item->setTextAlignment(Qt::AlignCenter);
        model->setItem(i, column++, item);
        bytes = Client::dataCounters.getSentBytes(i);
        str = (i > 0) ? Utilities::formatBytes(bytes)
              : QString::number(bytes);
        item = new QStandardItem(str);
        item->setSelectable(false);
        item->setTextAlignment(Qt::AlignCenter);
        model->setItem(i, column++, item);

    }
}
Ejemplo n.º 4
0
NewWidget::NewWidget(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::NewWidget)
{
    ui->setupUi(this);


    this->setWindowFlags(Qt::SplashScreen);            //hide menu bar from dialog
    this->setAttribute(Qt::WA_TranslucentBackground);


    //Initialize ComboBox Status
    QStringList list=(QStringList()<<"--Select Type--"<<"String"<<"Char"<<"Bool"<<"Integer"<<"Double"<<"Float"<<"Long"<<"Short");
    ui->comboBox->addItems(list);
    ui->comboBox->setItemData(0,QColor(Qt::gray), Qt::BackgroundRole);

    QStandardItemModel* model =
            qobject_cast<QStandardItemModel*>(ui->comboBox->model());
    QModelIndex firstIndex = model->index(0, ui->comboBox->modelColumn(),
            ui->comboBox->rootModelIndex());
    QStandardItem* firstItem = model->itemFromIndex(firstIndex);
    firstItem->setSelectable(false);


}
void MangaDownloadWidget::chaptersListUpdated(int status, QProcess::ExitStatus exitStatus) {
  switch (exitStatus) {
  case QProcess::CrashExit: {
    _messageModel->editMessageWarning("Warning: Chapters list update failed. Status code: "+QString::number(status));
    break;
  }
  case QProcess::NormalExit: {
    if (status == 1) {
      _messageModel->editMessageWarning("Warning: "+_getChaptersListProcess->readAllStandardError());
      _messageModel->editMessageError("Abort.");
    } else if (status == 0) {
      _messageModel->editMessageSuccess("Chapters list updated.");
    }
    break;
  }
  }

  if (_chaptersOnWebModel->rowCount() == 0) {
    QStandardItem* upToDateItem = new QStandardItem;
    upToDateItem->setData("Already up-to-date.", Qt::DisplayRole);
    upToDateItem->setEditable(false);
    upToDateItem->setSelectable(false);
    _chaptersOnWebModel->appendRow(upToDateItem);
  }

  _selectLineEdit->setEnabled(true);
  _updateButton->setEnabled(true);
  _downloadButton->setEnabled(true);
  _selectAllButton->setEnabled(true);
}
Ejemplo n.º 6
0
void fillTitle(QComboBox* combo, const QString& s) {
    combo->addItem(s);
    QStandardItem* item = lastItem(combo);
    QFont f;
    f.setBold(true);
    item->setFont(f);
    item->setSelectable(false);
}
Ejemplo n.º 7
0
LogViewFilterWidget::LogViewFilterWidget()
    : d(new LogViewFilterWidgetPrivate())
{
    QHBoxLayout *filterBarLayout = new QHBoxLayout();
    filterBarLayout->setMargin(0);
    setLayout(filterBarLayout);

    d->filterLine = new LogViewWidgetSearchLine();

    d->filterLine->setToolTip(i18n("Type your filter here"));
    d->filterLine->setWhatsThis(i18n("Allows you to only list items that match the content of this text."));
    d->filterLine->setPlaceholderText(i18n("Enter your search here..."));

    QLabel *filterIcon = new QLabel();
    filterIcon->setPixmap(SmallIcon(QStringLiteral("view-filter")));
    filterIcon->setBuddy(d->filterLine);
    filterBarLayout->addWidget(filterIcon);

    QLabel *filterLabel = new QLabel(i18n("Filter:"));
    filterLabel->setBuddy(d->filterLine);
    filterBarLayout->addWidget(filterLabel);

    filterBarLayout->addWidget(d->filterLine);

    initSearchListFilter();

    filterBarLayout->addWidget(d->filterList);

    d->prioritiesComboBox = new QComboBox(this);
    ComboBoxDelegate *delegate = new ComboBoxDelegate(d->prioritiesComboBox);
    d->prioritiesComboBox->setItemDelegate(delegate);
    filterBarLayout->addWidget(d->prioritiesComboBox);

    QMetaEnum &metaEnum = Globals::instance().logLevelsMetaEnum();

    d->prioritiesModel = new QStandardItemModel(d->prioritiesComboBox);
    d->prioritiesComboBox->setModel(d->prioritiesModel);

    QStandardItem *item = new QStandardItem(i18n("Select priorities"));
    item->setSelectable(false);
    d->prioritiesModel->appendRow(item);
    connect(d->prioritiesModel, &QStandardItemModel::itemChanged,
            this, &LogViewFilterWidget::prioritiesChanged);

    // Don't add last enum value into combobox.
    for (int i = 0; i < metaEnum.keyCount() - 1; i++) {
        int id = metaEnum.value(i);
        LogLevel *logLevel = Globals::instance().logLevelByPriority(id);

        QStandardItem *item = new QStandardItem(logLevel->name());
        item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
        item->setData(Qt::Checked, Qt::CheckStateRole);
        item->setData(metaEnum.value(i), Qt::UserRole);
        item->setData(QVariant(logLevel->color()), Qt::ForegroundRole);

        d->prioritiesModel->appendRow(item);
    }
}
Ejemplo n.º 8
0
projectWindow::projectWindow(QWidget *parent, student_obj *student, studentpre_obj *preference) :
    QDialog(parent),
    ui(new Ui::projectWindow)
{

    ui->setupUi(this);
    user = student;
    userpref = preference;

    string Result;//string which will contain the result

    stringstream convert; // stringstream used for the conversion

    convert << user->getStudent_number();//add the value of Number to the characters in the stream

    Result = convert.str();//set Result to the content of the stream


    project_control pc;
    pc.SearchAllProject(&data);
    pc.SearchProjectofstudent(Result,&registeredProj);

    QStandardItemModel *stdModel = new QStandardItemModel(this);
    QStandardItemModel *stdModel2 = new QStandardItemModel(this);
    ui->listView->setModel(stdModel);
    ui->registerproject->setModel(stdModel2);
    for(int i=0; i<data.size();i++){
        QStandardItem* Item = new QStandardItem(QString::fromStdString(data[i]->getTitle()));
        Item->setEditable(false);
        Item->setSelectable(true);
        stdModel->appendRow(Item);
    }

    for(int j=0; j<registeredProj.size();j++){
        QStandardItem* Item = new QStandardItem(QString::fromStdString(registeredProj[j]->getTitle()));
        Item->setEditable(false);
        Item->setSelectable(true);
        stdModel2->appendRow(Item);
    }


}
Ejemplo n.º 9
0
QStandardItem * m_table::addStandardItem(int line, int coll,QString val){

    QStandardItem * tmpItem = new QStandardItem(QString(val));
    tmpItem->setSelectable(true);
    tmpItem->setEditable(true);

    model->setItem(line, coll, tmpItem);


    return tmpItem;
}
Ejemplo n.º 10
0
ReloadPVDialog::ReloadPVDialog(QList<QString> reloadList, QWidget *parent) :
    QDialog(parent)
{
    QLabel *dialogMessage = new QLabel("Previous pvs detected--reload pvs?");

    QStandardItemModel *contentsModel  = new QStandardItemModel(this);
    connect( contentsModel , SIGNAL(itemChanged(QStandardItem*)), this, SLOT(onItemChanged(QStandardItem*)) );

    foreach (QString entry, reloadList)
    {
        QStandardItem *modelEntry = new QStandardItem(entry);
        modelEntry->setCheckable(true);
        modelEntry->setSelectable(false);
        contentsModel ->appendRow(modelEntry);
    }
Ejemplo n.º 11
0
void MainWindow::showDataInTableView(QStandardItemModel *tvModel,  QVector<QString> vGlobal){
    int j = 0;
    for(int i = 0; i < vGlobal.length()/2; i++)
    {
        for(int k = 0; k < 2; k++){
            QStandardItem *item = new QStandardItem(vGlobal.at(j));

            item->setEditable(false);
            item->setSelectable(false);
            tvModel->setItem(i, k, item);

            j++;
        }
    }
}
Ejemplo n.º 12
0
void SkDebuggerGUI::setupComboBox() {
    fFilter.clear();
    fFilter.addItem("--Filter By Available Commands--");

    std::map<std::string, int> map;
    for (int i = 0; i < fDebugger.getSize(); i++) {
        map[fDebugger.getDrawCommandAt(i)->toString().c_str()]++;
    }

    for (std::map<std::string, int>::iterator it = map.begin(); it != map.end();
         ++it) {
        fFilter.addItem((it->first).c_str());
    }

    // NOTE(chudy): Makes first item unselectable.
    QStandardItemModel* model = qobject_cast<QStandardItemModel*>(
            fFilter.model());
    QModelIndex firstIndex = model->index(0, fFilter.modelColumn(),
            fFilter.rootModelIndex());
    QStandardItem* firstItem = model->itemFromIndex(firstIndex);
    firstItem->setSelectable(false);
}
Ejemplo n.º 13
0
void tst_QStandardItem::getSetFlags()
{
    QStandardItem item;
    item.setEnabled(true);
    QVERIFY(item.isEnabled());
    QVERIFY(item.flags() & Qt::ItemIsEnabled);
    item.setEditable(true);
    QVERIFY(item.isEditable());
    QVERIFY(item.flags() & Qt::ItemIsEditable);
    item.setSelectable(true);
    QVERIFY(item.isSelectable());
    QVERIFY(item.flags() & Qt::ItemIsSelectable);
    item.setCheckable(true);
    QVERIFY(item.isCheckable());
    QCOMPARE(item.checkState(), Qt::Unchecked);
    QVERIFY(item.flags() & Qt::ItemIsUserCheckable);
    item.setTristate(true);
    QVERIFY(item.isTristate());
    QVERIFY(item.flags() & Qt::ItemIsTristate);
#ifndef QT_NO_DRAGANDDROP
    item.setDragEnabled(true);
    QVERIFY(item.isDragEnabled());
    QVERIFY(item.flags() & Qt::ItemIsDragEnabled);
    item.setDropEnabled(true);
    QVERIFY(item.isDropEnabled());
    QVERIFY(item.flags() & Qt::ItemIsDropEnabled);
#endif
    
    QVERIFY(item.isEnabled());
    item.setEnabled(false);
    QVERIFY(!item.isEnabled());
    QVERIFY(!(item.flags() & Qt::ItemIsEnabled));
    QVERIFY(item.isEditable());
    item.setEditable(false);
    QVERIFY(!item.isEditable());
    QVERIFY(!(item.flags() & Qt::ItemIsEditable));
    QVERIFY(item.isSelectable());
    item.setSelectable(false);
    QVERIFY(!item.isSelectable());
    QVERIFY(!(item.flags() & Qt::ItemIsSelectable));
    QVERIFY(item.isCheckable());
    item.setCheckable(false);
    QVERIFY(!item.isCheckable());
    QVERIFY(!(item.flags() & Qt::ItemIsUserCheckable));
    QVERIFY(item.isTristate());
    item.setTristate(false);
    QVERIFY(!item.isTristate());
    QVERIFY(!(item.flags() & Qt::ItemIsTristate));
#ifndef QT_NO_DRAGANDDROP
    QVERIFY(item.isDragEnabled());
    item.setDragEnabled(false);
    QVERIFY(!item.isDragEnabled());
    QVERIFY(!(item.flags() & Qt::ItemIsDragEnabled));
    QVERIFY(item.isDropEnabled());
    item.setDropEnabled(false);
    QVERIFY(!item.isDropEnabled());
    QVERIFY(!(item.flags() & Qt::ItemIsDropEnabled));
#endif

    item.setCheckable(false);
    item.setCheckState(Qt::Checked);
    item.setCheckable(true);
    QCOMPARE(item.checkState(), Qt::Checked);
}    
/**
 * @brief Creates a new item with the specified directory name.
 * @param dir_name Name of a directory.
 * @return The created item.
 */
QStandardItem* ResourceModel::create_dir_item(const QString& dir_name) {

  QStandardItem* item = new QStandardItem(dir_name);
  item->setSelectable(false);
  return item;
}
Ejemplo n.º 15
0
void PreferencesDialog::InitWaveInfo()
{
    QHash<MachineType, int> toprows;

    waveModel->clear();
    machlevel.clear();
    toprows.clear();
    QStringList headers;
    headers.append(tr("Name"));
    headers.append(tr("Color"));
    headers.append(tr("Overview"));
    headers.append(tr("Lower"));
    headers.append(tr("Upper"));
    headers.append(tr("Label"));
    headers.append(tr("Details"));
    waveModel->setHorizontalHeaderLabels(headers);
    ui->waveView->setColumnWidth(0, 200);
    ui->waveView->setColumnWidth(1, 40);
    ui->waveView->setColumnWidth(2, 60);
    ui->waveView->setColumnWidth(3, 50);
    ui->waveView->setColumnWidth(4, 50);
    ui->waveView->setColumnWidth(5, 100);
    ui->waveView->setSelectionMode(QAbstractItemView::SingleSelection);
    ui->waveView->setSelectionBehavior(QAbstractItemView::SelectItems);

    waveModel->setColumnCount(7);

    QStandardItem *hdr = nullptr;

    QMap<MachineType, QString> Section;

    Section[MT_CPAP] = tr("CPAP Waveforms");
    Section[MT_OXIMETER] = tr("Oximeter Waveforms");
    Section[MT_POSITION] = tr("Positional Waveforms");
    Section[MT_SLEEPSTAGE] = tr("Sleep Stage Waveforms");

    QMap<MachineType, QString>::iterator it;

    for (it = Section.begin(); it != Section.end(); ++it) {
        machlevel[it.key()] = hdr = new QStandardItem(it.value());
        hdr->setEditable(false);
        QList<QStandardItem *> list;
        list.append(hdr);
        for (int i=0; i<6; i++) {
            QStandardItem *it = new QStandardItem();
            it->setEnabled(false);
            list.append(it);
        }
        waveModel->appendRow(list);
    }

    ui->waveView->setAlternatingRowColors(true);

    // ui->graphView->setFirstColumnSpanned(0,daily->index(),true); // Crashes on windows.. Why do I need this again?

    QHash<QString, schema::Channel *>::iterator ci;

    SpinBoxDelegate * spinbox = new SpinBoxDelegate(ui->waveView);

    ui->waveView->setItemDelegateForColumn(3,spinbox);
    ui->waveView->setItemDelegateForColumn(4,spinbox);

    int row = 0;
    for (ci = schema::channel.names.begin(); ci != schema::channel.names.end(); ci++) {
        schema::Channel * chan = ci.value();
        if (chan->type() != schema::WAVEFORM) continue;

        QList<QStandardItem *> items;
        QStandardItem *it = new QStandardItem(chan->fullname());

        it->setCheckable(true);
        it->setCheckState(chan->enabled() ? Qt::Checked : Qt::Unchecked);
        it->setEditable(true);
        it->setData(chan->id(), Qt::UserRole);
        it->setToolTip(tr("Double click to change the descriptive name this channel."));
        items.push_back(it);

        it = new QStandardItem();
        it->setBackground(QBrush(chan->defaultColor()));
        it->setEditable(false);
        it->setData(chan->defaultColor().rgba(), Qt::UserRole);
        it->setToolTip(tr("Double click to change the default color for this channel plot/flag/data."));
        it->setSelectable(false);
        items.push_back(it);

        it = new QStandardItem();
        it->setCheckable(true);
        it->setCheckState(chan->showInOverview() ? Qt::Checked : Qt::Unchecked);
        it->setEditable(true);
        it->setData(chan->id(), Qt::UserRole);
        it->setToolTip(tr("Whether a breakdown of this waveform displays in overview."));
        items.push_back(it);


        it = new QStandardItem(QString::number(chan->lowerThreshold(),'f',1));
        it->setToolTip(tr("Here you can set the <b>lower</b> threshold used for certain calculations on the %1 waveform").arg(chan->fullname()));
        it->setEditable(true);
        items.push_back(it);

        it = new QStandardItem(QString::number(chan->upperThreshold(),'f',1));
        it->setToolTip(tr("Here you can set the <b>upper</b> threshold used for certain calculations on the %1 waveform").arg(chan->fullname()));
        it->setEditable(true);
        items.push_back(it);

        it = new QStandardItem(chan->label());
        it->setToolTip(tr("This is the short-form label to indicate this channel on screen."));

        it->setEditable(true);
        items.push_back(it);

        it = new QStandardItem(chan->description());
        it->setToolTip(tr("This is a description of what this channel does."));

        it->setEditable(true);
        items.push_back(it);

        row = toprows[chan->machtype()]++;
        machlevel[chan->machtype()]->insertRow(row, items);
    }

    for(QHash<MachineType, QStandardItem *>::iterator i = machlevel.begin(); i != machlevel.end(); ++i) {
        if (i.value()->rowCount() == 0) {
            waveModel->removeRow(i.value()->row());
        }
    }

    ui->waveView->expandAll();
    ui->waveView->setSortingEnabled(true);
}
Ejemplo n.º 16
0
void PreferencesDialog::InitChanInfo()
{
    QHash<MachineType, int> toprows;

    chanModel->clear();
    toplevel.clear();
    toprows.clear();
    QStringList headers;
    headers.append(tr("Name"));
    headers.append(tr("Color"));
    headers.append(tr("Overview"));
    headers.append(tr("Flag Type"));
    headers.append(tr("Label"));
    headers.append(tr("Details"));
    chanModel->setHorizontalHeaderLabels(headers);
    ui->chanView->setColumnWidth(0, 200);
    ui->chanView->setColumnWidth(1, 40);
    ui->chanView->setColumnWidth(2, 60);
    ui->chanView->setColumnWidth(3, 100);
    ui->chanView->setColumnWidth(4, 100);
    ui->chanView->setSelectionMode(QAbstractItemView::SingleSelection);
    ui->chanView->setSelectionBehavior(QAbstractItemView::SelectItems);

    chanModel->setColumnCount(6);

    QStandardItem *hdr = nullptr;

    QMap<MachineType, QString> Section;

    Section[MT_CPAP] = tr("CPAP Events");
    Section[MT_OXIMETER] = tr("Oximeter Events");
    Section[MT_POSITION] = tr("Positional Events");
    Section[MT_SLEEPSTAGE] = tr("Sleep Stage Events");
    Section[MT_UNCATEGORIZED] = tr("Unknown Events");

    QMap<MachineType, QString>::iterator it;

    QHash<QString, schema::Channel *>::iterator ci;

    for (it = Section.begin(); it != Section.end(); ++it) {
        toplevel[it.key()] = hdr = new QStandardItem(it.value());
        hdr->setEditable(false);
        QList<QStandardItem *> list;
        list.append(hdr);
        for (int i=0; i<5; i++) {
            QStandardItem *it = new QStandardItem();
            it->setEnabled(false);
            list.append(it);
        }
        chanModel->appendRow(list);
    }

    ui->chanView->setAlternatingRowColors(true);

    // ui->graphView->setFirstColumnSpanned(0,daily->index(),true); // Crashes on windows.. Why do I need this again?


    ComboBoxDelegate * combobox = new ComboBoxDelegate(ui->waveView);

    ui->chanView->setItemDelegateForColumn(3,combobox);

    int row = 0;
    for (ci = schema::channel.names.begin(); ci != schema::channel.names.end(); ci++) {
        schema::Channel * chan = ci.value();
        if ((chan->type() == schema::DATA) || (chan->type() == schema::SETTING) || chan->type() == schema::WAVEFORM) continue;

        QList<QStandardItem *> items;
        QStandardItem *it = new QStandardItem(chan->fullname());
        it->setCheckable(true);
        it->setCheckState(chan->enabled() ? Qt::Checked : Qt::Unchecked);
        it->setEditable(true);
        it->setData(chan->id(), Qt::UserRole);

        // Dear translators: %1 is a unique ascii english string used to indentify channels in the code, I'd like feedback on how this goes..
        // It's here in case users mess up which field is which.. it will always show the Channel Code underneath in the tooltip.
        it->setToolTip(tr("Double click to change the descriptive name the '%1' channel.").arg(chan->code()));
        items.push_back(it);


        it = new QStandardItem();
        it->setBackground(QBrush(chan->defaultColor()));
        it->setEditable(false);
        it->setData(chan->defaultColor().rgba(), Qt::UserRole);
        it->setToolTip(tr("Double click to change the default color for this channel plot/flag/data."));
        it->setSelectable(false);
        items.push_back(it);

        it = new QStandardItem(QString());
        it->setToolTip(tr("Whether this flag has a dedicated overview chart."));
        it->setCheckable(true);
        it->setCheckState(chan->showInOverview() ? Qt::Checked : Qt::Unchecked);
        it->setTextAlignment(Qt::AlignCenter);
        it->setData(chan->id(), Qt::UserRole);
        items.push_back(it);

        schema::ChanType type = chan->type();

        it = new QStandardItem(channeltype[type]);
        it->setToolTip(tr("Here you can change the type of flag shown for this event"));
        it->setEditable(type != schema::UNKNOWN);
        items.push_back(it);

        it = new QStandardItem(chan->label());
        it->setToolTip(tr("This is the short-form label to indicate this channel on screen."));

        it->setEditable(true);
        items.push_back(it);

        it = new QStandardItem(chan->description());
        it->setToolTip(tr("This is a description of what this channel does."));

        it->setEditable(true);
        items.push_back(it);

        MachineType mt = chan->machtype();
        if (chan->type() == schema::UNKNOWN) mt = MT_UNCATEGORIZED;
        row = toprows[mt]++;
        toplevel[mt]->insertRow(row, items);
    }


    for(QHash<MachineType, QStandardItem *>::iterator i = toplevel.begin(); i != toplevel.end(); ++i) {
        if (i.value()->rowCount() == 0) {
            chanModel->removeRow(i.value()->row());
        }
    }

    ui->chanView->expandAll();
    ui->chanView->setSortingEnabled(true);
}