Ticket #3930: mythplugins-mouse.diff

File mythplugins-mouse.diff, 12.1 KB (added by Anthony D'Alberto <afd1009@…>, 5 years ago)

Mythplugins patch

  • mythplugins/mythmusic/mythmusic/playbackbox.cpp

     
    4949    playlist_tree = NULL; 
    5050    playlist_popup = NULL; 
    5151    progress = NULL; 
    52  
     52    
     53//added by Anthony D'Alberto to support back button 
     54    back_button = NULL; 
     55    menu_button = NULL; 
     56    exec_button = NULL; 
     57//end of added section 
     58  
    5359    isplaying = false; 
    5460    tree_is_done = false; 
    5561    first_playlist_check = true; 
     
    226232 
    227233    // Ready to go. Let's update the foreground just to be safe. 
    228234 
     235//added by Anthony D'Alberto to support back button 
     236    back_button = getUIPushButtonType("backbutton"); 
     237    menu_button = getUIPushButtonType("menubutton"); 
     238    exec_button = getUIPushButtonType("execbutton"); 
     239     
     240    if (back_button!= NULL) 
     241        connect(back_button, SIGNAL(pushed()), this, SLOT(back())); 
     242    else 
     243        back_button = NULL; 
     244 
     245    if(menu_button != NULL) 
     246        connect(menu_button, SIGNAL(pushed()), this, SLOT(Menu())); 
     247    else 
     248        menu_button = NULL; 
     249 
     250    if(exec_button != NULL) 
     251        connect(exec_button, SIGNAL(pushed()), this, SLOT(Run())); 
     252    else 
     253        exec_button = NULL; 
     254         
     255//end of added section 
     256 
    229257    updateForeground(); 
    230258 
    231259    if (class LCD *lcd = LCD::Get()) 
     
    588616    } 
    589617} 
    590618 
     619//added by Anthony D'Alberto to support back button (and mouse presses) 
     620void PlaybackBoxMusic::mousePressEvent(QMouseEvent *e) 
     621{ 
     622        int iReturnValue; 
     623        if(back_button != NULL) 
     624        { 
     625                if(back_button->getScreenArea().contains(e->x(), e->y())) 
     626                { 
     627                        back_button->push(); 
     628                        e->accept(); 
     629                        return; 
     630                } 
     631        } 
     632 
     633    if(menu_button != NULL) 
     634    { 
     635            if(menu_button->getScreenArea().contains(e->x(), e->y())) 
     636            { 
     637                menu_button->push(); 
     638                e->accept(); 
     639                return; 
     640            } 
     641    } 
     642 
     643    if(exec_button != NULL) 
     644    { 
     645            if(exec_button->getScreenArea().contains(e->x(), e->y())) 
     646            { 
     647                exec_button->push(); 
     648                e->accept(); 
     649                return; 
     650            } 
     651    } 
     652 
     653        iReturnValue = music_tree_list->mousePressHandler(e); 
     654 
     655        if(iReturnValue >= 0) 
     656        { 
     657                //the mouse was pressed in the tree control 
     658                e->accept(); 
     659 
     660        } 
     661        else 
     662        { 
     663                MythThemedDialog::mousePressEvent(e); 
     664        } 
     665} 
     666 
     667void PlaybackBoxMusic::back() 
     668{ 
     669        keyPressEvent(new QKeyEvent(QEvent::KeyPress, 4096, 27, 0)); 
     670} 
     671 
     672void PlaybackBoxMusic::Menu() 
     673{ 
     674      showMenu(); 
     675} 
     676 
     677void PlaybackBoxMusic::Run() 
     678{ 
     679      printf("Exec button\n"); 
     680 
     681} 
     682 
     683//end of added section 
     684 
    591685void PlaybackBoxMusic::showMenu() 
    592686{ 
    593687    if (playlist_popup) 
     
    629723        playlist_popup->addButton(tr("Tracks from current Year"), this, 
    630724                                  SLOT(byYear())); 
    631725    } 
     726 
     727    //Added by Anthiny D'Alberto to support mouswe 
     728        playlist_popup->addButton(tr("Cancel"), this, SLOT(closePlaylistPopup())); 
     729    //end of added section 
    632730     
    633731    playlist_popup->ShowPopup(this, SLOT(closePlaylistPopup())); 
    634732 
     
    23052403    QButton *button = popup->addButton(tr("Replace")); 
    23062404    popup->addButton(tr("Insert after current track")); 
    23072405    popup->addButton(tr("Append to end")); 
     2406 
    23082407    button->setFocus(); 
    23092408 
    23102409    QLabel *splitter = popup->addLabel(" ", MythPopupBox::Small); 
     
    23372436    { 
    23382437        case 0: 
    23392438            insertOption = PL_REPLACE; 
    2340             break; 
     2439             break; 
    23412440        case 1: 
    23422441            insertOption = PL_INSERTAFTERCURRENT; 
    2343             break; 
     2442             break; 
    23442443        case 2: 
    2345             insertOption = PL_INSERTATEND; 
    2346             break; 
    2347     } 
     2444            insertOption = PL_INSERTATEND;             
     2445             break; 
     2446     } 
    23482447 
    23492448    bRemoveDups = dupsCheck->isChecked(); 
    23502449 
  • mythplugins/mythmusic/mythmusic/cdrip.h

     
    120120    void searchArtist(void); 
    121121    void searchAlbum(void); 
    122122    void searchGenre(void); 
     123//added by Anthony D'Alberto to support back button 
     124    void back(); 
     125//end of added section 
    123126 
    124127  private: 
    125128    void wireupTheme(void); 
     
    151154    UIPushButtonType  *m_searchAlbumButton; 
    152155    UIPushButtonType  *m_searchGenreButton; 
    153156 
     157//added by Anthony D'Alberto to support the back button 
     158    MythPushButton *back_button; 
     159//end of added section 
     160 
    154161    int                m_currentTrack; 
    155162    int                m_totalTracks; 
    156163    vector<RipTrack*> *m_tracks; 
  • mythplugins/mythmusic/mythmusic/music-ui.xml

     
    817817            </textbutton> 
    818818 
    819819      </container> 
     820 
    820821   </window> 
    821822 
    822823   <window name="cdripper"> 
  • mythplugins/mythmusic/mythmusic/cdrip.cpp

     
    405405{ 
    406406    m_CDdevice = device; 
    407407 
     408//added by Anthony D'Alberto to support back button 
     409    back_button = NULL; 
     410//end of added section 
     411 
    408412#ifndef _WIN32 
    409413    // if the MediaMonitor is running stop it 
    410414    m_mediaMonitorActive = false; 
     
    541545 
    542546    m_trackList = (UIListType*) getUIObject("track_list"); 
    543547 
     548//added by Anthony D'Alberto to support back button 
     549    back_button = new MythPushButton(tr("Back"), m_parent); 
     550    if(back_button) 
     551    { 
     552            //vbox->addWidget(back_button); 
     553        connect(back_button, SIGNAL(clicked()), this, SLOT(back())); 
     554    } 
     555//end of added section 
     556 
    544557    buildFocusList(); 
    545558    assignFirstFocus(); 
    546559} 
     
    808821bool Ripper::isNewTune(const QString& artist, const QString& album, const QString& title) 
    809822{ 
    810823 
     824 
    811825    QString matchartist = artist; 
    812826    QString matchalbum = album; 
    813827    QString matchtitle = title; 
     
    905919                MythContext::DBError("Delete Track", deleteQuery); 
    906920        } 
    907921    } 
     922 
    908923} 
    909924 
    910925// static function to create a filename based on the metadata information 
     
    16031618    m_ripperThread = new CDRipperThread(this, m_CDdevice, m_tracks, m_quality); 
    16041619    m_ripperThread->start(); 
    16051620} 
     1621 
     1622//added by Anthony D'Alberto to support back button 
     1623void Ripper::back() 
     1624{ 
     1625        keyPressEvent(new QKeyEvent(QEvent::KeyPress, 4096, 27,0)); 
     1626} 
     1627//end of added section 
  • mythplugins/mythmusic/mythmusic/databasebox.h

     
    4848    void dealWithTracks(PlaylistItem *item_ptr); 
    4949    void setCDTitle(const QString& title); 
    5050    void fillCD(void); 
    51      
     51 
     52//Added by Anthony D'Alberto to support back button 
     53  public slots: 
     54    void back(); 
     55    void Menu(); 
     56//end of added section 
     57 
    5258  protected slots: 
    5359    void selected(UIListGenericTree *); 
    5460    void entered(UIListTreeType *, UIListGenericTree *); 
     
    7682    void CreateCDMP3(); 
    7783    void BlankCDRW(); 
    7884 
     85//added by Anthony D'Alberto to support mouse presses 
     86    void mousePressEvent(QMouseEvent *e); 
     87//end of added section 
     88 
    7989  private: 
    8090    void doSelected(UIListGenericTree *, bool cd_flag); 
    8191    void doPlaylistPopup(TreeCheckItem *item_ptr); 
     
    119129    QStringList         treelevels; 
    120130 
    121131    QPtrList<UITextType> m_lines; 
     132 
     133//Added by Anthony D'Alberto to support back button 
     134    UIPushButtonType *back_button; 
     135    UIPushButtonType *menu_button; 
     136//end of added section 
     137 
    122138}; 
    123139 
    124140#endif 
  • mythplugins/mythmusic/mythmusic/databasebox.cpp

     
    3232    the_playlists = all_playlists; 
    3333    active_playlist = NULL; 
    3434 
     35//Added by Anthony D'Alberto to support back button 
     36    back_button = NULL; 
     37    menu_button = NULL; 
     38//end of added section 
     39 
    3540    if (!music_ptr) 
    3641    { 
    3742        VERBOSE(VB_IMPORTANT, "We are not going to get very far with a null " 
     
    133138    fill_list_timer = new QTimer(this); 
    134139    connect(fill_list_timer, SIGNAL(timeout()), this, SLOT(keepFilling())); 
    135140    fill_list_timer->start(20); 
     141 
     142//Added by Anthony D'Alberto to support back button 
     143    back_button = getUIPushButtonType("backbutton"); 
     144    menu_button = getUIPushButtonType("menubutton"); 
     145     
     146    if(back_button) 
     147        connect(back_button, SIGNAL(pushed()), this, SLOT(back())); 
     148    else 
     149        back_button = NULL; 
     150 
     151    if(menu_button) 
     152    connect(menu_button, SIGNAL(pushed()), this, SLOT(Menu())); 
     153    else 
     154    menu_button = NULL; 
     155//end of added section 
     156 
    136157} 
    137158 
    138159DatabaseBox::~DatabaseBox() 
     
    797818 
    798819    playlist_popup->addButton(tr("Rename This Playlist"), this, 
    799820                              SLOT(renamePlaylist())); 
     821    //added by Anthony D'Alberto to support mouse 
     822    playlist_popup->addButton(tr("Cancel"), this, SLOT(closePlaylistPopup())); 
     823    //end of added section 
    800824 
    801825    playlist_popup->ShowPopup(this, SLOT(closePlaylistPopup())); 
    802826 
     
    860884        active_popup->addButton(tr("Clear CD-RW Disk"), this, 
    861885                                SLOT(BlankCDRW())); 
    862886 
     887        //added by Anthony D'Alberto to support mouse 
     888        active_popup->addButton(tr("Cancel"), this, SLOT(closeActivePopup())); 
     889        //end of added section 
     890         
    863891        double size_in_MB = 0.0; 
    864892        double size_in_sec = 0.0; 
    865893        active_playlist->computeSize(size_in_MB, size_in_sec); 
     
    13321360    delete decoder; 
    13331361} 
    13341362 
     1363//Added by Anthony D'Alberto to support mouse press 
     1364void DatabaseBox::mousePressEvent(QMouseEvent *e) 
     1365{ 
     1366        int iReturnValue; 
     1367        UIListGenericTree *curItem; 
     1368 
     1369        if(back_button != NULL) 
     1370        { 
     1371                if(back_button->getScreenArea().contains(e->x(), e->y())) 
     1372                { 
     1373                        back_button->push(); 
     1374                        e->accept(); 
     1375                        return; 
     1376                } 
     1377 
     1378                if(menu_button->getScreenArea().contains(e->x(), e->y())) 
     1379                { 
     1380                        menu_button->push(); 
     1381                        e->accept(); 
     1382                        return; 
     1383                } 
     1384 
     1385        } 
     1386 
     1387        iReturnValue = tree->mousePressHandler(e); 
     1388 
     1389        if(iReturnValue >= 0) 
     1390        { 
     1391                e->accept(); 
     1392                if((iReturnValue & ClickCheck) == ClickCheck) 
     1393                { 
     1394                        curItem = tree->GetCurrentPosition(); 
     1395                        if(curItem) 
     1396                                selected(curItem); 
     1397                } 
     1398        } 
     1399        else 
     1400        { 
     1401                MythThemedDialog::mousePressEvent(e); 
     1402        } 
     1403} 
     1404 
     1405void DatabaseBox::back() 
     1406{ 
     1407        keyPressEvent(new QKeyEvent(QEvent::KeyPress, 4096, 27, 0)); 
     1408} 
     1409 
     1410void DatabaseBox::Menu() 
     1411{ 
     1412    UIListGenericTree *curItem; 
     1413    curItem = tree->GetCurrentPosition(); 
     1414    doMenus(curItem); 
     1415} 
     1416 
     1417//end of added section 
  • mythplugins/mythmusic/mythmusic/playbackbox.h

     
    4141 
    4242    bool onMediaEvent(MythMediaDevice *pDev); 
    4343 
     44//added by Anthony D'Alberto to support back button 
     45    void mousePressEvent(QMouseEvent *e); 
     46//end of added section 
     47 
    4448  public slots: 
    4549 
    4650    void play(); 
     
    9498    void showSearchDialog(); 
    9599    bool getInsertPLOptions(InsertPLOption &insertOption, 
    96100                            PlayPLOption &playOption, bool &bRemoveDups); 
     101//added by Anthony D'Alberto to support back button 
     102    void back(); 
     103    void Menu(); 
     104    void Run(); 
     105//end of added section 
    97106 
    98107  signals: 
    99108 
     
    239248    UITextButtonType      *pledit_button; 
    240249    UITextButtonType      *vis_button; 
    241250 
     251//added by Anthony D'Alberto to support back button 
     252    UIPushButtonType    *back_button; 
     253    UIPushButtonType    *menu_button; 
     254    UIPushButtonType    *exec_button; 
     255//end of added section 
     256 
    242257    MythProgressDialog    *progress; 
    243258    enum { kProgressNone, kProgressMusic } progress_type; 
    244259};