Patch mythdialogs to add a busy-spinner style progress bar. Also
changed mythmusic to use this spinner while searching for music, since
ie. scanning big nfs mounted directories can take >10 secs.

This patch requires the lcd-busy-520 patch.

1) add a MythBusyDialog, inherited from MythProgressDialog, which
essentially just displays the QProgressBar as a busy-spinner instead
of a normal progress bar. It sets up a timer, so the used just has to
periodically call qApp->processEvents to make the spinner spin. It
also updates the LCD.

2) Change mythmusic, so searching for music files displays a busy
spinner.

Index: mythtv/libs/libmyth/mythdialogs.cpp
===================================================================
--- mythtv/libs/libmyth/mythdialogs.cpp	(revision 7592)
+++ mythtv/libs/libmyth/mythdialogs.cpp	(working copy)
@@ -1520,10 +1520,7 @@
     progress->setBackgroundOrigin(ParentOrigin);
     progress->setProgress(0);
 
-    m_totalSteps = totalSteps;
-    steps = totalSteps / 1000;
-    if (steps == 0)
-        steps = 1;
+    setTotalSteps (totalSteps);
 
     if (class LCD * lcddev = LCD::Get())
     {
@@ -1588,6 +1585,57 @@
         MythDialog::keyPressEvent(e);
 }
 
+void MythProgressDialog::setTotalSteps (int totalSteps) {
+    m_totalSteps = totalSteps;
+    steps = totalSteps / 1000;
+    if (steps == 0)
+        steps = 1;
+}
+
+MythBusyDialog::MythBusyDialog (const QString &title) : 
+    MythProgressDialog (title, 0),
+    timer (NULL)
+{
+}
+
+MythBusyDialog::~MythBusyDialog () {
+    if (timer) 
+        delete timer;
+}
+
+void 
+MythBusyDialog::start (int interval) {
+    if (timer == NULL) {
+        timer = new QTimer (this);
+    }
+    connect (timer, SIGNAL (timeout ()), SLOT (timeout ()));
+    timer->start (interval);
+}
+
+void 
+MythBusyDialog::Close () {
+    if (timer) {
+        disconnect (timer, SIGNAL (timeout ()), this, SLOT (timeout ()));
+        delete timer;
+        timer = 0;
+    }
+
+    MythProgressDialog::Close ();
+}
+
+void
+MythBusyDialog::setProgress ()  {
+    progress->setProgress (progress->progress () + 10);
+    qApp->processEvents ();
+    if (LCD *lcddev = LCD::Get())
+        lcddev->setGenericBusy ();
+}
+
+void
+MythBusyDialog::timeout ()  {
+    setProgress ();
+}
+
 MythThemedDialog::MythThemedDialog(MythMainWindow *parent, QString window_name,
                                    QString theme_filename, const char* name,
                                    bool setsize)
Index: mythtv/libs/libmyth/mythdialogs.h
===================================================================
--- mythtv/libs/libmyth/mythdialogs.h	(revision 7592)
+++ mythtv/libs/libmyth/mythdialogs.h	(working copy)
@@ -11,6 +11,7 @@
 #include <qevent.h>
 #include <qvaluevector.h>
 #include <qscrollview.h>
+#include <qthread.h>
 
 #include <vector>
 using namespace std;
@@ -229,22 +230,95 @@
     bool arrowAccel;
 };
 
+/** The MythTV progress bar dialog.
+
+    This dialog is responsible for displaying a progress bar box on
+    the screen. This is used when you have a known set of steps to
+    perform and the possibility of calling the \p setProgress call at
+    the end of each step.
+
+	If you do not know the number of steps, use \p MythBusyDialog
+	instead.
+
+    The dialog widget also updates the LCD display if present.
+
+*/
 class MythProgressDialog: public MythDialog
 {
   public:
+    /** Create a progress bar dialog.
+        
+        \param message the title string to appear in the progress dialog.
+        \param totalSteps the total number of steps
+     */
     MythProgressDialog(const QString& message, int totalSteps);
 
+	/* \brief Close the dialog.
+	   This will close the dialog and return the LCD to the Time screen 
+	*/
     void Close(void);
+	/* \brief Update thr progress bar.  
+
+	    This will move the progress bar the percentage-completed as
+	    determined by \p curprogress and the totalsteps as set by the
+	    call to the constructor.
+
+		The LCD is updated as well.
+	 */
     void setProgress(int curprogress);
+
     void keyPressEvent(QKeyEvent *);
 
+  protected:
+    QProgressBar *progress;
+
   private:
-    QProgressBar *progress;
+	void setTotalSteps (int totalSteps);	
     int steps;
-
+    int m_totalSteps;
     QPtrList<class LCDTextItem> * textItems;
+};
 
-    int m_totalSteps;
+/** MythDialog box that displays a busy spinner-style dialog box to
+    indicate the program is busy, but that the number of steps needed
+    is unknown. 
+
+    Ie. used by MythMusic when scanning the filesystem for musicfiles.
+ */
+class MythBusyDialog : public MythProgressDialog {
+    Q_OBJECT
+  public:
+    /** \brief Create the busy indicator.  
+
+        Creates the dialog widget and sets up the timer that causes
+        the widget to indicate progress every 100msec;
+
+        \param title the title to appear in the progress bar dialog
+    */
+    MythBusyDialog (const QString &title);
+
+    ~MythBusyDialog ();
+
+    /** \brief Setup a timer to 'move' the spinner
+
+        This will create a \p QTimer object that will update the
+        spinner ever \p interval msecs.
+
+        \param interval msecs between movement, default is 100
+    */
+    void start (int interval = 100);
+
+    /** \brief Close the dialog.
+        This will close the dialog and stop the timer.		
+    */
+    void Close ();
+
+  protected slots:
+    void setProgress();
+    void timeout ();
+
+  private:
+    QTimer *timer;
 };
 
 class MythThemedDialog : public MythDialog
Index: mythplugins/mythmusic/mythmusic/main.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/main.cpp	(revision 7592)
+++ mythplugins/mythmusic/mythmusic/main.cpp	(working copy)
@@ -102,16 +102,26 @@
     QFileInfoListIterator it(*list);
     QFileInfo *fi;
 
+    /* Recursively traverse directory, calling
+       QApplication::processEvents every now and then to ensure the UI
+       updates */
+    int update_interval = 0;
     while ((fi = it.current()) != 0)
     {
         ++it;
         if (fi->fileName() == "." || fi->fileName() == "..")
             continue;
         QString filename = fi->absFilePath();
-        if (fi->isDir())
+        if (fi->isDir()) {
             BuildFileList(filename, music_files);
-        else
+            qApp->processEvents ();
+        } else {
+            if (++update_interval > 100) {
+                qApp->processEvents ();
+                update_interval = 0;
+            }
             music_files[filename] = kFileSystem;
+        }
     }
 }
 
@@ -177,7 +187,11 @@
     MusicLoadedMap music_files;
     MusicLoadedMap::Iterator iter;
 
+    MythBusyDialog *busy = new MythBusyDialog (QObject::tr("Searching for music files"));
+    busy->start ();
     BuildFileList(directory, music_files);
+    busy->Close ();
+    delete busy;
 
     MSqlQuery query(MSqlQuery::InitCon());
     query.exec("SELECT filename FROM musicmetadata "
@@ -186,7 +200,7 @@
     int counter = 0;
 
     MythProgressDialog *file_checking;
-    file_checking = new MythProgressDialog(QObject::tr("Searching for music files"),
+    file_checking = new MythProgressDialog(QObject::tr("Scanning music files"),
                                            query.numRowsAffected());
 
     if (query.isActive() && query.size() > 0)
