[mythtv] [patch] Progress & error dialgos for channel retrieval.

J. Donavan Stanley jdonavan at gorpe.com
Sat Dec 27 09:21:51 EST 2003


This patch to libmythtv adds progress windows and minimal error 
notification to the channel retrieval process.  This should put an end 
the need for the "after step 3 it may appear to lock up" stuff in  the 
guides.

-------------- next part --------------
Index: videosource.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/videosource.cpp,v
retrieving revision 1.36
diff -u -r1.36 videosource.cpp
--- videosource.cpp	26 Dec 2003 04:48:25 -0000	1.36
+++ videosource.cpp	27 Dec 2003 11:16:54 -0000
@@ -129,6 +129,11 @@
 
 void XMLTV_na_config::save(QSqlDatabase* db) {
     (void)db;
+    QString waitMsg( QObject::tr("Please wait while we MythTV retrieves the list of channels\nfor your provider\nYou might want to check the program output as it runs\nby switching to the terminal from which you started this program."));
+    MythProgressDialog pdlg( waitMsg, 2 );
+    VERBOSE( VB_GENERAL, QString("Please wait while we MythTV retrieves the list of channelsfor your provider") ); 
+    pdlg.show(); 
+
 
     QString filename = QString("%1/.mythtv/%2.xmltv")
         .arg(QDir::homeDirPath()).arg(parent.getSourceName());
@@ -139,17 +144,31 @@
         .arg(postalcode->getValue().replace(QRegExp(" "), ""))
         .arg(provider->getValue());
 
+    pdlg.setProgress( 1 );
+
     int ret = system(command);
 
     if (ret != 0)
     {
         VERBOSE(VB_GENERAL, command);
         VERBOSE(VB_GENERAL, QString("exited with status %1").arg(ret));
+        MythPopupBox::showOkPopup(gContext->GetMainWindow(), QObject::tr("Failed to get channel information."),
+	  QObject::tr("MythTV was unable to retrieve channel information for your provider.\nPlesae check the terminal window for more information") );
+
     }
+
+    pdlg.setProgress( 2 );
+    pdlg.Close();
+
 }
 
 void XMLTV_uk_config::save(QSqlDatabase* db) {
     (void)db;
+    
+    QString waitMsg( QObject::tr("Please wait while we MythTV retrieves the list of channels\nfor your provider\nYou might want to check the program output as it runs\nby switching to the terminal from which you started this program."));
+    MythProgressDialog pdlg( waitMsg, 2 );
+    VERBOSE( VB_GENERAL, QString("Please wait while we MythTV retrieves the list of channelsfor your provider") ); 
+    pdlg.show(); 
 
     QString filename = QString("%1/.mythtv/%2.xmltv")
         .arg(QDir::homeDirPath()).arg(parent.getSourceName());
@@ -160,17 +179,30 @@
         .arg(region->getValue())
         .arg(provider->getValue());
 
+    pdlg.setProgress( 1 );    
+
     int ret = system(command);
     if (ret != 0)
     {
         VERBOSE(VB_GENERAL, command);
         VERBOSE(VB_GENERAL, QString("exited with status %1").arg(ret));
+	MythPopupBox::showOkPopup(gContext->GetMainWindow(), QObject::tr("Failed to get channel information."),
+	  QObject::tr("MythTV was unable to retrieve channel information for your provider.\nPlesae check the terminal window for more information") );
     }
+
+    pdlg.setProgress( 2 );    
+    pdlg.Close();
+
 }
 
 void XMLTV_generic_config::save(QSqlDatabase* db) {
     (void)db;
 
+    QString waitMsg( QObject::tr("Please wait while we MythTV retrieves the list of channels\nfor your provider\nYou might want to check the program output as it runs\nby switching to the terminal from which you started this program."));
+    MythProgressDialog pdlg( waitMsg, 2 );
+    VERBOSE( VB_GENERAL, QString("Please wait while we MythTV retrieves the list of channelsfor your provider") ); 
+    pdlg.show(); 
+
     QString command;
     if (grabber == "tv_grab_de") {
         command = "tv_grab_de --configure";
@@ -181,12 +213,15 @@
         command = QString("%1 --config-file '%2' --configure")
             .arg(grabber).arg(filename);
     }
+    pdlg.setProgress( 1 );    
 
     int ret = system(command);
     if (ret != 0)
     {
         VERBOSE(VB_GENERAL, command);
         VERBOSE(VB_GENERAL, QString("exited with status %1").arg(ret));
+	MythPopupBox::showOkPopup(gContext->GetMainWindow(), QObject::tr("Failed to get channel information."),
+	  QObject::tr("MythTV was unable to retrieve channel information for your provider.\nPlesae check the terminal window for more information") );
     }
 
     if (grabber == "tv_grab_de" || grabber == "tv_grab_sn" || 
@@ -197,8 +232,13 @@
              << "instead\n";
         cerr << "of just 'mythfilldatabase'.  Your grabber does not provide\n";
         cerr << "channel numbers, so you have to set them manually.\n";
+	MythPopupBox::showOkPopup(gContext->GetMainWindow(), QObject::tr("Warning."),
+	  QObject::tr("You MUST run 'mythfilldatabase --manual the first time,\n instead of just 'mythfilldatabase'.\nYour grabber does not provide channel numbers, so you have to set them manually.") );
     }
 
+    pdlg.setProgress( 2 );    
+    pdlg.Close();
+
 }
 
 void VideoSource::fillSelections(QSqlDatabase* db,


More information about the mythtv-dev mailing list