aboutsummaryrefslogtreecommitdiff
path: root/src/ui/skin.h
diff options
context:
space:
mode:
authorvovanec <vovanec@90c681e8-e032-0410-971d-27865f9a5e38>2008-02-07 13:36:34 +0000
committervovanec <vovanec@90c681e8-e032-0410-971d-27865f9a5e38>2008-02-07 13:36:34 +0000
commit06d1877811fa6aa97dddc0e03bcde4e766928c87 (patch)
treec25462d0e58c3d58c728664440412bf4f16a49ec /src/ui/skin.h
parent3f6b60f23c44a8ba8dd97ca6f41a16e2af7ef2f7 (diff)
downloadqmmp-06d1877811fa6aa97dddc0e03bcde4e766928c87.tar.gz
qmmp-06d1877811fa6aa97dddc0e03bcde4e766928c87.tar.bz2
qmmp-06d1877811fa6aa97dddc0e03bcde4e766928c87.zip
new directory structure
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@232 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/ui/skin.h')
-rw-r--r--src/ui/skin.h340
1 files changed, 340 insertions, 0 deletions
diff --git a/src/ui/skin.h b/src/ui/skin.h
new file mode 100644
index 000000000..d981c4613
--- /dev/null
+++ b/src/ui/skin.h
@@ -0,0 +1,340 @@
+/***************************************************************************
+ * Copyright (C) 2007 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 getVisColor(int n) const
+ {
+ return m_vis_colors[n];
+ };
+ const QRegion getMWRegion() const
+ {
+ return m_mwRegion;
+ };
+ const QRegion getPLRegion() const
+ {
+ return m_plRegion;
+ };
+ const QColor scrollerTextColor() const
+ {
+ return m_scroller_color;
+ };
+
+ enum Buttons
+ {
+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
+ BT_PL_ON_N,
+ BT_PL_ON_P,
+ BT_PL_OFF_N,
+ BT_PL_OFF_P,
+ BT_PL_CLOSE_N,
+ BT_PL_CLOSE_P,
+ REPEAT_ON_N,
+ REPEAT_ON_P,
+ REPEAT_OFF_N,
+ REPEAT_OFF_P,
+ SHUFFLE_ON_N,
+ SHUFFLE_ON_P,
+ SHUFFLE_OFF_N,
+ SHUFFLE_OFF_P,
+ /* volume.* */
+ BT_VOL_N,
+ BT_VOL_P,
+ /* balance.* */
+ BT_BAL_N,
+ BT_BAL_P,
+ };
+ enum TitleBar
+ {
+ TITLEBAR_A = 0,
+ TITLEBAR_I,
+ TITLEBAR_SHADED_A,
+ TITLEBAR_SHADED_I,
+ };
+ enum PlayList
+ {
+ PL_CORNER_UL_A = 0,
+ 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,
+ PL_TITLEBAR_SHADED1_A,
+ PL_TITLEBAR_SHADED1_I,
+ PL_TITLEBAR_SHADED2,
+ PL_TFILL_SHADED,
+ };
+ enum Equalizer
+ {
+ EQ_MAIN = 0,
+ EQ_TITLEBAR_A,
+ EQ_TITLEBAR_I,
+ EQ_GRAPH,
+ EQ_TITLEBAR_SHADED_A,
+ EQ_TITLEBAR_SHADED_I,
+ EQ_VOLUME1,
+ EQ_VOLUME2,
+ EQ_VOLUME3,
+ EQ_BALANCE1,
+ EQ_BALANCE2,
+ EQ_BALANCE3,
+ };
+ enum MonoSter
+ {
+ MONO_A = 0,
+ MONO_I,
+ STEREO_A,
+ STEREO_I,
+ };
+ enum OtherParts
+ {
+ PLAY = 0,
+ 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;
+ QColor m_scroller_color;
+ 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_colors;
+ QRegion m_mwRegion;
+ QRegion m_plRegion;
+
+ void loadMain();
+ void loadButtons();
+ void loadTitleBar();
+ void loadPosBar();
+ void loadNumbers();
+ void loadPlayList();
+ void loadPLEdit();
+ void loadEqMain();
+ void loadEq_ex();
+ void loadVisColor();
+ void loadShufRep();
+ void loadLetters();
+ void loadMonoSter();
+ void loadVolume();
+ void loadBalance();
+ void loadRegion();
+ void loadColors();
+ QRegion createRegion(const QString &path, const QString &key);
+
+};
+
+#endif