Beispiel #1
0
/*! \brief Called when a tab has been pressed
    \param index the index of the tab
 */
void MainWindow::onTabChangeItem(int index)
{

    GenericViewWidget *w = (GenericViewWidget*)ui->mainTabs->widget(index);
    if(w && w->getType() == yarp::manager::APPLICATION) {
        ui->actionSelect_All->setEnabled(true);
        ui->actionRefresh_Status->setEnabled(true);
        ui->actionExport_Graph->setEnabled(true);
        ui->actionConnect->setEnabled(true);
        ui->actionDisconnect->setEnabled(true);
        ui->actionRun->setEnabled(true);
        ui->actionStop->setEnabled(true);
        ui->actionKill->setEnabled(true);
    } else {
        ui->actionSelect_All->setEnabled(false);
        ui->actionRefresh_Status->setEnabled(false);
        ui->actionExport_Graph->setEnabled(false);
        ui->actionConnect->setEnabled(false);
        ui->actionDisconnect->setEnabled(false);
        ui->actionRun->setEnabled(false);
        ui->actionStop->setEnabled(false);
        ui->actionKill->setEnabled(false);

    }
}
Beispiel #2
0
/*! \brief Close the tab of index index
    \param index the index of the tab
 */
void MainWindow::onTabClose(int index)
{
    GenericViewWidget *w = (GenericViewWidget*)ui->mainTabs->widget(index);
    if(!w) {
        return;
    }
    if(w->getType() == yarp::manager::APPLICATION) {
        ApplicationViewWidget *aw = ((ApplicationViewWidget*)w);
        if(aw->isRunning()) {
            if( QMessageBox::warning(this,QString("Closing %1").arg(ui->mainTabs->tabText(index)),"You have some running module. After closing the application window you might not be able to recover them. Are you sure?",QMessageBox::Yes,QMessageBox::No) == QMessageBox::No) {
                return;
            }
        }
    }
    ui->mainTabs->removeTab(index);
    delete w;
}