| 1 | /* smplayer, GUI front-end for mplayer.
|
|---|
| 2 | Copyright (C) 2006-2010 Ricardo Villalba <rvm@escomposlinux.org>
|
|---|
| 3 |
|
|---|
| 4 | This program is free software; you can redistribute it and/or modify
|
|---|
| 5 | it under the terms of the GNU General Public License as published by
|
|---|
| 6 | the Free Software Foundation; either version 2 of the License, or
|
|---|
| 7 | (at your option) any later version.
|
|---|
| 8 |
|
|---|
| 9 | This program is distributed in the hope that it will be useful,
|
|---|
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 12 | GNU General Public License for more details.
|
|---|
| 13 |
|
|---|
| 14 | You should have received a copy of the GNU General Public License
|
|---|
| 15 | along with this program; if not, write to the Free Software
|
|---|
| 16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 17 | */
|
|---|
| 18 |
|
|---|
| 19 | #ifndef _WIDGETACTIONS_H_
|
|---|
| 20 | #define _WIDGETACTIONS_H_
|
|---|
| 21 |
|
|---|
| 22 | #include <QWidgetAction>
|
|---|
| 23 | #include "timeslider.h"
|
|---|
| 24 | #include "config.h"
|
|---|
| 25 | #include "guiconfig.h"
|
|---|
| 26 |
|
|---|
| 27 | class QStyle;
|
|---|
| 28 |
|
|---|
| 29 | class MyWidgetAction : public QWidgetAction
|
|---|
| 30 | {
|
|---|
| 31 | Q_OBJECT
|
|---|
| 32 |
|
|---|
| 33 | public:
|
|---|
| 34 | MyWidgetAction( QWidget * parent );
|
|---|
| 35 | ~MyWidgetAction();
|
|---|
| 36 |
|
|---|
| 37 | void setCustomStyle(QStyle * style) { custom_style = style; };
|
|---|
| 38 | QStyle * customStyle() { return custom_style; };
|
|---|
| 39 |
|
|---|
| 40 | void setStyleSheet(QString style) { custom_stylesheet = style; };
|
|---|
| 41 | QString styleSheet() { return custom_stylesheet; };
|
|---|
| 42 |
|
|---|
| 43 | public slots:
|
|---|
| 44 | virtual void enable(); // setEnabled in QAction is not virtual :(
|
|---|
| 45 | virtual void disable();
|
|---|
| 46 |
|
|---|
| 47 | protected:
|
|---|
| 48 | virtual void propagate_enabled(bool);
|
|---|
| 49 |
|
|---|
| 50 | protected:
|
|---|
| 51 | QStyle * custom_style;
|
|---|
| 52 | QString custom_stylesheet;
|
|---|
| 53 | };
|
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 | class TimeSliderAction : public MyWidgetAction
|
|---|
| 57 | {
|
|---|
| 58 | Q_OBJECT
|
|---|
| 59 |
|
|---|
| 60 | public:
|
|---|
| 61 | TimeSliderAction( QWidget * parent );
|
|---|
| 62 | ~TimeSliderAction();
|
|---|
| 63 |
|
|---|
| 64 | public slots:
|
|---|
| 65 | virtual void setPos(int);
|
|---|
| 66 | virtual int pos();
|
|---|
| 67 | #if ENABLE_DELAYED_DRAGGING
|
|---|
| 68 | void setDragDelay(int);
|
|---|
| 69 | int dragDelay();
|
|---|
| 70 |
|
|---|
| 71 | private:
|
|---|
| 72 | int drag_delay;
|
|---|
| 73 | #endif
|
|---|
| 74 |
|
|---|
| 75 | signals:
|
|---|
| 76 | void posChanged(int value);
|
|---|
| 77 | void draggingPos(int value);
|
|---|
| 78 | #if ENABLE_DELAYED_DRAGGING
|
|---|
| 79 | void delayedDraggingPos(int);
|
|---|
| 80 | #endif
|
|---|
| 81 |
|
|---|
| 82 | protected:
|
|---|
| 83 | virtual QWidget * createWidget ( QWidget * parent );
|
|---|
| 84 | };
|
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 | class VolumeSliderAction : public MyWidgetAction
|
|---|
| 88 | {
|
|---|
| 89 | Q_OBJECT
|
|---|
| 90 |
|
|---|
| 91 | public:
|
|---|
| 92 | VolumeSliderAction( QWidget * parent );
|
|---|
| 93 | ~VolumeSliderAction();
|
|---|
| 94 |
|
|---|
| 95 | void setFixedSize(QSize size) { fixed_size = size; };
|
|---|
| 96 | QSize fixedSize() { return fixed_size; };
|
|---|
| 97 |
|
|---|
| 98 | void setTickPosition(QSlider::TickPosition position);
|
|---|
| 99 | QSlider::TickPosition tickPosition() { return tick_position; };
|
|---|
| 100 |
|
|---|
| 101 | public slots:
|
|---|
| 102 | virtual void setValue(int);
|
|---|
| 103 | virtual int value();
|
|---|
| 104 |
|
|---|
| 105 | signals:
|
|---|
| 106 | void valueChanged(int value);
|
|---|
| 107 |
|
|---|
| 108 | protected:
|
|---|
| 109 | virtual QWidget * createWidget ( QWidget * parent );
|
|---|
| 110 |
|
|---|
| 111 | private:
|
|---|
| 112 | QSize fixed_size;
|
|---|
| 113 | QSlider::TickPosition tick_position;
|
|---|
| 114 | };
|
|---|
| 115 |
|
|---|
| 116 |
|
|---|
| 117 | class TimeLabelAction : public MyWidgetAction
|
|---|
| 118 | {
|
|---|
| 119 | Q_OBJECT
|
|---|
| 120 |
|
|---|
| 121 | public:
|
|---|
| 122 | TimeLabelAction( QWidget * parent );
|
|---|
| 123 | ~TimeLabelAction();
|
|---|
| 124 |
|
|---|
| 125 | virtual QString text() { return _text; };
|
|---|
| 126 |
|
|---|
| 127 | public slots:
|
|---|
| 128 | virtual void setText(QString s);
|
|---|
| 129 |
|
|---|
| 130 | signals:
|
|---|
| 131 | void newText(QString s);
|
|---|
| 132 |
|
|---|
| 133 | protected:
|
|---|
| 134 | virtual QWidget * createWidget ( QWidget * parent );
|
|---|
| 135 |
|
|---|
| 136 | private:
|
|---|
| 137 | QString _text;
|
|---|
| 138 | };
|
|---|
| 139 |
|
|---|
| 140 |
|
|---|
| 141 | #if MINI_ARROW_BUTTONS
|
|---|
| 142 | class SeekingButton : public QWidgetAction
|
|---|
| 143 | {
|
|---|
| 144 | Q_OBJECT
|
|---|
| 145 |
|
|---|
| 146 | public:
|
|---|
| 147 | SeekingButton( QList<QAction*> actions, QWidget * parent );
|
|---|
| 148 | ~SeekingButton();
|
|---|
| 149 |
|
|---|
| 150 | protected:
|
|---|
| 151 | virtual QWidget * createWidget ( QWidget * parent );
|
|---|
| 152 |
|
|---|
| 153 | QList<QAction*> _actions;
|
|---|
| 154 | };
|
|---|
| 155 | #endif
|
|---|
| 156 |
|
|---|
| 157 | #endif
|
|---|
| 158 |
|
|---|