int TestSelectionKeyboardCallback(int key, int current_test) { const udword NbTests = GetNbTests(); switch(key) { case GLUT_KEY_DOWN: { current_test++; if(current_test==NbTests) current_test=0; break; } case GLUT_KEY_UP: { if(current_test) current_test--; else current_test = NbTests-1; break; } case GLUT_KEY_RIGHT: { current_test = NextCategory(current_test); break; } case GLUT_KEY_LEFT: { current_test = PreviousCategory(current_test); break; } } return current_test; }
//----------------------------------------------------------------------------- //! //----------------------------------------------------------------------------- // Select by category popup void tSiriusController::SelectCategory() { // Get the subscribed list const QList<tChannelRecord *>& chanList = GetSubscribedChannelList(); if ( chanList.isEmpty() ) { // Assert(chanList.size() > 0); // Must be at least the currently playing channel tMessageBox::Error( 0, tr( "Categories"), tr( "No channels"), tMessageBox::CLOSE ); return; } m_pSelectCategoryDialog = new tListenDialog(tr("Channels") + QString(" - ") + tr("Categories"), 0, true, true); m_pCategoryTable = new tCategorySelect(); //not sure Cougar needs this Connect(m_pCategoryTable, SIGNAL(NewSiriusCategorySelectedByUser(QString&)), m_pSelectCategoryDialog, SLOT(OnNewSiriusCategorySelectedByUser(QString&))); m_pCategoryTable->SetRecords(chanList, m_ChannelId); // Close the dialog on channel selected Connect(m_pCategoryTable, SIGNAL(activated(const QModelIndex&)), this, SLOT(TuneToHighlightedChannelFromCategory())); Connect(m_pSelectCategoryDialog, SIGNAL(accepted()), this, SLOT(TuneToHighlightedChannelAndAcceptFromCategory())); Connect(this, SIGNAL(FavoriteUpdated(const bool)), m_pSelectCategoryDialog, SLOT(OnFavoriteUpdated(const bool))); Connect(m_pCategoryTable, SIGNAL(NewFocusRow(const int)), this, SLOT(OnNewFocusRow(const int))); Connect(m_pSelectCategoryDialog, SIGNAL(ToggleFavoriteMenuSelected()), m_pCategoryTable, SLOT(ToggleFavorite())); // Close the dialog on cancel Connect(m_pCategoryTable, SIGNAL(Cancel()), m_pSelectCategoryDialog, SLOT(reject())); Connect(m_pSelectCategoryDialog, SIGNAL(WheelIndicatesScrollUp()), m_pCategoryTable, SLOT(OnWheelIndicatesScrollUp())); Connect(m_pSelectCategoryDialog, SIGNAL(WheelIndicatesScrollDown()), m_pCategoryTable, SLOT(OnWheelIndicatesScrollDown())); Connect(m_pSelectCategoryDialog, SIGNAL(NextCategoryMenuSelected()), m_pCategoryTable, SLOT(NextCategory())); Connect(m_pSelectCategoryDialog, SIGNAL(PreviousCategoryMenuSelected()), m_pCategoryTable, SLOT(PrevCategory())); // Layout QVBoxLayout* pLayout = new QVBoxLayout; pLayout->addWidget(m_pCategoryTable); m_pSelectCategoryDialog->setLayout(pLayout); Connect(m_pCategoryTable, SIGNAL(RowLocationPossiblyChanged(const QRect)), m_pSelectCategoryDialog, SLOT(OnRowLocationPossiblyChanged(const QRect))); m_pSelectCategoryDialog->exec(); delete m_pSelectCategoryDialog; m_pSelectCategoryDialog = 0; // delete m_pCategoryTable; we do not need to do this, it is owned by the dialog m_pCategoryTable = 0; }