3
* KMix -- KDE's full featured mini mixer
5
* Copyright Christian Esken <esken@kde.org>
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Library General Public
9
* License as published by the Free Software Foundation; either
10
* version 2 of the License, or (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Library General Public License for more details.
17
* You should have received a copy of the GNU Library General Public
18
* License along with this program; if not, write to the Free
19
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29
#include <KActionCollection>
39
* The ViewBase is a virtual base class, to be used for subclassing the real Mixer Views.
41
class ViewBase : public QWidget
45
friend class KMixToolBox; // the toolbox is everybodys friend :-)
49
typedef uint ViewFlags;
53
MenuBarVisible = 0x0002,
58
ViewBase(QWidget* parent, const char* id, Mixer* mixer, Qt::WFlags=0, ViewFlags vflags=0, GUIProfile *guiprof=0, KActionCollection* actionCollection = 0);
63
// This method is called by ViewBase at the end of createDeviceWidgets(). The default
64
// implementation does nothing. Subclasses can override this method for doing final
65
// touches. This is very much like polish(), but called at an exactly well-known time.
66
// Also I do not want Views to interfere with polish()
67
virtual void constructionFinished() = 0;
69
// This method is called after a configuration update (show/hide controls, split/unsplit).
70
// More complicated changes (e.g. order of controls) need a GUI rebuild - please use
71
// rebuildFromProfile() then.
72
// The default implementation does nothing.
73
virtual void configurationUpdate();
75
// This method is called after a configuration update (in other words: after the user
76
// has clicked "OK" on the "show/hide" configuration dialog. The default implementation
78
virtual void rebuildFromProfile();
81
* Creates the widgets for all supported devices. The default implementation loops
82
* over the supported MixDevice's and calls add() for each of it.
84
virtual void createDeviceWidgets();
86
virtual void setMixSet() = 0;
91
* Creates a suitable representation for the given MixDevice.
92
* The default implementation creates a label
94
virtual QWidget* add(MixDevice *) = 0;
99
virtual KMenu* getPopup();
100
virtual void popupReset();
101
virtual void showContextMenu();
103
virtual bool isValid() const;
105
void setIcons(bool on);
106
void setLabels(bool on);
107
void setTicks(bool on);
108
GUIProfile* guiProfile() { return _guiprof; };
109
KActionCollection* actionCollection() { return _actions; };
112
* Contains the widgets for the _mixSet. There is a 1:1 relationship, which means:
113
* _mdws[i] is the Widget for the MixDevice _mixSet[i] - please see ViewBase::createDeviceWidgets().
114
* Hint: !! The new ViewSurround class shows that a 1:1 relationship does not work in a general scenario.
115
* I actually DID expect this. The solution is unclear yet, probably there will be a virtual mapper method.
117
QList<QWidget *> _mdws;
127
KActionCollection* _actions; // -<- applciations wide action collection
130
GUIProfile* _guiprof;
131
KActionCollection *_localActionColletion;
133
virtual void refreshVolumeLevels();
134
virtual void configureView();
135
void toggleMenuBarSlot();
138
void mousePressEvent( QMouseEvent *e );
141
void toggleMenuBar();
144
unsigned int _dummyImplPos;