Ticket #902: queueui.patch

File queueui.patch, 3.3 KB (added by anonymous, 15 years ago)
  • mythflix/mythflixqueue.cpp

     
    332332        else if (action == "PAGEDOWN")
    333333             cursorDown(true);
    334334        else if (action == "REMOVE")
    335              removeFromQueue();
     335             slotRemoveFromQueue();
    336336        else if (action == "MOVETOTOP")
    337              moveToTop();
     337             slotMoveToTop();
     338        else if (action == "SELECT")
     339            displayOptions();
    338340        else
    339341            handled = false;
    340342    }
     
    396398    }
    397399}
    398400
    399 void MythFlixQueue::moveToTop()
     401void MythFlixQueue::slotMoveToTop()
    400402{
     403
     404    if (expectingPopup)
     405        slotCancelPopup();
     406
    401407    UIListBtnTypeItem *articleUIItem = m_UIArticles->GetItemCurrent();
    402408
    403409    if (articleUIItem && articleUIItem->getData())
     
    435441
    436442}
    437443
    438 void MythFlixQueue::removeFromQueue()
     444void MythFlixQueue::slotRemoveFromQueue()
    439445{
     446
     447    if (expectingPopup)
     448        slotCancelPopup();
     449
    440450    UIListBtnTypeItem *articleUIItem = m_UIArticles->GetItemCurrent();
    441451
    442452    if (articleUIItem && articleUIItem->getData())
     
    480490    update(m_InfoRect);
    481491}
    482492
     493void MythFlixQueue::displayOptions()
     494{
     495
     496    popup = new MythPopupBox(gContext->GetMainWindow(), "menu popup");
     497
     498    QLabel *label = popup->addLabel(tr("Manage Queue"),
     499                                  MythPopupBox::Large, false);
     500    label->setAlignment(Qt::AlignCenter | Qt::WordBreak);
     501
     502    QButton *topButton = popup->addButton(tr("Top Of Queue"), this,
     503                     SLOT(slotMoveToTop()));
     504
     505    popup->addButton(tr("Remove From Queue"), this,
     506                     SLOT(slotRemoveFromQueue()));
     507
     508    popup->addButton(tr("Cancel"), this, SLOT(slotCancelPopup()));
     509
     510    popup->ShowPopup(this, SLOT(slotCancelPopup()));
     511
     512    topButton->setFocus();
     513
     514    expectingPopup = true;
     515
     516}
     517
     518void MythFlixQueue::slotCancelPopup(void)
     519{
     520    popup->hide();
     521    expectingPopup = false;
     522
     523    delete popup;
     524    popup = NULL;
     525
     526    setActiveWindow();
     527}
     528
    483529// Execute an external command and return results in string
    484530//   probably should make this routing async vs polling like this
    485531//   but it would require a lot more code restructuring
  • mythflix/mythflixqueue.h

     
    5757    void cursorUp(bool page=false);
    5858    void cursorDown(bool page=false);
    5959
     60    void displayOptions();
     61
    6062    void cancelRetrieve();
    6163    void processAndShowNews(NewsSite *site);
    6264
    63     void moveToTop();
    64     void removeFromQueue();
    6565    QString executeExternal(const QStringList& args, const QString& purpose);
    6666
    6767    XMLParse      *m_Theme;
     
    6969    UIListBtnType *m_UIArticles;
    7070    QRect          m_ArticlesRect;
    7171    QRect          m_InfoRect;
     72    MythPopupBox  *popup;
    7273
    7374    NewsSite::List m_NewsSites;
    7475
    7576    QHttp         *http;
    7677
     78    bool           expectingPopup;
     79
    7780private slots:
    7881    void slotViewArticle();
    7982    void slotRetrieveNews();
     
    8386   
    8487    void slotArticleSelected(UIListBtnTypeItem *item);
    8588
     89    void slotMoveToTop();
     90    void slotRemoveFromQueue();
     91    void slotCancelPopup();
     92
    8693};
    8794
    8895#endif /* MYTHFLIXQUEUE_H */