[mythtv] [patch] patch for changing how "Recording Group View" works

Dave Alden alden at math.ohio-state.edu
Sat Feb 21 19:34:13 EST 2004


Hi,
  Enclosed is a patch that removes the "password" and "Ok" fields from the
recording group view.  If you select a group that has a password, it pops
up a MythPasswordDialog box.
...dave
-------------- next part --------------
? programs/mythfrontend/playbackbox.cpp_ORIG
Index: libs/libmyth/mythwidgets.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/mythwidgets.cpp,v
retrieving revision 1.77
diff -u -r1.77 mythwidgets.cpp
--- libs/libmyth/mythwidgets.cpp	5 Feb 2004 22:50:36 -0000	1.77
+++ libs/libmyth/mythwidgets.cpp	22 Feb 2004 00:27:06 -0000
@@ -41,6 +41,8 @@
                 if (count() > 0)
                     setCurrentItem((currentItem() + 1) % count());
             }
+            else if (action == "SELECT")
+                emit accepted(currentItem());
             else
                 handled = false;
         }
Index: libs/libmyth/mythwidgets.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/mythwidgets.h,v
retrieving revision 1.50
diff -u -r1.50 mythwidgets.h
--- libs/libmyth/mythwidgets.h	31 Dec 2003 21:02:34 -0000	1.50
+++ libs/libmyth/mythwidgets.h	22 Feb 2004 00:27:07 -0000
@@ -41,6 +41,7 @@
 
   signals:
     void changeHelpText(QString);
+    void accepted(int);
     void gotFocus();
 
   public slots:
Index: programs/mythfrontend/playbackbox.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/playbackbox.cpp,v
retrieving revision 1.134
diff -u -r1.134 playbackbox.cpp
--- programs/mythfrontend/playbackbox.cpp	19 Feb 2004 08:26:04 -0000	1.134
+++ programs/mythfrontend/playbackbox.cpp	22 Feb 2004 00:27:08 -0000
@@ -2304,7 +2304,7 @@
         recGroupType[tr("All Programs")] = "recgroup";
     }
 
-    QGridLayout *grid = new QGridLayout(2, 2, (int)(10 * wmult));
+    QGridLayout *grid = new QGridLayout(1, 2, (int)(10 * wmult));
 
     label = new QLabel("Group", choosePopup);
     label->setAlignment(Qt::WordBreak | Qt::AlignLeft);
@@ -2316,29 +2316,10 @@
     chooseComboBox->insertStringList(groups);
     grid->addWidget(chooseComboBox, 0, 1, Qt::AlignLeft);
 
-    label = new QLabel("Password", choosePopup);
-    label->setAlignment(Qt::WordBreak | Qt::AlignLeft);
-    label->setBackgroundOrigin(ParentOrigin);
-    label->setPaletteForegroundColor(popupForeground);
-    grid->addWidget(label, 1, 0, Qt::AlignLeft);
-
-    chooseLineEdit = new MythLineEdit(choosePopup);
-    chooseLineEdit->setText("");
-    chooseLineEdit->selectAll();
-    grid->addWidget(chooseLineEdit, 1, 1, Qt::AlignLeft);
-
     choosePopup->addLayout(grid);
 
-    chooseOkButton = new MythPushButton(choosePopup);
-    chooseOkButton->setText(tr("OK"));
-    chooseOkButton->setEnabled(true);
-    choosePopup->addWidget(chooseOkButton);
-
-    connect(chooseLineEdit, SIGNAL(textChanged(const QString &)), this,
-            SLOT(chooseEditChanged(const QString &)));
-    connect(chooseOkButton, SIGNAL(clicked()), this,
+    connect(chooseComboBox, SIGNAL(accepted(int)), this,
             SLOT(chooseSetViewGroup()));
-    connect(chooseOkButton, SIGNAL(clicked()), choosePopup, SLOT(accept()));
     connect(chooseComboBox, SIGNAL(activated(int)), this,
             SLOT(chooseComboBoxChanged()));
     connect(chooseComboBox, SIGNAL(highlighted(int)), this,
@@ -2346,26 +2327,9 @@
 
     chooseGroupPassword = getRecGroupPassword(recGroup);
 
-    chooseLineEdit->setEchoMode(QLineEdit::Password);
-    chooseLineEdit->setText(curGroupPassword);
-
-    if (chooseGroupPassword != "")
-        chooseLineEdit->setEnabled(true);
-    else
-        chooseLineEdit->setEnabled(false);
-
-    if (chooseGroupPassword == curGroupPassword)
-        chooseOkButton->setEnabled(true);
-    else
-        chooseOkButton->setEnabled(false);
-
     chooseComboBox->setFocus();
     choosePopup->ExecPopup();
 
-    delete chooseLineEdit;
-    chooseLineEdit = NULL;
-    delete chooseOkButton;
-    chooseOkButton = NULL;
     delete chooseComboBox;
     chooseComboBox = NULL;
 
@@ -2384,17 +2348,28 @@
 
 void PlaybackBox::chooseSetViewGroup(void)
 {
-    if (!chooseComboBox || !chooseLineEdit)
+    if (!chooseComboBox)
         return;
 
     recGroup = chooseComboBox->currentText();
     recGroupPassword = chooseGroupPassword;
 
-    curGroupPassword = chooseLineEdit->text();
+    if (recGroupPassword != "" ) {
 
-    if ((recGroupPassword != "" ) &&
-        (recGroupPassword != curGroupPassword))
-        return;
+        bool ok = false;
+        QString text = "Password:";
+
+        MythPasswordDialog *pwd = new MythPasswordDialog(text, &ok,
+                                                     recGroupPassword,
+                                                     gContext->GetMainWindow());
+        pwd->exec();
+        delete pwd;
+        if (!ok)
+            return;
+
+        curGroupPassword = recGroupPassword;
+    } else
+        curGroupPassword = "";
 
     chooseGroupPassword = "";
 
@@ -2414,54 +2389,17 @@
     connected = FillList();
     skipUpdate = false;
     update(fullRect);
+    choosePopup->done(0);
 }
 
 void PlaybackBox::chooseComboBoxChanged(void)
 {
-    if (!chooseComboBox || !chooseLineEdit)
+    if (!chooseComboBox)
         return;
 
     QString newGroup = chooseComboBox->currentText();
 
     chooseGroupPassword = getRecGroupPassword(newGroup);
-    if (chooseGroupPassword != "")
-    {
-        if (chooseGroupPassword != curGroupPassword)
-        {
-            chooseLineEdit->setText("");
-            chooseOkButton->setEnabled(false);
-        }
-        else
-        {
-            chooseLineEdit->setText(curGroupPassword);
-            chooseOkButton->setEnabled(true);
-        }
-
-        chooseLineEdit->setEnabled(true);
-    }
-    else
-    {
-        chooseLineEdit->setText("");
-        chooseLineEdit->setEnabled(false);
-        chooseOkButton->setEnabled(true);
-    }
-}
-
-void PlaybackBox::chooseEditChanged(const QString &newText)
-{
-    if (!chooseOkButton || !chooseLineEdit)
-        return;
-
-    if (newText == chooseGroupPassword)
-    {
-        chooseOkButton->setEnabled(true);
-        if (newText != "")
-            chooseOkButton->setFocus();
-    }
-    else
-    {
-        chooseOkButton->setEnabled(false);
-    }
 }
 
 QString PlaybackBox::getRecGroupPassword(QString group)
Index: programs/mythfrontend/playbackbox.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/playbackbox.h,v
retrieving revision 1.43
diff -u -r1.43 playbackbox.h
--- programs/mythfrontend/playbackbox.h	6 Feb 2004 05:43:49 -0000	1.43
+++ programs/mythfrontend/playbackbox.h	22 Feb 2004 00:27:08 -0000
@@ -75,7 +75,6 @@
 
     void chooseComboBoxChanged(void);
     void chooseSetViewGroup(void);
-    void chooseEditChanged(const QString &newText);
     void changeComboBoxChanged(void);
     void changeSetRecGroup(void);
     void changeRecGroupPassword();


More information about the mythtv-dev mailing list