Ticket #110: watch-filter.3.diff

File watch-filter.3.diff, 5.8 KB (added by kuphal@…, 16 years ago)

Please use this instead of the previous two. Fixed another bug this time affecting category filters.

  • programs/mythfrontend/playbackbox.cpp

     
    250250    connect(freeSpaceTimer, SIGNAL(timeout()), this,
    251251            SLOT(setUpdateFreeSpace()));
    252252
    253     if (recGroupPassword != "")
     253    if ((recGroupPassword != "") || (gContext->GetNumSetting("ShowInitialFilter")))
    254254        showRecGroupChooser();
    255255
    256256    // Initialize yuv2rgba conversion stuff
     
    36543654    grayOut(&backup);
    36553655    backup.end();
    36563656
    3657     QLabel *label = choosePopup->addLabel(tr("Recording Group View"),
     3657    QLabel *label = choosePopup->addLabel(tr("Select Group Filter"),
    36583658                                  MythPopupBox::Large, false);
    36593659    label->setAlignment(Qt::AlignCenter | Qt::WordBreak);
    36603660
    36613661    QStringList groups;
    36623662   
    36633663    MSqlQuery query(MSqlQuery::InitCon());
    3664     query.prepare("SELECT DISTINCT recgroup from recorded;");
     3664    query.prepare("SELECT DISTINCT recgroup, COUNT(title) from recorded GROUP BY recgroup;");
    36653665    query.exec();
    36663666
    36673667    QString tmpType = recGroupType[recGroup];
     
    36713671
    36723672    if ((recGroup == "Default") || (recGroup == "All Programs"))
    36733673        groups += tr(recGroup);
    3674     else
    3675         groups += recGroup;
    36763674
     3675    if (recGroup != "All Programs")
     3676    {
     3677        groups += tr("All Programs");
     3678        recGroupType["All Programs"] = "recgroup";
     3679    }
     3680
    36773681    if (query.isActive() && query.size() > 0)
    36783682    {
    36793683        while (query.next())
    36803684        {
    3681             QString key = QString::fromUtf8(query.value(0).toString());
     3685            QString key = QString::fromUtf8(QString("%1 [%2 items]").arg(query.value(0).toString()).arg(query.value(1).toString()));
    36823686
    36833687            if (key != recGroup)
    36843688            {
     
    36863690                    groups += tr("Default");
    36873691                else
    36883692                    groups += key;
    3689                 recGroupType[key] = "recgroup";
     3693                recGroupType[query.value(0).toString()] = "recgroup";
    36903694            }
    36913695        }
    36923696    }
    36933697
    3694     query.prepare("SELECT DISTINCT category from recorded;");
     3698    query.prepare("SELECT DISTINCT category, COUNT(title) from recorded GROUP BY category;");
    36953699
    36963700    if (query.exec() && query.isActive() && query.size() > 0)
    36973701    {
    36983702        while (query.next())
    36993703        {
    3700             QString key = QString::fromUtf8(query.value(0).toString());
     3704            QString key = QString::fromUtf8(QString("%1 [%2 items]").arg(query.value(0).toString()).arg(query.value(1).toString()));
    37013705
    37023706            if ((key != recGroup) && (key != ""))
    37033707            {
    37043708                groups += key;
    37053709                if (!recGroupType.contains(key))
    3706                     recGroupType[key] = "category";
     3710                    recGroupType[query.value(0).toString()] = "category";
    37073711            }
    37083712        }
    37093713    }
    37103714
    3711     if (recGroup != "All Programs")
    3712     {
    3713         groups += tr("All Programs");
    3714         recGroupType["All Programs"] = "recgroup";
    3715     }
     3715    chooseListBox = new MythListBox(choosePopup);
     3716    chooseListBox->insertStringList(groups);
    37163717
    3717     QGridLayout *grid = new QGridLayout(1, 2, (int)(10 * wmult));
     3718    choosePopup->addWidget(chooseListBox);
    37183719
    3719     label = new QLabel(tr("Group"), choosePopup);
    3720     label->setAlignment(Qt::WordBreak | Qt::AlignLeft);
    3721     label->setBackgroundOrigin(ParentOrigin);
    3722     label->setPaletteForegroundColor(popupForeground);
    3723     grid->addWidget(label, 0, 0, Qt::AlignLeft);
    3724 
    3725     chooseComboBox = new MythComboBox(false, choosePopup);
    3726     chooseComboBox->insertStringList(groups);
    3727     chooseComboBox->setAcceptOnSelect(true);
    3728     grid->addWidget(chooseComboBox, 0, 1, Qt::AlignLeft);
    3729 
    3730     choosePopup->addLayout(grid);
    3731 
    3732     connect(chooseComboBox, SIGNAL(accepted(int)), this,
     3720    connect(chooseListBox, SIGNAL(accepted(int)), this,
    37333721            SLOT(chooseSetViewGroup()));
    3734     connect(chooseComboBox, SIGNAL(activated(int)), this,
    3735             SLOT(chooseComboBoxChanged()));
    3736     connect(chooseComboBox, SIGNAL(highlighted(int)), this,
    3737             SLOT(chooseComboBoxChanged()));
     3722    connect(chooseListBox, SIGNAL(highlighted(int)), this,
     3723            SLOT(chooseListBoxChanged()));
    37383724
    37393725    chooseGroupPassword = getRecGroupPassword(recGroup);
    37403726
    3741     chooseComboBox->setFocus();
     3727    chooseListBox->setFocus();
    37423728    choosePopup->ExecPopup();
    37433729
    3744     delete chooseComboBox;
    3745     chooseComboBox = NULL;
     3730    delete chooseListBox;
     3731    chooseListBox = NULL;
    37463732
    37473733    backup.begin(this);
    37483734    backup.drawPixmap(0, 0, myBackground);
     
    37593745
    37603746void PlaybackBox::chooseSetViewGroup(void)
    37613747{
    3762     if (!chooseComboBox)
     3748    if (!chooseListBox)
    37633749        return;
    37643750
    3765     recGroup = chooseComboBox->currentText();
     3751    recGroup = chooseListBox->currentText().section('[', 0, 0).simplifyWhiteSpace();
    37663752    recGroupPassword = chooseGroupPassword;
    37673753
    37683754    if (groupnameAsAllProg)
     
    38123798    choosePopup->done(0);
    38133799}
    38143800
    3815 void PlaybackBox::chooseComboBoxChanged(void)
     3801void PlaybackBox::chooseListBoxChanged(void)
    38163802{
    3817     if (!chooseComboBox)
     3803    if (!chooseListBox)
    38183804        return;
    38193805
    3820     QString newGroup = chooseComboBox->currentText();
     3806    QString newGroup = chooseListBox->currentText().section('[', 0, 0).simplifyWhiteSpace();
    38213807
    38223808    if (newGroup == tr("Default"))
    38233809        newGroup = "Default";
  • programs/mythfrontend/playbackbox.h

     
    9292
    9393    void setUpdateFreeSpace() { updateFreeSpace = true; }
    9494
    95     void chooseComboBoxChanged(void);
     95    // void chooseComboBoxChanged(void);
     96    void chooseListBoxChanged(void);
    9697    void chooseSetViewGroup(void);
    9798    void chooseSetGroupView(void);
    9899    void changeComboBoxChanged(void);