~ubuntu-branches/ubuntu/natty/kdemultimedia/natty-proposed

« back to all changes in this revision

Viewing changes to kmix/viewbase.h

  • Committer: Bazaar Package Importer
  • Author(s): Debian Qt/KDE Maintainers
  • Date: 2011-05-26 02:41:36 UTC
  • mfrom: (0.2.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 108.
  • Revision ID: james.westby@ubuntu.com-20110526024136-jjwsigfy402jhupm
Tags: upstream-4.6.3
ImportĀ upstreamĀ versionĀ 4.6.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//-*-C++-*-
2
 
/*
3
 
 * KMix -- KDE's full featured mini mixer
4
 
 *
5
 
 * Copyright Christian Esken <esken@kde.org>
6
 
 *
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.
11
 
 *
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.
16
 
 *
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.
20
 
 */
21
 
#ifndef ViewBase_h
22
 
#define ViewBase_h
23
 
 
24
 
// QT
25
 
#include <QWidget>
26
 
#include <qlist.h>
27
 
 
28
 
// KDE
29
 
#include <KActionCollection>
30
 
class KMenu;
31
 
class MixSet;
32
 
class Mixer;
33
 
class MixDevice;
34
 
 
35
 
// KMix
36
 
class GUIProfile;
37
 
 
38
 
/**
39
 
  * The ViewBase is a virtual base class, to be used for subclassing the real Mixer Views.
40
 
  */
41
 
class ViewBase : public QWidget
42
 
{
43
 
    Q_OBJECT
44
 
 
45
 
friend class KMixToolBox;  // the toolbox is everybodys friend :-)
46
 
 
47
 
public:
48
 
 
49
 
   typedef uint ViewFlags;
50
 
   enum ViewFlagsEnum {
51
 
      // Regular flags
52
 
      HasMenuBar     = 0x0001,
53
 
      MenuBarVisible = 0x0002,
54
 
      Horizontal     = 0x0004,
55
 
      Vertical       = 0x0008
56
 
   };
57
 
 
58
 
    ViewBase(QWidget* parent, const char* id, Mixer* mixer, Qt::WFlags=0, ViewFlags vflags=0, GUIProfile *guiprof=0, KActionCollection* actionCollection = 0);
59
 
    virtual ~ViewBase();
60
 
 
61
 
    QString id() const;
62
 
 
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;
68
 
 
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();
74
 
 
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
77
 
    // does nothing.
78
 
    virtual void rebuildFromProfile();
79
 
 
80
 
    /**
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.
83
 
     */
84
 
    virtual void createDeviceWidgets();
85
 
 
86
 
    virtual void setMixSet() = 0;
87
 
    
88
 
    Mixer* getMixer();
89
 
 
90
 
    /**
91
 
     * Creates a suitable representation for the given MixDevice.
92
 
     * The default implementation creates a label
93
 
     */
94
 
    virtual QWidget* add(MixDevice *) = 0;
95
 
 
96
 
    /**
97
 
     * Popup stuff
98
 
     */
99
 
    virtual KMenu* getPopup();
100
 
    virtual void popupReset();
101
 
    virtual void showContextMenu();
102
 
 
103
 
    virtual bool isValid() const;
104
 
 
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; };
110
 
 
111
 
    /**
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.
116
 
     */
117
 
    QList<QWidget *> _mdws;
118
 
 
119
 
signals:
120
 
    void rebuildGUI();
121
 
 
122
 
 
123
 
protected:
124
 
    MixSet *_mixSet;
125
 
    Mixer *_mixer;
126
 
    KMenu *_popMenu;
127
 
    KActionCollection* _actions; // -<- applciations wide action collection
128
 
 
129
 
    ViewFlags _vflags;
130
 
    GUIProfile* _guiprof;
131
 
   KActionCollection *_localActionColletion;
132
 
public slots:
133
 
   virtual void refreshVolumeLevels();
134
 
   virtual void configureView(); 
135
 
   void toggleMenuBarSlot();
136
 
 
137
 
protected slots:
138
 
   void mousePressEvent( QMouseEvent *e );
139
 
 
140
 
signals:
141
 
   void toggleMenuBar();
142
 
 
143
 
private:
144
 
   unsigned int _dummyImplPos;
145
 
   QString      m_viewId;
146
 
};
147
 
 
148
 
#endif
149