Example #1
0
void ConfigPage::removeMonitor()
{
    MonitorItem *currentItem = dynamic_cast<MonitorItem *>( m_page->monitors->currentItem() );
    if ( !currentItem )
        return;

    MonitorConfigMap::Iterator monitorIt = m_monitors.find( currentItem->text( 0 ) );
    if ( monitorIt == m_monitors.end() )
        return;

    m_monitors.remove( monitorIt );
    delete currentItem;
}
Example #2
0
void ConfigPage::modifyMonitor()
{
    MonitorItem *currentItem = dynamic_cast<MonitorItem *>( m_page->monitors->currentItem() );
    if ( !currentItem )
        return;

    MonitorConfigMap::Iterator monitorIt = m_monitors.find( currentItem->text( 0 ) );
    if ( monitorIt == m_monitors.end() )
        return;

    MonitorDialog dlg( *monitorIt, m_hosts, this );
    if ( dlg.exec() ) {
        MonitorConfig newMonitor = dlg.monitorConfig();

        if ( newMonitor.name != monitorIt.key() ) {
            m_monitors.remove( monitorIt );
            monitorIt = m_monitors.insert( newMonitor.name, newMonitor );
        } else
            *monitorIt = newMonitor;

        currentItem->setFromMonitor( newMonitor );
    }
}