From 461106eb43f162356b24660d96bc39afc052b8b1 Mon Sep 17 00:00:00 2001 From: Thomas Frauendorfer Date: Sun, 2 Nov 2008 11:52:49 +0100 Subject: [PATCH] OTHER: Change a Parameter from QDir to QString. I think this will be needed when I add zipped skin support later --- README | 4 +++- config.pri | 3 --- promoe.pro | 11 ++++++++--- src/Skin.cpp | 9 +++++---- src/Skin.h | 2 +- src/SkinChooser.cpp | 11 +++++------ 6 files changed, 22 insertions(+), 18 deletions(-) diff --git a/README b/README index 8922111..f9667a8 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -Required dependencys: +Required dependencies: * QT4.2.x http://www.trolltech.no/ * XMMS2 http://xmms2.xmms.org/ * XMMS2 C++ bindings (make sure you have boost_signals when compiling xmms2) @@ -16,6 +16,8 @@ Compiling: 5) ???? 6) profit + To change the install directory, use 'qmake PREFIX=' at step 1 + Compilation problems: - Errormessage "WARNING: Found potential symbol conflict of " -> make sure you use uic from Qt4 (uic -version) diff --git a/config.pri b/config.pri index 9c88f69..8f33e25 100644 --- a/config.pri +++ b/config.pri @@ -2,6 +2,3 @@ DEFINES += PROMOE_VERSION="\"\\\"0.1-dev\\\"\"" DEPENDPATH += $PWD/src $PWD/lib INCLUDEPATH += $$PWD/src $$PWD/lib - -PREFIX = /usr/local -BINDIR = $$PREFIX/bin diff --git a/promoe.pro b/promoe.pro index 3e4b6f1..c67d903 100644 --- a/promoe.pro +++ b/promoe.pro @@ -4,6 +4,11 @@ SUBDIRS = lib src include (config.pri) -target.path = $$BINDIR -target.files = promoe -INSTALLS += target +isEmpty(PREFIX): PREFIX = /usr/local +isEmpty(BINDIR): BINDIR = $$PREFIX/bin + +message ( "Install path set to:" $$PREFIX ) + +binarys.path = $$BINDIR +binarys.files = promoe +INSTALLS += binarys diff --git a/src/Skin.cpp b/src/Skin.cpp index bf68dd2..b787541 100644 --- a/src/Skin.cpp +++ b/src/Skin.cpp @@ -71,10 +71,11 @@ Skin::setSkin (const QString& name) } const QPixmap -Skin::getPixmap (const QString& file, QDir dir) +Skin::getPixmap (const QString& file, const QString &path) { /* check for files in zip and check if file exists */ + QDir dir (path); dir.setFilter (QDir::Files); QFileInfoList list = dir.entryInfoList(); @@ -93,10 +94,10 @@ Skin::getPixmap (const QString& file, QDir dir) const QPixmap Skin::getPixmap (const QString& file) { - QDir dir; +/* QDir dir; dir.setPath (m_path); -/* dir.setFilter (QDir::Files); + dir.setFilter (QDir::Files); QFileInfoList list = dir.entryInfoList(); for (int i = 0; i < list.size(); ++i) { @@ -109,7 +110,7 @@ Skin::getPixmap (const QString& file) return QPixmap (); */ - return getPixmap (file, dir); + return getPixmap (file, m_path); } bool diff --git a/src/Skin.h b/src/Skin.h index 0210f2b..fc22f43 100644 --- a/src/Skin.h +++ b/src/Skin.h @@ -37,7 +37,7 @@ class Skin : public QObject static Skin *getInstance (void); bool setSkin (const QString& name); - static const QPixmap getPixmap (const QString&, QDir); + static const QPixmap getPixmap (const QString&, const QString&); const QSize getSize (uint item) const { return m_sizes[item]; }; const QPoint getPos (uint item) const { return m_positions[item]; }; diff --git a/src/SkinChooser.cpp b/src/SkinChooser.cpp index a7f1c59..9c64375 100644 --- a/src/SkinChooser.cpp +++ b/src/SkinChooser.cpp @@ -63,20 +63,19 @@ SkinList::SkinList (QWidget *parent) : QListWidget (parent) settings.setValue ("skin/searchpath", searchpath); } - QFileInfoList list; QDir d; - d.setFilter (QDir::Dirs); + d.setFilter (QDir::Dirs|QDir::NoDotAndDotDot); + QFileInfoList list; foreach (QString path, searchpath) { d.setPath (path); list += d.entryInfoList(); } foreach (QFileInfo fileInfo, list) { - QDir dir (fileInfo.filePath()); - QPixmap p = Skin::getPixmap ("main", dir); + QPixmap p = Skin::getPixmap ("main", fileInfo.filePath()); if (!p.isNull()) { - new SkinChooserItem (QIcon (p), dir.dirName(), dir.absolutePath(), - this); + new SkinChooserItem (QIcon (p), fileInfo.baseName (), + fileInfo.absoluteFilePath (), this); } }