OTHER: Some cleanups
Whitespace cleanups and small changes to SkinChooser
This commit is contained in:
parent
15677bdf39
commit
63def9b10b
4 changed files with 42 additions and 48 deletions
|
@ -32,7 +32,7 @@
|
||||||
// Used to check for Protocolversion at compiletime
|
// Used to check for Protocolversion at compiletime
|
||||||
#include <xmmsc/xmmsc_idnumbers.h>
|
#include <xmmsc/xmmsc_idnumbers.h>
|
||||||
|
|
||||||
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 ("#");
|
||||||
m_columns.append ("Artist");
|
m_columns.append ("Artist");
|
||||||
|
@ -51,9 +51,7 @@ PlaylistModel::PlaylistModel (QObject *parent, XClient *client, const QString &n
|
||||||
connect (client, SIGNAL(gotConnection (XClient *)), this, SLOT (got_connection (XClient *)));
|
connect (client, SIGNAL(gotConnection (XClient *)), this, SLOT (got_connection (XClient *)));
|
||||||
connect (client->cache (), SIGNAL(entryChanged (uint32_t)), this, SLOT (entry_changed (uint32_t)));
|
connect (client->cache (), SIGNAL(entryChanged (uint32_t)), this, SLOT (entry_changed (uint32_t)));
|
||||||
|
|
||||||
if (name == QLatin1String ("_active")) {
|
m_isactive = (name == QLatin1String ("_active"));
|
||||||
m_isactive = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_name = name;
|
m_name = name;
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,6 @@ class PlaylistModel : public QAbstractItemModel
|
||||||
|
|
||||||
void getInfo (unsigned int id) const;
|
void getInfo (unsigned int id) const;
|
||||||
|
|
||||||
|
|
||||||
uint32_t m_current_pos;
|
uint32_t m_current_pos;
|
||||||
bool m_isactive;
|
bool m_isactive;
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mainwindow.h"
|
|
||||||
#include "Skin.h"
|
#include "Skin.h"
|
||||||
#include "SkinChooser.h"
|
#include "SkinChooser.h"
|
||||||
|
|
||||||
|
@ -24,27 +23,22 @@
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
SkinChooser::SkinChooser (QWidget *parent) : QMainWindow (parent)
|
SkinChooser::SkinChooser (QWidget *parent) : QDialog (parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
setWindowIcon (QIcon (":icon.png"));
|
setWindowIcon (QIcon (":icon.png"));
|
||||||
#endif
|
#endif
|
||||||
setWindowFlags (Qt::Dialog);
|
|
||||||
setWindowModality (Qt::ApplicationModal);
|
setWindowModality (Qt::ApplicationModal);
|
||||||
setAttribute (Qt::WA_DeleteOnClose);
|
setAttribute (Qt::WA_DeleteOnClose);
|
||||||
|
|
||||||
m_mw = dynamic_cast<MainWindow *>(parent);
|
QVBoxLayout *vbox = new QVBoxLayout (this);
|
||||||
m_c = new QWidget (this);
|
QLabel *label = new QLabel ("Available skins...", this);
|
||||||
setCentralWidget (m_c);
|
label->setFont (QFont ("Helvetica", 16));
|
||||||
|
vbox->addWidget (label);
|
||||||
|
|
||||||
m_vbox = new QVBoxLayout (m_c);
|
m_skin = new SkinList (this);
|
||||||
m_label = new QLabel ("Available skins...", m_c);
|
vbox->addWidget (m_skin);
|
||||||
m_label->setFont (QFont ("Helvetica", 16));
|
|
||||||
m_vbox->addWidget (m_label);
|
|
||||||
|
|
||||||
m_skin = new SkinList (m_c);
|
|
||||||
m_vbox->addWidget (m_skin);
|
|
||||||
|
|
||||||
resize (500, 300);
|
resize (500, 300);
|
||||||
|
|
||||||
|
@ -52,30 +46,42 @@ SkinChooser::SkinChooser (QWidget *parent) : QMainWindow (parent)
|
||||||
|
|
||||||
SkinList::SkinList (QWidget *parent) : QListWidget (parent)
|
SkinList::SkinList (QWidget *parent) : QListWidget (parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
setIconSize (QSize (137, 58));
|
setIconSize (QSize (137, 58));
|
||||||
|
|
||||||
|
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;
|
QString path;
|
||||||
path.append (QDir::homePath());
|
path.append (QDir::homePath());
|
||||||
path.append ("/.config/xmms2/clients/promoe/skins/");
|
path.append ("/.config/xmms2/clients/promoe/skins/");
|
||||||
|
searchpath.append (path);
|
||||||
|
settings.setValue ("skin/searchpath", searchpath);
|
||||||
|
}
|
||||||
|
|
||||||
|
QFileInfoList list;
|
||||||
QDir d;
|
QDir d;
|
||||||
|
|
||||||
new SkinChooserItem (QIcon (":CleanAMP/main.png"), "CleanAMP (default)", ":CleanAMP/", this);
|
|
||||||
|
|
||||||
d.setPath (path);
|
|
||||||
d.setFilter (QDir::Dirs);
|
d.setFilter (QDir::Dirs);
|
||||||
|
foreach (QString path, searchpath) {
|
||||||
|
d.setPath (path);
|
||||||
|
list += d.entryInfoList();
|
||||||
|
}
|
||||||
|
|
||||||
QFileInfoList list = d.entryInfoList();
|
foreach (QFileInfo fileInfo, list) {
|
||||||
for (int i = 0; i < list.size(); ++i) {
|
|
||||||
QFileInfo fileInfo = list.at(i);
|
|
||||||
QDir dir (fileInfo.filePath());
|
QDir dir (fileInfo.filePath());
|
||||||
QPixmap p = Skin::getPixmap ("main", dir);
|
QPixmap p = Skin::getPixmap ("main", dir);
|
||||||
if (!p.isNull()) {
|
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
|
void
|
||||||
|
|
|
@ -15,11 +15,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
#include <QMainWindow>
|
#include <QDialog>
|
||||||
class QLabel;
|
|
||||||
class QVBoxLayout;
|
|
||||||
|
|
||||||
class MainWindow;
|
|
||||||
|
|
||||||
class SkinList : public QListWidget
|
class SkinList : public QListWidget
|
||||||
{
|
{
|
||||||
|
@ -46,19 +42,14 @@ class SkinChooserItem : public QListWidgetItem
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SkinChooser : public QMainWindow
|
class SkinChooser : public QDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SkinChooser (QWidget *parent);
|
SkinChooser (QWidget *parent);
|
||||||
~SkinChooser (void) {}
|
~SkinChooser (void) {}
|
||||||
MainWindow *getMW (void) { return m_mw; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVBoxLayout *m_vbox;
|
|
||||||
SkinList *m_skin;
|
SkinList *m_skin;
|
||||||
QLabel *m_label;
|
|
||||||
QWidget *m_c;
|
|
||||||
MainWindow *m_mw;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue