Ejemplo n.º 1
0
QWidget* XletQueuesConfigure::buildConfigureQueueList(QWidget *parent)
{
    QWidget *root = new QWidget(parent);
    QGridLayout *layout = new QGridLayout(root);
    root->setLayout(layout);

    layout->addWidget(new QLabel(tr("Queue"), root), 0, 0, Qt::AlignLeft);
    QLabel *label_qos = new QLabel(tr("Qos - X (s)"), root);
    label_qos->setToolTip(tr(
        "This is the threshold in seconds to consider that the answer to a "
        "call was too late to be accounted as an answer of quality."));
    layout->addWidget(label_qos, 0, 1, Qt::AlignLeft);
    QLabel *label_window = new QLabel(tr("Window (s)"), root);
    label_window->setToolTip(tr(
        "The window is the period of time used to compute the statistics"));
    layout->addWidget(label_window, 0, 2, Qt::AlignLeft);

    QCheckBox *displayQueue;
    QSpinBox *spinBox;
    int row;
    int column;
    QVariantMap statConfig = b_engine->getConfig("guioptions.queuespanel").toMap();
    QString xqueueid;

    row = 1;

    QHashIterator<QString, XInfo *> i = \
        QHashIterator<QString, XInfo *>(b_engine->iterover("queues"));

    while (i.hasNext()) {
        column = 0;
        i.next();
        QueueInfo * queueinfo = (QueueInfo *) i.value();
        xqueueid = queueinfo->xid();

        displayQueue = new QCheckBox(queueinfo->queueName(), root);
        displayQueue->setProperty("xqueueid", xqueueid);
        displayQueue->setProperty("param", "visible");
        displayQueue->setChecked(statConfig.value("visible" + xqueueid, true).toBool());
        layout->addWidget(displayQueue, row, column++);
        connect(displayQueue, SIGNAL(stateChanged(int)),
                this, SLOT(changeQueueStatParam(int)));

        spinBox = new QSpinBox(root);
        spinBox->setAlignment(Qt::AlignCenter);
        spinBox->setMaximum(240);
        spinBox->setProperty("xqueueid", xqueueid);
        spinBox->setProperty("param", "xqos");
        spinBox->setValue(statConfig.value("xqos" + xqueueid, 60).toInt());
        layout->addWidget(spinBox, row, column++);
        connect(spinBox, SIGNAL(valueChanged(int)),
                this, SLOT(changeQueueStatParam(int)));

        spinBox = new QSpinBox(root);
        spinBox->setAlignment(Qt::AlignCenter);
        spinBox->setMaximum(3600*3);
        spinBox->setProperty("xqueueid", xqueueid);
        spinBox->setProperty("param", "window");
        spinBox->setValue(statConfig.value("window" + xqueueid, 3600).toInt());
        layout->addWidget(spinBox, row, column++);
        connect(spinBox, SIGNAL(valueChanged(int)),
                this, SLOT(changeQueueStatParam(int)));

        row++;
    }

    return root;
}