aboutsummaryrefslogtreecommitdiff
path: root/src/skin.h
diff options
context:
space:
mode:
authorvovanec <vovanec@90c681e8-e032-0410-971d-27865f9a5e38>2007-06-23 16:48:01 +0000
committervovanec <vovanec@90c681e8-e032-0410-971d-27865f9a5e38>2007-06-23 16:48:01 +0000
commit2d622fd9bcb8da9dd3f3206e296cd6a701fc9d12 (patch)
treef92135e6cb831e46336dfd4ade47e03ef3a19ac5 /src/skin.h
parent4b6a6720805c585c89f44fd276b3ace8670514d9 (diff)
downloadqmmp-2d622fd9bcb8da9dd3f3206e296cd6a701fc9d12.tar.gz
qmmp-2d622fd9bcb8da9dd3f3206e296cd6a701fc9d12.tar.bz2
qmmp-2d622fd9bcb8da9dd3f3206e296cd6a701fc9d12.zip
moved into qmmp dir
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@12 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/skin.h')
-rw-r--r--src/skin.h308
1 files changed, 308 insertions, 0 deletions
diff --git a/src/skin.h b/src/skin.h
new file mode 100644
index 000000000..47ca70fb7
--- /dev/null
+++ b/src/skin.h
@@ -0,0 +1,308 @@
+/***************************************************************************
+ * Copyright (C) 2006 by Ilya Kotov *
+ * forkotov02@hotmail.ru *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef SKIN_H
+#define SKIN_H
+
+#include <QObject>
+#include <QMap>
+#include <QPixmap>
+#include <QDir>
+#include <QRegion>
+
+/*
+ @author Ilya Kotov <forkotov02@hotmail.ru>
+*/
+
+
+class Skin : public QObject
+{
+ Q_OBJECT
+public:
+ Skin(QObject *parent = 0);
+
+ ~Skin();
+
+ static Skin *getPointer();
+ static QPixmap getPixmap(const QString&, QDir);
+ void setSkin(const QString& path);
+ const QPixmap getMain() const
+ {
+ return m_main;
+ };
+ const QPixmap getButton(uint bt) const
+ {
+ return buttons[bt];
+ };
+ const QPixmap getTitleBar(uint tb) const
+ {
+ return titlebar[tb];
+ };
+ const QPixmap getPosBar() const
+ {
+ return posbar;
+ };
+ const QPixmap getNumber(uint n) const
+ {
+ return m_numbers[n];
+ };
+ /*!
+ * Returns count of numbers in number list.
+ * We need this to check if we have "-" in pixmaps.
+ * if no we should draw it manually.
+ */
+ const uint getNumCount(void) const
+ {
+ return m_numbers.count();
+ }
+ const QPixmap getPlPart(uint p) const
+ {
+ return m_pl_parts[p];
+ };
+ const QPixmap getEqPart(uint p) const
+ {
+ return m_eq_parts[p];
+ };
+ const QPixmap getEqSlider(uint n) const
+ {
+ return m_eq_bar[n];
+ };
+ const QPixmap getEqSpline(uint n) const
+ {
+ return m_eq_spline[n];
+ };
+ const QPixmap getMSPart(uint n) const
+ {
+ return m_ms_parts[n];
+ };
+ const QPixmap getLetter(const QChar& ch)
+ {
+ return m_letters[ch];
+ };
+ const QPixmap getItem(uint n) const
+ {
+ return m_parts[n];
+ };
+ const QPixmap getVolumeBar(int n) const
+ {
+ return m_volume[n];
+ };
+ const QPixmap getBalanceBar(int n) const
+ {
+ return m_balance[n];
+ };
+ const QByteArray getPLValue (QByteArray c) const
+ {
+ return m_pledit_txt[c];
+ };
+ const QColor getVisBarColor(int n) const
+ {
+ return m_vis_bars[n];
+ };
+ const QRegion getMWRegion() const
+ {
+ return m_mwRegion;
+ };
+ const QRegion getPLRegion() const
+ {
+ return m_plRegion;
+ };
+
+ enum Buttons
+ {
+ BT_PREVIOUS_N,
+ BT_PREVIOUS_P,
+ BT_PL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+ BT_PL_NEXT,
+ BT_PL_PREV,
+ BT_PL_EJECT*/
+ };
+ enum TitleBar
+ {
+ TITLEBAR_A,
+ TITLEBAR_I,
+ STATUSBAR_A,
+ STATUSBAR_I
+ };
+ enum PlayList
+ {
+ PL_CORNER_UL_A,
+ PL_CORNER_UL_I,
+ PL_CORNER_UR_A,
+ PL_CORNER_UR_I,
+ PL_TITLEBAR_A,
+ PL_TITLEBAR_I,
+ PL_TFILL1_A,
+ PL_TFILL1_I,
+ PL_TFILL2_A,
+ PL_TFILL2_I,
+ PL_LFILL,
+ PL_RFILL,
+ PL_LSBAR,
+ PL_RSBAR,
+ PL_SFILL1,
+ PL_SFILL2,
+ PL_CONTROL
+ };
+ enum Equalizer
+ {
+ EQ_MAIN,
+ EQ_TITLEBAR_A,
+ EQ_TITLEBAR_I,
+ EQ_GRAPH,
+ };
+ enum MonoSter
+ {
+ MONO_A,
+ MONO_I,
+ STEREO_A,
+ STEREO_I,
+ };
+ enum OtherParts
+ {
+ PLAY,
+ PAUSE,
+ STOP,
+ };
+
+signals:
+ void skinChanged();
+
+private:
+ QPixmap *getPixmap(const QString&);
+
+ /*!
+ * As far as there is no standard in skin making we cannot be sure
+ * that all needful images we can find in skin :( This will cause
+ * segfaults and asserts. So to prevent this we need such method
+ * to load pixmap from default skin.
+ */
+ QPixmap *getDummyPixmap(const QString&);
+ static Skin *pointer;
+ QDir m_skin_dir;
+ QMap<uint, QPixmap> buttons;
+ QMap<uint, QPixmap> titlebar;
+ QMap<uint, QPixmap> m_pl_parts;
+ QMap<uint, QPixmap> m_eq_parts;
+ QMap<uint, QPixmap> m_ms_parts;
+ QMap<uint, QPixmap> m_parts;
+ QMap<QChar, QPixmap> m_letters;
+ QMap<QByteArray, QByteArray> m_pledit_txt;
+ QPixmap m_main;
+ QPixmap posbar;
+ QList<QPixmap> m_numbers;
+ QList<QPixmap> m_eq_bar;
+ QList<QPixmap> m_eq_spline;
+ QList<QPixmap> m_volume;
+ QList<QPixmap> m_balance;
+ QList<QColor> m_vis_bars;
+ QRegion m_mwRegion;
+ QRegion m_plRegion;
+
+ void loadMain();
+ void loadButtons();
+ void loadTitleBar();
+ void loadPosBar();
+ void loadNumbers();
+ void loadPlayList();
+ void loadPLEdit();
+ void loadEqMain();
+ void loadVisColor();
+ void loadShufRep();
+ void loadLetters();
+ void loadMonoSter();
+ void loadVolume();
+ void loadBalance();
+ void loadRegion();
+ QRegion createRegion(const QString &path, const QString &key);
+
+};
+
+#endif