diff --git a/lib/playlistmodel.cpp b/lib/playlistmodel.cpp index c449c48..d331702 100644 --- a/lib/playlistmodel.cpp +++ b/lib/playlistmodel.cpp @@ -32,7 +32,7 @@ // Used to check for Protocolversion at compiletime #include -PlaylistModel::PlaylistModel (QObject *parent, XClient *client, const QString &name) : QAbstractItemModel (parent) +PlaylistModel::PlaylistModel (QObject *parent, XClient *client, const QString &name) : QAbstractItemModel (parent), m_current_pos (0) { // m_columns.append ("#"); m_columns.append ("Artist"); @@ -50,16 +50,14 @@ PlaylistModel::PlaylistModel (QObject *parent, XClient *client, const QString &n connect (client, SIGNAL(gotConnection (XClient *)), this, SLOT (got_connection (XClient *))); connect (client->cache (), SIGNAL(entryChanged (uint32_t)), this, SLOT (entry_changed (uint32_t))); - - if (name == QLatin1String ("_active")) { - m_isactive = true; + + m_isactive = (name == QLatin1String ("_active")); + + m_name = name; + + if (client->isConnected ()) { + got_connection (client); } - - m_name = name; - - if (client->isConnected ()) { - got_connection (client); - } } void diff --git a/lib/playlistmodel.h b/lib/playlistmodel.h index 11a153e..65d9e2c 100644 --- a/lib/playlistmodel.h +++ b/lib/playlistmodel.h @@ -140,7 +140,6 @@ class PlaylistModel : public QAbstractItemModel void getInfo (unsigned int id) const; - uint32_t m_current_pos; bool m_isactive; diff --git a/src/SkinChooser.cpp b/src/SkinChooser.cpp index 65a241e..a7f1c59 100644 --- a/src/SkinChooser.cpp +++ b/src/SkinChooser.cpp @@ -13,7 +13,6 @@ * GNU General Public License for more details. */ -#include "mainwindow.h" #include "Skin.h" #include "SkinChooser.h" @@ -24,27 +23,22 @@ #include #include -SkinChooser::SkinChooser (QWidget *parent) : QMainWindow (parent) +SkinChooser::SkinChooser (QWidget *parent) : QDialog (parent) { #ifndef _WIN32 setWindowIcon (QIcon (":icon.png")); #endif - setWindowFlags (Qt::Dialog); setWindowModality (Qt::ApplicationModal); setAttribute (Qt::WA_DeleteOnClose); - m_mw = dynamic_cast(parent); - m_c = new QWidget (this); - setCentralWidget (m_c); + QVBoxLayout *vbox = new QVBoxLayout (this); + QLabel *label = new QLabel ("Available skins...", this); + label->setFont (QFont ("Helvetica", 16)); + vbox->addWidget (label); - m_vbox = new QVBoxLayout (m_c); - m_label = new QLabel ("Available skins...", m_c); - m_label->setFont (QFont ("Helvetica", 16)); - m_vbox->addWidget (m_label); - - m_skin = new SkinList (m_c); - m_vbox->addWidget (m_skin); + m_skin = new SkinList (this); + vbox->addWidget (m_skin); resize (500, 300); @@ -52,30 +46,42 @@ SkinChooser::SkinChooser (QWidget *parent) : QMainWindow (parent) SkinList::SkinList (QWidget *parent) : QListWidget (parent) { - setIconSize (QSize (137, 58)); - QString path; - path.append (QDir::homePath()); - path.append ("/.config/xmms2/clients/promoe/skins/"); + new SkinChooserItem (QIcon (":CleanAMP/main.png"), "CleanAMP (default)", + ":CleanAMP/", this); + + QSettings settings; + QStringList searchpath; + if (settings.contains ("skin/searchpath") ) { + searchpath = settings.value ("skin/searchpath").toStringList (); + } else { + QString path; + path.append (QDir::homePath()); + path.append ("/.config/xmms2/clients/promoe/skins/"); + searchpath.append (path); + settings.setValue ("skin/searchpath", searchpath); + } + + QFileInfoList list; QDir d; - - new SkinChooserItem (QIcon (":CleanAMP/main.png"), "CleanAMP (default)", ":CleanAMP/", this); - - d.setPath (path); d.setFilter (QDir::Dirs); + foreach (QString path, searchpath) { + d.setPath (path); + list += d.entryInfoList(); + } - QFileInfoList list = d.entryInfoList(); - for (int i = 0; i < list.size(); ++i) { - QFileInfo fileInfo = list.at(i); + foreach (QFileInfo fileInfo, list) { QDir dir (fileInfo.filePath()); QPixmap p = Skin::getPixmap ("main", dir); if (!p.isNull()) { - new SkinChooserItem (QIcon (p), dir.dirName(), dir.absolutePath(), this); + new SkinChooserItem (QIcon (p), dir.dirName(), dir.absolutePath(), + this); } } - connect (this, SIGNAL (itemClicked (QListWidgetItem *)), this, SLOT (changeSkin (QListWidgetItem *))); + connect (this, SIGNAL (itemClicked (QListWidgetItem *)), + this, SLOT (changeSkin (QListWidgetItem *))); } void diff --git a/src/SkinChooser.h b/src/SkinChooser.h index 181c66b..135f8f4 100644 --- a/src/SkinChooser.h +++ b/src/SkinChooser.h @@ -15,11 +15,7 @@ #include -#include -class QLabel; -class QVBoxLayout; - -class MainWindow; +#include class SkinList : public QListWidget { @@ -46,19 +42,14 @@ class SkinChooserItem : public QListWidgetItem }; -class SkinChooser : public QMainWindow +class SkinChooser : public QDialog { public: SkinChooser (QWidget *parent); ~SkinChooser (void) {} - MainWindow *getMW (void) { return m_mw; } private: - QVBoxLayout *m_vbox; SkinList *m_skin; - QLabel *m_label; - QWidget *m_c; - MainWindow *m_mw; };