Ticket #7791: mythgallery-buttonlist-marking.patch

File mythgallery-buttonlist-marking.patch, 8.9 KB (added by Robert S, 14 years ago)
  • mythgallery/mythgallery/iconview.cpp

     
    439439                {
    440440                    if (!m_itemMarked.contains(thumbitem->GetPath()))
    441441                    {
    442                         m_itemMarked.append(thumbitem->GetPath());
    443                         item->setChecked(MythUIButtonListItem::FullChecked);
     442                        HandleSelectOne();
     443                        //m_itemMarked.append(thumbitem->GetPath());
     444                        //item->setChecked(MythUIButtonListItem::FullChecked);
    444445                    }
    445446                    else
    446447                    {
    447                         m_itemMarked.removeAll(thumbitem->GetPath());
    448                         item->setChecked(MythUIButtonListItem::NotChecked);
     448                        HandleClearOneMarked();
     449                        //m_itemMarked.removeAll(thumbitem->GetPath());
     450                        //item->setChecked(MythUIButtonListItem::NotChecked);
    449451                    }
    450452                }
    451453            }
     
    729731        }
    730732        delete ccd;
    731733    }
    732     else if (event->type() == kMythDialogBoxCompletionEventType)
    733     {
    734         DialogCompletionEvent *dce =
    735                                 dynamic_cast<DialogCompletionEvent*>(event);
    736 
    737         QString resultid= dce->GetId();
    738         int buttonnum  = dce->GetResult();
    739 
    740         if (resultid == "mainmenu")
    741         {
    742             switch (buttonnum)
    743             {
    744                 case 0:
    745                     HandleSlideShow();
    746                     break;
    747                 case 1:
    748                     HandleRandomShow();
    749                     break;
    750                 case 2:
    751                     HandleSubMenuMetadata();
    752                     break;
    753                 case 3:
    754                     HandleSubMenuMark();
    755                     break;
    756                 case 4:
    757                     HandleSubMenuFile();
    758                     break;
    759                 case 5:
    760                     HandleSettings();
    761                     break;
    762             }
    763         }
    764         else if (resultid == "metadatamenu")
    765         {
    766             switch (buttonnum)
    767             {
    768                 case 0:
    769                     HandleRotateCW();
    770                     break;
    771                 case 1:
    772                     HandleRotateCCW();
    773                     break;
    774             }
    775         }
    776         else if (resultid == "markingmenu")
    777         {
    778             switch (buttonnum)
    779             {
    780                 case 0:
    781                     HandleClearMarked();
    782                     break;
    783                 case 1:
    784                     HandleSelectAll();
    785                     break;
    786             }
    787         }
    788         else if (resultid == "filemenu")
    789         {
    790             switch (buttonnum)
    791             {
    792                 case 0:
    793                     HandleShowDevices();
    794                     break;
    795                 case 1:
    796                     HandleEject();
    797                     break;
    798                 case 2:
    799                     HandleImport();
    800                     break;
    801                 case 3:
    802                     HandleCopyHere();
    803                     break;
    804                 case 4:
    805                     HandleMoveHere();
    806                     break;
    807                 case 5:
    808                     HandleDelete();
    809                     break;
    810                 case 6:
    811                     HandleMkDir();
    812                     break;
    813                 case 7:
    814                     HandleRename();
    815                     break;
    816             }
    817         }
    818 
    819         m_menuPopup = NULL;
    820 
    821     }
    822 
    823734}
    824735
    825736void IconView::HandleMainMenu(void)
     
    828739
    829740    m_menuPopup = new MythDialogBox(label, m_popupStack, "mythgallerymenupopup");
    830741
    831     if (!m_menuPopup->Create())
    832     {
    833         delete m_menuPopup;
    834         m_menuPopup = NULL;
    835         return;
    836     }
     742    if (m_menuPopup->Create())
     743        m_popupStack->AddScreen(m_menuPopup);
    837744
    838745    m_menuPopup->SetReturnEvent(this, "mainmenu");
    839746
    840     m_menuPopup->AddButton(tr("SlideShow"));
    841     m_menuPopup->AddButton(tr("Random"));
    842     m_menuPopup->AddButton(tr("Meta Data Menu"));
    843     m_menuPopup->AddButton(tr("Marking Menu"));
    844     m_menuPopup->AddButton(tr("File Menu"));
    845     m_menuPopup->AddButton(tr("Settings"));
     747    m_menuPopup->AddButton(tr("SlideShow"), SLOT(HandleSlideShow()));
     748    m_menuPopup->AddButton(tr("Random"), SLOT(HandleRandomShow()));
     749    m_menuPopup->AddButton(tr("Meta Data Menu"), SLOT(HandleSubMenuMetadata()), true);
     750    m_menuPopup->AddButton(tr("Marking Menu"), SLOT(HandleSubMenuMark()), true);
     751    m_menuPopup->AddButton(tr("File Menu"), SLOT(HandleSubMenuFile()), true);
     752    m_menuPopup->AddButton(tr("Settings"), SLOT(HandleSettings()));
    846753//     if (m_showDevices)
    847754//     {
    848755//         QDir d(m_currDir);
     
    852759//         LoadDirectory(m_currDir);
    853760//         m_showDevices = false;
    854761//     }
    855 
    856     m_popupStack->AddScreen(m_menuPopup);
    857762}
    858763
    859764void IconView::HandleSubMenuMetadata(void)
     
    867772
    868773    m_menuPopup->SetReturnEvent(this, "metadatamenu");
    869774
    870     m_menuPopup->AddButton(tr("Rotate CW"));
    871     m_menuPopup->AddButton(tr("Rotate CCW"));
     775    m_menuPopup->AddButton(tr("Rotate CW"), SLOT(HandleRotateCW()));
     776    m_menuPopup->AddButton(tr("Rotate CCW"), SLOT(HandleRotateCCW()));
    872777}
    873778
    874779void IconView::HandleSubMenuMark(void)
     
    882787
    883788    m_menuPopup->SetReturnEvent(this, "markingmenu");
    884789
    885     m_menuPopup->AddButton(tr("Clear Marked"));
    886     m_menuPopup->AddButton(tr("Select All"));
     790    m_menuPopup->AddButton(tr("Select One"), SLOT(HandleSelectOne()));
     791    m_menuPopup->AddButton(tr("Clear Marked"), SLOT(HandleClearOneMarked()));
     792    m_menuPopup->AddButton(tr("Select All"), SLOT(HandleSelectAll()));
     793    m_menuPopup->AddButton(tr("Clear All Marked"), SLOT(HandleClearAllMarked()));
    887794}
    888795
    889796void IconView::HandleSubMenuFile(void)
     
    897804
    898805    m_menuPopup->SetReturnEvent(this, "filemenu");
    899806
    900     m_menuPopup->AddButton(tr("Show Devices"));
    901     m_menuPopup->AddButton(tr("Eject"));
    902     m_menuPopup->AddButton(tr("Import"));
    903     m_menuPopup->AddButton(tr("Copy here"));
    904     m_menuPopup->AddButton(tr("Move here"));
    905     m_menuPopup->AddButton(tr("Delete"));
    906     m_menuPopup->AddButton(tr("Create Dir"));
    907     m_menuPopup->AddButton(tr("Rename"));
     807    m_menuPopup->AddButton(tr("Show Devices"), SLOT(HandleShowDevices()));
     808    m_menuPopup->AddButton(tr("Eject"), SLOT(HandleEject()));
     809    m_menuPopup->AddButton(tr("Import"), SLOT(HandleImport()));
     810    m_menuPopup->AddButton(tr("Copy here"), SLOT(HandleCopyHere()));
     811    m_menuPopup->AddButton(tr("Move here"), SLOT(HandleMoveHere()));
     812    m_menuPopup->AddButton(tr("Delete"), SLOT(HandleDelete()));
     813    m_menuPopup->AddButton(tr("Create Dir"), SLOT(HandleMkDir()));
     814    m_menuPopup->AddButton(tr("Rename"), SLOT(HandleRename()));
    908815}
    909816
    910817void IconView::HandleRotateCW(void)
     
    11331040void IconView::HandleCopyHere(void)
    11341041{
    11351042    CopyMarkedFiles(false);
    1136     HandleClearMarked();
     1043    HandleClearAllMarked();
    11371044}
    11381045
    11391046void IconView::HandleMoveHere(void)
    11401047{
    11411048    CopyMarkedFiles(true);
    1142     HandleClearMarked();
     1049    HandleClearAllMarked();
    11431050}
    11441051
    11451052void IconView::HandleDelete(void)
     
    11781085    }
    11791086}
    11801087
    1181 void IconView::HandleClearMarked(void)
     1088void IconView::HandleClearOneMarked(void)
     1089{
     1090    int pos = m_imageList->GetCurrentPos();
     1091
     1092    ThumbItem *item = GetCurrentThumb();
     1093    if (m_itemMarked.contains(item->GetPath()))
     1094        m_itemMarked.removeOne(item->GetPath());
     1095
     1096    m_imageList->SetChecked(MythUIButtonListItem::NotChecked, pos);
     1097}
     1098
     1099void IconView::HandleClearAllMarked(void)
    11821100{
    11831101    m_itemMarked.clear();
    11841102    m_imageList->SetAllChecked(MythUIButtonListItem::NotChecked);
    11851103}
    11861104
     1105void IconView::HandleSelectOne(void)
     1106{
     1107    int pos = m_imageList->GetCurrentPos();
     1108
     1109    ThumbItem *item = GetCurrentThumb();
     1110    if (m_itemMarked.contains(item->GetPath()))
     1111        m_itemMarked.removeOne(item->GetPath());
     1112
     1113    m_imageList->SetChecked(MythUIButtonListItem::FullChecked, pos);
     1114}
     1115
    11871116void IconView::HandleSelectAll(void)
    11881117{
    11891118    ThumbItem *item;
  • mythgallery/mythgallery/iconview.h

     
    7373    bool HandleMediaDeviceSelect(ThumbItem *item);
    7474    bool HandleImageSelect(const QString &action);
    7575
     76  private slots:
    7677    void HandleMainMenu(void);
    7778    void HandleSubMenuMetadata(void);
    7879    void HandleSubMenuMark(void);
    7980    void HandleSubMenuFile(void);
    80 
    81   private slots:
    8281    void HandleRotateCW(void);
    8382    void HandleRotateCCW(void);
    8483    void HandleDeleteCurrent(void);
     
    9291    void HandleMoveHere(void);
    9392    void HandleDelete(void);
    9493    void HandleDeleteMarked(void);
    95     void HandleClearMarked(void);
     94    void HandleClearOneMarked(void);
     95    void HandleSelectOne(void);
     96    void HandleClearAllMarked(void);
    9697    void HandleSelectAll(void);
    9798    void HandleMkDir(void);
    9899    void HandleRename(void);