[137] | 1 | /* smplayer, GUI front-end for mplayer.
|
---|
[188] | 2 | Copyright (C) 2006-2017 Ricardo Villalba <rvm@users.sourceforge.net>
|
---|
[137] | 3 | umplayer, Copyright (C) 2010 Ori Rejwan
|
---|
| 4 |
|
---|
| 5 | This program is free software; you can redistribute it and/or modify
|
---|
| 6 | it under the terms of the GNU General Public License as published by
|
---|
| 7 | the Free Software Foundation; either version 2 of the License, or
|
---|
| 8 | (at your option) any later version.
|
---|
| 9 |
|
---|
| 10 | This program is distributed in the hope that it will be useful,
|
---|
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 13 | GNU General Public License for more details.
|
---|
| 14 |
|
---|
| 15 | You should have received a copy of the GNU General Public License
|
---|
| 16 | along with this program; if not, write to the Free Software
|
---|
| 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
| 18 | */
|
---|
| 19 |
|
---|
| 20 | #ifndef QPROPERTYSETTER_H
|
---|
| 21 | #define QPROPERTYSETTER_H
|
---|
| 22 |
|
---|
| 23 | #include "myaction.h"
|
---|
| 24 | #include <QWidget>
|
---|
| 25 | #include <QPixmap>
|
---|
| 26 | #include <QMessageBox>
|
---|
| 27 | #include "playcontrol.h"
|
---|
| 28 | #include "myicon.h"
|
---|
| 29 | #include "mediapanel.h"
|
---|
| 30 |
|
---|
| 31 |
|
---|
| 32 |
|
---|
| 33 | class IconSetter : public QWidget
|
---|
| 34 | {
|
---|
| 35 | Q_OBJECT
|
---|
| 36 | Q_PROPERTY(QPixmap toolbar READ toolbarIcon WRITE setToolbarIcon)
|
---|
| 37 |
|
---|
| 38 | Q_PROPERTY(QPixmap backward READ backwardIcon WRITE setBackwardIcon)
|
---|
| 39 | Q_PROPERTY(QPixmap previous READ previousIcon WRITE setPreviousIcon)
|
---|
| 40 | Q_PROPERTY(QPixmap playPause READ playPauseIcon WRITE setPlayPauseIcon)
|
---|
| 41 | Q_PROPERTY(QPixmap stop READ stopIcon WRITE setStopIcon )
|
---|
| 42 | Q_PROPERTY(QPixmap record READ recordIcon WRITE setRecordIcon )
|
---|
| 43 | Q_PROPERTY(QPixmap next READ nextIcon WRITE setNextIcon)
|
---|
| 44 | Q_PROPERTY(QPixmap forward READ forwardIcon WRITE setForwardIcon)
|
---|
| 45 |
|
---|
| 46 | Q_PROPERTY(QPixmap shuffle READ shuffleIcon WRITE setShuffleIcon )
|
---|
| 47 | Q_PROPERTY(QPixmap repeat READ repeatIcon WRITE setRepeatIcon )
|
---|
| 48 |
|
---|
| 49 | public:
|
---|
| 50 |
|
---|
| 51 | static IconSetter* instance();
|
---|
| 52 | static void removeInstance();
|
---|
| 53 | ~IconSetter() {}
|
---|
| 54 | PlayControl* playControl;
|
---|
| 55 | MediaPanel* mediaPanel;
|
---|
| 56 |
|
---|
| 57 | void setToolbarIcon(QPixmap icon) { setActionIcon(icon); }
|
---|
| 58 | QPixmap toolbarIcon() { return QPixmap();}
|
---|
| 59 |
|
---|
| 60 |
|
---|
| 61 | void setBackwardIcon(QPixmap icon) { buttonIcon(1, icon); }
|
---|
| 62 | QPixmap backwardIcon() { return playControl->backwardButton->myIcon().pixmap(MyIcon::Normal, MyIcon::Off); }
|
---|
| 63 |
|
---|
| 64 | void setPreviousIcon(QPixmap icon) { buttonIcon(2, icon); }
|
---|
| 65 | QPixmap previousIcon() { return playControl->previousButton->myIcon().pixmap(MyIcon::Normal, MyIcon::Off); }
|
---|
| 66 |
|
---|
| 67 | void setPlayPauseIcon(QPixmap icon) { buttonIcon(3, icon); }
|
---|
| 68 | QPixmap playPauseIcon() { return playControl->playPauseButton->myIcon().pixmap(MyIcon::Normal, MyIcon::Off); }
|
---|
| 69 |
|
---|
| 70 | void setStopIcon(QPixmap icon) { buttonIcon(4, icon); }
|
---|
| 71 | QPixmap stopIcon() { return playControl->stopButton->myIcon().pixmap(MyIcon::Normal, MyIcon::Off); }
|
---|
| 72 |
|
---|
| 73 | void setRecordIcon( QPixmap icon) { buttonIcon(5, icon); }
|
---|
| 74 | QPixmap recordIcon() { return playControl->recordButton->myIcon().pixmap(MyIcon::Normal, MyIcon::Off); }
|
---|
| 75 |
|
---|
| 76 | void setNextIcon( QPixmap icon) { buttonIcon(6, icon); }
|
---|
| 77 | QPixmap nextIcon() { return playControl->nextButton->myIcon().pixmap(MyIcon::Normal, MyIcon::Off); }
|
---|
| 78 |
|
---|
| 79 | void setForwardIcon( QPixmap icon) { buttonIcon(7, icon); }
|
---|
| 80 | QPixmap forwardIcon() { return playControl->forwardButton->myIcon().pixmap(MyIcon::Normal, MyIcon::Off); }
|
---|
| 81 |
|
---|
| 82 | void setShuffleIcon( QPixmap icon) { mediaPanelButtonIcon(1, icon); }
|
---|
| 83 | QPixmap shuffleIcon() { return mediaPanel->shuffleButton->myIcon().pixmap(MyIcon::Normal, MyIcon::Off); }
|
---|
| 84 |
|
---|
| 85 | void setRepeatIcon( QPixmap icon) { mediaPanelButtonIcon(2, icon); }
|
---|
| 86 | QPixmap repeatIcon() { return mediaPanel->repeatButton->myIcon().pixmap(MyIcon::Normal, MyIcon::Off); }
|
---|
| 87 |
|
---|
| 88 | void setToolbarActions(QList<QAction *>actions) { toolbar_actions = actions; }
|
---|
| 89 | QList<QAction *> toolbarActions() { return toolbar_actions; }
|
---|
| 90 |
|
---|
| 91 |
|
---|
| 92 | private:
|
---|
| 93 | IconSetter(QWidget *parent = 0);
|
---|
| 94 |
|
---|
| 95 | static IconSetter* m_instance;
|
---|
| 96 | void setActionIcon(QPixmap pix );
|
---|
| 97 | void buttonIcon(int n, QPixmap pix );
|
---|
| 98 | void mediaPanelButtonIcon( int n, QPixmap pix);
|
---|
| 99 |
|
---|
| 100 | QList<QAction *> toolbar_actions;
|
---|
| 101 | };
|
---|
| 102 |
|
---|
| 103 | #endif // QPROPERTYSETTER_H
|
---|