Ticket #3930: mythplugins-mouse.diff
File mythplugins-mouse.diff, 12.1 KB (added by , 17 years ago) |
---|
-
mythplugins/mythmusic/mythmusic/playbackbox.cpp
49 49 playlist_tree = NULL; 50 50 playlist_popup = NULL; 51 51 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 53 59 isplaying = false; 54 60 tree_is_done = false; 55 61 first_playlist_check = true; … … 226 232 227 233 // Ready to go. Let's update the foreground just to be safe. 228 234 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 229 257 updateForeground(); 230 258 231 259 if (class LCD *lcd = LCD::Get()) … … 588 616 } 589 617 } 590 618 619 //added by Anthony D'Alberto to support back button (and mouse presses) 620 void 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 667 void PlaybackBoxMusic::back() 668 { 669 keyPressEvent(new QKeyEvent(QEvent::KeyPress, 4096, 27, 0)); 670 } 671 672 void PlaybackBoxMusic::Menu() 673 { 674 showMenu(); 675 } 676 677 void PlaybackBoxMusic::Run() 678 { 679 printf("Exec button\n"); 680 681 } 682 683 //end of added section 684 591 685 void PlaybackBoxMusic::showMenu() 592 686 { 593 687 if (playlist_popup) … … 629 723 playlist_popup->addButton(tr("Tracks from current Year"), this, 630 724 SLOT(byYear())); 631 725 } 726 727 //Added by Anthiny D'Alberto to support mouswe 728 playlist_popup->addButton(tr("Cancel"), this, SLOT(closePlaylistPopup())); 729 //end of added section 632 730 633 731 playlist_popup->ShowPopup(this, SLOT(closePlaylistPopup())); 634 732 … … 2305 2403 QButton *button = popup->addButton(tr("Replace")); 2306 2404 popup->addButton(tr("Insert after current track")); 2307 2405 popup->addButton(tr("Append to end")); 2406 2308 2407 button->setFocus(); 2309 2408 2310 2409 QLabel *splitter = popup->addLabel(" ", MythPopupBox::Small); … … 2337 2436 { 2338 2437 case 0: 2339 2438 insertOption = PL_REPLACE; 2340 break;2439 break; 2341 2440 case 1: 2342 2441 insertOption = PL_INSERTAFTERCURRENT; 2343 break;2442 break; 2344 2443 case 2: 2345 insertOption = PL_INSERTATEND; 2346 break;2347 }2444 insertOption = PL_INSERTATEND; 2445 break; 2446 } 2348 2447 2349 2448 bRemoveDups = dupsCheck->isChecked(); 2350 2449 -
mythplugins/mythmusic/mythmusic/cdrip.h
120 120 void searchArtist(void); 121 121 void searchAlbum(void); 122 122 void searchGenre(void); 123 //added by Anthony D'Alberto to support back button 124 void back(); 125 //end of added section 123 126 124 127 private: 125 128 void wireupTheme(void); … … 151 154 UIPushButtonType *m_searchAlbumButton; 152 155 UIPushButtonType *m_searchGenreButton; 153 156 157 //added by Anthony D'Alberto to support the back button 158 MythPushButton *back_button; 159 //end of added section 160 154 161 int m_currentTrack; 155 162 int m_totalTracks; 156 163 vector<RipTrack*> *m_tracks; -
mythplugins/mythmusic/mythmusic/music-ui.xml
817 817 </textbutton> 818 818 819 819 </container> 820 820 821 </window> 821 822 822 823 <window name="cdripper"> -
mythplugins/mythmusic/mythmusic/cdrip.cpp
405 405 { 406 406 m_CDdevice = device; 407 407 408 //added by Anthony D'Alberto to support back button 409 back_button = NULL; 410 //end of added section 411 408 412 #ifndef _WIN32 409 413 // if the MediaMonitor is running stop it 410 414 m_mediaMonitorActive = false; … … 541 545 542 546 m_trackList = (UIListType*) getUIObject("track_list"); 543 547 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 544 557 buildFocusList(); 545 558 assignFirstFocus(); 546 559 } … … 808 821 bool Ripper::isNewTune(const QString& artist, const QString& album, const QString& title) 809 822 { 810 823 824 811 825 QString matchartist = artist; 812 826 QString matchalbum = album; 813 827 QString matchtitle = title; … … 905 919 MythContext::DBError("Delete Track", deleteQuery); 906 920 } 907 921 } 922 908 923 } 909 924 910 925 // static function to create a filename based on the metadata information … … 1603 1618 m_ripperThread = new CDRipperThread(this, m_CDdevice, m_tracks, m_quality); 1604 1619 m_ripperThread->start(); 1605 1620 } 1621 1622 //added by Anthony D'Alberto to support back button 1623 void Ripper::back() 1624 { 1625 keyPressEvent(new QKeyEvent(QEvent::KeyPress, 4096, 27,0)); 1626 } 1627 //end of added section -
mythplugins/mythmusic/mythmusic/databasebox.h
48 48 void dealWithTracks(PlaylistItem *item_ptr); 49 49 void setCDTitle(const QString& title); 50 50 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 52 58 protected slots: 53 59 void selected(UIListGenericTree *); 54 60 void entered(UIListTreeType *, UIListGenericTree *); … … 76 82 void CreateCDMP3(); 77 83 void BlankCDRW(); 78 84 85 //added by Anthony D'Alberto to support mouse presses 86 void mousePressEvent(QMouseEvent *e); 87 //end of added section 88 79 89 private: 80 90 void doSelected(UIListGenericTree *, bool cd_flag); 81 91 void doPlaylistPopup(TreeCheckItem *item_ptr); … … 119 129 QStringList treelevels; 120 130 121 131 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 122 138 }; 123 139 124 140 #endif -
mythplugins/mythmusic/mythmusic/databasebox.cpp
32 32 the_playlists = all_playlists; 33 33 active_playlist = NULL; 34 34 35 //Added by Anthony D'Alberto to support back button 36 back_button = NULL; 37 menu_button = NULL; 38 //end of added section 39 35 40 if (!music_ptr) 36 41 { 37 42 VERBOSE(VB_IMPORTANT, "We are not going to get very far with a null " … … 133 138 fill_list_timer = new QTimer(this); 134 139 connect(fill_list_timer, SIGNAL(timeout()), this, SLOT(keepFilling())); 135 140 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 136 157 } 137 158 138 159 DatabaseBox::~DatabaseBox() … … 797 818 798 819 playlist_popup->addButton(tr("Rename This Playlist"), this, 799 820 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 800 824 801 825 playlist_popup->ShowPopup(this, SLOT(closePlaylistPopup())); 802 826 … … 860 884 active_popup->addButton(tr("Clear CD-RW Disk"), this, 861 885 SLOT(BlankCDRW())); 862 886 887 //added by Anthony D'Alberto to support mouse 888 active_popup->addButton(tr("Cancel"), this, SLOT(closeActivePopup())); 889 //end of added section 890 863 891 double size_in_MB = 0.0; 864 892 double size_in_sec = 0.0; 865 893 active_playlist->computeSize(size_in_MB, size_in_sec); … … 1332 1360 delete decoder; 1333 1361 } 1334 1362 1363 //Added by Anthony D'Alberto to support mouse press 1364 void 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 1405 void DatabaseBox::back() 1406 { 1407 keyPressEvent(new QKeyEvent(QEvent::KeyPress, 4096, 27, 0)); 1408 } 1409 1410 void 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
41 41 42 42 bool onMediaEvent(MythMediaDevice *pDev); 43 43 44 //added by Anthony D'Alberto to support back button 45 void mousePressEvent(QMouseEvent *e); 46 //end of added section 47 44 48 public slots: 45 49 46 50 void play(); … … 94 98 void showSearchDialog(); 95 99 bool getInsertPLOptions(InsertPLOption &insertOption, 96 100 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 97 106 98 107 signals: 99 108 … … 239 248 UITextButtonType *pledit_button; 240 249 UITextButtonType *vis_button; 241 250 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 242 257 MythProgressDialog *progress; 243 258 enum { kProgressNone, kProgressMusic } progress_type; 244 259 };