// When the active tab changes, enable/disable the test panel. We // can't maintain ownership of the USB device and program at the same time. void GenericHID::onTabChanged( int index ) { if ( index == TAB_DESIGN ) { ui.testPanel->Deactivate(); setMenus( true ); } else if ( index == TAB_TEST ) { m_pScene->clearSelection(); setMenus( false ); ui.testPanel->Activate(); } }
MenuSystem::MenuSystem(char ** mTitles, char ** aTitles, char ** aValues, int ** menus, int lcdPin, int width) : serLCD(lcdPin) { setMenuTitles(mTitles); setActionTitles(aTitles); setActionValues(aValues); setMenus(menus); _screenWidth = width; _curMenu = 0; _curSubMenu = 1; _curOption = 0; }
TabWidget::TabWidget( QWidget* parent ) { qDebug() << "[TABWIDGET] Constructing"; mGrabbedWidget = 0; mTabs = 0; // set the tab position setTabsPosition(); mStatusBar = &mStatusBar->getInstance(); // create the tabbar mBar = new TabBar; setTabBar( mBar ); // connect the mouse clicks connect( mBar, SIGNAL( tabRightClicked( int, QPoint ) ), this, SLOT( tabRightClicked( int, QPoint ) ) ); connect( mBar, SIGNAL( tabMiddleClicked( int, QPoint ) ), this, SLOT( tabMiddleClicked( int, QPoint ) ) ); TabButton* newTabButton = new TabButton( this ); TabButton* mMenuButton = new TabButton( this ); connect( newTabButton, SIGNAL( clicked() ), this, SLOT( addUnityBrowser()) ); connect( newTabButton, SIGNAL( middleClicked() ), this, SLOT( addUnityBrowserWithSR() ) ); connect( mMenuButton, SIGNAL( clicked() ), mMenuButton, SLOT( showMenu()) ); mMenuButton->setMenu( kueueMainMenu() ); newTabButton->setIcon( QIcon( ":icons/menus/newtab.png" ) ); mMenuButton->setIcon( QIcon(":/icons/kueue.png") ); if ( Settings::unityEnabled() ) { setCornerWidget( newTabButton, Qt::TopRightCorner ); } setCornerWidget( mMenuButton, Qt::TopLeftCorner ); // create the main browser tabs... mQueueBrowser = new QueueBrowser( this ); mSubownerBrowser = new SubownerBrowser( this ); mPersonalTab = new BrowserWithSearch( mQueueBrowser, this ); mSubownerTab = new BrowserWithSearch( mSubownerBrowser, this ); connect( mQueueBrowser, SIGNAL( setMenus() ), this, SLOT( setMenus() ) ); connect( mSubownerBrowser, SIGNAL( setMenus() ), this, SLOT( setMenus() ) ); connect( mQueueBrowser, SIGNAL( expandAll() ), this, SLOT( expandAllTables() ) ); connect( mQueueBrowser, SIGNAL( closeAll() ), this, SLOT( closeAllTables() ) ); mQmonBrowser = new QMonBrowser( this ); mMonitorTab = new BrowserWithSearch( mQmonBrowser, this ); mStatsBrowser = new StatsBrowser( this ); mStatsTab = new BrowserWithSearch( mStatsBrowser, this ); if ( Settings::unityEnabled() ) { addUnityBrowser(); rebuildMaps(); } mSubVisible = true; // ...and add them to the tabbar insertTab( 0, mPersonalTab, QIcon( ":icons/conf/targets.png" ), "Personal queue" ); insertTab( 1, mSubownerTab, QIcon( ":icons/conf/targets.png" ), "Subowned SRs" ); insertTab( 2, mMonitorTab, QIcon( ":/icons/conf/monitor.png" ), "Queue monitor" ); insertTab( 3, mStatsTab, QIcon( ":/icons/conf/stats.png" ), "Statistics" ); QShortcut* search = new QShortcut( QKeySequence( Qt::CTRL + Qt::Key_F ), this ); connect( search, SIGNAL( activated() ), this, SLOT( showSearch() ) ); refreshTabs(); }
QMenu* TabWidget::kueueMainMenu() { QMenu* menu = new QMenu( this ); QMenu* kueue = new QMenu( menu ); kueue->setIcon( QIcon( ":/icons/kueue.png" ) ); kueue->setTitle( "Kueue" ); mActionConfig = new QAction( kueue ); mActionConfig->setText( "Configure kueue" ); mActionConfig->setIcon( QIcon( ":/icons/menus/configure.png" ) ); mActionNSA = new QAction( kueue ); mActionNSA->setText( "Generate NSA Report" ); mActionNSA->setIcon( QIcon( ":/icons/menus/nsa.png" ) ); if ( Settings::unityEnabled() ) { mActionAddUnityTab = new QAction( kueue ); mActionAddUnityTab->setText( "Add Unity tab" ); mActionAddUnityTab->setIcon( QIcon( ":/icons/menus/web.png" ) ); } mActionQuit = new QAction( kueue ); mActionQuit->setText( "Quit" ); mActionQuit->setIcon( QIcon( ":/icons/menus/quit.png" ) ); mActionQuit->setShortcut ( QKeySequence( Qt::CTRL + Qt::Key_Q ) ); kueue->addAction( mActionConfig ); if ( Settings::unityEnabled() ) { kueue->addAction( mActionAddUnityTab ); } kueue->addAction( mActionNSA ); kueue->addAction( mActionQuit ); QMenu* view = new QMenu( menu ); view->setIcon( QIcon( ":/icons/conf/targets.png" ) ); view->setTitle( "Personal queue" ); QMenu* filter = new QMenu( menu ); filter->setIcon( QIcon( ":/icons/menus/filter.png" ) ); filter->setTitle( "Filter" ); mActionAwaitingCustomer = new QAction( filter ); mActionAwaitingCustomer->setText( "Awaiting Customer" ); mActionAwaitingCustomer->setCheckable( true ); mActionAwaitingSupport = new QAction( filter ); mActionAwaitingSupport->setText( "Awaiting Support" ); mActionAwaitingSupport->setCheckable( true ); mActionOthers = new QAction( filter ); mActionOthers->setText( "Other" ); mActionOthers->setCheckable( true ); mActionShowCR = new QAction( filter ); mActionShowCR->setText( "Show CRs" ); mActionShowCR->setCheckable( true ); mActionShowSR = new QAction( filter ); mActionShowSR->setText( "Show SRs" ); mActionShowSR->setCheckable( true ); filter->addAction( mActionAwaitingCustomer ); filter->addAction( mActionAwaitingSupport ); filter->addAction( mActionOthers ); filter->addSeparator(); filter->addAction( mActionShowCR ); filter->addAction( mActionShowSR ); view->addMenu( filter ); QMenu* sortby = new QMenu( menu ); sortby->setIcon( QIcon( ":/icons/menus/sort.png" ) ); sortby->setTitle( "Sort by" ); mActionSortUpdate = new QAction( sortby ); mActionSortUpdate->setText( "Last activity" ); mActionSortUpdate->setCheckable( true ); mActionSortAge = new QAction( sortby ); mActionSortAge->setText( "Age" ); mActionSortAge->setCheckable( true ); sortby->addAction( mActionSortUpdate ); sortby->addAction( mActionSortAge ); view->addMenu( sortby ); QMenu* other = new QMenu( menu ); other->setIcon( QIcon( ":/icons/menus/misc.png" ) ); other->setTitle( "Other" ); mActionCloseSrTables = new QAction( other ); mActionCloseSrTables->setText( "Close all SR tables" ); mActionExpandSrTables = new QAction( other ); mActionExpandSrTables->setText( "Expand all SR tables" ); other->addAction( mActionCloseSrTables ); other->addAction( mActionExpandSrTables ); view->addMenu( other ); QMenu* sub = new QMenu( menu ); sub->setIcon( QIcon( ":/icons/conf/targets.png" ) ); sub->setTitle( "Subowned SRs" ); QMenu* subfilter = new QMenu( menu ); subfilter->setIcon( QIcon( ":/icons/menus/filter.png" ) ); subfilter->setTitle( "Filter" ); mActionSubAwaitingCustomer = new QAction( subfilter ); mActionSubAwaitingCustomer->setText( "Awaiting Customer" ); mActionSubAwaitingCustomer->setCheckable( true ); mActionSubAwaitingSupport = new QAction( subfilter ); mActionSubAwaitingSupport->setText( "Awaiting Support" ); mActionSubAwaitingSupport->setCheckable( true ); mActionSubOthers = new QAction( subfilter ); mActionSubOthers->setText( "Other" ); mActionSubOthers->setCheckable( true ); mActionSubShowCR = new QAction( subfilter ); mActionSubShowCR->setText( "Show CRs" ); mActionSubShowCR->setCheckable( true ); mActionSubShowSR = new QAction( subfilter ); mActionSubShowSR->setText( "Show SRs" ); mActionSubShowSR->setCheckable( true ); subfilter->addAction( mActionSubAwaitingCustomer ); subfilter->addAction( mActionSubAwaitingSupport ); subfilter->addAction( mActionSubOthers ); subfilter->addSeparator(); subfilter->addAction( mActionSubShowCR ); subfilter->addAction( mActionSubShowSR ); sub->addMenu( subfilter ); QMenu* subsortby = new QMenu( menu ); subsortby->setIcon( QIcon( ":/icons/menus/sort.png" ) ); subsortby->setTitle( "Sort by" ); mActionSubSortUpdate = new QAction( subsortby ); mActionSubSortUpdate->setText( "Last activity" ); mActionSubSortUpdate->setCheckable( true ); mActionSubSortAge = new QAction( subsortby ); mActionSubSortAge->setText( "Age" ); mActionSubSortAge->setCheckable( true ); sortby->addAction( mActionSubSortUpdate ); sortby->addAction( mActionSubSortAge ); sub->addMenu( subsortby ); QMenu* subother = new QMenu( menu ); subother->setIcon( QIcon( ":/icons/menus/misc.png" ) ); subother->setTitle( "Other" ); mActionSubCloseSrTables = new QAction( other ); mActionSubCloseSrTables->setText( "Close all SR tables" ); mActionSubExpandSrTables = new QAction( other ); mActionSubExpandSrTables->setText( "Expand all SR tables" ); subother->addAction( mActionSubCloseSrTables ); subother->addAction( mActionSubExpandSrTables ); sub->addMenu( subother ); QMenu* qmon = new QMenu( menu ); qmon->setIcon( QIcon( ":/icons/conf/monitor.png" ) ); qmon->setTitle( "Queue monitor" ); QMenu* qmonfilter = new QMenu( qmon ); filter->setIcon( QIcon( ":/icons/menus/filter.png" ) ); filter->setTitle( "Filter" ); /*mActionQmonAwaitingCustomer = new QAction( qmonfilter ); mActionQmonAwaitingCustomer->setText( "Awaiting Customer" ); mActionQmonAwaitingCustomer->setCheckable( true ); mActionQmonAwaitingSupport = new QAction( qmonfilter ); mActionQmonAwaitingSupport->setText( "Awaiting Support" ); mActionQmonAwaitingSupport->setCheckable( true ); mActionQmonOthers = new QAction( qmonfilter ); mActionQmonOthers->setText( "Other" ); mActionQmonOthers->setCheckable( true ); qmonfilter->addAction( mActionAwaitingCustomer ); qmonfilter->addAction( mActionAwaitingSupport ); qmonfilter->addAction( mActionOthers );*/ qmon->addMenu( qmonfilter ); QMenu* help = new QMenu( menu ); help->setIcon( QIcon( ":/icons/menus/help.png" ) ); help->setTitle( "Help" ); mActionHelp = new QAction( help ); mActionHelp->setText( "Help" ); mActionHelp->setIcon( QIcon( ":/icons/menus/help.png" ) ); mActionBug = new QAction( help ); mActionBug->setText( "Report Bug" ); mActionBug->setIcon( QIcon( ":/icons/menus/reportbug.png" ) ); mActionFeature = new QAction( help ); mActionFeature->setText( "Suggest feature" ); mActionFeature->setIcon( QIcon( ":/icons/menus/feature.png" ) ); mActionAbout = new QAction( help ); mActionAbout->setText( "About kueue" ); mActionAbout->setIcon( QIcon( ":/icons/menus/about.png" ) ); help->addAction( mActionHelp ); help->addAction( mActionBug ); help->addAction( mActionFeature ); help->addAction( mActionAbout ); menu->addMenu( kueue ); menu->addMenu( view ); menu->addMenu( sub ); menu->addMenu( qmon ); menu->addMenu( help ); setMenus(); connect( mActionQuit, SIGNAL( activated() ), qApp, SLOT( quit() ) ); connect( mActionConfig, SIGNAL( activated() ), this, SIGNAL( openConfig() ) ); connect( mActionShowSR, SIGNAL( toggled( bool ) ), this, SLOT( setShowSR( bool ) ) ); connect( mActionShowCR, SIGNAL( toggled( bool ) ), this, SLOT( setShowCR( bool ) ) ); connect( mActionSortUpdate, SIGNAL( toggled( bool ) ), this, SLOT( setSortUpdate( bool ) ) ); connect( mActionSortAge, SIGNAL( toggled( bool ) ), this, SLOT( setSortAge( bool ) ) ); connect( mActionAwaitingCustomer, SIGNAL( toggled( bool ) ), this, SLOT( setShowAwaitingCustomer( bool ) ) ); connect( mActionAwaitingSupport, SIGNAL( toggled( bool ) ), this, SLOT( setShowAwaitingSupport( bool ) ) ); connect( mActionOthers, SIGNAL( toggled( bool ) ), this, SLOT( setShowStatusOthers( bool ) ) ); connect( mActionExpandSrTables, SIGNAL( activated() ), this, SLOT( expandAllTables() ) ); connect( mActionCloseSrTables, SIGNAL( activated() ), this, SLOT( closeAllTables() ) ); connect( mActionSubShowSR, SIGNAL( toggled( bool ) ), this, SLOT( subSetShowSR( bool ) ) ); connect( mActionSubShowCR, SIGNAL( toggled( bool ) ), this, SLOT( subSetShowCR( bool ) ) ); connect( mActionSubSortUpdate, SIGNAL( toggled( bool ) ), this, SLOT( subSetSortUpdate( bool ) ) ); connect( mActionSubSortAge, SIGNAL( toggled( bool ) ), this, SLOT( subSetSortAge( bool ) ) ); connect( mActionSubAwaitingCustomer, SIGNAL( toggled( bool ) ), this, SLOT( subSetShowAwaitingCustomer( bool ) ) ); connect( mActionSubAwaitingSupport, SIGNAL( toggled( bool ) ), this, SLOT( subSetShowAwaitingSupport( bool ) ) ); connect( mActionSubOthers, SIGNAL( toggled( bool ) ), this, SLOT( subSetShowStatusOthers( bool ) ) ); connect( mActionSubExpandSrTables, SIGNAL( activated() ), this, SLOT( subExpandAllTables() ) ); connect( mActionSubCloseSrTables, SIGNAL( activated() ), this, SLOT( subCloseAllTables() ) ); connect( mActionAbout, SIGNAL( activated() ), this, SLOT( aboutDialog() ) ); connect( mActionBug, SIGNAL( activated() ), this, SLOT( reportBug() ) ); connect( mActionFeature, SIGNAL( activated() ), this, SLOT( suggestFeature() ) ); connect( mActionHelp, SIGNAL( activated() ), this, SLOT( openHelp() ) ); if ( Settings::unityEnabled() ) { connect( mActionAddUnityTab, SIGNAL( activated() ), this, SLOT( addUnityBrowser() ) ); } connect( mActionNSA, SIGNAL( activated() ), this, SLOT( makeNsaReport() ) ); return menu; }