Пример #1
0
E2TaskManager::E2TaskManager(QWidget* par)
    : E2PopupFrame(par)
{
    QVBoxLayout* vlayout = new QVBoxLayout(this);

    QLabel* label = new QLabel(this);
    label->setText(tr("System Memory Status"));
    vlayout->addWidget(label);

    m_memoryBar = new E2MemoryBar(this);
    vlayout->addWidget(m_memoryBar);
    memoryUpdate(); // force update

    m_memoryTimer = new QTimer(this);
    m_memoryTimer->setInterval(30000);
    connect(m_memoryTimer, SIGNAL(timeout()), this, SLOT(memoryUpdate()));

    m_taskList = new QTreeWidget(this);
    m_taskList->header()->setResizeMode(QHeaderView::Interactive);
    m_taskList->setRootIsDecorated(false);
    m_taskList->setItemsExpandable(false);
    QStringList labels;
    labels << QString("") << QString(tr("Name")) << QString("");
    m_taskList->setHeaderLabels(labels);
    m_taskList->header()->setDefaultAlignment(Qt::AlignCenter);
    m_taskList->header()->setStretchLastSection(true);
    vlayout->addWidget(m_taskList);

    m_bar = new E2Bar(this);
    m_bar->setFixedHeight(24);
    vlayout->addWidget(m_bar);
    E2Button* button = new E2Button(m_bar);
    button->setText(tr("Switch", "Switch task"));
    connect(button, SIGNAL(clicked()), this, SLOT(switchToTask()));
    m_bar->addButton(button,0);
    button = new E2Button(m_bar);
    button->setText(tr("End", "End task"));
    connect(button, SIGNAL(clicked()), this, SLOT(endTask()));
    m_bar->addButton(button,0);
    button = new E2Button(m_bar);
    button->setText(tr("Cancel"));
    connect(button, SIGNAL(clicked()), this, SLOT(close()));
    m_bar->addButton(button,0);

    QObject::connect(&m_appMonitor, SIGNAL(applicationRunning(QString)),
                     this, SLOT(doUpdate()));
    QObject::connect(&m_appMonitor, SIGNAL(applicationClosed(QString)),
                     this, SLOT(doUpdate()));
}
void CntServiceViewManager::closeApp()
{
    // Quit happens when returnValueDelivered signal from XQServiceProver
    // is caught from service handler.
    emit applicationClosed();
}