Index: mythplugins/mythmusic/mythmusic/playbackbox.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/playbackbox.cpp	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/playbackbox.cpp	(working copy)
@@ -6,15 +6,12 @@
 using namespace std;
 
 // Qt includes
-#include <qapplication.h>
-#include <qregexp.h>
-//Added by qt3to4:
+#include <QApplication>
 #include <QLabel>
 #include <QPixmap>
+
+#include <Q3Frame>
 #include <Q3ValueList>
-#include <QKeyEvent>
-#include <Q3Frame>
-#include <Q3PtrList>
 
 // MythTV plugin includes
 #include <mythtv/mythcontext.h>
@@ -33,6 +30,7 @@
 #include "databasebox.h"
 #include "mainvisual.h"
 #include "smartplaylist.h"
+#include "playlistcontainer.h"
 #include "search.h"
 
 #ifndef USING_MINGW
@@ -108,7 +106,8 @@
     {
         volume_control = true;
     }
-    volume_display_timer->start(2000, true);
+    volume_display_timer->setSingleShot(true);
+    volume_display_timer->start(2000);
     connect(volume_display_timer, SIGNAL(timeout()),
             this, SLOT(hideVolume()));
 
@@ -160,7 +159,8 @@
     waiting_for_playlists_timer = new QTimer(this);
     connect(waiting_for_playlists_timer, SIGNAL(timeout()), this, 
             SLOT(checkForPlaylists()));
-    waiting_for_playlists_timer->start(50, TRUE);
+    waiting_for_playlists_timer->setSingleShot(true);
+    waiting_for_playlists_timer->start(50);
 
     // Warm up the visualizer
 
@@ -175,7 +175,9 @@
 
     fullscreen_blank = false; 
 
-    visual_modes = QStringList::split(';', gContext->GetSetting("VisualMode"));
+    visual_modes = gContext->GetSetting("VisualMode")
+        .split(';', QString::SkipEmptyParts);
+
     if (!visual_modes.count())
         visual_modes.push_front("Blank");
 
@@ -491,7 +493,8 @@
                     resetScrollCount();
 
                 speed_scroll_timer->stop();
-                speed_scroll_timer->start(300, true);
+                speed_scroll_timer->setSingleShot(true);
+                speed_scroll_timer->start(300);
 
             }
             else if (action == "DOWN")
@@ -512,7 +515,8 @@
                     resetScrollCount();
 
                 speed_scroll_timer->stop();
-                speed_scroll_timer->start(300, true);
+                speed_scroll_timer->setSingleShot(true);
+                speed_scroll_timer->start(300);
             }
             else if (action == "LEFT")
                 music_tree_list->popUp();
@@ -956,8 +960,9 @@
 
 void PlaybackBoxMusic::occasionallyCheckCD()
 {
-    if (cd_reader_thread->getLock()->locked())
+    if (!cd_reader_thread->getLock()->tryLock())
         return;
+    cd_reader_thread->getLock()->unlock();
 
     if (!scan_for_cd)
     {
@@ -1160,7 +1165,8 @@
         }
     }
 
-    waiting_for_playlists_timer->start(100, TRUE); // Restart Timer
+    waiting_for_playlists_timer->setSingleShot(true);
+    waiting_for_playlists_timer->start(100); // Restart Timer
 }
 
 void PlaybackBoxMusic::changeVolume(bool up_or_down)
@@ -1223,7 +1229,8 @@
                 volume_status->SetUsed(gPlayer->getOutput()->GetCurrentVolume());
                 volume_status->SetOrder(0);
                 volume_status->refresh();
-                volume_display_timer->start(2000, true);
+                volume_display_timer->setSingleShot(true);
+                volume_display_timer->start(2000);
                 if (class LCD *lcd = LCD::Get())
                     lcd->switchToVolume("Music");
 
@@ -1266,7 +1273,8 @@
             speed_status->SetText(speed_text);
             speed_status->SetOrder(0);
             speed_status->refresh();
-            volume_display_timer->start(2000, true);
+            volume_display_timer->setSingleShot(true);
+            volume_display_timer->start(2000);
         }
     }
 
@@ -1286,7 +1294,7 @@
 void PlaybackBoxMusic::resetTimer()
 {
     if (visual_mode_delay > 0)
-        visual_mode_timer->changeInterval(visual_mode_delay * 1000);
+        visual_mode_timer->start(visual_mode_delay * 1000);
 }
 
 void PlaybackBoxMusic::play()
@@ -1526,7 +1534,7 @@
         gPlayer->getOutput()->Reset();
         gPlayer->getOutput()->SetTimecode(pos*1000);
 
-        if (gPlayer->getDecoder() && gPlayer->getDecoder()->running()) 
+        if (gPlayer->getDecoder() && gPlayer->getDecoder()->isRunning()) 
         {
             gPlayer->getDecoder()->lock();
             gPlayer->getDecoder()->seek(pos);
@@ -1740,7 +1748,7 @@
 
     if (position != "")
     {
-        QStringList list = QStringList::split(",", position);
+        QStringList list = position.split(",", QString::SkipEmptyParts);
 
         for (QStringList::Iterator it = list.begin(); it != list.end(); ++it)
             branches_to_current_node.append((*it).toInt());
@@ -1855,13 +1863,14 @@
     }
 
     visual_mode_timer->stop();
-    DatabaseBox dbbox(gContext->GetMainWindow(), m_CDdevice, 
-                      "music_select", "music-", "database box");
+    DatabaseBox *dbbox = new DatabaseBox(
+        gContext->GetMainWindow(), m_CDdevice, 
+        "music_select", "music-", "database box");
 
     if (cd_watcher)
         cd_watcher->stop();
 
-    dbbox.exec();
+    dbbox->exec();
     if (visual_mode_delay > 0)
         visual_mode_timer->start(visual_mode_delay * 1000);
 
@@ -1888,6 +1897,8 @@
 
     if (scan_for_cd && cd_watcher)
         cd_watcher->start(1000);
+
+    dbbox->deleteLater();
 }
 
 void PlaybackBoxMusic::customEvent(QEvent *event)
Index: mythplugins/mythmusic/mythmusic/mythmusic.pro
===================================================================
--- mythplugins/mythmusic/mythmusic/mythmusic.pro	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/mythmusic.pro	(working copy)
@@ -3,6 +3,8 @@
 include ( ../../programs-libs.pro )
 include (config.pro)
 
+QT += xml sql opengl qt3support network
+
 !exists( config.pro ) {
    error(Missing config.pro: please run the configure script)
 }
@@ -35,6 +37,7 @@
 HEADERS += editmetadata.h smartplaylist.h search.h genres.h
 HEADERS += treebuilders.h importmusic.h directoryfinder.h
 HEADERS += filescanner.h libvisualplugin.h musicplayer.h miniplayer.h
+HEADERS += playlistcontainer.h
 HEADERS += mythlistview-qt3.h mythlistbox-qt3.h
 
 SOURCES += cddecoder.cpp cdrip.cpp decoder.cpp
@@ -52,6 +55,7 @@
 SOURCES += avfdecoder.cpp editmetadata.cpp smartplaylist.cpp search.cpp
 SOURCES += treebuilders.cpp importmusic.cpp directoryfinder.cpp
 SOURCES += filescanner.cpp libvisualplugin.cpp musicplayer.cpp miniplayer.cpp
+SOURCES += playlistcontainer.cpp
 SOURCES += mythlistview-qt3.cpp mythlistbox-qt3.cpp
 
 macx {
@@ -69,8 +73,4 @@
     LIBS += -logg
 }
 
-
-#The following line was inserted by qt3to4
-QT += xml  sql opengl qt3support
-
 include ( ../../libs-targetfix.pro )
Index: mythplugins/mythmusic/mythmusic/search.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/search.cpp	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/search.cpp	(working copy)
@@ -257,8 +257,8 @@
 
     while (index < (int) sText.length())
     {
-        start = sText.find('[', index);
-        end = sText.find(']', start);
+        start = sText.indexOf('[', index);
+        end = sText.indexOf(']', start);
 
         if (start != -1 && end != -1)
         {
Index: mythplugins/mythmusic/mythmusic/playlist.h
===================================================================
--- mythplugins/mythmusic/mythmusic/playlist.h	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/playlist.h	(working copy)
@@ -1,17 +1,18 @@
 #ifndef PLAYLIST_H_
 #define PLAYLIST_H_
 
-#include <q3valuelist.h>
-#include <q3listview.h>
-#include <q3ptrlist.h>
-#include <qthread.h>
+#include <vector>
+#include <list>
+using namespace std;
 
+#include <QList>
+
 #include "metadata.h"
 #include "treecheckitem.h"
 #include <mythtv/uitypes.h>
 #include <mythtv/uilistbtntype.h>
 
-class PlaylistsContainer;
+class PlaylistContainer;
 
 
 enum InsertPLOption
@@ -30,6 +31,14 @@
     PL_CURRENT
 };
 
+typedef enum TrackTypes
+{
+    kTrackCD,
+    kTrackPlaylist,
+    kTrackSong,
+    kTrackUnknown,
+} TrackType;
+
 class Track
 {
     //  Why isn't this class just Metadata?
@@ -40,7 +49,7 @@
   public: 
     Track(int x, AllMusic *all_music_ptr);
 
-    void postLoad(PlaylistsContainer *grandparent);
+    void postLoad(PlaylistContainer *grandparent);
 
     void setParent(Playlist *parent_ptr);
     void setValue(int x){index_value = x;}
@@ -58,6 +67,8 @@
     void setCDFlag(bool yes_or_no) { cd_flag = yes_or_no; }
     bool getCDFlag(void) { return cd_flag; }
 
+    TrackType GetTrackType(void) const;
+
   private:    
     int           index_value;
     PlaylistTrack *my_widget;
@@ -74,9 +85,9 @@
     Playlist(AllMusic *all_music_ptr);
     ~Playlist();
 
-    Playlist& operator=(const Playlist& rhs);
+    //Playlist& operator=(const Playlist& rhs);
 
-    void setParent(PlaylistsContainer *myparent) { parent = myparent; }
+    void setParent(PlaylistContainer *myparent) { parent = myparent; }
 
     void postLoad(void);
 
@@ -89,7 +100,7 @@
 
     int writeTree(GenericTree *tree_to_write_to, int a_counter);
 
-    void describeYourself(void); //  debugging
+    void describeYourself(void) const; //  debugging
 
     void fillSongsFromCD();
     void fillSongsFromSonglist(bool filter);
@@ -107,7 +118,7 @@
 
     void moveTrackUpDown(bool flag, Track *the_track);
 
-    bool checkTrack(int a_track_id, bool cd_flag);
+    bool checkTrack(int a_track_id, bool cd_flag) const;
 
     void addTrack(int the_track_id, bool update_display, bool cd_flag);
 
@@ -115,7 +126,7 @@
     void removeAllTracks(void);
     void removeAllWidgets(void);
     
-    void copyTracks(Playlist *to_ptr, bool update_display);
+    void copyTracks(Playlist *to_ptr, bool update_display) const;
 
     bool hasChanged(void) { return changed; }
     void Changed(void) { changed = true; }
@@ -124,7 +135,7 @@
     void    setName(QString a_name) { name = a_name; }
 
     int     getID(void) { return playlistid; }
-    int     getFirstTrackID(void);
+    int     getFirstTrackID(void) const;
     void    setID(int x) { playlistid = x; }
 
     bool    containsReference(int to_check, int depth);
@@ -139,92 +150,11 @@
     int                 playlistid;
     QString             name;
     QString             raw_songlist;
-    Q3PtrList<Track>     songs;
-    AllMusic            *all_available_music;
-    PlaylistsContainer  *parent;
+    typedef QList<Track*> SongList;
+    SongList            songs;
+    AllMusic           *all_available_music;
+    PlaylistContainer  *parent;
     bool                changed;
 };
 
-class PlaylistLoadingThread : public QThread
-{
-  public:
-    PlaylistLoadingThread(PlaylistsContainer *parent_ptr,
-                          AllMusic *all_music_ptr);
-    virtual void run();
-    
-  private:  
-    PlaylistsContainer* parent;
-    AllMusic*           all_music;
-};
-
-class PlaylistsContainer
-{
-  public:
-    PlaylistsContainer(AllMusic *all_music, QString host_name);
-   ~PlaylistsContainer();
-
-    void            load();
-    void            describeYourself();    // debugging
-
-    Playlist*       getActive(void) { return active_playlist; }
-    Playlist*       getPlaylist(int id);
-
-    void            setActiveWidget(PlaylistTitle *widget);
-    PlaylistTitle*  getActiveWidget(void) { return active_widget; }
-
-    GenericTree*    writeTree(GenericTree *tree_to_write_to);
-    void            clearCDList();
-    void            addCDTrack(int x);
-    void            removeCDTrack(int x);
-    bool            checkCDTrack(int x);
-    void            save();
-
-    void            createNewPlaylist(QString name);
-    void            copyNewPlaylist(QString name);
-    void            copyToActive(int index);
-
-    void            showRelevantPlaylists(TreeCheckItem *alllist);
-    void            refreshRelevantPlaylists(TreeCheckItem *alllist);
-
-    QString         getPlaylistName(int index, bool &reference);
-
-    void            postLoad();
-
-    void            deletePlaylist(int index);
-    void            renamePlaylist(int index, QString new_name);
-
-    void            popBackPlaylist();
-    bool            pendingWriteback();
-    void            setPending(int x){pending_writeback_index = x;}
-    int             getPending(){return pending_writeback_index;}
-
-    bool            nameIsUnique(QString a_name, int which_id);
-
-    void            clearActive();
-
-    bool            doneLoading(){return done_loading;}
-
-    bool            cleanOutThreads();
-
-    void            FillIntelliWeights(int &rating, int &playcount,
-                                       int &lastplay, int &random);
-  private:  
-    Playlist            *active_playlist;
-    Playlist            *backup_playlist;
-    Q3ValueList<int>     cd_playlist;
-    Q3PtrList<Playlist>  *all_other_playlists;
-    AllMusic            *all_available_music;
-    PlaylistTitle       *active_widget;
-    int                 pending_writeback_index;
-    
-    PlaylistLoadingThread  *playlists_loader;
-    bool                    done_loading;
-    QString                 my_host;
-
-    int RatingWeight;
-    int PlayCountWeight;
-    int LastPlayWeight;
-    int RandomWeight;
-};
-
 #endif
Index: mythplugins/mythmusic/mythmusic/miniplayer.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/miniplayer.cpp	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/miniplayer.cpp	(working copy)
@@ -1,15 +1,8 @@
-#include <iostream>
-//Added by qt3to4:
+// qt
 #include <QKeyEvent>
-#include <Q3PtrList>
-#include <Q3Frame>
-using namespace std;
+#include <QPixmap>
+#include <QImage>
 
-// qt
-#include <qpixmap.h>
-#include <qimage.h>
-#include <qapplication.h>
-
 // mythtv
 #include <mythtv/mythcontext.h>
 #include <mythtv/mythdialogs.h>
@@ -27,7 +20,7 @@
                     bool setsize)
             : MythThemedDialog(parent, name, setsize)
 {
-    setFrameStyle(Q3Frame::NoFrame | Q3Frame::Plain);
+    setFrameStyle(QFrame::Panel);
     setLineWidth(1);
     m_parentPlayer = parentPlayer;
 
@@ -66,10 +59,11 @@
 {
     gPlayer->setListener(NULL);
 
-    m_displayTimer->deleteLater();
+    // Timers are deleted by Qt
+    m_displayTimer->disconnect();
     m_displayTimer = NULL;
 
-    m_infoTimer->deleteLater();
+    m_displayTimer->disconnect();
     m_infoTimer = NULL;
 
     if (class LCD *lcd = LCD::Get()) 
@@ -255,7 +249,8 @@
                         else
                             m_infoText->SetText(tr("Mute: Off"));
 
-                        m_infoTimer->start(5000, true);
+                        m_infoTimer->setSingleShot(true);
+                        m_infoTimer->start(5000);
                     }
 
                     if (m_volText)
@@ -507,7 +502,7 @@
         gPlayer->getOutput()->Reset();
         gPlayer->getOutput()->SetTimecode(pos*1000);
 
-        if (gPlayer->getDecoder() && gPlayer->getDecoder()->running()) 
+        if (gPlayer->getDecoder() && gPlayer->getDecoder()->isRunning()) 
         {
             gPlayer->getDecoder()->lock();
             gPlayer->getDecoder()->seek(pos);
Index: mythplugins/mythmusic/mythmusic/decoder.h
===================================================================
--- mythplugins/mythmusic/mythmusic/decoder.h	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/decoder.h	(working copy)
@@ -5,7 +5,6 @@
 #include <qstring.h>
 #include <qevent.h>
 #include <qthread.h>
-#include <q3ptrlist.h>
 #include <qwaitcondition.h>
 #include <qmutex.h>
 
@@ -72,7 +71,7 @@
     virtual void lock(void) { return mtx.lock(); }
     virtual void unlock(void) { return mtx.unlock(); }
     virtual bool tryLock(void) { return mtx.tryLock(); }
-    virtual bool locked(void) { return mtx.locked(); }
+    //virtual bool locked(void) { return mtx.locked(); }
 
     QWaitCondition *cond() { return &cnd; }
 
Index: mythplugins/mythmusic/mythmusic/streaminput.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/streaminput.cpp	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/streaminput.cpp	(working copy)
@@ -6,24 +6,25 @@
 
 #include "streaminput.h"
 
-#include "mythtv/mythcontext.h"
+#include "mythverbose.h"
 
-#include <qapplication.h>
-#include <q3socket.h>
+#include <QApplication>
 
+#define LOC      QString("StreamInput: ")
+#define LOC_WARN QString("StreamInput, Warning: ")
+#define LOC_ERR  QString("StreamInput, Error: ")
 
-StreamInput::StreamInput(const Q3Url &source)
-    : request(0), url(source), sock(0), stage(0)
+StreamInput::StreamInput(const QUrl &source) :
+    request(QString::null), url(source), sock(NULL), stage(0)
 {
 }
 
-
-void StreamInput::setup()
+void StreamInput::Setup(void)
 {
-    if (! url.isValid())
+    if (!url.isValid())
         return;
 
-    QString protocol = url.protocol();
+    QString protocol = url.scheme();
     QString host = url.host();
     QString path = url.path();
     int port = url.port();
@@ -31,70 +32,79 @@
     if (protocol != "mqp" || host.isNull())
         return;
 
-    if (port == -1)
-        port = 42666;
+    port = (port < 0) ? 42666 : port;
 
-    request = ".song " + QString(path.toUtf8()) + "\r\n";
+    request = path;
+    request.detach();
 
+    sock = new QTcpSocket();
+    connect(sock, SIGNAL(Error(QAbstractSocket::SocketError)),
+            this, SLOT(  Error(QAbstractSocket::SocketError)));
+    connect(sock, SIGNAL(hostFound()), this, SLOT(HostFound()));
+    connect(sock, SIGNAL(connected()), this, SLOT(Connected()));
+    connect(sock, SIGNAL(readyRead()), this, SLOT(Readyread()));
 
-    sock = new Q3Socket;
-    connect(sock, SIGNAL(error(int)), this, SLOT(error(int)));
-    connect(sock, SIGNAL(hostFound()), this, SLOT(hostfound()));
-    connect(sock, SIGNAL(connected()), this, SLOT(connected()));
-    connect(sock, SIGNAL(readyRead()), this, SLOT(readyread()));
+    sock->connectToHost(host, port, QIODevice::ReadWrite);
 
-    sock->connectToHost(host, port);
-
     while (stage != -1 && stage < 4) 
     {
-        qDebug("processing one event: stage %d %d %ld",
-               stage, sock->canReadLine(), (long int)sock->bytesAvailable());
-        qApp->processOneEvent();
+        VERBOSE(VB_GENERAL, LOC +
+                QString("Processing one event: stage %1 %2 %3")
+                .arg(stage).arg(sock->canReadLine())
+                .arg(sock->bytesAvailable()));
+
+        qApp->processEvents();
     }
 
-    qDebug("disconnecting from socket");
-    disconnect(sock, SIGNAL(error(int)), this, SLOT(error(int)));
-    disconnect(sock, SIGNAL(hostFound()), this, SLOT(hostfound()));
-    disconnect(sock, SIGNAL(connected()), this, SLOT(connected()));
-    disconnect(sock, SIGNAL(readyRead()), this, SLOT(readyread()));
+    VERBOSE(VB_GENERAL, LOC + "Disconnecting from socket");
+    disconnect(sock, SIGNAL(Error(QAbstractSocket::SocketError)),
+               this, SLOT(  Error(QAbstractSocket::SocketError)));
+    disconnect(sock, SIGNAL(hostFound()), this, SLOT(HostFound()));
+    disconnect(sock, SIGNAL(connected()), this, SLOT(Connected()));
+    disconnect(sock, SIGNAL(readyRead()), this, SLOT(ReadyRead()));
 
     if (stage == -1) 
     {
         // some sort of error
         delete sock;
-        sock = 0;
+        sock = NULL;
     }
 }
 
 
-void StreamInput::hostfound()
+void StreamInput::HostFound(void)
 {
-    qDebug("host found");
+    VERBOSE(VB_GENERAL, LOC + "Host found");
     stage = 1;
 }
 
 
-void StreamInput::connected()
+void StreamInput::Connected(void)
 {
-    qDebug("connected... sending request '%s' %d", request.data(), request.length());
+    QString tmp = QString(".song %1\r\n").arg(QString(request.toUtf8()));
+    QByteArray ba = tmp.toAscii();
 
-    sock->writeBlock(request.data(), request.length());
+    VERBOSE(VB_GENERAL, LOC +
+            QString("Connected... sending request '%1' %2")
+            .arg(ba.constData()).arg(ba.length()));
+
+    sock->write(ba.constData(), ba.length());
     sock->flush();
 
     stage = 2;
 }
 
 
-void StreamInput::readyread()
+void StreamInput::ReadyRead(void)
 {
     if (stage == 2) 
     {
-        qDebug("readyread... checking response");
+        VERBOSE(VB_GENERAL, LOC + "ReadyRead... checking response");
         
         if (! sock->canReadLine()) 
         {
             stage = -1;
-            qDebug("can't read line");
+            VERBOSE(VB_IMPORTANT, LOC_ERR + "ReadyRead... can't read line");
             return;
         }
         
@@ -102,14 +112,14 @@
         if (line.isEmpty()) 
         {
             stage = -1;
-            qDebug("line is empty");
+            VERBOSE(VB_IMPORTANT, LOC_ERR + "ReadyRead... line is empty");
             return;
         }
 
         if (line.left(5) != "*GOOD") 
         {
-            VERBOSE(VB_IMPORTANT, QString("server error response: %1")
-                    .arg(line));
+            VERBOSE(VB_IMPORTANT, LOC_ERR +
+                    QString("Server error response: %1").arg(line));
             stage = -1;
             return;
         }
@@ -122,10 +132,10 @@
     }
 }
 
-
-void StreamInput::error(int err)
+void StreamInput::Error(QAbstractSocket::SocketError)
 {
-    qDebug("socket error: %d", err);
+    VERBOSE(VB_IMPORTANT, LOC_ERR +
+            QString("Socket error: %1").arg(sock->errorString()));
 
     stage = -1;
 }
Index: mythplugins/mythmusic/mythmusic/visualize.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/visualize.cpp	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/visualize.cpp	(working copy)
@@ -18,7 +18,6 @@
 #include <qpixmap.h>
 #include <qimage.h>
 #include <qdir.h>
-#include <q3url.h>
 
 // mythtv
 #include <mythtv/mythdbcon.h>
@@ -108,15 +107,16 @@
     scale.setMax(192, size.width() / analyzerBarWidth);
 
     rects.resize( scale.range() );
-    int i = 0, w = 0;
-    for (; (unsigned) i < rects.count(); i++, w += analyzerBarWidth)
+    unsigned int i = 0;
+    int w = 0;
+    for (; i < rects.size(); i++, w += analyzerBarWidth)
     {
         rects[i].setRect(w, size.height() / 2, analyzerBarWidth - 1, 1);
     }
 
-    int os = magnitudes.size();
+    unsigned int os = magnitudes.size();
     magnitudes.resize( scale.range() * 2 );
-    for (; (unsigned) os < magnitudes.size(); os++)
+    for (; os < magnitudes.size(); os++)
     {
         magnitudes[os] = 0.0;
     }
@@ -161,7 +161,7 @@
 #endif
 
     index = 1;
-    for (i = 0; i < rects.count(); i++, w += analyzerBarWidth)
+    for (i = 0; i < rects.size(); i++, w += analyzerBarWidth)
     {        
 #ifdef FFTW3_SUPPORT
         magL = (log(sq(real(lout[index])) + sq(real(lout[FFTW_N - index]))) - 22.0) * 
@@ -252,7 +252,7 @@
     double r, g, b, per;
 
     p->fillRect(0, 0, size.width(), size.height(), back);
-    for (uint i = 0; i < rects.count(); i++)
+    for (uint i = 0; i < rects.size(); i++)
     {
         per = double( rectsp[i].height() - 2 ) / double( size.height() );
 
@@ -324,13 +324,13 @@
 {
     // if a front cover image is available show that first
     AlbumArtImages albumArt(m_pParent->metadata());
-    if (albumArt.isImageAvailable(IT_FRONTCOVER))
+    if (albumArt.getImage(IT_FRONTCOVER))
         m_currImageType = IT_FRONTCOVER;
     else
     {
         // not available so just show the first image available
         if (albumArt.getImageCount() > 0)
-            m_currImageType = albumArt.getImageAt(0).imageType;
+            m_currImageType = albumArt.getImageAt(0)->imageType;
         else
             m_currImageType = IT_UNKNOWN;
     }
@@ -362,7 +362,7 @@
         {
             newType++;
 
-            while(!albumArt.isImageAvailable((ImageType) newType))
+            while (!albumArt.getImage((ImageType) newType))
             {
                 newType++;
                 if (newType == IT_LAST)
@@ -568,7 +568,7 @@
 
 #if defined(FFTW3_SUPPORT) || defined(FFTW2_SUPPORT)
     QRect *rectsp = rects.data();
-    for (uint i = 0; i < rects.count(); i++)
+    for (uint i = 0; i < rects.size(); i++)
         drawRect(p, &(rectsp[i]), i, center, w, h);
 
 #else
@@ -732,9 +732,10 @@
 static GLfloat view_rotx=20.0, view_rotz=0.0;
 static GLint gear1, gear2, gear3;
 
-Gears::Gears(QWidget *parent, const char *name)
-     : QGLWidget(parent, name)
+Gears::Gears(QWidget *parent, const char *name) :
+    QGLWidget(parent)
 {
+    setObjectName(name);
     falloff = 4.0;
     analyzerBarWidth = 10;
     fps = 60;
@@ -807,7 +808,7 @@
 
     rects.resize( scale.range() );
     int i = 0, w = 0;
-    for (; (unsigned) i < rects.count(); i++, w += analyzerBarWidth)
+    for (; (unsigned) i < rects.size(); i++, w += analyzerBarWidth)
     {
         rects[i].setRect(w, size.height() / 2, analyzerBarWidth - 1, 1);
     }
@@ -858,7 +859,7 @@
     rfftw_one(plan, rin, rout);
 #endif
     index = 1;
-    for (i = 0; i < rects.count(); i++, w += analyzerBarWidth)
+    for (i = 0; i < rects.size(); i++, w += analyzerBarWidth)
     {
 #ifdef FFTW3_SUPPORT
         magL = (log(sq(real(lout[index])) + sq(real(lout[FFTW_N - index]))) - 22.0) * 
Index: mythplugins/mythmusic/mythmusic/metaioflacvorbiscomment.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/metaioflacvorbiscomment.cpp	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/metaioflacvorbiscomment.cpp	(working copy)
@@ -1,7 +1,5 @@
 #include <iostream>
 #include <sys/stat.h>
-//Added by qt3to4:
-#include <Q3CString>
 using namespace std;
 
 #include "metaioflacvorbiscomment.h"
@@ -298,9 +296,9 @@
 
         // we need to make sure the '=' comes immediately after
         // the desired label
-        if ((loc = entrytext.find("=")) && 
+        if ((loc = entrytext.indexOf("=")) && 
             (loc == (int)qlabel.length()) && 
-            entrytext.lower().left(qlabel.length()) == qlabel.lower())
+            entrytext.toLower().left(qlabel.length()) == qlabel.toLower())
         {
             return QString::fromUtf8(entrytext.right(entrytext.length() - loc - 1));
         }
@@ -328,7 +326,7 @@
 
     QString test = getComment(pBlock, pLabel);
 
-    QString thenewentry = QString(pLabel).upper() + "=" + rData;
+    QString thenewentry = QString(pLabel).toUpper() + "=" + rData;
     QByteArray utf8str = thenewentry.toUtf8();
 
     FLAC__StreamMetadata_VorbisComment_Entry entry;
Index: mythplugins/mythmusic/mythmusic/mainvisual.h
===================================================================
--- mythplugins/mythmusic/mythmusic/mainvisual.h	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/mainvisual.h	(working copy)
@@ -7,16 +7,17 @@
 #ifndef __mainvisual_h
 #define __mainvisual_h
 
+#include <vector>
+using namespace std;
+
 #include <mythtv/visual.h>
 #include "polygon.h"
 #include "constants.h"
 
 #include <qwidget.h>
 #include <qdialog.h>
-#include <q3memarray.h>
 #include <qpixmap.h>
 #include <qimage.h>
-#include <q3ptrlist.h>
 #include <qstringlist.h>
 #include <qtimer.h>
 #include <QPaintEvent>
@@ -136,7 +137,7 @@
     VisualBase *vis;
     Metadata *meta;
     QPixmap pixmap;
-    Q3PtrList<VisualNode> nodes;
+    QList<VisualNode*> nodes;
     bool playing;
     int fps;
     QTimer *timer;
@@ -176,7 +177,7 @@
 
 protected:
     QColor startColor, targetColor;
-    Q3MemArray<double> magnitudes;
+    vector<double> magnitudes;
     QSize size;
     bool rubberband;
     double falloff;
Index: mythplugins/mythmusic/mythmusic/metadata.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/metadata.cpp	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/metadata.cpp	(working copy)
@@ -1,15 +1,9 @@
-#include <iostream> 
-
 // qt
-#include <qapplication.h>
-#include <qregexp.h> 
-#include <qdatetime.h>
-#include <qdir.h>
-//Added by qt3to4:
-#include <Q3ValueList>
+#include <QApplication>
+#include <QRegExp>
+#include <QDateTime>
+#include <QDir>
 
-using namespace std;
-
 // mythtv
 #include <mythtv/mythcontext.h>
 #include <mythtv/mythwidgets.h>
@@ -41,6 +35,27 @@
     return false;
 }
 
+static bool meta_less_than(const Metadata *item1, const Metadata *item2)
+{
+    return item1->compare(item2) < 0;
+}
+
+static bool music_less_than(const MusicNode *itemA, const MusicNode *itemB)
+{
+    QString title1 = itemA->getTitle().toLower();
+    QString title2 = itemB->getTitle().toLower();
+    
+    // Cut "the " off the front of titles
+    if (title1.left(4) == thePrefix) 
+        title1 = title1.mid(4);
+    if (title2.left(4) == thePrefix) 
+        title2 = title2.mid(4);
+
+    return title1.localeAwareCompare(title2) < 0;
+}
+
+/**************************************************************************/
+
 Metadata& Metadata::operator=(Metadata *rhs)
 {
     m_artist = rhs->m_artist;
@@ -86,14 +101,16 @@
         MythDB::DBError("music persist", query);
 }
 
-int Metadata::compare(Metadata *other) 
+int Metadata::compare(const Metadata *other) const
 {
     if (m_format == "cast") 
     {
-        int artist_cmp = Artist().lower().localeAwareCompare(other->Artist().lower());
+        int artist_cmp = Artist().toLower().localeAwareCompare(
+            other->Artist().toLower());
 
         if (artist_cmp == 0) 
-            return Title().lower().localeAwareCompare(other->Title().lower());
+            return Title().toLower().localeAwareCompare(
+                other->Title().toLower());
 
         return artist_cmp;
     }
@@ -102,7 +119,8 @@
         int track_cmp = Track() - other->Track();
 
         if (track_cmp == 0)
-            return Title().lower().localeAwareCompare(other->Title().lower());
+            return Title().toLower().localeAwareCompare(
+                other->Title().toLower());
 
         return track_cmp;
     }
@@ -398,7 +416,7 @@
 
     if (! m_albumart.empty())
     {
-        Q3ValueList<struct AlbumArtImage>::iterator it;
+        QList<struct AlbumArtImage>::iterator it;
         for ( it = m_albumart.begin(); it != m_albumart.end(); ++it )
         {
             query.prepare("SELECT albumart_id FROM music_albumart WHERE "
@@ -681,7 +699,7 @@
     m_changed = true;
 }
 
-void Metadata::setEmbeddedAlbumArt(Q3ValueList<struct AlbumArtImage> albumart)
+void Metadata::setEmbeddedAlbumArt(const QList<struct AlbumArtImage> &albumart)
 {
     m_albumart = albumart;
 }
@@ -735,26 +753,27 @@
     QImage image;
     ImageType type;
 
-    if (albumArt.isImageAvailable(IT_FRONTCOVER))
+    AlbumArtImage *albumart_image = NULL;
+
+    if ((albumart_image = albumArt.getImage(IT_FRONTCOVER)))
         type = IT_FRONTCOVER;
-    else if (albumArt.isImageAvailable(IT_UNKNOWN))
+    else if ((albumart_image = albumArt.getImage(IT_UNKNOWN)))
         type = IT_UNKNOWN;
-    else if (albumArt.isImageAvailable(IT_BACKCOVER))
+    else if ((albumart_image = albumArt.getImage(IT_BACKCOVER)))
         type = IT_BACKCOVER;
-    else if (albumArt.isImageAvailable(IT_INLAY))
+    else if ((albumart_image = albumArt.getImage(IT_INLAY)))
         type = IT_INLAY;
-    else if (albumArt.isImageAvailable(IT_CD))
+    else if ((albumart_image = albumArt.getImage(IT_CD)))
         type = IT_CD;
-    else
-        return image;
 
-    AlbumArtImage albumart_image = albumArt.getImage(type);
+    if (albumart_image)
+    {
+        if (albumart_image->embedded)
+            image = QImage(MetaIOTagLib::getAlbumArt(m_filename, type));
+        else
+            image = QImage(albumart_image->filename);
+    }
 
-    if (albumart_image.embedded)
-        image = QImage(MetaIOTagLib::getAlbumArt(m_filename, type));
-    else
-        image = QImage(albumart_image.filename);
-
     return image;
 }
 
@@ -764,14 +783,13 @@
 
     QImage image;
 
-    if (albumArt.isImageAvailable(type))
+    AlbumArtImage *albumart_image = albumArt.getImage(type);
+    if (albumart_image)
     {
-        AlbumArtImage albumart_image = albumArt.getImage(type);
-
-        if (albumart_image.embedded)
+        if (albumart_image->embedded)
             image = QImage(MetaIOTagLib::getAlbumArt(m_filename, type));
         else
-            image = QImage(albumart_image.filename);
+            image = QImage(albumart_image->filename);
     }
 
     return image;
@@ -884,14 +902,16 @@
     m_metadata_loader = NULL;
     startLoading();
 
-    m_all_music.setAutoDelete(true);
-
     m_last_listed = -1;
 }
 
 AllMusic::~AllMusic()
 {
-    m_all_music.clear();
+    while (!m_all_music.empty())
+    {
+        delete m_all_music.back();
+        m_all_music.pop_back();
+    }
 
     delete m_root_node;
 
@@ -1039,16 +1059,10 @@
 
     //  To find this data quickly, build a map
     //  (a map to pointers!)
-
-    Q3PtrListIterator<Metadata> an_iterator( m_all_music );
-    Metadata *map_add;
-
     music_map.clear();
-    while ( (map_add = an_iterator.current()) != 0 )
-    {
-        music_map[map_add->ID()] = map_add; 
-        ++an_iterator;
-    }
+    MetadataPtrList::iterator it = m_all_music.begin();
+    for (; it != m_all_music.end(); ++it)
+        music_map[(*it)->ID()] = *it;
 
     //  Build a tree to reflect current state of 
     //  the metadata. Once built, sort it.
@@ -1085,21 +1099,18 @@
     //  Select Music screen
     //
 
-    Q3PtrListIterator<Metadata> an_iterator( m_all_music );
-    Metadata *inserter;
     MetadataPtrList list;
 
-    while ( (inserter = an_iterator.current()) != 0 )
+    MetadataPtrList::iterator it = m_all_music.begin();
+    for (; it != m_all_music.end(); ++it)
     {
-        if (inserter->isVisible())
-            list.append(inserter);
-        ++an_iterator;
-
+        if ((*it)->isVisible())
+            list.append(*it);
         m_numLoaded++;
     }
 
-    MusicTreeBuilder *builder = MusicTreeBuilder::createBuilder (m_paths);
-    builder->makeTree (m_root_node, list);
+    MusicTreeBuilder *builder = MusicTreeBuilder::createBuilder(m_paths);
+    builder->makeTree(m_root_node, list);
     delete builder;
 }
 
@@ -1222,21 +1233,14 @@
     return false;
 }
 
-void AllMusic::save()
+/// \brief Check each Metadata entry and save those that have changed (ratings, etc.)
+void AllMusic::save(void)
 {
-    //  Check each Metadata entry and save those that 
-    //  have changed (ratings, etc.)
-    
-    
-    Q3PtrListIterator<Metadata> an_iterator( m_all_music );
-    Metadata *searcher;
-    while ( (searcher = an_iterator.current()) != 0 )
+    MetadataPtrList::iterator it = m_all_music.begin();
+    for (; it != m_all_music.end(); ++it)
     {
-        if(searcher->hasChanged())
-        {
-            searcher->persist();
-        }
-        ++an_iterator;
+        if ((*it)->hasChanged())
+            (*it)->persist();
     }
 }
 
@@ -1288,7 +1292,7 @@
         return;
 
     //  Error checking
-    QStringList tree_levels = QStringList::split(" ", m_paths);
+    QStringList tree_levels = m_paths.split(" ");
     QStringList::const_iterator it = tree_levels.begin();
     for (; it != tree_levels.end(); ++it)
     {
@@ -1307,20 +1311,15 @@
 
 void AllMusic::setAllVisible(bool visible)
 {
-    Q3PtrListIterator<Metadata> an_iterator( m_all_music );
-    Metadata *md;
-    while ( (md = an_iterator.current()) != 0 )
-    {
-        md->setVisible(visible);
-        ++an_iterator;
-    }
+    MetadataPtrList::iterator it = m_all_music.begin();
+    for (; it != m_all_music.end(); ++it)
+        (*it)->setVisible(visible);
 }
 
 MusicNode::MusicNode(const QString &a_title, const QString &tree_level)
 {
     my_title = a_title;
     my_level = tree_level;
-    my_subnodes.setAutoDelete(true);
     setPlayCountMin(0);
     setPlayCountMax(0);
     setLastPlayMin(0);
@@ -1329,7 +1328,11 @@
 
 MusicNode::~MusicNode()
 {
-    my_subnodes.clear();
+    while (!my_subnodes.empty())
+    {
+        delete my_subnodes.back();
+        my_subnodes.pop_back();
+    }
 }
 
 // static member vars
@@ -1367,28 +1370,21 @@
     }
 
 
-    Q3PtrListIterator<Metadata>  anit(my_tracks);
-    Metadata *a_track;
-    while ((a_track = anit.current() ) != 0)
+    MetadataPtrList::iterator it = my_tracks.begin();
+    for (; it != my_tracks.end(); ++it)
     {
         QString title_temp = QString(QObject::tr("%1 - %2"))
-                                  .arg(a_track->Track()).arg(a_track->Title());
+            .arg((*it)->Track()).arg((*it)->Title());
         QString level_temp = QObject::tr("title");
-        TreeCheckItem *new_item = new TreeCheckItem(current_parent, title_temp,
-                                                    level_temp, a_track->ID());
-        ++anit;
+        TreeCheckItem *new_item = new TreeCheckItem(
+            current_parent, title_temp, level_temp, (*it)->ID());
         new_item->setCheck(false); //  Avoiding -Wall     
     }  
 
+    MusicNodePtrList::iterator mit = my_subnodes.begin();
+    for (; mit != my_subnodes.end(); ++mit)
+        (*mit)->putYourselfOnTheListView(current_parent, true);
     
-    Q3PtrListIterator<MusicNode> iter(my_subnodes);
-    MusicNode *sub_traverse;
-    while ((sub_traverse = iter.current() ) != 0)
-    {
-        sub_traverse->putYourselfOnTheListView(current_parent, true);
-        ++iter;
-    }
-    
 }
 
 void MusicNode::writeTree(GenericTree *tree_to_write_to, int a_counter)
@@ -1402,14 +1398,14 @@
     sub_node->setAttribute(4, a_counter);
     sub_node->setAttribute(5, a_counter);
 
-    Q3PtrListIterator<Metadata>  anit(my_tracks);
-    Metadata *a_track;
     int track_counter = 0;
-    anit.toFirst();
-    while( (a_track = anit.current() ) != 0)
+
+    MetadataPtrList::iterator it = my_tracks.begin();
+    for (; it != my_tracks.end(); ++it)
     {
-        QString title_temp = QString(QObject::tr("%1 - %2")).arg(a_track->Track()).arg(a_track->Title());
-        GenericTree *subsub_node = sub_node->addNode(title_temp, a_track->ID(), true);
+        QString title_temp = QObject::tr("%1 - %2")
+            .arg((*it)->Track()).arg((*it)->Title());
+        GenericTree *subsub_node = sub_node->addNode(title_temp, (*it)->ID(), true);
         subsub_node->setAttribute(0, 1);
         subsub_node->setAttribute(1, track_counter);    // regular order
         subsub_node->setAttribute(2, rand());           // random order
@@ -1417,44 +1413,52 @@
         //
         //  "Intelligent" ordering
         //
-        int rating = a_track->Rating();
-        int playcount = a_track->PlayCount();
-        double lastplaydbl = a_track->LastPlay();
+        int rating = (*it)->Rating();
+        int playcount = (*it)->PlayCount();
+        double lastplaydbl = (*it)->LastPlay();
         double ratingValue = (double)(rating) / 10;
         double playcountValue, lastplayValue;
 
-        if (m_playcountMax == m_playcountMin) 
-            playcountValue = 0; 
-        else 
-            playcountValue = ((m_playcountMin - (double)playcount) / (m_playcountMax - m_playcountMin) + 1); 
-        if (m_lastplayMax == m_lastplayMin) 
+        if (m_playcountMax == m_playcountMin)
+        {
+            playcountValue = 0;
+        }
+        else
+        {
+            playcountValue = ((m_playcountMin - (double)playcount) /
+                              (m_playcountMax - m_playcountMin) + 1);
+        }
+
+        if (m_lastplayMax == m_lastplayMin)
+        {
             lastplayValue = 0;
-        else 
-            lastplayValue = ((m_lastplayMin - lastplaydbl) / (m_lastplayMax - m_lastplayMin) + 1);
+        }
+        else
+        {
+            lastplayValue = ((m_lastplayMin - lastplaydbl) /
+                             (m_lastplayMax - m_lastplayMin) + 1);
+        }
 
-        double rating_value =  (m_RatingWeight * ratingValue + m_PlayCountWeight * playcountValue +
-                                m_LastPlayWeight * lastplayValue + m_RandomWeight * (double)rand() /
-                                (RAND_MAX + 1.0));
+        double rating_value =
+            m_RatingWeight * ratingValue +
+            m_PlayCountWeight * playcountValue +
+            m_LastPlayWeight * lastplayValue +
+            m_RandomWeight * (double)rand() / (RAND_MAX + 1.0);
+
         int integer_rating = (int) (4000001 - rating_value * 10000);
         subsub_node->setAttribute(3, integer_rating);   //  "intelligent" order
         ++track_counter;
-        ++anit;
     }  
 
-    
-    Q3PtrListIterator<MusicNode> iter(my_subnodes);
-    MusicNode *sub_traverse;
-    int another_counter = 0;
-    iter.toFirst();
-    while( (sub_traverse = iter.current() ) != 0)
+    MusicNodePtrList::const_iterator sit = my_subnodes.begin();
+    for (int another_counter = 0; sit != my_subnodes.end(); ++sit)
     {
-        sub_traverse->setPlayCountMin(m_playcountMin);
-        sub_traverse->setPlayCountMax(m_playcountMax);
-        sub_traverse->setLastPlayMin(m_lastplayMin);
-        sub_traverse->setLastPlayMax(m_lastplayMax);
-        sub_traverse->writeTree(sub_node, another_counter);
+        (*sit)->setPlayCountMin(m_playcountMin);
+        (*sit)->setPlayCountMax(m_playcountMax);
+        (*sit)->setLastPlayMin(m_lastplayMin);
+        (*sit)->setLastPlayMax(m_lastplayMax);
+        (*sit)->writeTree(sub_node, another_counter);
         ++another_counter;
-        ++iter;
     }
 }
 
@@ -1462,91 +1466,65 @@
 void MusicNode::sort()
 {
     //  Sort any tracks
-    my_tracks.sort();
+    qStableSort(my_tracks.begin(), my_tracks.end(), meta_less_than);
 
     //  Sort any subnodes
-    my_subnodes.sort();
+    qStableSort(my_subnodes.begin(), my_subnodes.end(), music_less_than);
     
     //  Tell any subnodes to sort themselves
-    Q3PtrListIterator<MusicNode> iter(my_subnodes);
-    MusicNode *crawler;
-    while ( (crawler = iter.current()) != 0 )
-    {
-        crawler->sort();
-        ++iter;
-    }
+    MusicNodePtrList::const_iterator sit = my_subnodes.begin();
+    for (; sit != my_subnodes.end(); ++sit)
+        (*sit)->sort();
 }
 
 
-void MusicNode::printYourself(int indent_level)
+void MusicNode::printYourself(int indent_level) const
 {
+    QString tmp = "";
+    for (int i = 0; i < indent_level; ++i)
+        tmp += "    ";
+    tmp += my_title;
+    VERBOSE(VB_GENERAL, tmp);
 
-    for(int i = 0; i < (indent_level) * 4; ++i)
+    MetadataPtrList::const_iterator it = my_tracks.begin();
+    for (; it != my_tracks.end(); ++it)
     {
-        cout << " " ;
+        QString tmp = "";
+        for (int i = 0; i < indent_level + 1; ++i)
+            tmp += "    ";
+        tmp += (*it)->Title();
+        VERBOSE(VB_GENERAL, tmp);
     }
-    cout << my_title.toLocal8Bit().constData() << endl;
 
-    Q3PtrListIterator<Metadata>  anit(my_tracks);
-    Metadata *a_track;
-    while( (a_track = anit.current() ) != 0)
-    {
-        for(int j = 0; j < (indent_level + 1) * 4; j++)
-        {
-            cout << " " ;
-        } 
-        cout << a_track->Title().toLocal8Bit().constData() << endl ;
-        ++anit;
-    }       
-    
-    Q3PtrListIterator<MusicNode> iter(my_subnodes);
-    MusicNode *print;
-    while( (print = iter.current() ) != 0)
-    {
-        print->printYourself(indent_level + 1);
-        ++iter;
-    }
+    MusicNodePtrList::const_iterator sit = my_subnodes.begin();
+    for (; sit != my_subnodes.end(); ++sit)
+        (*sit)->printYourself(indent_level + 1);
 }
 
 /**************************************************************************/
 
-int MetadataPtrList::compareItems(Q3PtrCollection::Item item1, 
-                                  Q3PtrCollection::Item item2)
-{
-    return ((Metadata*)item1)->compare((Metadata*)item2);
-}
-
-int MusicNodePtrList::compareItems (Q3PtrCollection::Item item1, 
-                                    Q3PtrCollection::Item item2)
-{
-    MusicNode *itemA = (MusicNode*)item1;
-    MusicNode *itemB = (MusicNode*)item2;
-
-    QString title1 = itemA->getTitle().lower();
-    QString title2 = itemB->getTitle().lower();
-    
-    // Cut "the " off the front of titles
-    if (title1.left(4) == thePrefix) 
-        title1 = title1.mid(4);
-    if (title2.left(4) == thePrefix) 
-        title2 = title2.mid(4);
-
-    return title1.localeAwareCompare(title2);
-}
-
-/**************************************************************************/
-
 AlbumArtImages::AlbumArtImages(Metadata *metadata)
     : m_parent(metadata)
 {
-    m_imageList.setAutoDelete(true);
-
     findImages();
 }
 
+AlbumArtImages::~AlbumArtImages()
+{
+    while (!m_imageList.empty())
+    {
+        delete m_imageList.back();
+        m_imageList.pop_back();
+    }
+}
+
 void AlbumArtImages::findImages(void)
 {
-    m_imageList.clear();
+    while (!m_imageList.empty())
+    {
+        delete m_imageList.back();
+        m_imageList.pop_back();
+    }
 
     if (m_parent == NULL)
         return;
@@ -1557,7 +1535,7 @@
         return;
 
     QFileInfo fi(m_parent->Filename());
-    QString dir = fi.dirPath(true);
+    QString dir = fi.absolutePath();
     dir.remove(0, Metadata::GetStartdir().length());
 
     MSqlQuery query(MSqlQuery::InitCon());
@@ -1586,59 +1564,44 @@
                 image->description = query.value(1).toString();
                 image->embedded = true;
             }
-            else {
+            else
+            {
                 image->embedded = false;
             }
-            m_imageList.append(image);
+            m_imageList.push_back(image);
         }
     }
 }
 
-AlbumArtImage AlbumArtImages::getImage(ImageType type)
+AlbumArtImage *AlbumArtImages::getImage(ImageType type)
 {
-    // try to find a matching image
-    AlbumArtImage *image;
-
-    for (image = m_imageList.first(); image; image = m_imageList.next())
+    ImageList::iterator it = m_imageList.begin();
+    for (; it != m_imageList.end(); ++it)
     {
-        if (image->imageType == type)
-            return *image;
+        if ((*it)->imageType == type)
+            return *it;
     }
 
-    return *image;
+    return NULL;
 }
 
-QStringList AlbumArtImages::getImageFilenames()
+QStringList AlbumArtImages::getImageFilenames(void) const
 {
     QStringList paths;
 
-    AlbumArtImage *image;
+    ImageList::const_iterator it = m_imageList.begin();
+    for (; it != m_imageList.end(); ++it)
+        paths += (*it)->filename;
 
-    for (image = m_imageList.first(); image; image = m_imageList.next())
-    {
-        paths += image->filename;
-    }
-
     return paths;
 }
 
-AlbumArtImage AlbumArtImages::getImageAt(uint index)
+AlbumArtImage *AlbumArtImages::getImageAt(uint index)
 {
-    return *(m_imageList.at(index));
-}
+    if (index < m_imageList.size())
+        return m_imageList[index];
 
-bool AlbumArtImages::isImageAvailable(ImageType type)
-{
-    // try to find a matching image
-    AlbumArtImage *image;
-
-    for (image = m_imageList.first(); image; image = m_imageList.next())
-    {
-        if (image->imageType == type)
-            return true;
-    }
-
-    return false;
+    return NULL;
 }
 
 bool AlbumArtImages::saveImageType(const int id, ImageType type)
@@ -1662,7 +1625,7 @@
         QT_TR_NOOP("Inlay")               // IT_INLAY
     };
 
-    return tr(type_strings[type]);
+    return QObject::tr(type_strings[type]);
 }
 
 // static method to guess the image type from the filename
@@ -1670,15 +1633,15 @@
 {
     ImageType type = IT_FRONTCOVER;
 
-    if (filename.contains(tr("front"), false))
+    if (filename.contains(QObject::tr("front"),      Qt::CaseInsensitive))
         type = IT_FRONTCOVER;
-    else if (filename.contains(tr("back"), false))
+    else if (filename.contains(QObject::tr("back"),  Qt::CaseInsensitive))
         type = IT_BACKCOVER;
-    else if (filename.contains(tr("inlay"), false))
+    else if (filename.contains(QObject::tr("inlay"), Qt::CaseInsensitive))
         type = IT_INLAY;
-    else if (filename.contains(tr("cd"), false))
+    else if (filename.contains(QObject::tr("cd"),    Qt::CaseInsensitive))
         type = IT_CD;
-    else if (filename.contains(tr("cover"), false))
+    else if (filename.contains(QObject::tr("cover"), Qt::CaseInsensitive))
         type = IT_FRONTCOVER;
 
     return type;
Index: mythplugins/mythmusic/mythmusic/dbcheck.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/dbcheck.cpp	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/dbcheck.cpp	(working copy)
@@ -43,7 +43,7 @@
     {
         query.exec(thequery);
 
-        if (query.lastError().type() != QSqlError::None)
+        if (query.lastError().type() != QSqlError::NoError)
         {
             QString msg =
                 QString("DB Error (Performing database upgrade): \n"
@@ -111,7 +111,7 @@
     if (dbver == "1000")
     {
         QString startdir = gContext->GetSetting("MusicLocation");
-        startdir = QDir::cleanDirPath(startdir);
+        startdir = QDir::cleanPath(startdir);
         if (!startdir.endsWith("/"))
             startdir += "/";
 
@@ -581,7 +581,7 @@
 
         // update the VisualMode setting to the new format
         QString setting = gContext->GetSetting("VisualMode");
-        setting = setting.simplifyWhiteSpace();
+        setting = setting.simplified();
         setting = setting.replace(' ', ";");
         gContext->SaveSetting("VisualMode", setting);
 
Index: mythplugins/mythmusic/mythmusic/directoryfinder.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/directoryfinder.cpp	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/directoryfinder.cpp	(working copy)
@@ -56,7 +56,7 @@
                 if (m_directoryList[index] == "..")
                 {
                     // move up on directory
-                    int pos = m_curDirectory.findRev('/');
+                    int pos = m_curDirectory.lastIndexOf('/');
                     if (pos > 0)
                         m_curDirectory = m_curDirectory.left(pos);
                     else
@@ -195,7 +195,7 @@
 void DirectoryFinder::backPressed()
 {
     // move up one directory
-    int pos = m_curDirectory.findRev('/');
+    int pos = m_curDirectory.lastIndexOf('/');
     if (pos > 0)
         m_curDirectory = m_curDirectory.left(pos);
     else
Index: mythplugins/mythmusic/mythmusic/treebuilders.h
===================================================================
--- mythplugins/mythmusic/mythmusic/treebuilders.h	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/treebuilders.h	(working copy)
@@ -1,10 +1,7 @@
 #ifndef TREEBUILDERS_H_
 #define TREEBUILDERS_H_
 
-#include <qstring.h>
-#include <qstringlist.h>
-#include <q3ptrdict.h>
-#include <q3dict.h>
+#include <QStringList>
 
 #include "metadata.h"
 
Index: mythplugins/mythmusic/mythmusic/cdrip.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/cdrip.cpp	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/cdrip.cpp	(working copy)
@@ -12,10 +12,6 @@
 #include "config.h"
 #ifdef HAVE_CDAUDIO
 #include <cdaudio.h>
-//Added by qt3to4:
-#include <QKeyEvent>
-#include <Q3PtrList>
-#include <QEvent>
 extern "C" {
 #include <cdda_interface.h>
 #include <cdda_paranoia.h>
@@ -28,9 +24,11 @@
 using namespace std;
 
 // Qt includes
-#include <qapplication.h>
-#include <qdir.h>
-#include <qregexp.h>
+#include <QApplication>
+#include <QDir>
+#include <QRegExp>
+#include <QKeyEvent>
+#include <QEvent>
 
 // MythTV plugin includes
 #include <mythtv/mythcontext.h>
@@ -940,7 +938,7 @@
 
             // delete file
             QString musicdir = gContext->GetSetting("MusicLocation");
-            musicdir = QDir::cleanDirPath(musicdir);
+            musicdir = QDir::cleanPath(musicdir);
             if (!musicdir.endsWith("/"))
                 musicdir += "/";
             QFile::remove(musicdir + filename);
@@ -961,7 +959,7 @@
 QString Ripper::filenameFromMetadata(Metadata *track, bool createDir)
 {
     QString musicdir = gContext->GetSetting("MusicLocation");
-    musicdir = QDir::cleanDirPath(musicdir);
+    musicdir = QDir::cleanPath(musicdir);
     if (!musicdir.endsWith("/"))
         musicdir += "/";
 
@@ -976,7 +974,7 @@
     int old_i = 0;
     while (i >= 0)
     {
-        i = rx.search(fntempl, i);
+        i = rx.indexIn(fntempl, i);
         if (i >= 0)
         {
             if (i > 0)
@@ -1024,19 +1022,19 @@
 
     filename = QString(filename.toLocal8Bit().constData());
 
-    QStringList directoryList = QStringList::split("/", filename);
+    QStringList directoryList = filename.split("/");
     for (int i = 0; i < (directoryList.size() - 1); i++)
     {
         musicdir += "/" + directoryList[i];
         if (createDir)
         {
             umask(022);
-            directoryQD.mkdir(musicdir, true);
+            directoryQD.mkdir(musicdir);
             directoryQD.cd(musicdir);
         }
     }
 
-    filename = QDir::cleanDirPath(musicdir) + "/" + directoryList.last();
+    filename = QDir::cleanPath(musicdir) + "/" + directoryList.last();
 
     return filename;
 }
@@ -1453,7 +1451,7 @@
     }
 
     searchDialog->deleteLater();
-    setActiveWindow();
+    activateWindow();
 
     return res;
 }
@@ -1571,7 +1569,7 @@
 
         if (action == "ESCAPE")
         {
-            if (m_ripperThread && m_ripperThread->running())
+            if (m_ripperThread && m_ripperThread->isRunning())
             {
                 if (MythPopupBox::showOkCancelPopup(gContext->GetMainWindow(),
                     "Stop Rip?",
Index: mythplugins/mythmusic/mythmusic/playlist.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/playlist.cpp	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/playlist.cpp	(working copy)
@@ -1,27 +1,30 @@
 #include <unistd.h>
 #include <inttypes.h>
 #include <cstdlib>
-#include <iostream>
-#include <map>
 
+#include <map>
+#include <algorithm>
 using namespace std;
-#include "playlist.h"
-#include "qdatetime.h"
-//Added by qt3to4:
-#include <Q3PtrList>
-#include <Q3TextStream>
 
-#include <mythtv/mythcontext.h>
+#include <QApplication>
+#include <QTextStream>
+#include <QFileInfo>
+#include <q3process.h>
+
+#include "playlist.h"
+#include "playlistcontainer.h"
 #include "smartplaylist.h"
-#include <mythtv/mythdb.h>
-#include <mythtv/compat.h>
 
-#include <qfileinfo.h>
-#include <q3process.h>
-#include <qapplication.h>
+#include <mythcontext.h>
+#include <mythdb.h>
+#include <compat.h>
 
 const char *kID0err = "Song with ID of 0 in playlist, this shouldn't happen.";
 
+#define LOC      QString("Track: ")
+#define LOC_WARN QString("Track, Warning: ")
+#define LOC_ERR  QString("Track, Error: ")
+
 Track::Track(int x, AllMusic *all_music_ptr)
 {
     index_value = x;
@@ -33,7 +36,7 @@
     cd_flag = false;
 }
 
-void Track::postLoad(PlaylistsContainer *grandparent)
+void Track::postLoad(PlaylistContainer *grandparent)
 {
     if (cd_flag)
     {
@@ -48,8 +51,7 @@
                                              bad_reference);
     else
     {
-        VERBOSE(VB_IMPORTANT, "playlist.o: Not sure how I got 0 as a track "
-                "number, but it ain't good");
+        VERBOSE(VB_IMPORTANT, LOC_WARN + "Track Number of 0 is invalid!");
     }
 }
 
@@ -59,46 +61,135 @@
     parent = parent_ptr;
 }
 
+void Track::deleteYourself()
+{
+    parent->removeTrack(index_value, cd_flag);
+}
+
+void Track::deleteYourWidget()
+{
+    if (my_widget)
+    {
+        my_widget->RemoveFromParent();
+        //delete my_widget;  Deleted by the parent..
+        my_widget = NULL;
+    }
+}
+
+void Track::moveUpDown(bool flag)
+{
+    parent->moveTrackUpDown(flag, this);
+}
+
+TrackType Track::GetTrackType(void) const
+{
+    if (my_widget)
+    {
+        if (dynamic_cast<PlaylistCD*>(my_widget))
+            return kTrackCD;
+
+        if (dynamic_cast<PlaylistPlaylist*>(my_widget))
+            return kTrackPlaylist;
+
+        if (dynamic_cast<PlaylistTrack*>(my_widget))
+            return kTrackSong;
+
+        return kTrackUnknown;
+    }
+
+    if (cd_flag)
+        return kTrackCD;
+
+    if (index_value < 0)
+        return kTrackPlaylist;
+
+    if (index_value > 0)
+        return kTrackSong;
+
+    return kTrackUnknown;
+}
+
+void Track::putYourselfOnTheListView(UIListGenericTree *a_listviewitem)
+{
+    if (my_widget)
+    {
+        VERBOSE(VB_IMPORTANT, LOC_ERR +
+                "putYourselfOnTheListView() called when my_widget already exists.");
+        return;
+    }
+
+    TrackType type = GetTrackType();
+    switch (type)
+    {
+        case kTrackCD:
+            my_widget = new PlaylistCD(a_listviewitem, label);       break;
+        case kTrackSong:
+            my_widget = new PlaylistTrack(a_listviewitem, label);    break;
+        case kTrackPlaylist:
+            my_widget = new PlaylistPlaylist(a_listviewitem, label); break;
+        default: break;
+    }
+
+    if (my_widget)
+    {
+        my_widget->setOwner(this);
+    }
+    else
+    {
+        VERBOSE(VB_IMPORTANT, LOC_ERR +
+                "putYourselfOnTheListView() failed to create a widget");
+    }
+}
+
+#undef LOC
+#undef LOC_WARN
+#undef LOC_ERR
+
+#define LOC      QString("Playlist: ")
+#define LOC_WARN QString("Playlist, Warning: ")
+#define LOC_ERR  QString("Playlist, Error: ")
+
 void Playlist::postLoad()
 {
-    Track *it;
-    for (it = songs.first(); it; it = songs.current())
+    SongList::iterator it = songs.begin();
+    while (it != songs.end())
     {
-        it->postLoad(parent);
-        if (it->badReference())
+        (*it)->postLoad(parent);
+        if ((*it)->badReference())
         {
-            songs.remove(it);
+            delete *it;
+            it = songs.erase(it);
             Changed();
         }
         else
-            it = songs.next();
+        {
+            ++it;
+        }
     }
 }
 
-bool Playlist::checkTrack(int a_track_id, bool cd_flag)
+bool Playlist::checkTrack(int a_track_id, bool cd_flag) const
 {
     // XXX SPEED THIS UP
     // Should be a straight lookup against cached index
-    Track *it;
 
-    for (it = songs.first(); it; it = songs.next())
+    SongList::const_iterator it = songs.begin();
+    for (; it != songs.end(); ++it)
     {
-        if (it->getValue() == a_track_id && it->getCDFlag() == cd_flag)
-        {
+        if ((*it)->getValue() == a_track_id && (*it)->getCDFlag() == cd_flag)
             return true;
-        }
     }
 
     return false;
 }
 
-void Playlist::copyTracks(Playlist *to_ptr, bool update_display)
+void Playlist::copyTracks(Playlist *to_ptr, bool update_display) const
 {
-    Track *it;
-    for (it = songs.first(); it; it = songs.next())
+    SongList::const_iterator it = songs.begin();
+    for (; it != songs.end(); ++it)
     {
-        if (!it->getCDFlag())
-            to_ptr->addTrack((*it).getValue(), update_display, false);
+        if (!(*it)->getCDFlag())
+            to_ptr->addTrack((*it)->getValue(), update_display, false);
     }
 
     to_ptr->fillSonglistFromSongs();
@@ -114,7 +205,7 @@
     a_track->setCDFlag(cd);
     a_track->postLoad(parent);
     a_track->setParent(this);
-    songs.append(a_track);
+    songs.push_back(a_track);
     changed = true;
 
     // If I'm part of a GUI, display the existence of this new track
@@ -128,316 +219,122 @@
         a_track->putYourselfOnTheListView(which_widget);
 }
 
-void Track::deleteYourself()
+void Playlist::removeAllTracks(void)
 {
-    parent->removeTrack(index_value, cd_flag);
-}
-
-void Track::deleteYourWidget()
-{
-    if (my_widget)
+    while (!songs.empty())
     {
-       my_widget->RemoveFromParent();
-    //    delete my_widget;  Deleted by the parent..
-        my_widget = NULL;
+        songs.back()->deleteYourWidget();
+        delete songs.back();
+        songs.pop_back();
     }
-}
 
-void Playlist::removeAllTracks()
-{
-    Track *it;
-    for (it = songs.first(); it; it = songs.current())
-    {
-        it->deleteYourWidget();
-        songs.remove(it);
-    }
-
     changed = true;
 }
 
-void Playlist::removeAllWidgets()
+void Playlist::removeAllWidgets(void)
 {
-    Track *it;
-    for (it = songs.first(); it; it = songs.next())
-    {
-        it->deleteYourWidget();
-    }
+    SongList::iterator it = songs.begin();
+    for (; it != songs.end(); ++it)
+        (*it)->deleteYourWidget();
 }
 
 void Playlist::ripOutAllCDTracksNow()
 {
-    Track *it;
-    for (it = songs.first(); it; it = songs.current())
+    SongList::iterator it = songs.begin();
+    while (it != songs.end())
     {
-        if (it->getCDFlag())
+        if ((*it)->getCDFlag())
         {
-            it->deleteYourWidget();
-            songs.remove(it);
+            (*it)->deleteYourWidget();
+            delete *it;
+            it = songs.erase(it);
+            changed = true;
         }
         else
-            it = songs.next();
+        {
+            ++it;
+        }
     }
-    changed = true;
 }
 
 void Playlist::removeTrack(int the_track, bool cd_flag)
 {
     // Should be a straight lookup against cached index
-    Track *it;
-    for (it = songs.first(); it; it = songs.current())
+
+    SongList::iterator it = songs.begin();
+    while (it != songs.end())
     {
-        if (it->getValue() == the_track && cd_flag == it->getCDFlag())
+        if ((*it)->getValue() == the_track && cd_flag == (*it)->getCDFlag())
         {
-            it->deleteYourWidget();
-            songs.remove(it);
-            //it = songs.last();
+            (*it)->deleteYourWidget();
+            delete *it;
+            it = songs.erase(it);
+            changed = true;
         }
         else
-            it = songs.next();
+        {
+            ++it;
+        }
     }
-    changed = true;
 }
 
 void Playlist::moveTrackUpDown(bool flag, Track *the_track)
 {
-    // Slightly complicated, as the PtrList owns the pointers
-    // Need to turn off auto delete
-
-    songs.setAutoDelete(false);
-
     uint insertion_point = 0;
-    int where_its_at = songs.findRef(the_track);
+    int where_its_at = songs.indexOf(the_track);
     if (where_its_at < 0)
-        VERBOSE(VB_IMPORTANT, "playlist.o: A playlist was asked to move a "
+    {
+        VERBOSE(VB_IMPORTANT, LOC_ERR + "A playlist was asked to move a "
                 "track, but can'd find it");
+        return;
+    }
+
+    if (flag)
+        insertion_point = ((uint)where_its_at) - 1;
     else
-    {
-        if (flag)
-            insertion_point = ((uint)where_its_at) - 1;
-        else
-            insertion_point = ((uint)where_its_at) + 1;
+        insertion_point = ((uint)where_its_at) + 1;
 
-        songs.remove(the_track);
-        songs.insert(insertion_point, the_track);
-    }
+    songs.removeAt(where_its_at);
+    songs.insert(insertion_point, the_track);
 
-    songs.setAutoDelete(true);
     changed = true; //  This playlist is now different than Database
 }
 
-void Track::moveUpDown(bool flag)
-{
-    parent->moveTrackUpDown(flag, this);
-}
-
-PlaylistLoadingThread::PlaylistLoadingThread(PlaylistsContainer *parent_ptr,
-                                             AllMusic *all_music_ptr)
-{
-    parent = parent_ptr;
-    all_music = all_music_ptr;
-}
-
-void PlaylistLoadingThread::run()
-{
-    while(!all_music->doneLoading())
-    {
-        sleep(1);
-    }
-    parent->load();
-}
-
-void PlaylistsContainer::clearCDList()
-{
-    cd_playlist.clear();
-}
-
-void PlaylistsContainer::addCDTrack(int track)
-{
-    cd_playlist.append(track);
-}
-
-void PlaylistsContainer::removeCDTrack(int track)
-{
-    cd_playlist.remove(track);
-}
-
-bool PlaylistsContainer::checkCDTrack(int track)
-{
-    for (int i = 0; i < (int)cd_playlist.count(); i++)
-    {
-        if (cd_playlist[i] == track)
-            return true;
-    }
-    return false;
-}
-
-PlaylistsContainer::PlaylistsContainer(AllMusic *all_music, QString host_name)
-{
-    active_widget = NULL;
-    my_host = host_name;
-
-    active_playlist = NULL;
-    backup_playlist = NULL;
-    all_other_playlists = NULL;
-
-    all_available_music = all_music;
-
-    done_loading = false;
-
-    RatingWeight = gContext->GetNumSetting("IntelliRatingWeight", 2);
-    PlayCountWeight = gContext->GetNumSetting("IntelliPlayCountWeight", 2);
-    LastPlayWeight = gContext->GetNumSetting("IntelliLastPlayWeight", 2);
-    RandomWeight = gContext->GetNumSetting("IntelliRandomWeight", 2);
-
-    playlists_loader = new PlaylistLoadingThread(this, all_music);
-    playlists_loader->start();
-}
-
-PlaylistsContainer::~PlaylistsContainer()
-{
-    if (active_playlist)
-        delete active_playlist;
-    if (backup_playlist)
-        delete backup_playlist;
-    if (all_other_playlists)
-        delete all_other_playlists;
-
-    playlists_loader->wait();
-    delete playlists_loader;
-}
-
-void PlaylistsContainer::FillIntelliWeights(int &rating, int &playcount,
-                                            int &lastplay, int &random)
-{
-    rating = RatingWeight;
-    playcount = PlayCountWeight;
-    lastplay = LastPlayWeight;
-    random = RandomWeight;
-}
-
-void PlaylistsContainer::load()
-{
-    done_loading = false;
-    active_playlist = new Playlist(all_available_music);
-    active_playlist->setParent(this);
-
-    backup_playlist = new Playlist(all_available_music);
-    backup_playlist->setParent(this);
-
-    all_other_playlists = new Q3PtrList<Playlist>;
-    all_other_playlists->setAutoDelete(true);
-
-    cd_playlist.clear();
-
-    active_playlist->loadPlaylist("default_playlist_storage", my_host);
-    active_playlist->fillSongsFromSonglist(false);
-
-    backup_playlist->loadPlaylist("backup_playlist_storage", my_host);
-    backup_playlist->fillSongsFromSonglist(false);
-
-    all_other_playlists->clear();
-
-    MSqlQuery query(MSqlQuery::InitCon());
-    query.prepare("SELECT playlist_id FROM music_playlists "
-                  "WHERE playlist_name != :DEFAULT"
-                  " AND playlist_name != :BACKUP "
-                  " AND (hostname = '' OR hostname = :HOST) "
-                  "ORDER BY playlist_id;");
-    query.bindValue(":DEFAULT", "default_playlist_storage");
-    query.bindValue(":BACKUP", "backup_playlist_storage");
-    query.bindValue(":HOST", my_host);
-
-    if (query.exec() && query.isActive() && query.size() > 0)
-    {
-        while (query.next())
-        {
-            Playlist *temp_playlist = new Playlist(all_available_music);
-            //  No, we don't destruct this ...
-            temp_playlist->setParent(this);
-            temp_playlist->loadPlaylistByID(query.value(0).toInt(), my_host);
-            temp_playlist->fillSongsFromSonglist(false);
-            all_other_playlists->append(temp_playlist);
-            //  ... cause it's sitting on this PtrList
-        }
-    }
-    postLoad();
-
-    pending_writeback_index = 0;
-
-    int x = gContext->GetNumSetting("LastMusicPlaylistPush");
-    setPending(x);
-    done_loading = true;
-}
-
-void PlaylistsContainer::describeYourself()
-{
-    //    Debugging
-
-    active_playlist->describeYourself();
-    Playlist *a_list;
-    for (a_list = all_other_playlists->first(); a_list;
-         a_list = all_other_playlists->next())
-    {
-        a_list->describeYourself();
-    }
-}
-
 Playlist::Playlist(AllMusic *all_music_ptr)
 {
     //  fallback values
     playlistid = 0;
     name = QObject::tr("oops");
     raw_songlist = "";
-    songs.setAutoDelete(true);  //  mine!
     all_available_music = all_music_ptr;
     changed = false;
 }
 
-void Track::putYourselfOnTheListView(UIListGenericTree *a_listviewitem)
-{
-    if (cd_flag)
-    {
-        my_widget = new PlaylistCD(a_listviewitem, label);
-        my_widget->setOwner(this);
-    }
-    else
-    {
-        if (index_value > 0)
-        {
-            my_widget = new PlaylistTrack(a_listviewitem, label);
-            my_widget->setOwner(this);
-        }
-        else if (index_value < 0)
-        {
-            my_widget = new PlaylistPlaylist(a_listviewitem, label);
-            my_widget->setOwner(this);
-        }
-    }
-}
-
 void Playlist::putYourselfOnTheListView(UIListGenericTree *a_listviewitem)
 {
-    Track *it;
-    for (it = songs.first(); it; it = songs.next())
-        it->putYourselfOnTheListView(a_listviewitem);
+    SongList::iterator it = songs.begin();
+    for (; it != songs.end(); ++it)
+        (*it)->putYourselfOnTheListView(a_listviewitem);
 }
 
-int Playlist::getFirstTrackID()
+int Playlist::getFirstTrackID(void) const
 {
-    Track *it = songs.first();
-    if (it)
-    {
-        return it->getValue();
-    }
+    SongList::const_iterator it = songs.begin();
+    if (it != songs.end())
+        return (*it)->getValue();
     return 0;
 }
 
 Playlist::~Playlist()
 {
-    songs.setAutoDelete(true);
-    songs.clear();
+    while (!songs.empty())
+    {
+        delete songs.front();
+        songs.pop_front();
+    }
 }
 
+/*
 Playlist& Playlist::operator=(const Playlist& rhs)
 {
     if (this == &rhs)
@@ -448,11 +345,19 @@
     playlistid = rhs.playlistid;
     name = rhs.name;
     raw_songlist = rhs.raw_songlist;
-    songs = rhs.songs;
+
+    while (!songs.empty())
+    {
+        delete songs.front();
+        songs.pop_front();
+    }
+#error Can not safely copy Playlist.. Track does not have a deep copy constructor
+
     return *this;
 }
+*/
 
-void Playlist::describeYourself()
+void Playlist::describeYourself(void) const
 {
     //  This is for debugging
 /*
@@ -461,23 +366,21 @@
     cout << "     songlist(raw) is \"" << raw_songlist << "\"" << endl;
     cout << "     songlist list is ";
 */
-    QString msg;
-    Track *it;
-    for(it = songs.first(); it; it = songs.next())
-    {
-        msg += it->getValue() + "," ;
-    }
+    QString msg = "";
+    SongList::const_iterator it = songs.begin();
+    for (; it != songs.end(); ++it)
+        msg += (*it)->getValue() + ",";
 
-    VERBOSE(VB_IMPORTANT, msg);
+    VERBOSE(VB_IMPORTANT, LOC + msg);
 }
 
 
 void Playlist::loadPlaylist(QString a_name, QString a_host)
 {
     QString thequery;
-    if (a_host.length() < 1)
+    if (a_host.isEmpty())
     {
-        VERBOSE(VB_IMPORTANT, "loadPlaylist() - We need a valid hostname");
+        VERBOSE(VB_IMPORTANT, LOC_ERR + "loadPlaylist() - We need a valid hostname");
         return;
     }
 
@@ -564,7 +467,7 @@
     if (filter)
         all_available_music->setAllVisible(false);
 
-    QStringList list = QStringList::split(",", raw_songlist);
+    QStringList list = raw_songlist.split(",", QString::SkipEmptyParts);
     QStringList::iterator it = list.begin();
     for (; it != list.end(); it++)
     {
@@ -581,14 +484,16 @@
             {
                 Track *a_track = new Track(an_int, all_available_music);
                 a_track->setParent(this);
-                songs.append(a_track);
+                songs.push_back(a_track);
             }
         }
         else
         {
             changed = true;
-            VERBOSE(VB_IMPORTANT, "Taking a 0 (zero) off a "
-                    "playlist. If this happens on repeated invocations of "
+
+            VERBOSE(VB_IMPORTANT, LOC_ERR +
+                    "Taking a 0 (zero) off a playlist. \n\t\t\t"
+                    "If this happens on repeated invocations of "
                     "mythmusic, then something is really wrong");
         }
     }
@@ -601,20 +506,18 @@
     }
 }
 
-void Playlist::fillSonglistFromSongs()
+void Playlist::fillSonglistFromSongs(void)
 {
     QString a_list = "";
-    Track *it;
-    for (it = songs.first(); it; it = songs.next())
+    SongList::const_iterator it = songs.begin();
+    for (; it != songs.end(); ++it)
     {
-        if (!it->getCDFlag())
-        {
-            a_list += QString(",%1").arg(it->getValue());
-        }
+        if (!(*it)->getCDFlag())
+            a_list += QString(",%1").arg((*it)->getValue());
     }
 
     raw_songlist = "";
-    if (a_list.length() > 1)
+    if (!a_list.isEmpty())
         raw_songlist = a_list.remove(0, 1);
 }
 
@@ -681,7 +584,7 @@
 
         case PL_INSERTAFTERCURRENT:
         {
-            QStringList list = QStringList::split(",", raw_songlist);
+            QStringList list = raw_songlist.split(",", QString::SkipEmptyParts);
             QStringList::iterator it = list.begin();
             raw_songlist = "";
             bool bFound = false;
@@ -745,7 +648,9 @@
     int categoryID = SmartPlaylistEditor::lookupCategoryID(category);
     if (categoryID == -1)
     {
-        VERBOSE(VB_GENERAL, "Cannot find Smartplaylist Category: " + category);
+        VERBOSE(VB_GENERAL, LOC_WARN +
+                QString("Cannot find Smartplaylist Category: %1")
+                .arg(category));
         return;
     }
 
@@ -773,7 +678,8 @@
         }
         else
         {
-            VERBOSE(VB_GENERAL, "Cannot find smartplaylist: " + name);
+            VERBOSE(VB_GENERAL, LOC_WARN +
+                    QString("Cannot find smartplaylist: %1").arg(name));
             return;
         }
     }
@@ -825,16 +731,18 @@
 
 void Playlist::savePlaylist(QString a_name, QString a_host)
 {
-    name = a_name.simplifyWhiteSpace();
+    name = a_name.simplified();
     if (name.length() < 1)
     {
-        VERBOSE(VB_GENERAL, "Not going to save a playlist with no name");
+        VERBOSE(VB_GENERAL, LOC_WARN +
+                "Not saving unnamed playlist");
         return;
     }
 
     if (a_host.length() < 1)
     {
-        VERBOSE(VB_GENERAL, "Not going to save a playlist with no hostname");
+        VERBOSE(VB_GENERAL, LOC_WARN +
+                "Not saving playlist without a host name");
         return;
     }
     if (name.length() < 1)
@@ -844,7 +752,7 @@
     MSqlQuery query(MSqlQuery::InitCon());
 
     int length = 0, songcount = 0, playtime = 0, an_int;
-    QStringList list = QStringList::split(",", raw_songlist);
+    QStringList list = raw_songlist.split(",", QString::SkipEmptyParts);
     QStringList::iterator it = list.begin();
     for (; it != list.end(); it++)
     {
@@ -927,8 +835,8 @@
 {
     raw_songlist.remove(' ');
 
-    QStringList curList = QStringList::split(",", raw_songlist);
-    QStringList newList = QStringList::split(",", new_songlist);
+    QStringList curList = raw_songlist.split(",", QString::SkipEmptyParts);
+    QStringList newList = new_songlist.split(",", QString::SkipEmptyParts);
     QStringList::iterator it = newList.begin();
     QString songlist = "";
 
@@ -943,8 +851,6 @@
 
 int Playlist::writeTree(GenericTree *tree_to_write_to, int a_counter)
 {
-    Track *it;
-
     // compute max/min playcount,lastplay for this playlist
     int playcountMin = 0;
     int playcountMax = 0;
@@ -961,24 +867,26 @@
     ArtistMap::iterator            Iartist;
     QString                        artist;
 
-    for (it = songs.first(); it; it = songs.next())
+    uint idx = 0;
+    SongList::const_iterator it = songs.begin();
+    for (; it != songs.end(); ++it, ++idx)
     {
-        if (!it->getCDFlag())
+        if (!(*it)->getCDFlag())
         {
-            if (it->getValue() == 0)
+            if ((*it)->getValue() == 0)
             {
-                VERBOSE(VB_IMPORTANT, kID0err);
+                VERBOSE(VB_IMPORTANT, LOC_ERR + kID0err);
             }
-            if (it->getValue() > 0)
+            if ((*it)->getValue() > 0)
             {
                 // Normal track
-                Metadata *tmpdata
-                    = all_available_music->getMetadata(it->getValue());
+                Metadata *tmpdata =
+                    all_available_music->getMetadata((*it)->getValue());
                 if (tmpdata)
                 {
                     if (tmpdata->isVisible())
                     {
-                        if (songs.at() == 0)
+                        if (0 == idx)
                         { // first song
                             playcountMin = playcountMax = tmpdata->PlayCount();
                             lastplayMin = lastplayMax = tmpdata->LastPlay();
@@ -1034,26 +942,26 @@
     parent->FillIntelliWeights(RatingWeight, PlayCountWeight, LastPlayWeight,
                                RandomWeight);
 
-    for (it = songs.first(); it; it = songs.next())
+    for (it = songs.begin(); it != songs.end(); ++it)
     {
-        if (!it->getCDFlag())
+        if (!(*it)->getCDFlag())
         {
-            if (it->getValue() == 0)
+            if ((*it)->getValue() == 0)
             {
-                VERBOSE(VB_IMPORTANT, kID0err);
+                VERBOSE(VB_IMPORTANT, LOC_ERR + kID0err);
             }
-            if (it->getValue() > 0)
+            if ((*it)->getValue() > 0)
             {
                 // Normal track
-                Metadata *tmpdata
-                    = all_available_music->getMetadata(it->getValue());
+                Metadata *tmpdata =
+                    all_available_music->getMetadata((*it)->getValue());
                 if (tmpdata && tmpdata->isVisible())
                 {
                     QString a_string = QString("%1 ~ %2")
                                        .arg(tmpdata->FormatArtist())
                                        .arg(tmpdata->FormatTitle());
                     GenericTree *added_node = tree_to_write_to->addNode(
-                        a_string, it->getValue(), true);
+                        a_string, (*it)->getValue(), true);
                     ++a_counter;
                     added_node->setAttribute(0, 1);
                     added_node->setAttribute(1, a_counter); //  regular order
@@ -1128,11 +1036,11 @@
                     added_node->setAttribute(5, integer_order);
                 }
             }
-            if (it->getValue() < 0)
+            if ((*it)->getValue() < 0)
             {
                 // it's a playlist, recurse (mildly)
                 Playlist *level_down
-                    = parent->getPlaylist((it->getValue()) * -1);
+                    = parent->getPlaylist(((*it)->getValue()) * -1);
                 if (level_down)
                 {
                     a_counter = level_down->writeTree(tree_to_write_to,
@@ -1142,8 +1050,8 @@
         }
         else
         {
-            Metadata *tmpdata
-                = all_available_music->getMetadata(it->getValue());
+            Metadata *tmpdata =
+                all_available_music->getMetadata((*it)->getValue());
             if (tmpdata)
             {
                 QString a_string = QString("(CD) %1 ~ %2")
@@ -1154,8 +1062,8 @@
                 {
                     a_string = QString("(CD) Track %1").arg(tmpdata->Track());
                 }
-                GenericTree *added_node
-                    = tree_to_write_to->addNode(a_string, it->getValue(), true);
+                GenericTree *added_node =
+                    tree_to_write_to->addNode(a_string, (*it)->getValue(), true);
                 ++a_counter;
                 added_node->setAttribute(0, 1);
                 added_node->setAttribute(1, a_counter); //  regular order
@@ -1167,266 +1075,13 @@
     return a_counter;
 }
 
-GenericTree* PlaylistsContainer::writeTree(GenericTree *tree_to_write_to)
-{
-    all_available_music->writeTree(tree_to_write_to);
-
-    GenericTree *sub_node
-        = tree_to_write_to->addNode(QObject::tr("All My Playlists"), 1);
-    sub_node->setAttribute(0, 1);
-    sub_node->setAttribute(1, 1);
-    sub_node->setAttribute(2, 1);
-    sub_node->setAttribute(3, 1);
-
-    GenericTree *subsub_node
-        = sub_node->addNode(QObject::tr("Active Play Queue"), 0);
-    subsub_node->setAttribute(0, 0);
-    subsub_node->setAttribute(1, 0);
-    subsub_node->setAttribute(2, rand());
-    subsub_node->setAttribute(3, rand());
-
-    active_playlist->writeTree(subsub_node, 0);
-
-    int a_counter = 0;
-
-    //
-    //  Write the CD playlist (if there's anything in it)
-    //
-
-/*
-    if (cd_playlist.count() > 0)
-    {
-        ++a_counter;
-        QString a_string = QObject::tr("CD: ");
-        a_string += all_available_music->getCDTitle();
-        GenericTree *cd_node = sub_node->addNode(a_string, 0);
-        cd_node->setAttribute(0, 0);
-        cd_node->setAttribute(1, a_counter);
-        cd_node->setAttribute(2, rand());
-        cd_node->setAttribute(3, rand());
-    }
-*/
-
-    //
-    //  Write the other playlists
-    //
-
-    Q3PtrListIterator<Playlist> iterator( *all_other_playlists );
-    Playlist *a_list;
-    while( ( a_list = iterator.current() ) != 0)
-    {
-        ++a_counter;
-        GenericTree *new_node = sub_node->addNode(a_list->getName(),
-                                                  a_list->getID());
-        new_node->setAttribute(0, 0);
-        new_node->setAttribute(1, a_counter);
-        new_node->setAttribute(2, rand());
-        new_node->setAttribute(3, rand());
-        a_list->writeTree(new_node, 0);
-        ++iterator;
-    }
-
-    GenericTree* active_playlist_node = subsub_node->findLeaf();
-    if (!active_playlist_node) active_playlist_node = subsub_node;
-    return active_playlist_node;
-}
-
-void PlaylistsContainer::save()
-{
-    Playlist *a_list;
-
-    for(a_list = all_other_playlists->first();
-        a_list; a_list = all_other_playlists->next())
-    {
-        if (a_list->hasChanged())
-        {
-            a_list->fillSonglistFromSongs();
-            a_list->savePlaylist(a_list->getName(), my_host);
-        }
-    }
-
-    active_playlist->savePlaylist("default_playlist_storage", my_host);
-    backup_playlist->savePlaylist("backup_playlist_storage", my_host);
-}
-
-void PlaylistsContainer::createNewPlaylist(QString name)
-{
-    Playlist *new_list = new Playlist(all_available_music);
-    new_list->setParent(this);
-
-    //  Need to touch the database to get persistent ID
-    new_list->savePlaylist(name, my_host);
-    new_list->Changed();
-    all_other_playlists->append(new_list);
-    //if (my_widget)
-    //{
-    //    new_list->putYourselfOnTheListView(my_widget);
-    //}
-}
-
-void PlaylistsContainer::copyNewPlaylist(QString name)
-{
-    Playlist *new_list = new Playlist(all_available_music);
-    new_list->setParent(this);
-
-    //  Need to touch the database to get persistent ID
-    new_list->savePlaylist(name, my_host);
-    new_list->Changed();
-    all_other_playlists->append(new_list);
-    active_playlist->copyTracks(new_list, false);
-    pending_writeback_index = 0;
-    active_widget->setText(QObject::tr("Active Play Queue"));
-    active_playlist->removeAllTracks();
-    active_playlist->addTrack(new_list->getID() * -1, true, false);
-}
-
-void PlaylistsContainer::setActiveWidget(PlaylistTitle *widget)
-{
-    active_widget = widget;
-    if (active_widget && pending_writeback_index > 0)
-    {
-        bool bad = false;
-        QString newlabel = QString(QObject::tr("Active Play Queue (%1)"))
-                           .arg(getPlaylistName(pending_writeback_index, bad));
-        active_widget->setText(newlabel);
-    }
-}
-
-void PlaylistsContainer::popBackPlaylist()
-{
-    Playlist *destination = getPlaylist(pending_writeback_index);
-    if (!destination)
-    {
-        VERBOSE(VB_IMPORTANT, QString("Unknown playlist: %1")
-                .arg(pending_writeback_index));
-        return;
-    }
-    destination->removeAllTracks();
-    destination->Changed();
-    active_playlist->copyTracks(destination, false);
-    active_playlist->removeAllTracks();
-    backup_playlist->copyTracks(active_playlist, true);
-    pending_writeback_index = 0;
-    active_widget->setText(QObject::tr("Active Play Queue"));
-
-    active_playlist->Changed();
-    backup_playlist->Changed();
-}
-
-void PlaylistsContainer::copyToActive(int index)
-{
-    backup_playlist->removeAllTracks();
-    active_playlist->copyTracks(backup_playlist, false);
-
-    pending_writeback_index = index;
-    if (active_widget)
-    {
-        bool bad = false;
-        QString newlabel = QString(QObject::tr("Active Play Queue (%1)"))
-            .arg(getPlaylistName(index, bad));
-        active_widget->setText(newlabel);
-    }
-    active_playlist->removeAllTracks();
-    Playlist *copy_from = getPlaylist(index);
-    if (!copy_from)
-    {
-        VERBOSE(VB_IMPORTANT, QString("Unknown playlist: %1").arg(index));
-        return;
-    }
-    copy_from->copyTracks(active_playlist, true);
-
-    active_playlist->Changed();
-    backup_playlist->Changed();
-}
-
-
-void PlaylistsContainer::renamePlaylist(int index, QString new_name)
-{
-    Playlist *list_to_rename = getPlaylist(index);
-    if (list_to_rename)
-    {
-        list_to_rename->setName(new_name);
-        list_to_rename->Changed();
-        if (list_to_rename->getID() == pending_writeback_index)
-        {
-            QString newlabel = QString(QObject::tr("Active Play Queue (%1)"))
-                .arg(new_name);
-            active_widget->setText(newlabel);
-        }
-    }
-}
-
-void PlaylistsContainer::deletePlaylist(int kill_me)
-{
-    Playlist *list_to_kill = getPlaylist(kill_me);
-    if (!list_to_kill)
-    {
-        VERBOSE(VB_IMPORTANT, QString("Unknown playlist: %1").arg(kill_me));
-        return;
-    }
-    //  First, we need to take out any **track** on any other
-    //  playlist that is actually a reference to this
-    //  playlist
-
-    if (kill_me == pending_writeback_index)
-        popBackPlaylist();
-
-    active_playlist->removeTrack(kill_me * -1, false);
-
-    Q3PtrListIterator<Playlist> iterator( *all_other_playlists );
-    Playlist *a_list;
-    while( ( a_list = iterator.current() ) != 0)
-    {
-        ++iterator;
-        if (a_list != list_to_kill)
-        {
-            a_list->removeTrack(kill_me * -1, false);
-        }
-    }
-
-    MSqlQuery query(MSqlQuery::InitCon());
-    query.prepare("DELETE FROM music_playlists WHERE playlist_id = :ID ;");
-    query.bindValue(":ID", kill_me);
-
-    if (!query.exec() || query.numRowsAffected() < 1)
-    {
-        MythDB::DBError("playlist delete", query);
-    }
-    list_to_kill->removeAllTracks();
-    all_other_playlists->remove(list_to_kill);
-}
-
-
-QString PlaylistsContainer::getPlaylistName(int index, bool &reference)
-{
-    if (active_playlist)
-    {
-        if (active_playlist->getID() == index)
-        {
-            return active_playlist->getName();
-        }
-
-        Playlist *a_list;
-        for(a_list = all_other_playlists->last();
-            a_list; a_list = all_other_playlists->prev())
-        {
-            if (a_list->getID() == index)
-            {
-                return a_list->getName();
-            }
-        }
-    }
-    VERBOSE(VB_IMPORTANT, "getPlaylistName() called with unknown index number");
-    reference = true;
-    return QObject::tr("Something is Wrong");
-}
-
 bool Playlist::containsReference(int to_check, int depth)
 {
     if (depth > 10)
     {
-        VERBOSE(VB_IMPORTANT, "Recursively checking playlists, and have "
-                              "reached a search depth over 10 ");
+        VERBOSE(VB_IMPORTANT,
+                LOC_ERR + "Recursively checking playlists, and have "
+                "reached a search depth over 10 ");
     }
     bool ref_exists = false;
 
@@ -1434,11 +1089,11 @@
     //  Attempt to avoid infinite recursion
     //  in playlists (within playlists) =P
 
-    Track *it;
-    for(it = songs.first(); it; it = songs.next())
+    SongList::const_iterator it = songs.begin();
+    for (; it != songs.end(); ++it)
     {
-        check = it->getValue();
-        if (check < 0 && !it->getCDFlag())
+        check = (*it)->getValue();
+        if (check < 0 && !(*it)->getCDFlag())
         {
             if (check * -1 == to_check)
             {
@@ -1459,191 +1114,10 @@
     return ref_exists;
 }
 
-Playlist *PlaylistsContainer::getPlaylist(int id)
-{
-    //  return a pointer to a playlist
-    //  by id;
-
-    if (active_playlist->getID() == id)
-    {
-        return active_playlist;
-    }
-
-    //  Very Suprisingly, we need to use an iterator on this,
-    //  because if we just traverse the list, other functions (that
-    //  called this) that are also traversing the same list get
-    //  reset. That took a **long** time to figure out
-
-    Q3PtrListIterator<Playlist> iterator( *all_other_playlists );
-    Playlist *a_list;
-    while( ( a_list = iterator.current() ) != 0)
-    {
-        ++iterator;
-        if (a_list->getID() == id)
-        {
-            return a_list;
-        }
-    }
-    VERBOSE(VB_IMPORTANT, "getPlaylistName() called with unknown index number");
-    return NULL;
-}
-
-void PlaylistsContainer::showRelevantPlaylists(TreeCheckItem *alllists)
-{
-    QString templevel, temptitle;
-    int id;
-    //  Deleting anything that's there
-    while (alllists->childCount() > 0)
-    {
-        UIListGenericTree *first_child;
-        first_child = (UIListGenericTree *)(alllists->getChildAt(0));
-        {
-            first_child->RemoveFromParent();
-            //delete first_child;  Deleted by GenericTree.
-        }
-    }
-
-    //  Add everything but the current playlist
-    Playlist *some_list;
-    for (some_list = all_other_playlists->first(); some_list;
-         some_list = all_other_playlists->next())
-    {
-        id = some_list->getID() * -1 ;
-        temptitle = some_list->getName();
-        templevel = "playlist";
-
-        TreeCheckItem *some_item = new TreeCheckItem(alllists, temptitle,
-                                                     templevel, id);
-
-        some_item->setCheckable(true);
-        some_item->setActive(true);
-
-        if (some_list->containsReference(pending_writeback_index, 0) ||
-            (id * -1) == pending_writeback_index)
-        {
-            some_item->setCheckable(false);
-            some_item->setActive(false);
-        }
-
-        some_list->putYourselfOnTheListView(some_item);
-    }
-
-    if (alllists->childCount() == 0)
-        alllists->setCheckable(false);
-    else
-        alllists->setCheckable(true);
-}
-
-void PlaylistsContainer::refreshRelevantPlaylists(TreeCheckItem *alllists)
-{
-    if (alllists->childCount() == 0)
-    {
-        alllists->setCheckable(false);
-        return;
-    }
-
-    UIListGenericTree *walker = (UIListGenericTree *)(alllists->getChildAt(0));
-    while (walker)
-    {
-        if (TreeCheckItem *check_item = dynamic_cast<TreeCheckItem*>(walker))
-        {
-            int id = check_item->getID() * -1;
-            Playlist *check_playlist = getPlaylist(id);
-            if ((check_playlist &&
-                check_playlist->containsReference(pending_writeback_index, 0))
-               || id == pending_writeback_index)
-            {
-                check_item->setCheckable(false);
-                check_item->setActive(false);
-            }
-            else
-            {
-                check_item->setCheckable(true);
-                check_item->setActive(true);
-            }
-        }
-        walker = (UIListGenericTree *)(walker->nextSibling(1));
-    }
-
-    alllists->setCheckable(true);
-}
-
-void PlaylistsContainer::postLoad()
-{
-    //  Now that everything is loaded, we need to recheck all
-    //  tracks and update those that refer to a playlist
-
-    active_playlist->postLoad();
-    backup_playlist->postLoad();
-    Q3PtrListIterator<Playlist> iterator( *all_other_playlists );
-    Playlist *a_list;
-    while( ( a_list = iterator.current() ) != 0)
-    {
-        ++iterator;
-        a_list->postLoad();
-    }
-}
-
-bool PlaylistsContainer::pendingWriteback()
-{
-    if (pending_writeback_index > 0)
-    {
-        return true;
-    }
-    return false;
-}
-
-bool PlaylistsContainer::nameIsUnique(QString a_name, int which_id)
-{
-    if (a_name == "default_playlist_storage")
-    {
-        return false;
-    }
-
-    if (a_name == "backup_playlist_storage")
-    {
-        return false;
-    }
-
-    Q3PtrListIterator<Playlist> iterator( *all_other_playlists );
-    Playlist *a_list;
-    while( ( a_list = iterator.current() ) != 0)
-    {
-        ++iterator;
-        if (a_list->getName() == a_name &&
-           a_list->getID() != which_id)
-        {
-            return false;
-        }
-    }
-    return true ;
-}
-
-bool PlaylistsContainer::cleanOutThreads()
-{
-    if (playlists_loader->isFinished())
-    {
-        return true;
-    }
-    playlists_loader->wait();
-    return false;
-}
-
-void PlaylistsContainer::clearActive()
-{
-    backup_playlist->removeAllTracks();
-    active_playlist->removeAllTracks();
-    backup_playlist->Changed();
-    active_playlist->Changed();
-    pending_writeback_index = 0;
-    active_widget->setText(QObject::tr("Active Play Queue"));
-}
-
 // Here begins CD Writing things. ComputeSize, CreateCDMP3 & CreateCDAudio
 
 void Playlist::computeSize(double &size_in_MB, double &size_in_sec)
 {
-    Track *it;
     double child_MB;
     double child_sec;
 
@@ -1651,20 +1125,21 @@
     size_in_MB = 0.0;
     size_in_sec = 0.0;
 
-    for (it = songs.first(); it; it = songs.next())
+    SongList::const_iterator it = songs.begin();
+    for (; it != songs.end(); ++it)
     {
-        if (it->getCDFlag())
+        if ((*it)->getCDFlag())
             continue;
 
-        if (it->getValue() == 0)
+        if ((*it)->getValue() == 0)
         {
             VERBOSE(VB_IMPORTANT, kID0err);
         }
-        else if (it->getValue() > 0)
+        else if ((*it)->getValue() > 0)
         {
             // Normal track
-            Metadata *tmpdata
-                = all_available_music->getMetadata(it->getValue());
+            Metadata *tmpdata =
+                all_available_music->getMetadata((*it)->getValue());
             if (tmpdata)
             {
                 if (tmpdata->Length() > 0)
@@ -1679,13 +1154,13 @@
                 size_in_MB += finfo.size() / 1000000;
             }
         }
-        if (it->getValue() < 0)
+        if ((*it)->getValue() < 0)
         {
             // it's a playlist, recurse (mildly)
 
             // Comment: I can't make this thing work.
             // Nothing is computed with playlists
-            Playlist *level_down = parent->getPlaylist((it->getValue()) * -1);
+            Playlist *level_down = parent->getPlaylist(((*it)->getValue()) * -1);
             if (level_down)
             {
                 level_down->computeSize(child_MB, child_sec);
@@ -1720,21 +1195,21 @@
 
     QStringList reclist;
 
-    Track *it;
-    for (it = songs.first(); it; it = songs.next())
+    SongList::const_iterator it = songs.begin();
+    for (; it != songs.end(); ++it)
     {
-        if (it->getCDFlag())
+        if ((*it)->getCDFlag())
             continue;
 
-        if (it->getValue() == 0)
+        if ((*it)->getValue() == 0)
         {
             VERBOSE(VB_IMPORTANT, kID0err);
         }
-        else if (it->getValue() > 0)
+        else if ((*it)->getValue() > 0)
         {
             // Normal track
-            Metadata *tmpdata
-                = all_available_music->getMetadata(it->getValue());
+            Metadata *tmpdata =
+                all_available_music->getMetadata((*it)->getValue());
             if (tmpdata)
             {
                 // check filename..
@@ -1757,7 +1232,7 @@
                 reclist += outline;
             }
         }
-        else if (it->getValue() < 0)
+        else if ((*it)->getValue() < 0)
         {
             // FIXME: handle playlists
         }
@@ -1800,7 +1275,7 @@
         return 1;
     }
 
-    Q3TextStream recstream(&reclistfile);
+    QTextStream recstream(&reclistfile);
 
     QStringList::Iterator iter;
 
@@ -1841,7 +1316,7 @@
                 if (buf[6] == '%')
                 {
                     buf = buf.mid(0, 3);
-                    progress->setProgress(buf.stripWhiteSpace().toInt());
+                    progress->setProgress(buf.trimmed().toInt());
                 }
             }
             if (isofs.isRunning())
@@ -1912,8 +1387,8 @@
                 QString line = burn.readLineStdout();
                 if (line.mid(15, 2) == "of")
                 {
-                    int mbdone = line.mid(10, 5).stripWhiteSpace().toInt();
-                    int mbtotal = line.mid(17, 5).stripWhiteSpace().toInt();
+                    int mbdone = line.mid(10, 5).trimmed().toInt();
+                    int mbtotal = line.mid(17, 5).trimmed().toInt();
 
                     if (mbtotal > 0)
                     {
@@ -1957,4 +1432,3 @@
 {
     return -1;
 }
-
Index: mythplugins/mythmusic/mythmusic/vorbisencoder.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/vorbisencoder.cpp	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/vorbisencoder.cpp	(working copy)
@@ -1,7 +1,5 @@
 #include <qstring.h>
-#include <q3cstring.h>
 #include <qapplication.h>
-#include <q3progressbar.h>
 
 #include "metadata.h"
 #include "encoder.h"
Index: mythplugins/mythmusic/mythmusic/decoder.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/decoder.cpp	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/decoder.cpp	(working copy)
@@ -13,7 +13,6 @@
 
 #include <qapplication.h>
 #include <qobject.h>
-#include <q3ptrlist.h>
 #include <qdir.h>
 #include <qstringlist.h>
 #include <qregexp.h>
@@ -171,7 +170,7 @@
 void Decoder::SetLocationFormatUseTags(void)
 {
     QString startdir = gContext->GetSetting("MusicLocation");
-    startdir = QDir::cleanDirPath(startdir);
+    startdir = QDir::cleanPath(startdir);
     if (!startdir.endsWith("/"))
         startdir += "/";
 
@@ -180,13 +179,13 @@
     ignore_id3 = gContext->GetNumSetting("Ignore_ID3", 0);
 }
 
-static Q3PtrList<DecoderFactory> *factories = 0;
+static QList<DecoderFactory*> *factories = NULL;
 
 static void checkFactories()
 {
     if (!factories)
     {
-        factories = new Q3PtrList<DecoderFactory>;
+        factories = new QList<DecoderFactory*>;
 
 #ifndef USING_MINGW
         Decoder::registerFactory(new CdDecoderFactory);
@@ -203,13 +202,11 @@
     checkFactories();
 
     QStringList l;
-    DecoderFactory *fact = factories->first();
-    while (fact)
-    {
-        l << fact->description();
-        fact = factories->next();
-    }
 
+    QList<DecoderFactory*>::iterator it = factories->begin();
+    for (; it != factories->end(); ++it)
+        l += (*it)->description();
+
     return l;
 }
 
@@ -217,21 +214,19 @@
 {
     checkFactories();
 
-    DecoderFactory *fact = factories->first();
-    while (fact)
+    QList<DecoderFactory*>::iterator it = factories->begin();
+    for (; it != factories->end(); ++it)
     {
-        if (fact->supports(source))
-            return TRUE;
-
-        fact = factories->next();
+        if ((*it)->supports(source))
+            return true;
     }
 
-    return FALSE;
+    return false;
 }
 
 void Decoder::registerFactory(DecoderFactory *fact)
 {
-    factories->append(fact);
+    factories->push_back(fact);
 }
 
 Decoder *Decoder::create(const QString &source, QIODevice *input,
@@ -239,21 +234,14 @@
 {
     checkFactories();
 
-    Decoder *decoder = 0;
-
-    DecoderFactory *fact = factories->first();
-    while (fact)
+    QList<DecoderFactory*>::iterator it = factories->begin();
+    for (; it != factories->end(); ++it)
     {
-        if (fact->supports(source))
-        {
-            decoder = fact->create(source, input, output, deletable);
-            break;
-        }
-
-        fact = factories->next();
+        if ((*it)->supports(source))
+            return (*it)->create(source, input, output, deletable);
     }
 
-    return decoder;
+    return NULL;
 }
 
 
Index: mythplugins/mythmusic/mythmusic/smartplaylist.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/smartplaylist.cpp	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/smartplaylist.cpp	(working copy)
@@ -975,27 +975,26 @@
 
     // criteria Rows
     SmartPLCriteriaRow *row;
-    criteriaRows.setAutoDelete(true);
 
     hbox = new Q3HBoxLayout(vbox, (int)(10 * wmult));
     row = new SmartPLCriteriaRow(this, hbox);
     connect(row, SIGNAL(criteriaChanged(void)), this, SLOT(updateMatches(void)));
-    criteriaRows.append(row);
+    criteriaRows.push_back(row);
 
     hbox = new Q3HBoxLayout(vbox, (int)(10 * wmult));
     row = new SmartPLCriteriaRow(this, hbox);
     connect(row, SIGNAL(criteriaChanged(void)), this, SLOT(updateMatches(void)));
-    criteriaRows.append(row);
+    criteriaRows.push_back(row);
 
     hbox = new Q3HBoxLayout(vbox, (int)(10 * wmult));
     row = new SmartPLCriteriaRow(this, hbox);
     connect(row, SIGNAL(criteriaChanged(void)), this, SLOT(updateMatches(void)));
-    criteriaRows.append(row);
+    criteriaRows.push_back(row);
 
     hbox = new Q3HBoxLayout(vbox, (int)(10 * wmult));
     row = new SmartPLCriteriaRow(this, hbox);
     connect(row, SIGNAL(criteriaChanged(void)), this, SLOT(updateMatches(void)));
-    criteriaRows.append(row);
+    criteriaRows.push_back(row);
 
     hbox = new Q3HBoxLayout(vbox, (int)(10 * wmult));
     message = tr("Order By:");
@@ -1108,6 +1107,11 @@
 SmartPlaylistEditor::~SmartPlaylistEditor(void)
 {
     gContext->removeListener(this);
+    while (!criteriaRows.empty())
+    {
+        delete criteriaRows.back();
+        criteriaRows.pop_back();
+    }
 }
 
 void SmartPlaylistEditor::titleChanged(void)
@@ -1117,32 +1121,27 @@
 
 void SmartPlaylistEditor::updateMatches(void)
 {
-    QString sql = "select count(*) from music_songs "
-                  "LEFT JOIN music_artists ON music_songs.artist_id=music_artists.artist_id "
-                  "LEFT JOIN music_albums ON music_songs.album_id=music_albums.album_id "
-                  "LEFT JOIN music_artists AS music_comp_artists ON "
-                  "music_albums.artist_id=music_comp_artists.artist_id "
-                  "LEFT JOIN music_genres ON music_songs.genre_id=music_genres.genre_id ";
+    QString sql =
+        "SELECT count(*) "
+        "FROM music_songs "
+        "LEFT JOIN music_artists ON "
+        "    music_songs.artist_id=music_artists.artist_id "
+        "LEFT JOIN music_albums ON music_songs.album_id=music_albums.album_id "
+        "LEFT JOIN music_artists AS music_comp_artists ON "
+        "    music_albums.artist_id=music_comp_artists.artist_id "
+        "LEFT JOIN music_genres ON music_songs.genre_id=music_genres.genre_id ";
 
     sql += getWhereClause();
 
+    matchesCount = 0;
+
     MSqlQuery query(MSqlQuery::InitCon());
-    if (query.exec(sql))
-    {
-        if (query.size() > 0)
-        {
-            query.first();
-            matchesCount = query.value(0).toInt();
-        }
-        else
-            matchesCount = 0;
-    }
-    else
-    {
-        matchesCount = 0;
-    }
+    if (!query.exec(sql))
+        MythDB::DBError("SmartPlaylistEditor::updateMatches", query);
+    else if (query.next())
+        matchesCount = query.value(0).toInt();
 
-    matchesLabel->setText(QString().setNum(matchesCount));
+    matchesLabel->setText(QString::number(matchesCount));
 
     bPlaylistIsValid = (matchesCount > 0);
     showResultsButton->setEnabled(matchesCount > 0);
@@ -1210,11 +1209,9 @@
     }
 
     // save smartplaylist items
-    SmartPLCriteriaRow *row;
-    for (row = criteriaRows.first(); row; row = criteriaRows.next())
-    {
-        row->saveToDatabase(ID);
-    }
+    vector<SmartPLCriteriaRow*>::iterator it = criteriaRows.begin();
+    for (; it != criteriaRows.end(); ++it)
+        (*it)->saveToDatabase(ID);
 
     reject();
 }
@@ -1291,9 +1288,9 @@
     if (query.isActive() && query.size() > 0)
     {
         rowCount = query.size();
-        if (rowCount > criteriaRows.count())
+        if (rowCount > criteriaRows.size())
         {
-            rowCount = criteriaRows.count();
+            rowCount = criteriaRows.size();
             VERBOSE(VB_IMPORTANT, QString("Warning:"
                     " got too many smartplaylistitems: %1").arg(rowCount));
         }
@@ -1301,7 +1298,7 @@
         query.first();
         for (uint x = 0; x < rowCount; x++)
         {
-            row = criteriaRows.at(x);
+            row = criteriaRows[x];
             QString Field = query.value(0).toString();
             QString Operator = query.value(1).toString();
             QString Value1 = query.value(2).toString();
@@ -1474,15 +1471,13 @@
 
 QString SmartPlaylistEditor::getWhereClause(void)
 {
-    SmartPLCriteriaRow *row;
-    QString sql, criteria, matchType;
-
     bool bFirst = true;
+    QString sql = "WHERE ";
 
-    sql = "WHERE ";
-    for (row = criteriaRows.first(); row; row = criteriaRows.next())
+    vector<SmartPLCriteriaRow*>::iterator it = criteriaRows.begin();
+    for (; it != criteriaRows.end(); ++it)
     {
-        criteria = row->getSQL();
+        QString criteria = (*it)->getSQL();
         if (criteria.isEmpty())
             continue;
 
Index: mythplugins/mythmusic/mythmusic/lameencoder.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/lameencoder.cpp	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/lameencoder.cpp	(working copy)
@@ -24,9 +24,7 @@
 */
 
 #include <qstring.h>
-#include <q3cstring.h>
 #include <qapplication.h>
-#include <q3progressbar.h>
 
 #include "metadata.h"
 #include "lameencoder.h"
Index: mythplugins/mythmusic/mythmusic/treecheckitem.h
===================================================================
--- mythplugins/mythmusic/mythmusic/treecheckitem.h	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/treecheckitem.h	(working copy)
@@ -6,7 +6,7 @@
 #include <QPixmap>
 
 class QPixmap;
-class PlaylistsContainer;
+class PlaylistContainer;
 class Playlist;
 class Track;
 
Index: mythplugins/mythmusic/mythmusic/databasebox.h
===================================================================
--- mythplugins/mythmusic/mythmusic/databasebox.h	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/databasebox.h	(working copy)
@@ -1,15 +1,12 @@
 #ifndef DATABASEBOX_H_
 #define DATABASEBOX_H_
 
-#include <qwidget.h>
-#include <qdialog.h>
-#include <qstringlist.h>
-#include <qthread.h>
-#include <qtimer.h>
-#include <q3ptrlist.h>
-//Added by qt3to4:
+#include <vector>
+using namespace std;
+
+#include <QStringList>
+#include <QThread>
 #include <QPixmap>
-#include <QKeyEvent>
 
 #include "metadata.h"
 #include "playlist.h"
@@ -18,6 +15,8 @@
 #include <mythtv/uilistbtntype.h>
 
 class TreeCheckItem;
+class QTimer;
+class QKeyEvent;
 
 class ReadCDThread : public QThread
 {
@@ -115,7 +114,7 @@
 
     QStringList         treelevels;
 
-    Q3PtrList<UITextType> m_lines;
+    vector<UITextType*> m_lines;
 };
 
 #endif
Index: mythplugins/mythmusic/mythmusic/metadata.h
===================================================================
--- mythplugins/mythmusic/mythmusic/metadata.h	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/metadata.h	(working copy)
@@ -1,13 +1,14 @@
 #ifndef METADATA_H_
 #define METADATA_H_
 
+// C++
+#include <vector>
+using namespace std;
+
 // qt
-#include <qstring.h>
-#include <qstringlist.h>
-#include <q3ptrlist.h>
-#include <q3valuelist.h>
-#include <qmap.h>
-#include <qthread.h>
+#include <QStringList>
+#include <QMap>
+#include <QThread>
 
 // mythtv
 #include <mythtv/uitypes.h>
@@ -18,7 +19,7 @@
 
 class AllMusic;
 class CoverArt;
-class PlaylistsContainer;
+class PlaylistContainer;
 
 enum ImageType
 {
@@ -170,7 +171,7 @@
     }
     bool determineIfCompilation(bool cd = false);
 
-    void setEmbeddedAlbumArt(Q3ValueList<struct AlbumArtImage> art);
+    void setEmbeddedAlbumArt(const QList<struct AlbumArtImage> &art);
 
     bool isInDatabase(void);
     void dumpToDatabase(void);
@@ -178,7 +179,7 @@
     void getField(const QString& field, QString *data);
     void persist();
     bool hasChanged() {return m_changed;}
-    int compare (Metadata *other);
+    int compare(const Metadata *other) const;
     static void setArtistAndTrackFormats();
 
     static void SetStartdir(const QString &dir);
@@ -217,7 +218,7 @@
     QString m_lastplay;
     int m_playcount;
     bool m_compilation;
-    Q3ValueList<struct AlbumArtImage> m_albumart;
+    QList<struct AlbumArtImage> m_albumart;
 
     unsigned int m_id;
     QString m_filename;
@@ -242,29 +243,10 @@
 bool operator==(const Metadata& a, const Metadata& b);
 bool operator!=(const Metadata& a, const Metadata& b);
 
-class MetadataPtrList : public Q3PtrList<Metadata>
-{
-  public:
-    MetadataPtrList() {}
-    ~MetadataPtrList() {}
-
-  protected:
-    int compareItems(Q3PtrCollection::Item item1,
-                     Q3PtrCollection::Item item2);
-};
-
+typedef QList<Metadata*> MetadataPtrList;
 class MusicNode;
-class MusicNodePtrList : public Q3PtrList<MusicNode>
-{
-  public:
-    MusicNodePtrList() {}
-    ~MusicNodePtrList() {}
+typedef QList<MusicNode*> MusicNodePtrList;
 
-  protected:
-    int compareItems(Q3PtrCollection::Item item1,
-                     Q3PtrCollection::Item item2);
-};
-
 class MusicNode
 {    
   public:
@@ -272,8 +254,8 @@
     MusicNode(const QString &a_title, const QString &tree_level);
    ~MusicNode();
 
-    QString     getTitle(){return my_title;}
-    void        printYourself(int indent_amount);   // debugging
+    QString     getTitle(void) const { return my_title; }
+    void        printYourself(int indent_amount) const;   // debugging
     void        putYourselfOnTheListView(TreeCheckItem *parent, bool show_node);
     void        writeTree(GenericTree *tree_to_write_to, int a_counter);
     void        sort();
@@ -384,7 +366,7 @@
     typedef QMap<int, Metadata*> MusicMap;
     MusicMap music_map;
     
-    typedef Q3ValueList<Metadata>  ValueMetadata;
+    typedef QList<Metadata>       ValueMetadata;
     ValueMetadata                 m_cd_data; //  More than one cd player?
     QString                       m_cd_title;
 
@@ -414,7 +396,7 @@
 
     QString             paths;
     QString             startdir;
-    PlaylistsContainer *all_playlists;
+    PlaylistContainer  *all_playlists;
     AllMusic           *all_music;
     bool                runPost;
 };
@@ -424,22 +406,21 @@
 
 //----------------------------------------------------------------------------
 
-class AlbumArtImages: public QObject
+class AlbumArtImages
 {
-  Q_OBJECT
-
   public:
     AlbumArtImages(Metadata *metadata);
+    ~AlbumArtImages();
 
-    uint                     getImageCount() { return m_imageList.count(); }
-    AlbumArtImage            getImage(ImageType type);
+    typedef vector<AlbumArtImage*> ImageList;
+
+    uint                     getImageCount() { return m_imageList.size(); }
+    AlbumArtImage           *getImage(ImageType type);
     QString                  getTypeName(ImageType type);
-    QStringList              getImageFilenames();
-    Q3PtrList<AlbumArtImage> *getImageList() { return &m_imageList; }
-    AlbumArtImage            getImageAt(uint index);
+    QStringList              getImageFilenames(void) const;
+    ImageList               *getImageList(void) { return &m_imageList; }
+    AlbumArtImage           *getImageAt(uint index);
 
-    bool isImageAvailable(ImageType type);
-
     bool saveImageType(const int id, ImageType type);
 
     static ImageType guessImageType(const QString &filename);
@@ -447,8 +428,8 @@
   private:
     void findImages(void);
 
-    Metadata                *m_parent;
-    Q3PtrList<AlbumArtImage>  m_imageList;
+    Metadata  *m_parent;
+    ImageList  m_imageList;
 };
 
 #endif
Index: mythplugins/mythmusic/mythmusic/editmetadata.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/editmetadata.cpp	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/editmetadata.cpp	(working copy)
@@ -1,17 +1,17 @@
-#include <mythtv/mythcontext.h>
-#include <mythtv/mythdbcon.h>
-#include <mythtv/libmythui/mythuihelper.h>
-#include <qdir.h>
-//Added by qt3to4:
+#include <QDir>
 #include <QKeyEvent>
 #include <QLabel>
-#include <Q3PtrList>
 #include <QPixmap>
+
 #include "editmetadata.h"
 #include "decoder.h"
 #include "genres.h"
 #include "metadata.h"
 
+#include <mythcontext.h>
+#include <mythdbcon.h>
+#include <libmythui/mythuihelper.h>
+
 EditMetadataDialog::EditMetadataDialog(Metadata       *source_metadata,
                                        MythMainWindow *parent,
                                        const QString  &window_name,
@@ -148,11 +148,11 @@
 
 void EditMetadataDialog::updateImageGrid()
 {
-    Q3PtrList<AlbumArtImage> *albumArtList = albumArt->getImageList();
+    vector<AlbumArtImage*> *albumArtList = albumArt->getImageList();
 
     QSize size = coverart_grid->getImageItemSize();
 
-    for (uint x = 0; x < albumArtList->count(); x++)
+    for (uint x = 0; x < albumArtList->size(); x++)
     {
         if (albumArtList->at(x)->embedded)
             continue;
@@ -166,10 +166,10 @@
         coverart_grid->appendItem(item);
     }
 
-    coverart_grid->setItemCount(albumArtList->count());
+    coverart_grid->setItemCount(albumArtList->size());
     coverart_grid->recalculateLayout();
 
-    if (albumArtList->count() > 0)
+    if (!albumArtList->empty())
         gridItemChanged(coverart_grid->getItemAt(0));
 
     coverart_grid->refresh();
@@ -536,7 +536,7 @@
     }
 
     searchDialog->deleteLater();
-    setActiveWindow();
+    activateWindow();
 
     return res;
 }
@@ -653,7 +653,7 @@
     {
         popup->deleteLater();
         popup = NULL;
-        setActiveWindow();
+        activateWindow();
     }
 }
 
Index: mythplugins/mythmusic/mythmusic/treebuilders.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/treebuilders.cpp	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/treebuilders.cpp	(working copy)
@@ -102,10 +102,10 @@
     typedef QMap<QString, Branch*> BranchMap;
     BranchMap branches;
     
-    Metadata *meta;
-    Q3PtrListIterator<Metadata> iter(metas);
-    while ((meta = iter.current()) != 0) 
+    MetadataPtrList::const_iterator it = metas.begin();
+    for (; it != metas.end(); ++it)
     {
+        Metadata *meta = *it;
         if (isLeafDone(meta)) 
         {
             root->addLeaf(meta);
@@ -113,7 +113,7 @@
         else 
         {
             QString field = getField(meta);
-            QString field_key = field.lower();
+            QString field_key = field.toLower();
 
             if (field_key.left(4) == thePrefix) 
                 field_key = field_key.mid(4);
@@ -127,13 +127,11 @@
             }
             branch->list.append(meta);
         }
-
-        ++iter;
     }
 
     for(BranchMap::iterator it = branches.begin(); it != branches.end(); it++) 
     {
-        Branch *branch = it.data();
+        Branch *branch = *it;
         MusicNode *sub_node = createNode(branch->field);
         root->addChild(sub_node);
         makeTree(sub_node, branch->list);
@@ -148,7 +146,7 @@
   public:
     MusicFieldTreeBuilder(const QString &paths) 
     {
-        m_paths = QStringList::split(' ', paths);
+        m_paths = paths.split(' ', QString::SkipEmptyParts);
     }
 
     ~MusicFieldTreeBuilder() 
@@ -198,12 +196,12 @@
 
     QString getSplitField(Metadata *meta, const QString &field) 
     {
-        QString firstchar_str = meta->FormatArtist().stripWhiteSpace();
+        QString firstchar_str = meta->FormatArtist().trimmed();
 
-        if (firstchar_str.left(4).lower() == thePrefix) 
-            firstchar_str = firstchar_str.mid(4,1).upper();
+        if (firstchar_str.left(4).toLower() == thePrefix) 
+            firstchar_str = firstchar_str.mid(4,1).toUpper();
         else 
-            firstchar_str = firstchar_str.left(1).upper();
+            firstchar_str = firstchar_str.left(1).toUpper();
         
         QChar firstchar = firstchar_str[0];
         QString split = m_split_map[firstchar];
@@ -291,7 +289,7 @@
     ~MusicDirectoryTreeBuilder() 
     {
         for(MetaMap::iterator it = m_map.begin(); it != m_map.end(); it++)
-            delete it.data();
+            delete *it;
     }
 
 protected:
@@ -321,7 +319,7 @@
             return paths;
 
         QString filename = meta->Filename().remove(0, getStartdir().length());
-        paths = new QStringList(QStringList::split('/', filename));
+        paths = new QStringList(filename.split('/'));
         m_map[meta] = paths;
         
         return paths;
Index: mythplugins/mythmusic/mythmusic/musicplayer.h
===================================================================
--- mythplugins/mythmusic/mythmusic/musicplayer.h	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/musicplayer.h	(working copy)
@@ -1,8 +1,6 @@
 #ifndef MUSICPLAYER_H_
 #define MUSICPLAYER_H_
 
-#include <iostream>
-
 #include <mythtv/mythdialogs.h>
 #include <mythtv/audiooutput.h>
 
@@ -14,12 +12,8 @@
 
 class MusicPlayer : public QObject
 {
-  //Q_OBJECT
-
   public:
-
      MusicPlayer(QObject *parent, const QString &dev);
-    ~MusicPlayer(void);
 
     void playFile(const QString &filename);
     void playFile(const Metadata &meta);
@@ -111,6 +105,7 @@
     ResumeMode  getResumeMode(void) { return m_resumeMode; }
 
   protected:
+    ~MusicPlayer(void);
     void customEvent(QEvent *event);
 
   private:
Index: mythplugins/mythmusic/mythmusic/avfdecoder.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/avfdecoder.cpp	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/avfdecoder.cpp	(working copy)
@@ -124,7 +124,7 @@
     seekTime = -1.0;
     totalTime = 0.0;
 
-    filename = ((QFile *)input())->name();
+    filename = ((QFile *)input())->fileName();
 
     if (!output_buf)
         output_buf = new char[globalBufferSize];
@@ -137,9 +137,10 @@
 
     // open the media file
     // this should populate the input context
-    int error;
-    error = av_open_input_file(&m_inputContext, filename, m_inputFormat, 0,
-                               m_ap);
+    int error = av_open_input_file(
+        &m_inputContext, filename.toLocal8Bit().constData(),
+        m_inputFormat, 0, m_ap);
+
     if (error < 0)
     {
         VERBOSE(VB_GENERAL, QString("Could open file with the AV decoder. "
@@ -427,14 +428,14 @@
 
 bool avfDecoderFactory::supports(const QString &source) const
 {
-     QStringList list = QStringList::split("|", extension());
-     for (QStringList::Iterator it = list.begin(); it != list.end(); ++it)
-     {
-         if (*it == source.right((*it).length()).lower())
-             return true;
-     }
+    QStringList list = extension().split("|", QString::SkipEmptyParts);
+    for (QStringList::const_iterator it = list.begin(); it != list.end(); ++it)
+    {
+        if (*it == source.right((*it).length()).toLower())
+            return true;
+    }
 
-     return false;
+    return false;
 }
 
 const QString &avfDecoderFactory::extension() const
Index: mythplugins/mythmusic/mythmusic/playlistcontainer.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/playlistcontainer.cpp	(revision 0)
+++ mythplugins/mythmusic/mythmusic/playlistcontainer.cpp	(revision 0)
@@ -0,0 +1,565 @@
+#include <mythcontext.h>
+#include <mythdb.h>
+#include <compat.h>
+
+#include "playlistcontainer.h"
+
+PlaylistLoadingThread::PlaylistLoadingThread(PlaylistContainer *parent_ptr,
+                                             AllMusic *all_music_ptr)
+{
+    parent = parent_ptr;
+    all_music = all_music_ptr;
+}
+
+void PlaylistLoadingThread::run()
+{
+    while(!all_music->doneLoading())
+    {
+        sleep(1);
+    }
+    parent->load();
+}
+
+#define LOC      QString("PlaylistContainer: ")
+#define LOC_WARN QString("PlaylistContainer, Warning: ")
+#define LOC_ERR  QString("PlaylistContainer, Error: ")
+
+void PlaylistContainer::clearCDList()
+{
+    cd_playlist.clear();
+}
+
+void PlaylistContainer::addCDTrack(int track)
+{
+    cd_playlist.push_back(track);
+}
+
+void PlaylistContainer::removeCDTrack(int track)
+{
+    cd_playlist.remove(track);
+}
+
+bool PlaylistContainer::checkCDTrack(int track)
+{
+    list<int>::const_iterator it = 
+        find(cd_playlist.begin(), cd_playlist.end(), track);
+    return it != cd_playlist.end();
+}
+
+PlaylistContainer::PlaylistContainer(AllMusic *all_music, const QString &host_name) :
+    active_playlist(NULL),      backup_playlist(NULL),
+    all_other_playlists(NULL),  all_available_music(all_music),
+    active_widget(NULL),
+
+    playlists_loader(new PlaylistLoadingThread(this, all_music)),
+    done_loading(false),        my_host(host_name),
+
+    RatingWeight(   gContext->GetNumSetting("IntelliRatingWeight",    2)),
+    PlayCountWeight(gContext->GetNumSetting("IntelliPlayCountWeight", 2)),
+    LastPlayWeight( gContext->GetNumSetting("IntelliLastPlayWeight",  2)),
+    RandomWeight(   gContext->GetNumSetting("IntelliRandomWeight",    2))
+{
+    playlists_loader->start();
+}
+
+PlaylistContainer::~PlaylistContainer()
+{
+    playlists_loader->wait();
+    playlists_loader->deleteLater();
+
+    if (active_playlist)
+        delete active_playlist;
+    if (backup_playlist)
+        delete backup_playlist;
+    if (all_other_playlists)
+    {
+        while (!all_other_playlists->empty())
+        {
+            delete all_other_playlists->front();
+            all_other_playlists->pop_front();
+        }
+        delete all_other_playlists;
+    }
+}
+
+void PlaylistContainer::FillIntelliWeights(int &rating, int &playcount,
+                                            int &lastplay, int &random)
+{
+    rating = RatingWeight;
+    playcount = PlayCountWeight;
+    lastplay = LastPlayWeight;
+    random = RandomWeight;
+}
+
+void PlaylistContainer::load()
+{
+    done_loading = false;
+    active_playlist = new Playlist(all_available_music);
+    active_playlist->setParent(this);
+
+    backup_playlist = new Playlist(all_available_music);
+    backup_playlist->setParent(this);
+
+    all_other_playlists = new list<Playlist*>;
+
+    cd_playlist.clear();
+
+    active_playlist->loadPlaylist("default_playlist_storage", my_host);
+    active_playlist->fillSongsFromSonglist(false);
+
+    backup_playlist->loadPlaylist("backup_playlist_storage", my_host);
+    backup_playlist->fillSongsFromSonglist(false);
+
+    MSqlQuery query(MSqlQuery::InitCon());
+    query.prepare("SELECT playlist_id FROM music_playlists "
+                  "WHERE playlist_name != :DEFAULT"
+                  " AND playlist_name != :BACKUP "
+                  " AND (hostname = '' OR hostname = :HOST) "
+                  "ORDER BY playlist_id;");
+    query.bindValue(":DEFAULT", "default_playlist_storage");
+    query.bindValue(":BACKUP", "backup_playlist_storage");
+    query.bindValue(":HOST", my_host);
+
+    if (!query.exec())
+    {
+        MythDB::DBError("Querying playlists", query);
+    }
+    else
+    {
+        while (query.next())
+        {
+            Playlist *temp_playlist = new Playlist(all_available_music);
+            //  No, we don't destruct this ...
+            temp_playlist->setParent(this);
+            temp_playlist->loadPlaylistByID(query.value(0).toInt(), my_host);
+            temp_playlist->fillSongsFromSonglist(false);
+            all_other_playlists->push_back(temp_playlist);
+            //  ... cause it's sitting on this PtrList
+        }
+    }
+    postLoad();
+
+    pending_writeback_index = 0;
+
+    int x = gContext->GetNumSetting("LastMusicPlaylistPush");
+    setPending(x);
+    done_loading = true;
+}
+
+void PlaylistContainer::describeYourself(void) const
+{
+    //    Debugging
+    active_playlist->describeYourself();
+    list<Playlist*>::const_iterator it = all_other_playlists->begin();
+    for (; it != all_other_playlists->end(); ++it)
+        (*it)->describeYourself();
+}
+
+Playlist *PlaylistContainer::getPlaylist(int id)
+{
+    //  return a pointer to a playlist
+    //  by id;
+
+    if (active_playlist->getID() == id)
+    {
+        return active_playlist;
+    }
+
+    list<Playlist*>::iterator it = all_other_playlists->begin();
+    for (; it != all_other_playlists->end(); ++it)
+    {
+        if ((*it)->getID() == id)
+            return *it;
+    }
+
+    VERBOSE(VB_IMPORTANT, "getPlaylistName() called with unknown index number");
+    return NULL;
+}
+
+GenericTree* PlaylistContainer::writeTree(GenericTree *tree_to_write_to)
+{
+    all_available_music->writeTree(tree_to_write_to);
+
+    GenericTree *sub_node
+        = tree_to_write_to->addNode(QObject::tr("All My Playlists"), 1);
+    sub_node->setAttribute(0, 1);
+    sub_node->setAttribute(1, 1);
+    sub_node->setAttribute(2, 1);
+    sub_node->setAttribute(3, 1);
+
+    GenericTree *subsub_node
+        = sub_node->addNode(QObject::tr("Active Play Queue"), 0);
+    subsub_node->setAttribute(0, 0);
+    subsub_node->setAttribute(1, 0);
+    subsub_node->setAttribute(2, rand());
+    subsub_node->setAttribute(3, rand());
+
+    active_playlist->writeTree(subsub_node, 0);
+
+    int a_counter = 0;
+
+    //
+    //  Write the CD playlist (if there's anything in it)
+    //
+
+/*
+    if (cd_playlist.count() > 0)
+    {
+        ++a_counter;
+        QString a_string = QObject::tr("CD: ");
+        a_string += all_available_music->getCDTitle();
+        GenericTree *cd_node = sub_node->addNode(a_string, 0);
+        cd_node->setAttribute(0, 0);
+        cd_node->setAttribute(1, a_counter);
+        cd_node->setAttribute(2, rand());
+        cd_node->setAttribute(3, rand());
+    }
+*/
+
+    //
+    //  Write the other playlists
+    //
+
+    list<Playlist*>::const_iterator it = all_other_playlists->begin();
+    for (; it != all_other_playlists->end(); ++it)
+    {
+        ++a_counter;
+        GenericTree *new_node = sub_node->addNode((*it)->getName(), (*it)->getID());
+        new_node->setAttribute(0, 0);
+        new_node->setAttribute(1, a_counter);
+        new_node->setAttribute(2, rand());
+        new_node->setAttribute(3, rand());
+        (*it)->writeTree(new_node, 0);
+    }
+
+    GenericTree* active_playlist_node = subsub_node->findLeaf();
+    if (!active_playlist_node) active_playlist_node = subsub_node;
+    return active_playlist_node;
+}
+
+void PlaylistContainer::save(void)
+{
+    list<Playlist*>::const_iterator it = all_other_playlists->begin();
+    for (; it != all_other_playlists->end(); ++it)
+    {
+        if ((*it)->hasChanged())
+        {
+            (*it)->fillSonglistFromSongs();
+            (*it)->savePlaylist((*it)->getName(), my_host);
+        }
+    }
+
+    active_playlist->savePlaylist("default_playlist_storage", my_host);
+    backup_playlist->savePlaylist("backup_playlist_storage", my_host);
+}
+
+void PlaylistContainer::createNewPlaylist(QString name)
+{
+    Playlist *new_list = new Playlist(all_available_music);
+    new_list->setParent(this);
+
+    //  Need to touch the database to get persistent ID
+    new_list->savePlaylist(name, my_host);
+    new_list->Changed();
+    all_other_playlists->push_back(new_list);
+    //if (my_widget)
+    //{
+    //    new_list->putYourselfOnTheListView(my_widget);
+    //}
+}
+
+void PlaylistContainer::copyNewPlaylist(QString name)
+{
+    Playlist *new_list = new Playlist(all_available_music);
+    new_list->setParent(this);
+
+    //  Need to touch the database to get persistent ID
+    new_list->savePlaylist(name, my_host);
+    new_list->Changed();
+    all_other_playlists->push_back(new_list);
+    active_playlist->copyTracks(new_list, false);
+    pending_writeback_index = 0;
+    active_widget->setText(QObject::tr("Active Play Queue"));
+    active_playlist->removeAllTracks();
+    active_playlist->addTrack(new_list->getID() * -1, true, false);
+}
+
+void PlaylistContainer::setActiveWidget(PlaylistTitle *widget)
+{
+    active_widget = widget;
+    if (active_widget && pending_writeback_index > 0)
+    {
+        bool bad = false;
+        QString newlabel = QString(QObject::tr("Active Play Queue (%1)"))
+                           .arg(getPlaylistName(pending_writeback_index, bad));
+        active_widget->setText(newlabel);
+    }
+}
+
+void PlaylistContainer::popBackPlaylist()
+{
+    Playlist *destination = getPlaylist(pending_writeback_index);
+    if (!destination)
+    {
+        VERBOSE(VB_IMPORTANT, LOC_WARN + "popBackPlaylist() " +
+                QString("Unknown playlist: %1")
+                .arg(pending_writeback_index));
+        return;
+    }
+    destination->removeAllTracks();
+    destination->Changed();
+    active_playlist->copyTracks(destination, false);
+    active_playlist->removeAllTracks();
+    backup_playlist->copyTracks(active_playlist, true);
+    pending_writeback_index = 0;
+    active_widget->setText(QObject::tr("Active Play Queue"));
+
+    active_playlist->Changed();
+    backup_playlist->Changed();
+}
+
+void PlaylistContainer::copyToActive(int index)
+{
+    backup_playlist->removeAllTracks();
+    active_playlist->copyTracks(backup_playlist, false);
+
+    pending_writeback_index = index;
+    if (active_widget)
+    {
+        bool bad = false;
+        QString newlabel = QString(QObject::tr("Active Play Queue (%1)"))
+            .arg(getPlaylistName(index, bad));
+        active_widget->setText(newlabel);
+    }
+    active_playlist->removeAllTracks();
+    Playlist *copy_from = getPlaylist(index);
+    if (!copy_from)
+    {
+        VERBOSE(VB_IMPORTANT, LOC_ERR + "copyToActive() " +
+                QString("Unknown playlist: %1").arg(index));
+        return;
+    }
+    copy_from->copyTracks(active_playlist, true);
+
+    active_playlist->Changed();
+    backup_playlist->Changed();
+}
+
+
+void PlaylistContainer::renamePlaylist(int index, QString new_name)
+{
+    Playlist *list_to_rename = getPlaylist(index);
+    if (list_to_rename)
+    {
+        list_to_rename->setName(new_name);
+        list_to_rename->Changed();
+        if (list_to_rename->getID() == pending_writeback_index)
+        {
+            QString newlabel = QString(QObject::tr("Active Play Queue (%1)"))
+                .arg(new_name);
+            active_widget->setText(newlabel);
+        }
+    }
+}
+
+void PlaylistContainer::deletePlaylist(int kill_me)
+{
+    Playlist *list_to_kill = getPlaylist(kill_me);
+    if (!list_to_kill)
+    {
+        VERBOSE(VB_IMPORTANT, LOC_ERR + "deletePlaylist() " +
+                QString("Unknown playlist: %1").arg(kill_me));
+        return;
+    }
+    //  First, we need to take out any **track** on any other
+    //  playlist that is actually a reference to this
+    //  playlist
+
+    if (kill_me == pending_writeback_index)
+        popBackPlaylist();
+
+    active_playlist->removeTrack(kill_me * -1, false);
+
+    list<Playlist*>::iterator it = all_other_playlists->begin();
+    for (; it != all_other_playlists->end(); ++it)
+    {
+        if ((*it) != list_to_kill)
+            (*it)->removeTrack(kill_me * -1, false);
+    }
+
+    MSqlQuery query(MSqlQuery::InitCon());
+    query.prepare("DELETE FROM music_playlists WHERE playlist_id = :ID ;");
+    query.bindValue(":ID", kill_me);
+
+    if (!query.exec() || query.numRowsAffected() < 1)
+    {
+        MythDB::DBError("playlist delete", query);
+    }
+    list_to_kill->removeAllTracks();
+    all_other_playlists->remove(list_to_kill);
+}
+
+
+QString PlaylistContainer::getPlaylistName(int index, bool &reference)
+{
+    if (active_playlist)
+    {
+        if (active_playlist->getID() == index)
+        {
+            return active_playlist->getName();
+        }
+
+        list<Playlist*>::const_reverse_iterator it = all_other_playlists->rbegin();
+        for (; it != all_other_playlists->rend(); it++)
+        {
+            if ((*it)->getID() == index)
+                return (*it)->getName();
+        }
+    }
+
+    VERBOSE(VB_IMPORTANT, LOC_ERR +
+            "getPlaylistName() called with unknown index number");
+
+    reference = true;
+    return QObject::tr("Something is Wrong");
+}
+
+void PlaylistContainer::showRelevantPlaylists(TreeCheckItem *alllists)
+{
+    QString templevel, temptitle;
+    int id;
+    //  Deleting anything that's there
+    while (alllists->childCount() > 0)
+    {
+        UIListGenericTree *first_child;
+        first_child = (UIListGenericTree *)(alllists->getChildAt(0));
+        {
+            first_child->RemoveFromParent();
+            //delete first_child;  Deleted by GenericTree.
+        }
+    }
+
+    //  Add everything but the current playlist
+    list<Playlist*>::iterator it = all_other_playlists->begin();
+    for (; it != all_other_playlists->end(); ++it)
+    {
+        id = (*it)->getID() * -1 ;
+        temptitle = (*it)->getName();
+        templevel = "playlist";
+
+        TreeCheckItem *some_item = new TreeCheckItem(alllists, temptitle,
+                                                     templevel, id);
+
+        some_item->setCheckable(true);
+        some_item->setActive(true);
+
+        if ((*it)->containsReference(pending_writeback_index, 0) ||
+            (id * -1) == pending_writeback_index)
+        {
+            some_item->setCheckable(false);
+            some_item->setActive(false);
+        }
+
+        (*it)->putYourselfOnTheListView(some_item);
+    }
+
+    if (alllists->childCount() == 0)
+        alllists->setCheckable(false);
+    else
+        alllists->setCheckable(true);
+}
+
+void PlaylistContainer::refreshRelevantPlaylists(TreeCheckItem *alllists)
+{
+    if (alllists->childCount() == 0)
+    {
+        alllists->setCheckable(false);
+        return;
+    }
+
+    UIListGenericTree *walker = (UIListGenericTree *)(alllists->getChildAt(0));
+    while (walker)
+    {
+        if (TreeCheckItem *check_item = dynamic_cast<TreeCheckItem*>(walker))
+        {
+            int id = check_item->getID() * -1;
+            Playlist *check_playlist = getPlaylist(id);
+            if ((check_playlist &&
+                check_playlist->containsReference(pending_writeback_index, 0))
+               || id == pending_writeback_index)
+            {
+                check_item->setCheckable(false);
+                check_item->setActive(false);
+            }
+            else
+            {
+                check_item->setCheckable(true);
+                check_item->setActive(true);
+            }
+        }
+        walker = (UIListGenericTree *)(walker->nextSibling(1));
+    }
+
+    alllists->setCheckable(true);
+}
+
+void PlaylistContainer::postLoad()
+{
+    //  Now that everything is loaded, we need to recheck all
+    //  tracks and update those that refer to a playlist
+
+    active_playlist->postLoad();
+    backup_playlist->postLoad();
+
+    list<Playlist*>::iterator it = all_other_playlists->begin();
+    for (; it != all_other_playlists->end(); ++it)
+        (*it)->postLoad();
+}
+
+bool PlaylistContainer::pendingWriteback()
+{
+    if (pending_writeback_index > 0)
+    {
+        return true;
+    }
+    return false;
+}
+
+bool PlaylistContainer::nameIsUnique(QString a_name, int which_id)
+{
+    if (a_name == "default_playlist_storage")
+        return false;
+
+    if (a_name == "backup_playlist_storage")
+        return false;
+
+    list<Playlist*>::iterator it = all_other_playlists->begin();
+    for (; it != all_other_playlists->end(); ++it)
+    {
+        if ((*it)->getName() == a_name && (*it)->getID() != which_id)
+            return false;
+    }
+
+    return true;
+}
+
+bool PlaylistContainer::cleanOutThreads()
+{
+    if (playlists_loader->isFinished())
+    {
+        return true;
+    }
+    playlists_loader->wait();
+    return false;
+}
+
+void PlaylistContainer::clearActive()
+{
+    backup_playlist->removeAllTracks();
+    active_playlist->removeAllTracks();
+    backup_playlist->Changed();
+    active_playlist->Changed();
+    pending_writeback_index = 0;
+    active_widget->setText(QObject::tr("Active Play Queue"));
+}
+
Index: mythplugins/mythmusic/mythmusic/metaiotaglib.h
===================================================================
--- mythplugins/mythmusic/mythmusic/metaiotaglib.h	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/metaiotaglib.h	(working copy)
@@ -1,16 +1,17 @@
 #ifndef METAIOTAGLIB_H_
 #define METAIOTAGLIB_H_
 
-#include "metaio.h"
-#include "metadata.h"
 #include <id3v2tag.h>
 #include <textidentificationframe.h>
 #include <attachedpictureframe.h>
 #include <mpegfile.h>
 #include <mpegproperties.h>
-//Added by qt3to4:
-#include <Q3ValueList>
 
+#include <QList>
+
+#include "metaio.h"
+#include "metadata.h"
+
 using TagLib::MPEG::File;
 using TagLib::Tag;
 using TagLib::ID3v2::UserTextIdentificationFrame;
@@ -19,7 +20,7 @@
 using TagLib::String;
 using TagLib::MPEG::Properties;
 
-typedef Q3ValueList<struct AlbumArtImage> AlbumArtList;
+typedef QList<struct AlbumArtImage> AlbumArtList;
 
 class MetaIOTagLib : public MetaIO
 {
Index: mythplugins/mythmusic/mythmusic/smartplaylist.h
===================================================================
--- mythplugins/mythmusic/mythmusic/smartplaylist.h	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/smartplaylist.h	(working copy)
@@ -1,15 +1,17 @@
 #ifndef SMARTPLAYLIST_H_
 #define SMARTPLAYLIST_H_
 
-#include <qdatetime.h>
-#include <qlayout.h>
-#include <q3hbox.h>
-#include <qvariant.h>
+#include <vector>
+using namespace std;
+
+#include <QDateTime>
+#include <QVariant>
+#include <QKeyEvent>
 //Added by qt3to4:
+#include <QLayout>
+#include <QLabel>
+#include <Q3HBox>
 #include <Q3HBoxLayout>
-#include <QLabel>
-#include <Q3PtrList>
-#include <QKeyEvent>
 #include <Q3VBoxLayout>
 
 #include <mythtv/mythwidgets.h>
@@ -155,7 +157,7 @@
     QAbstractButton            *renameCategoryButton;
     QAbstractButton            *deleteCategoryButton;
     
-    Q3PtrList<SmartPLCriteriaRow> criteriaRows;
+    vector<SmartPLCriteriaRow*> criteriaRows;
     int matchesCount;
     bool bNewPlaylist;
     bool bPlaylistIsValid;
Index: mythplugins/mythmusic/mythmusic/databasebox.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/databasebox.cpp	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/databasebox.cpp	(working copy)
@@ -1,18 +1,16 @@
+// C
 #include <cstdlib>
+
+// C++
 #include <iostream>
-//Added by qt3to4:
-#include <QKeyEvent>
-#include <Q3PtrList>
 using namespace std;
 
 // qt
-#include <qapplication.h>
-#include <qstringlist.h>
-#include <qpixmap.h>
-#include <qregexp.h>
-#include <q3frame.h>
-#include <qlayout.h>
-#include <qevent.h>
+#include <QApplication>
+#include <QKeyEvent>
+#include <QRegExp>
+#include <QLayout>
+#include <QEvent>
 
 // mythtv
 #include <mythtv/dialogbox.h>
@@ -26,7 +24,7 @@
 #include "databasebox.h"
 #include "treecheckitem.h"
 #include "cddecoder.h"
-#include "playlist.h"
+#include "playlistcontainer.h"
 #include "musicplayer.h"
 #ifndef USING_MINGW
 #include "cddecoder.h"
@@ -52,7 +50,7 @@
     cd_checking_flag = gContext->GetNumSetting("AutoLookupCD");
 
     QString treelev = gContext->GetSetting("TreeLevels", "artist album title");
-    QStringList treelevels = QStringList::split(" ", treelev.lower());
+    QStringList treelevels = treelev.toLower().split(" ");
 
     active_popup = NULL;
     active_pl_edit = NULL;
@@ -88,10 +86,10 @@
     {
         QString linename = QString("line%1").arg(i);
         if ((line = getUITextType(linename)))
-            m_lines.append(line);
+            m_lines.push_back(line);
     }
 
-    if (m_lines.count() < 3)
+    if (m_lines.size() < 3)
     {
         DialogBox *dlg = new DialogBox(
             gContext->GetMainWindow(),
@@ -234,8 +232,9 @@
 
 void DatabaseBox::occasionallyCheckCD()
 {
-    if (cd_reader_thread->getLock()->locked())
+    if (!cd_reader_thread->getLock()->tryLock())
         return;
+    cd_reader_thread->getLock()->unlock();
 
     if (cd_reader_thread->statusChanged())
     {
@@ -245,7 +244,7 @@
             fillCD();
         }
     }
-    if (!cd_reader_thread->running())
+    if (!cd_reader_thread->isRunning())
         cd_reader_thread->start();
 }
 
@@ -700,7 +699,7 @@
         }
 
         // Pre increment as not incremented from previous use.
-        while (++line < m_lines.count())
+        while (++line < (unsigned) m_lines.size())
           m_lines.at(line)->SetText("");
 
         // Don't forget to delete the mdata storage if we allocated it.
@@ -749,7 +748,7 @@
         dispat++;
     }
 
-    for (unsigned int i = dispat; i < m_lines.count(); i++)
+    for (unsigned int i = dispat; i < (unsigned) m_lines.size(); i++)
         m_lines.at(i)->SetText("");
 }
 
Index: mythplugins/mythmusic/mythmusic/vcedit.c
===================================================================
--- mythplugins/mythmusic/mythmusic/vcedit.c	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/vcedit.c	(working copy)
@@ -100,7 +100,7 @@
 /* Next two functions pulled straight from libvorbis, apart from one change
  * - we don't want to overwrite the vendor string.
  */
-static void _v_writestring(oggpack_buffer *o,char *s, int len)
+static void _v_writestring(oggpack_buffer *o,const char *s, int len)
 {
 	while(len--)
 	{
Index: mythplugins/mythmusic/mythmusic/main.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/main.cpp	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/main.cpp	(working copy)
@@ -25,7 +25,7 @@
 #include "metadata.h"
 #include "databasebox.h"
 #include "playbackbox.h"
-#include "playlist.h"
+#include "playlistcontainer.h"
 #include "globalsettings.h"
 #include "dbcheck.h"
 #include "filescanner.h"
@@ -218,7 +218,7 @@
 {
     (void) data;
 
-    QString sel = selection.lower();
+    QString sel = selection.toLower();
     if (sel == "music_create_playlist")
         startDatabaseTree();
     else if (sel == "music_play")
@@ -443,7 +443,7 @@
 
     //  Load all available info about songs (once!)
     QString startdir = gContext->GetSetting("MusicLocation");
-    startdir = QDir::cleanDirPath(startdir);
+    startdir = QDir::cleanPath(startdir);
     if (!startdir.endsWith("/"))
         startdir += "/";
 
@@ -468,7 +468,8 @@
     AllMusic *all_music = new AllMusic(paths, startdir);
 
     //  Load all playlists into RAM (once!)
-    PlaylistsContainer *all_playlists = new PlaylistsContainer(all_music, gContext->GetHostName());
+    PlaylistContainer *all_playlists = new PlaylistContainer(
+        all_music, gContext->GetHostName());
 
     gMusicData->paths = paths;
     gMusicData->startdir = startdir;
@@ -512,7 +513,7 @@
     gMusicData->runPost = false;
     gMusicData->paths = gContext->GetSetting("TreeLevels");
     gMusicData->startdir = gContext->GetSetting("MusicLocation");
-    gMusicData->startdir = QDir::cleanDirPath(gMusicData->startdir);
+    gMusicData->startdir = QDir::cleanPath(gMusicData->startdir);
 
     if (!gMusicData->startdir.endsWith("/"))
         gMusicData->startdir += "/";
@@ -528,7 +529,7 @@
 
 void mythplugin_destroy(void)
 {
-    delete gPlayer;
+    gPlayer->deleteLater();
     delete gMusicData;
 }
 
Index: mythplugins/mythmusic/mythmusic/musicplayer.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/musicplayer.cpp	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/musicplayer.cpp	(working copy)
@@ -1,17 +1,11 @@
 // ANSI C includes
 #include <cstdlib>
 
-// C++ includes
-#include <iostream>
-#include <Q3ValueList>
-
-using namespace std;
-
 // qt
-#include <qapplication.h>
-#include <q3url.h>
-#include <qwidget.h>
+#include <QApplication>
+#include <QWidget>
 #include <QFile>
+#include <QList>
 
 // mythtv
 #include <mythtv/mythcontext.h>
@@ -25,7 +19,7 @@
 #include "constants.h"
 #include "mainvisual.h"
 #include "miniplayer.h"
-#include "playlist.h"
+#include "playlistcontainer.h"
 
 // how long to wait before updating the lastplay and playcount fields
 #define LASTPLAY_DELAY 15
@@ -58,29 +52,29 @@
     m_playSpeed = 1.0;
 
     QString playmode = gContext->GetSetting("PlayMode", "none");
-    if (playmode.lower() == "random")
+    if (playmode.toLower() == "random")
         setShuffleMode(SHUFFLE_RANDOM);
-    else if (playmode.lower() == "intelligent")
+    else if (playmode.toLower() == "intelligent")
         setShuffleMode(SHUFFLE_INTELLIGENT);
-    else if (playmode.lower() == "album")
+    else if (playmode.toLower() == "album")
         setShuffleMode(SHUFFLE_ALBUM);
-    else if (playmode.lower() == "artist")
+    else if (playmode.toLower() == "artist")
         setShuffleMode(SHUFFLE_ARTIST);
     else
         setShuffleMode(SHUFFLE_OFF);
 
     QString repeatmode = gContext->GetSetting("RepeatMode", "all");
-    if (repeatmode.lower() == "track")
+    if (repeatmode.toLower() == "track")
         setRepeatMode(REPEAT_TRACK);
-    else if (repeatmode.lower() == "all")
+    else if (repeatmode.toLower() == "all")
         setRepeatMode(REPEAT_ALL);
     else
         setRepeatMode(REPEAT_OFF);
 
     QString resumestring = gContext->GetSetting("ResumeMode", "off");
-    if (resumestring.lower() == "off")
+    if (resumestring.toLower() == "off")
         m_resumeMode = RESUME_OFF;
-    else if (resumestring.lower() == "track")
+    else if (resumestring.toLower() == "track")
         m_resumeMode = RESUME_TRACK;
     else
         m_resumeMode = RESUME_EXACT;
@@ -326,7 +320,7 @@
 
 void MusicPlayer::stopDecoder(void)
 {
-    if (m_decoder && m_decoder->running())
+    if (m_decoder && m_decoder->isRunning())
     {
         m_decoder->lock();
         m_decoder->stop();
@@ -666,11 +660,11 @@
 
 void MusicPlayer::restorePosition(const QString &position)
 {
-    Q3ValueList <int> branches_to_current_node;
+    QList<int> branches_to_current_node;
 
     if (position != "")
     {
-        QStringList list = QStringList::split(",", position);
+        QStringList list = position.split(",", QString::SkipEmptyParts);
 
         for (QStringList::Iterator it = list.begin(); it != list.end(); ++it)
             branches_to_current_node.append((*it).toInt());
@@ -707,7 +701,7 @@
         m_output->Reset();
         m_output->SetTimecode(pos*1000);
 
-        if (m_decoder && m_decoder->running())
+        if (m_decoder && m_decoder->isRunning())
         {
             m_decoder->lock();
             m_decoder->seek(pos);
Index: mythplugins/mythmusic/mythmusic/metaiotaglib.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/metaiotaglib.cpp	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/metaiotaglib.cpp	(working copy)
@@ -1,12 +1,16 @@
-#include <math.h>
+#include <cmath>
 
 #include "metaiotaglib.h"
 #include "metadata.h"
 
-#include <mythtv/mythcontext.h>
-//Added by qt3to4:
-#include <Q3ValueList>
+#include <mythverbose.h>
 
+#undef QStringToTString
+#define QStringToTString(s) TagLib::String(s.toUtf8().data(), TagLib::String::UTF8)
+#undef TStringToQString
+#define TStringToQString(s) QString::fromUtf8(s.toCString(true))
+
+
 MetaIOTagLib::MetaIOTagLib(void)
     : MetaIO(".mp3")
 {
@@ -129,7 +133,7 @@
             genre = "";
     int year = 0, tracknum = 0, length = 0, playcount = 0, rating = 0, id = 0;
     bool compilation = false;
-    Q3ValueList<struct AlbumArtImage> albumart;
+    QList<struct AlbumArtImage> albumart;
 
     QString extension = filename.section( '.', -1 ) ;
 
@@ -148,12 +152,12 @@
     // Basic Tags
     if (! tag->isEmpty())
     {
-        title = TStringToQString(tag->title()).stripWhiteSpace();
-        artist = TStringToQString(tag->artist()).stripWhiteSpace();
-        album = TStringToQString(tag->album()).stripWhiteSpace();
+        title = TStringToQString(tag->title()).trimmed();
+        artist = TStringToQString(tag->artist()).trimmed();
+        album = TStringToQString(tag->album()).trimmed();
         tracknum = tag->track();
         year = tag->year();
-        genre = TStringToQString(tag->genre()).stripWhiteSpace();
+        genre = TStringToQString(tag->genre()).trimmed();
     }
 
     // ID3V2 Only Tags
@@ -164,7 +168,7 @@
         {
             compilation_artist = TStringToQString(
             taglib->ID3v2Tag()->frameListMap()["TPE4"].front()->toString())
-            .stripWhiteSpace();
+                .trimmed();
         }
 
         // Look for MusicBrainz Album+Artist ID in TXXX Frame
@@ -323,9 +327,8 @@
  */
 AlbumArtList MetaIOTagLib::readAlbumArt(TagLib::ID3v2::Tag *tag)
 {
+    QList<struct AlbumArtImage> artlist;
 
-    Q3ValueList<struct AlbumArtImage> artlist;
-
     if (!tag->frameListMap()["APIC"].isEmpty())
     {
         TagLib::ID3v2::FrameList apicframes = tag->frameListMap()["APIC"];
Index: mythplugins/mythmusic/mythmusic/playbackbox.h
===================================================================
--- mythplugins/mythmusic/mythmusic/playbackbox.h	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/playbackbox.h	(working copy)
@@ -2,10 +2,8 @@
 #define PLAYBACKBOX_H_
 
 // qt
-#include <qtimer.h>
-#include <qmutex.h>
-#include <q3valuevector.h>
 #include <QKeyEvent>
+#include <q3valuevector.h>
 
 // mythtv
 #include <mythtv/mythwidgets.h>
@@ -22,6 +20,7 @@
 
 class Output;
 class Decoder;
+class QTimer;
 
 class PlaybackBoxMusic : public MythThemedDialog
 {
Index: mythplugins/mythmusic/mythmusic/mainvisual.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/mainvisual.cpp	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/mainvisual.cpp	(working copy)
@@ -74,16 +74,17 @@
     int y = size.height() / 2 - height / 2;
 
     for (int offset = 0; offset < height; offset += fm.height()) {
-        QString l = warning.left(warning.find("\n"));
+        QString l = warning.left(warning.indexOf("\n"));
         p->drawText(x, y + offset, width, height, Qt::AlignCenter, l);
         warning.remove(0, l.length () + 1);
     }
 }
 
 MainVisual::MainVisual(QWidget *parent, const char *name)
-    : QWidget(parent, name), vis(0), meta(0), playing(FALSE), fps(20),
+    : QWidget(parent), vis(0), meta(0), playing(FALSE), fps(20),
       timer (0), bannerTimer(0), info_widget(0)
 {
+    setObjectName(name);
     int screenwidth = 0, screenheight = 0;
     float wmult = 0, hmult = 0;
 
@@ -121,8 +122,11 @@
     delete bannerTimer;
     bannerTimer = 0;
 
-    nodes.setAutoDelete(TRUE);
-    nodes.clear();
+    while (!nodes.empty())
+    {
+        delete nodes.back();
+        nodes.pop_back();
+    }
 }
 
 void MainVisual::setVisual(const QString &name)
@@ -167,9 +171,11 @@
 
 void MainVisual::prepare()
 {
-    nodes.setAutoDelete(TRUE);
-    nodes.clear();
-    nodes.setAutoDelete(FALSE);
+    while (!nodes.empty())
+    {
+        delete nodes.back();
+        nodes.pop_back();
+    }
 }
 
 void MainVisual::add(uchar *b, unsigned long b_len, unsigned long w, int c, int p)
@@ -219,19 +225,21 @@
         return;
     }
 
-    VisualNode *node = 0;
-
+    VisualNode *node = NULL;
     if (playing && output())
     {
         long synctime = output()->GetAudiotime();
         mutex()->lock();
-        VisualNode *prev = 0;
-        while ((node = nodes.first()))
+        VisualNode *prev = NULL;
+        while (!nodes.empty())
         {
+            node = nodes.front();
             if (node->offset > synctime)
                 break;
-            delete prev;
-            nodes.removeFirst();
+            nodes.pop_front();
+
+            if (prev)
+                delete prev;
             prev = node;
         }
         mutex()->unlock();
@@ -443,7 +451,7 @@
         QString info_copy = info;
         for (int offset = 0; offset < textHeight; offset += fm.height())
         {
-            QString l = info_copy.left(info_copy.find("\n"));
+            QString l = info_copy.left(info_copy.indexOf("\n"));
             p.setPen(Qt::black);
             p.drawText(x + 2, y + offset + 2, textWidth, textHeight, Qt::AlignLeft, l);
             p.setPen(Qt::white);
@@ -489,7 +497,7 @@
     QString info_copy = info;
     for (int offset = 0; offset < textHeight; offset += fm.height())
     {
-        QString l = info_copy.left(info_copy.find("\n"));
+        QString l = info_copy.left(info_copy.indexOf("\n"));
         p.setPen(Qt::black);
         p.drawText(x + 2, y + offset + 2, textWidth, textHeight, Qt::AlignLeft, l);
         p.setPen(Qt::white);
@@ -527,7 +535,7 @@
     uint os = magnitudes.size();
     magnitudes.resize( size.width() * 2 );
     for ( ; os < magnitudes.size(); os++ )
-    magnitudes[os] = 0.0;
+        magnitudes[os] = 0.0;
 }
 
 bool StereoScope::process( VisualNode *node )
Index: mythplugins/mythmusic/mythmusic/playlistcontainer.h
===================================================================
--- mythplugins/mythmusic/mythmusic/playlistcontainer.h	(revision 0)
+++ mythplugins/mythmusic/mythmusic/playlistcontainer.h	(revision 0)
@@ -0,0 +1,90 @@
+#ifndef _PLAYLIST_CONTAINER_H_
+#define _PLAYLIST_CONTAINER_H_
+
+#include <QThread>
+
+#include "playlist.h"
+
+class PlaylistLoadingThread : public QThread
+{
+  public:
+    PlaylistLoadingThread(PlaylistContainer *parent_ptr,
+                          AllMusic *all_music_ptr);
+    virtual void run();
+    
+  private:  
+    PlaylistContainer *parent;
+    AllMusic          *all_music;
+};
+
+class PlaylistContainer
+{
+  public:
+    PlaylistContainer(AllMusic *all_music, const QString &host_name);
+   ~PlaylistContainer();
+
+    void            load();
+    void            describeYourself(void) const;    // debugging
+
+    Playlist*       getActive(void) { return active_playlist; }
+    Playlist*       getPlaylist(int id);
+
+    void            setActiveWidget(PlaylistTitle *widget);
+    PlaylistTitle*  getActiveWidget(void) { return active_widget; }
+
+    GenericTree*    writeTree(GenericTree *tree_to_write_to);
+    void            clearCDList();
+    void            addCDTrack(int x);
+    void            removeCDTrack(int x);
+    bool            checkCDTrack(int x);
+    void            save();
+
+    void            createNewPlaylist(QString name);
+    void            copyNewPlaylist(QString name);
+    void            copyToActive(int index);
+
+    void            showRelevantPlaylists(TreeCheckItem *alllist);
+    void            refreshRelevantPlaylists(TreeCheckItem *alllist);
+
+    QString         getPlaylistName(int index, bool &reference);
+
+    void            postLoad();
+
+    void            deletePlaylist(int index);
+    void            renamePlaylist(int index, QString new_name);
+
+    void            popBackPlaylist();
+    bool            pendingWriteback();
+    void            setPending(int x){pending_writeback_index = x;}
+    int             getPending(){return pending_writeback_index;}
+
+    bool            nameIsUnique(QString a_name, int which_id);
+
+    void            clearActive();
+
+    bool            doneLoading(){return done_loading;}
+
+    bool            cleanOutThreads();
+
+    void            FillIntelliWeights(int &rating, int &playcount,
+                                       int &lastplay, int &random);
+  private:  
+    Playlist            *active_playlist;
+    Playlist            *backup_playlist;
+    list<int>            cd_playlist;
+    list<Playlist*>     *all_other_playlists;
+    AllMusic            *all_available_music;
+    PlaylistTitle       *active_widget;
+    int                 pending_writeback_index;
+    
+    PlaylistLoadingThread  *playlists_loader;
+    bool                    done_loading;
+    QString                 my_host;
+
+    int RatingWeight;
+    int PlayCountWeight;
+    int LastPlayWeight;
+    int RandomWeight;
+};
+
+#endif // _PLAYLIST_CONTAINER_H_
Index: mythplugins/mythmusic/mythmusic/importmusic.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/importmusic.cpp	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/importmusic.cpp	(working copy)
@@ -555,7 +555,7 @@
         ++it;
         if (fi->fileName() == "." || fi->fileName() == "..")
             continue;
-        QString filename = fi->absFilePath();
+        QString filename = fi->absoluteFilePath();
         if (fi->isDir())
             scanDirectory(filename, tracks);
         else
@@ -1087,13 +1087,13 @@
     QFileInfo fi(filename);
     filename = fi.fileName();
 
-    if (filename.contains("front", false) > 0)
+    if (filename.contains("front", Qt::CaseInsensitive) > 0)
         m_type_selector->setToItem(tr("Front Cover"));
-    else if (filename.contains("back", false) > 0)
+    else if (filename.contains("back", Qt::CaseInsensitive) > 0)
         m_type_selector->setToItem(tr("Back Cover"));
-    else if (filename.contains("inlay", false) > 0)
+    else if (filename.contains("inlay", Qt::CaseInsensitive) > 0)
         m_type_selector->setToItem(tr("Inlay"));
-    else if (filename.contains("cd", false) > 0)
+    else if (filename.contains("cd", Qt::CaseInsensitive) > 0)
         m_type_selector->setToItem(tr("CD"));
     else
         m_type_selector->setToItem(tr("<Unknown>"));
Index: mythplugins/mythmusic/mythmusic/cddecoder.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/cddecoder.cpp	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/cddecoder.cpp	(working copy)
@@ -258,7 +258,7 @@
 void CdDecoder::setCDSpeed(int speed)
 {
     QMutexLocker lock(getMutex());
-    MediaMonitor::SetCDSpeed(devicename, speed);
+    MediaMonitor::SetCDSpeed(devicename.toLocal8Bit().constData(), speed);
 }
 
 int CdDecoder::getNumTracks(void)
@@ -408,7 +408,7 @@
 
     compilation_artist = M_QSTRING_UNICODE(discdata.data_artist);
 
-    if (compilation_artist.lower().left(7) == "various")
+    if (compilation_artist.toLower().left(7) == "various")
     {
         compilation_artist = QObject::tr("Various Artists");
     }
@@ -419,8 +419,8 @@
 
     if (!genre.isEmpty())
     {
-        QString flet = genre.upper().left(1);
-        QString rt = genre.right(genre.length()-1).lower();
+        QString flet = genre.toUpper().left(1);
+        QString rt = genre.right(genre.length()-1).toLower();
         genre = flet + rt;
     }
 
@@ -547,7 +547,7 @@
 
 bool CdDecoderFactory::supports(const QString &source) const
 {
-    return (source.right(extension().length()).lower() == extension());
+    return (source.right(extension().length()).toLower() == extension());
 }
 
 const QString &CdDecoderFactory::extension() const
Index: mythplugins/mythmusic/mythmusic/metaio.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/metaio.cpp	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/metaio.cpp	(working copy)
@@ -13,7 +13,7 @@
 MetaIO::MetaIO(QString fileExtension)
     : mFileExtension(fileExtension)
 {
-    mFilenameFormat = gContext->GetSetting("NonID3FileNameFormat").upper();
+    mFilenameFormat = gContext->GetSetting("NonID3FileNameFormat").toUpper();
 }
 
 
@@ -44,8 +44,8 @@
     static QString regext = mFileExtension + "$";
     int part_num = 0;
     filename.replace(QRegExp(QString("_")), QString(" "));
-    filename.replace(QRegExp(regext, FALSE), QString(""));
-    QStringList fmt_list = QStringList::split("/", mFilenameFormat);
+    filename.replace(QRegExp(regext, Qt::CaseInsensitive), QString(""));
+    QStringList fmt_list = mFilenameFormat.split("/");
     QStringList::iterator fmt_it = fmt_list.begin();
 
     // go through loop once to get minimum part number
@@ -67,22 +67,22 @@
             title = part_str;
         else if ( *fmt_it == "TRACK_TITLE" ) 
         {
-            QStringList tracktitle_list = QStringList::split("-", part_str);
+            QStringList tracktitle_list = part_str.split("-");
             if (tracktitle_list.size() > 1)
             {
                 tracknum = tracktitle_list[0].toInt();
-                title = tracktitle_list[1].simplifyWhiteSpace();
+                title = tracktitle_list[1].simplified();
             }
             else
                 title = part_str;
         }
         else if ( *fmt_it == "ARTIST_TITLE" ) 
         {
-            QStringList artisttitle_list = QStringList::split("-", part_str);
+            QStringList artisttitle_list = part_str.split("-");
             if (artisttitle_list.size() > 1)
             {
-                artist = artisttitle_list[0].simplifyWhiteSpace();
-                title = artisttitle_list[1].simplifyWhiteSpace();
+                artist = artisttitle_list[0].simplified();
+                title = artisttitle_list[1].simplified();
             }
             else
             {
Index: mythplugins/mythmusic/mythmusic/goom/graphic.h
===================================================================
--- mythplugins/mythmusic/mythmusic/goom/graphic.h	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/goom/graphic.h	(working copy)
@@ -18,7 +18,7 @@
 extern const Color ORANGE;
 extern const Color VIOLET;
 
-inline void setPixelRGB (Uint * buffer, Uint x, Uint y, Color c);
-inline void getPixelRGB (Uint * buffer, Uint x, Uint y, Color * c);
+//inline void setPixelRGB (Uint * buffer, Uint x, Uint y, Color c);
+//inline void getPixelRGB (Uint * buffer, Uint x, Uint y, Color * c);
 
 #endif /* GRAPHIC_H */
Index: mythplugins/mythmusic/mythmusic/streaminput.h
===================================================================
--- mythplugins/mythmusic/mythmusic/streaminput.h	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/streaminput.h	(working copy)
@@ -1,5 +1,3 @@
-//Added by qt3to4:
-#include <Q3CString>
 // Copyright (c) 2000-2001 Brad Hughes <bhughes@trolltech.com>
 //
 // Use, modification and distribution is allowed without limitation,
@@ -11,33 +9,31 @@
 
 class StreamInput;
 
-#include <q3url.h>
-#include <q3socket.h>
+#include <QUrl>
+#include <QTcpSocket>
 
-
 class StreamInput : public QObject
 {
     Q_OBJECT
-public:
-    StreamInput(const Q3Url &);
 
-    QIODevice *socket() { return sock; }
+  public:
+    StreamInput(const QUrl&);
 
-    void setup();
+    QIODevice *GetSocket(void) { return sock; }
 
+    void Setup(void);
 
-private slots:
-    void hostfound();
-    void connected();
-    void readyread();
-    void error(int);
+  private slots:
+    void HostFound(void);
+    void Connected(void);
+    void ReadyRead(void);
+    void Error(QAbstractSocket::SocketError);
 
-
-private:
-    Q3CString request;
-    Q3Url url;
-    Q3Socket *sock;
-    int stage;
+  private:
+    QString     request;
+    QUrl        url;
+    QTcpSocket *sock;
+    int         stage;
 };
 
 
Index: mythplugins/mythmusic/mythmusic/visualize.h
===================================================================
--- mythplugins/mythmusic/mythmusic/visualize.h	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/visualize.h	(working copy)
@@ -12,6 +12,9 @@
 #ifndef VISUALIZE_H
 #define VISUALIZE_H
 
+#include <vector>
+using namespace std;
+
 #include <mythtv/visual.h>
 #include "mainvisual.h"
 #include "metadata.h"
@@ -19,8 +22,6 @@
 #include "config.h"
 
 #include <complex>
-//Added by qt3to4:
-#include <Q3MemArray>
 extern "C" {
 #ifdef FFTW3_SUPPORT
 #include <fftw3.h>
@@ -63,8 +64,8 @@
     inline double clamp(double cur, double max, double min);
 
     QColor startColor, targetColor;
-    Q3MemArray<QRect> rects;
-    Q3MemArray<double> magnitudes;
+    vector<QRect> rects;
+    vector<double> magnitudes;
     QSize size;
     LogScale scale;
     double scaleFactor, falloff;
@@ -159,8 +160,8 @@
 		
   private:
     QColor startColor, targetColor;
-    Q3MemArray<QRect> rects;
-    Q3MemArray<double> magnitudes;
+    vector<QRect> rects;
+    vector<double> magnitudes;
     QSize size;
     LogScale scale;
     double scaleFactor, falloff;
Index: mythplugins/mythmusic/mythmusic/metaiooggvorbiscomment.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/metaiooggvorbiscomment.cpp	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/metaiooggvorbiscomment.cpp	(working copy)
@@ -70,10 +70,10 @@
         {
             // find the tagname
             tmp = pComment->user_comments[i];
-            int tag = tmp.find('=');
+            int tag = tmp.indexOf('=');
             if (tag)
             {
-                tmp = tmp.left(tag).upper();
+                tmp = tmp.left(tag).toUpper();
                 if (MYTH_VORBISCOMMENT_ARTIST != tmp
                     && MYTH_VORBISCOMMENT_COMPILATIONARTIST != tmp
                     && MYTH_VORBISCOMMENT_TITLE != tmp
@@ -209,7 +209,7 @@
     QString newfilename = createTempFile(
         QString(l8bit.constData()) + ".XXXXXX");
 
-    FILE *p_output = fopen(newfilename, "wb");
+    FILE *p_output = fopen(newfilename.toLocal8Bit().constData(), "wb");
 
     if (!p_output)
     {
Index: mythplugins/mythmusic/mythmusic/filescanner.cpp
===================================================================
--- mythplugins/mythmusic/mythmusic/filescanner.cpp	(revision 19679)
+++ mythplugins/mythmusic/mythmusic/filescanner.cpp	(working copy)
@@ -104,19 +104,19 @@
         ++it;
         if (fi->fileName() == "." || fi->fileName() == "..")
             continue;
-        QString filename = fi->absFilePath();
+        QString filename = fi->absoluteFilePath();
         if (fi->isDir())
         {
 
             QString dir(filename);
             dir.remove(0, m_startdir.length());
 
-            newparentid = m_directoryid[QString(dir.toUtf8()).lower()];
+            newparentid = m_directoryid[QString(dir.toUtf8()).toLower()];
 
             if (newparentid == 0)
             {
                 int id = GetDirectoryId(dir, parentid);
-                m_directoryid[QString(dir.toUtf8()).lower()] = id;
+                m_directoryid[QString(dir.toUtf8()).toLower()] = id;
 
                 if (id > 0)
                 {
@@ -249,7 +249,7 @@
                                               "*.png;*.jpg;*.jpeg;*.gif;*.bmp");
 
     // If this file is an image, insert the details into the music_albumart table
-    if (nameFilter.find(extension.lower()) > -1)
+    if (nameFilter.indexOf(extension.toLower()) > -1)
     {
         QString name = filename.section( '/', -1);
 
@@ -258,7 +258,7 @@
                       "directory_id = :DIRID, imagetype = :TYPE;");
         query.bindValue(":FILE", name);
         query.bindValue(":DIRID", m_directoryid[
-                            QString(directory.toUtf8()).lower()]);
+                            QString(directory.toUtf8()).toLower()]);
         query.bindValue(":TYPE", AlbumArtImages::guessImageType(name));
 
         if (!query.exec() || query.numRowsAffected() <= 0)
@@ -279,24 +279,24 @@
             QString album_cache_string;
 
             // Set values from cache
-            int did = m_directoryid[QString(directory.toUtf8()).lower()];
+            int did = m_directoryid[QString(directory.toUtf8()).toLower()];
             if (did > 0)
                 data->setDirectoryId(did);
 
-            int aid = m_artistid[QString(data->Artist().toUtf8()).lower()];
+            int aid = m_artistid[QString(data->Artist().toUtf8()).toLower()];
             if (aid > 0)
             {
                 data->setArtistId(aid);
 
                 // The album cache depends on the artist id
                 album_cache_string = data->getArtistId() + "#"
-                    + QString(data->Album().toUtf8()).lower();
+                    + QString(data->Album().toUtf8()).toLower();
 
                 if (m_albumid[album_cache_string] > 0)
                     data->setAlbumId(m_albumid[album_cache_string]);
             }
 
-            int gid = m_genreid[QString(data->Genre().toUtf8()).lower()];
+            int gid = m_genreid[QString(data->Genre().toUtf8()).toLower()];
             if (gid > 0)
                 data->setGenreId(gid);
 
@@ -304,14 +304,14 @@
             data->dumpToDatabase();
 
             // Update the cache
-            m_artistid[QString(data->Artist().toUtf8()).lower()] =
+            m_artistid[QString(data->Artist().toUtf8()).toLower()] =
                 data->getArtistId();
 
-            m_genreid[QString(data->Genre().toUtf8()).lower()] =
+            m_genreid[QString(data->Genre().toUtf8()).toLower()] =
                 data->getGenreId();
 
             album_cache_string = data->getArtistId() + "#"
-                + QString(data->Album().toUtf8()).lower();
+                + QString(data->Album().toUtf8()).toLower();
             m_albumid[album_cache_string] = data->getAlbumId();
             delete data;
         }
@@ -430,14 +430,14 @@
     QString nameFilter = gContext->GetSetting("AlbumArtFilter",
                                               "*.png;*.jpg;*.jpeg;*.gif;*.bmp");
 
-    if (nameFilter.find(extension) > -1)
+    if (nameFilter.indexOf(extension) > -1)
     {
         MSqlQuery query(MSqlQuery::InitCon());
         query.prepare("DELETE FROM music_albumart WHERE filename= :FILE AND "
                       "directory_id= :DIRID;");
         query.bindValue(":FILE", sqlfilename);
         query.bindValue(":DIRID", m_directoryid[
-                            QString(directory.toUtf8()).lower()]);
+                            QString(directory.toUtf8()).toLower()]);
 
         if (!query.exec() || query.numRowsAffected() <= 0)
         {
@@ -480,24 +480,24 @@
             QString album_cache_string;
 
             // Set values from cache
-            int did = m_directoryid[QString(directory.toUtf8()).lower()];
+            int did = m_directoryid[QString(directory.toUtf8()).toLower()];
             if (did > 0)
                 disk_meta->setDirectoryId(did);
 
-            int aid = m_artistid[QString(disk_meta->Artist().toUtf8()).lower()];
+            int aid = m_artistid[QString(disk_meta->Artist().toUtf8()).toLower()];
             if (aid > 0)
             {
                 disk_meta->setArtistId(aid);
 
                 // The album cache depends on the artist id
                 album_cache_string = disk_meta->getArtistId() + "#" +
-                    QString(disk_meta->Album().toUtf8()).lower();
+                    QString(disk_meta->Album().toUtf8()).toLower();
 
                 if (m_albumid[album_cache_string] > 0)
                     disk_meta->setAlbumId(m_albumid[album_cache_string]);
             }
 
-            int gid = m_genreid[QString(disk_meta->Genre().toUtf8()).lower()];
+            int gid = m_genreid[QString(disk_meta->Genre().toUtf8()).toLower()];
             if (gid > 0)
                 disk_meta->setGenreId(gid);
 
@@ -505,12 +505,12 @@
             disk_meta->dumpToDatabase();
 
             // Update the cache
-            m_artistid[QString(disk_meta->Artist().toUtf8()).lower()]
+            m_artistid[QString(disk_meta->Artist().toUtf8()).toLower()]
                 = disk_meta->getArtistId();
-            m_genreid[QString(disk_meta->Genre().toUtf8()).lower()]
+            m_genreid[QString(disk_meta->Genre().toUtf8()).toLower()]
                 = disk_meta->getGenreId();
             album_cache_string = disk_meta->getArtistId() + "#" +
-                QString(disk_meta->Album().toUtf8()).lower();
+                QString(disk_meta->Album().toUtf8()).toLower();
             m_albumid[album_cache_string] = disk_meta->getAlbumId();
         }
 
@@ -667,7 +667,7 @@
                     else if (HasFileChanged(name, query.value(1).toString()))
                         music_files[name] = kNeedUpdate;
                     else
-                        music_files.remove(iter);
+                        music_files.erase(iter);
                 }
                 else
                 {
@@ -737,7 +737,7 @@
                         continue;
                     }
                     else
-                        music_files.remove(iter);
+                        music_files.erase(iter);
                 }
                 else
                 {
Index: mythtv/libs/libmyth/uilistbtntype.h
===================================================================
--- mythtv/libs/libmyth/uilistbtntype.h	(revision 19679)
+++ mythtv/libs/libmyth/uilistbtntype.h	(working copy)
@@ -44,8 +44,8 @@
     int getCheck(void) { return m_check; }
     virtual void setCheck(int flag);
 
-    void setItem(UIListBtnTypeItem *item) { m_physitem = item; }
-    UIListBtnTypeItem *getItem(void) { return m_physitem; }
+    void SetItem(UIListBtnTypeItem *item);
+    UIListBtnTypeItem *GetItem(void) { return m_physitem; }
 
     void setText(const QString &text);
     void setPixmap(QPixmap *pixmap);
@@ -335,7 +335,9 @@
      
     void setData(void *data);
     void *getData();
-    
+
+    void SetTree(UIListGenericTree*);
+
     void setOverrideInactive(bool flag);
     bool getOverrideInactive(void);
 
@@ -365,6 +367,7 @@
 
     bool           m_overrideInactive;
     int            m_justify;
+    UIListGenericTree *m_tree;
 
     friend class UIListBtnType;
 };
Index: mythtv/libs/libmyth/uilistbtntype.cpp
===================================================================
--- mythtv/libs/libmyth/uilistbtntype.cpp	(revision 19679)
+++ mythtv/libs/libmyth/uilistbtntype.cpp	(working copy)
@@ -62,8 +62,21 @@
     }
 }
 
+void UIListGenericTree::SetItem(UIListBtnTypeItem *item)
+{
+    m_physitem = item;
+    if (m_physitem)
+        m_physitem->SetTree(this);
+}
+
 UIListGenericTree::~UIListGenericTree()
 {
+    if (m_physitem)
+    {
+        m_physitem->SetTree(NULL);
+        m_physitem = NULL;
+    }
+    m_image = NULL;
 }
 
 void UIListGenericTree::RemoveFromParent(void)
@@ -400,7 +413,7 @@
     while (clear)
     {
         UIListGenericTree *gt = (UIListGenericTree *)clear->getData();
-        gt->setItem(NULL);
+        gt->SetItem(NULL);
         clear = list->GetItemNext(clear);
     }
 
@@ -449,7 +462,7 @@
                                         (uichild->childCount() > 0));
         newitem->setData(uichild);
 
-        uichild->setItem(newitem);
+        uichild->SetItem(newitem);
 
         if (!uichild->getActive())
             newitem->setOverrideInactive(true);
@@ -1051,7 +1064,7 @@
 
     m_itemCount--;
 
-    if (m_topItem != m_itemList.first())
+    if (!m_itemList.empty() && m_topItem != m_itemList.first())
         m_showUpArrow = true;
     else
         m_showUpArrow = false;
@@ -1933,6 +1946,9 @@
 
 void UIListBtnTypeItem::CalcDimensions(void)
 {
+    if (!m_parent)
+        return;
+
     if (!m_parent->m_initialized)
         m_parent->Init();
 
@@ -1946,6 +1962,9 @@
     QPixmap& checkPix = m_parent->m_checkNonePix;
     QPixmap& arrowPix = m_parent->m_arrowPix;
 
+    if (checkPix.isNull() || arrowPix.isNull())
+        return;
+
     int cw = checkPix.width();
     int ch = checkPix.height();
     int aw = arrowPix.width();
@@ -1986,8 +2005,19 @@
 {
     if (m_parent)
         m_parent->RemoveItem(this);
+
+    if (m_tree)
+    {
+        m_tree->SetItem(NULL);
+        m_tree = NULL;
+    }
 }
 
+void UIListBtnTypeItem::SetTree(UIListGenericTree *tree)
+{
+    m_tree = tree;
+}
+
 QString UIListBtnTypeItem::text() const
 {
     return m_text;
@@ -2041,7 +2071,8 @@
 void UIListBtnTypeItem::setDrawArrow(bool flag)
 {
     m_showArrow = flag;
-    CalcDimensions();
+    if (m_parent && m_parent->m_initialized)
+        CalcDimensions();
 }
 
 void UIListBtnTypeItem::setData(void *data)
