[mythtv] [Patch] Progress window for provider list retrieval

J. Donavan Stanley jdonavan at gorpe.com
Wed Dec 24 18:15:48 EST 2003


This patch removes one of the apparent hangs in the setup program, 
namely the freeze when we pull provider info for a postal code.  This 
patch displays a progress window letting the user know what's going on 
as well as spits out a verbose message.  I'll try to get around to the 
channel one later.

I've noticed one odd thing, for some reason on my system the message 
doesn't display.  The progress window comes up just fine but there's no 
text in the window just the progress bar.  I've not been able to pin 
down the cause, though it's got to be something specfic to my machine.  
I'm going to do a restart of X after a couple downloads finish to see if 
that clears it...


-------------- next part --------------
Index: videosource.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/videosource.cpp,v
retrieving revision 1.35
diff -u -r1.35 videosource.cpp
--- videosource.cpp	18 Oct 2003 18:31:25 -0000	1.35
+++ videosource.cpp	24 Dec 2003 19:37:43 -0000
@@ -77,8 +77,19 @@
 }
 
 void ProviderSelector::fillSelections(const QString& location) {
+    QString waitMsg(QString("Fetching providers for %1... Please be patient.").arg(location));
+    VERBOSE( VB_GENERAL, waitMsg );
+    
+    MythProgressDialog pdlg( QObject::tr(waitMsg), 2 );
     clearSelections();
-
+    
+    // First let the final character show up...
+    qApp->processEvents();    
+    
+    // Now show our progress dialog.
+    pdlg.show();
+    
+    
     QString command = QString("%1 --configure --postalcode %2 --list-providers")
         .arg(grabber)
         .arg(location);
@@ -86,9 +97,15 @@
     FILE* fp = popen(command.ascii(), "r");
 
     if (fp == NULL) {
+	pdlg.Close();
+	VERBOSE( VB_GENERAL, "Failed to get providers" );
+	MythPopupBox::showOkPopup( gContext->GetMainWindow(), QObject::tr("Failed to get provider information"), QObject::tr("You probably need to update XMLTV."));
+	qApp->processEvents();
         perror(command.ascii());
         return;
     }
+    // Update our progress
+    pdlg.setProgress(1);
 
     QFile f;
     f.open(IO_ReadOnly, fp);
@@ -96,7 +113,9 @@
         QStringList fields = QStringList::split(":", line.stripWhiteSpace());
         addSelection(fields.last(), fields.first());
     }
-
+    
+    pdlg.setProgress( 2 );
+    pdlg.Close();
     f.close();
     fclose(fp);
 }


More information about the mythtv-dev mailing list