bool EditRomInfoDialog::Create() { if (!LoadWindowFromXML("game-ui.xml", "edit_metadata", this)) return false; bool err = false; UIUtilE::Assign(this, m_gamenameEdit, "title_edit", &err); UIUtilE::Assign(this, m_genreEdit, "genre_edit", &err); UIUtilE::Assign(this, m_yearEdit, "year_edit", &err); UIUtilE::Assign(this, m_countryEdit, "country_edit", &err); UIUtilE::Assign(this, m_plotEdit, "description_edit", &err); UIUtilE::Assign(this, m_publisherEdit, "publisher_edit", &err); UIUtilE::Assign(this, m_favoriteCheck, "favorite_check", &err); UIUtilE::Assign(this, m_screenshotButton, "screenshot_button", &err); UIUtilE::Assign(this, m_screenshotText, "screenshot_text", &err); UIUtilE::Assign(this, m_fanartButton, "fanart_button", &err); UIUtilE::Assign(this, m_fanartText, "fanart_text", &err); UIUtilE::Assign(this, m_boxartButton, "coverart_button", &err); UIUtilE::Assign(this, m_boxartText, "coverart_text", &err); UIUtilE::Assign(this, m_doneButton, "done_button", &err); if (err) { VERBOSE(VB_IMPORTANT, "Cannot load screen 'edit_metadata'"); return false; } fillWidgets(); BuildFocusList(); connect(m_gamenameEdit, SIGNAL(valueChanged()), SLOT(SetGamename())); connect(m_genreEdit, SIGNAL(valueChanged()), SLOT(SetGenre())); connect(m_yearEdit, SIGNAL(valueChanged()), SLOT(SetYear())); connect(m_countryEdit, SIGNAL(valueChanged()), SLOT(SetCountry())); connect(m_plotEdit, SIGNAL(valueChanged()), SLOT(SetPlot())); connect(m_publisherEdit, SIGNAL(valueChanged()), SLOT(SetPublisher())); connect(m_favoriteCheck, SIGNAL(valueChanged()), SLOT(ToggleFavorite())); connect(m_screenshotButton, SIGNAL(Clicked()), SLOT(FindScreenshot())); connect(m_fanartButton, SIGNAL(Clicked()), SLOT(FindFanart())); connect(m_boxartButton, SIGNAL(Clicked()), SLOT(FindBoxart())); connect(m_doneButton, SIGNAL(Clicked()), SLOT(SaveAndExit())); return true; }
void tAllChannelStatus::keyPressEvent(QKeyEvent *pEvent) { int key = pEvent->key(); switch(key) { case Key::Exit: if( pEvent->isAutoRepeat() == false) { pEvent->accept(); emit Cancel(); } break; case Key::Up: ScrollUp(); pEvent->accept(); break; case Key::Down: ScrollDown(); pEvent->accept(); break; case Key::Right: case Key::Left: if( pEvent->isAutoRepeat() == false ) { ToggleFavorite(); pEvent->accept(); } break; case Key::Enter: case Key::Rotary: if( pEvent->isAutoRepeat() == false) { tAbstractChannelTable::keyPressEvent(pEvent); pEvent->accept(); } break; case Key::Menu: pEvent->ignore(); //this makes it so the parent gets the event break; default: tAbstractChannelTable::keyPressEvent(pEvent); break; }; }
//----------------------------------------------------------------------------- //! Activate the Select From subscribed or favorites channels menu item //----------------------------------------------------------------------------- void tSiriusController::SelectFromChannels(const QList<tChannelRecord *>& chanList, const QString& title, bool needFavoritesColumn) { // First get the subscribed list if ( chanList.isEmpty() ) { // Assert(chanList.size() > 0); // Must be at least the currently playing channel tMessageBox::Error( 0, tr("Subscribed"), tr("No channels"), tMessageBox::CLOSE ); return; } // If there is only 1 subscribed channel, it must be the the current channel // TODO the dialog should say "Call Sirius" m_pChannelsDialog = new tListenDialog(title, 0, needFavoritesColumn); m_pChannelsDialog->SetAlignment(tDialog::AlignScreenCenter); m_pChannelsTable = new tChannelSelect(0, needFavoritesColumn); m_pChannelsTable->SetRecords(chanList, m_ChannelId); // Close the dialog on channel selected Connect(m_pChannelsTable, SIGNAL(activated(const QModelIndex&)), this, SLOT(TuneToHighlightedChannelFromChannelsTable(const QModelIndex&))); Connect(m_pChannelsDialog, SIGNAL(accepted()), this, SLOT(TuneToHighlightedChannelAndAcceptFromChannelsTable())); Connect(this, SIGNAL(FavoriteUpdated(const bool)), m_pChannelsDialog, SLOT(OnFavoriteUpdated(const bool))); Connect(m_pChannelsTable, SIGNAL(NewFocusRow(const int)), this, SLOT(OnNewFocusRow(const int))); Connect(m_pChannelsDialog, SIGNAL(ToggleFavoriteMenuSelected()), m_pChannelsTable, SLOT(ToggleFavorite())); // Close the dialog on cancel Connect(m_pChannelsTable, SIGNAL(Cancel()), m_pChannelsDialog, SLOT(reject())); Connect(m_pChannelsDialog, SIGNAL(WheelIndicatesScrollUp()), m_pChannelsTable, SLOT(OnWheelIndicatesScrollUp())); Connect(m_pChannelsDialog, SIGNAL(WheelIndicatesScrollDown()), m_pChannelsTable, SLOT(OnWheelIndicatesScrollDown())); // Layout QVBoxLayout* pLayout = new QVBoxLayout; pLayout->addWidget(m_pChannelsTable); m_pChannelsDialog->setLayout(pLayout); Connect(m_pChannelsTable, SIGNAL(RowLocationPossiblyChanged(const QRect)), m_pChannelsDialog, SLOT(OnRowLocationPossiblyChanged(const QRect))); m_pChannelsDialog->exec(); delete m_pChannelsDialog; m_pChannelsDialog = 0; //delete m_pChannelsTable; we do not need to do this, it is owned by the dialog m_pChannelsTable = 0; }
//----------------------------------------------------------------------------- //! All channel status popup //----------------------------------------------------------------------------- void tSiriusController::AllChannelStatus() { const QList<tChannelInfo *>& chanList = m_rSiriusConnector.AllChannelList(); if ( chanList.isEmpty() ) { // Assert(chanList.size() > 0); // Must be at least the currently playing channel tMessageBox::Error( 0, tr( "All" ), tr( "No channels" ), tMessageBox::CLOSE ); return; } m_pAllChannelStatusDialog = new tListenDialog( tr("Channels") + QString(" - ") + tr("All"), 0, true); m_pAllChannelStatusDialog->SetAlignment(tDialog::AlignScreenCenter); m_pAllChannelStatusTable = new tAllChannelStatus(m_pAllChannelStatusDialog); Connect(m_pAllChannelStatusTable, SIGNAL(Cancel()), m_pAllChannelStatusDialog, SLOT(reject())); Connect(m_pAllChannelStatusTable, SIGNAL(activated(const QModelIndex&)), this, SLOT(TuneToHighlightedChannelFromAllChannelStatusTable())); Connect(m_pAllChannelStatusDialog, SIGNAL(accepted()), this, SLOT(TuneToHighlightedChannelAndAcceptFromAllChannelStatusTable())); Connect(this, SIGNAL(FavoriteUpdated(const bool)), m_pAllChannelStatusDialog, SLOT(OnFavoriteUpdated(const bool))); Connect(m_pAllChannelStatusTable, SIGNAL(NewFocusRow(const int)), this, SLOT(OnNewFocusRow(const int))); Connect(m_pAllChannelStatusDialog, SIGNAL(ToggleFavoriteMenuSelected()), m_pAllChannelStatusTable, SLOT(ToggleFavorite())); Connect(m_pAllChannelStatusDialog, SIGNAL(WheelIndicatesScrollUp()), m_pAllChannelStatusTable, SLOT(OnWheelIndicatesScrollUp())); Connect(m_pAllChannelStatusDialog, SIGNAL(WheelIndicatesScrollDown()), m_pAllChannelStatusTable, SLOT(OnWheelIndicatesScrollDown())); // Layout QVBoxLayout* pLayout = new QVBoxLayout; pLayout->addWidget(m_pAllChannelStatusTable); m_pAllChannelStatusDialog->setLayout(pLayout); m_pAllChannelStatusTable->SetRecords(chanList, m_ChannelId); Connect(m_pAllChannelStatusTable, SIGNAL(RowLocationPossiblyChanged(const QRect)), m_pAllChannelStatusDialog, SLOT(OnRowLocationPossiblyChanged(const QRect))); m_pAllChannelStatusDialog->exec(); delete m_pAllChannelStatusDialog; m_pAllChannelStatusDialog = 0; //delete m_pAllChannelStatusTable; we do not need to do this, it is owned by the dialog m_pAllChannelStatusTable = 0; }
//----------------------------------------------------------------------------- //! //----------------------------------------------------------------------------- // 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; }