-rw-r--r-- | noncore/applets/volumeapplet2/volumeapplet.cpp | 3 | ||||
-rw-r--r-- | noncore/applets/volumeapplet2/volumeapplet.h | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/noncore/applets/volumeapplet2/volumeapplet.cpp b/noncore/applets/volumeapplet2/volumeapplet.cpp index 946616f..fad8e42 100644 --- a/noncore/applets/volumeapplet2/volumeapplet.cpp +++ b/noncore/applets/volumeapplet2/volumeapplet.cpp | |||
@@ -124,65 +124,66 @@ int VolumeAppletControl::volPercent ( ) const | |||
124 | bool VolumeAppletControl::volMuted ( ) const | 124 | bool VolumeAppletControl::volMuted ( ) const |
125 | { | 125 | { |
126 | return m_vol_muted; | 126 | return m_vol_muted; |
127 | } | 127 | } |
128 | 128 | ||
129 | 129 | ||
130 | void VolumeAppletControl::showEvent( QShowEvent* e ) | 130 | void VolumeAppletControl::showEvent( QShowEvent* e ) |
131 | { | 131 | { |
132 | odebug << "showEvent" << oendl; | 132 | odebug << "showEvent" << oendl; |
133 | QWidget::showEvent( e ); | 133 | QWidget::showEvent( e ); |
134 | } | 134 | } |
135 | 135 | ||
136 | 136 | ||
137 | void VolumeAppletControl::hideEvent( QHideEvent* e ) | 137 | void VolumeAppletControl::hideEvent( QHideEvent* e ) |
138 | { | 138 | { |
139 | odebug << "hideEvent" << oendl; | 139 | odebug << "hideEvent" << oendl; |
140 | QWidget::hideEvent( e ); | 140 | QWidget::hideEvent( e ); |
141 | } | 141 | } |
142 | 142 | ||
143 | 143 | ||
144 | QSize VolumeAppletControl::sizeHint() const | 144 | QSize VolumeAppletControl::sizeHint() const |
145 | { | 145 | { |
146 | int wd = QPEApplication::desktop()->width(); | 146 | int wd = QPEApplication::desktop()->width(); |
147 | return QSize( wd, 200 ); //QFrame::sizeHint(); | 147 | return QSize( wd, 200 ); //QFrame::sizeHint(); |
148 | } | 148 | } |
149 | 149 | ||
150 | 150 | ||
151 | VolumeApplet::VolumeApplet( QWidget *parent, const char *name ) | 151 | VolumeApplet::VolumeApplet( QWidget *parent, const char *name ) |
152 | :OTaskbarApplet( parent, name ) | 152 | :OTaskbarApplet( parent, name ) |
153 | { | 153 | { |
154 | setFixedHeight( AppLnk::smallIconSize() +4); | 154 | setFixedHeight( AppLnk::smallIconSize() +4); |
155 | setFixedWidth( AppLnk::smallIconSize() ); | 155 | setFixedWidth( AppLnk::smallIconSize() ); |
156 | _pixmap = new QPixmap (Opie::Core::OResource::loadPixmap( "volume", Opie::Core::OResource::SmallIcon )); | 156 | _pixmap = Opie::Core::OResource::loadPixmap( "volume", Opie::Core::OResource::SmallIcon ); |
157 | // _pixmap = new QPixmap (Opie::Core::OResource::loadPixmap( "volume", Opie::Core::OResource::SmallIcon )); | ||
157 | _control = new VolumeAppletControl( this, "control" ); | 158 | _control = new VolumeAppletControl( this, "control" ); |
158 | } | 159 | } |
159 | 160 | ||
160 | 161 | ||
161 | VolumeApplet::~VolumeApplet() | 162 | VolumeApplet::~VolumeApplet() |
162 | { | 163 | { |
163 | } | 164 | } |
164 | 165 | ||
165 | 166 | ||
166 | int VolumeApplet::position() | 167 | int VolumeApplet::position() |
167 | { | 168 | { |
168 | return 4; | 169 | return 4; |
169 | } | 170 | } |
170 | 171 | ||
171 | 172 | ||
172 | void VolumeApplet::paintEvent( QPaintEvent* ) | 173 | void VolumeApplet::paintEvent( QPaintEvent* ) |
173 | { | 174 | { |
174 | QPainter p(this); | 175 | QPainter p(this); |
175 | p.drawPixmap(0, 2, _pixmap ); | 176 | p.drawPixmap(0, 2, _pixmap ); |
176 | 177 | ||
177 | /* | 178 | /* |
178 | p. drawPixmap ( (width()- _pixmap->width())/2, QMAX( (height()-4-_pixmap->height() )/2, 1), *_pixmap ); | 179 | p. drawPixmap ( (width()- _pixmap->width())/2, QMAX( (height()-4-_pixmap->height() )/2, 1), *_pixmap ); |
179 | p. setPen ( darkGray ); | 180 | p. setPen ( darkGray ); |
180 | p. drawRect ( 1, height() - 4, width() - 2, 4 ); | 181 | p. drawRect ( 1, height() - 4, width() - 2, 4 ); |
181 | 182 | ||
182 | OMixerInterface* mixer = new OMixerInterface( this, "/dev/mixer" ); | 183 | OMixerInterface* mixer = new OMixerInterface( this, "/dev/mixer" ); |
183 | 184 | ||
184 | int volPercent = mixer->volume( "Vol" ) >> 8; | 185 | int volPercent = mixer->volume( "Vol" ) >> 8; |
185 | 186 | ||
186 | int pixelsWide = volPercent * ( width() - 4 ) / 100; | 187 | int pixelsWide = volPercent * ( width() - 4 ) / 100; |
187 | p. fillRect ( 2, height() - 3, pixelsWide, 2, red ); | 188 | p. fillRect ( 2, height() - 3, pixelsWide, 2, red ); |
188 | p. fillRect ( pixelsWide + 2, height() - 3, width() - 4 - pixelsWide, 2, lightGray ); | 189 | p. fillRect ( pixelsWide + 2, height() - 3, width() - 4 - pixelsWide, 2, lightGray ); |
diff --git a/noncore/applets/volumeapplet2/volumeapplet.h b/noncore/applets/volumeapplet2/volumeapplet.h index 953c305..e5dd4b9 100644 --- a/noncore/applets/volumeapplet2/volumeapplet.h +++ b/noncore/applets/volumeapplet2/volumeapplet.h | |||
@@ -76,37 +76,37 @@ class VolumeAppletControl : public QFrame | |||
76 | 76 | ||
77 | int m_vol_percent; | 77 | int m_vol_percent; |
78 | bool m_vol_muted; | 78 | bool m_vol_muted; |
79 | 79 | ||
80 | Opie::MM::OMixerInterface* mixer; | 80 | Opie::MM::OMixerInterface* mixer; |
81 | 81 | ||
82 | virtual QSize sizeHint() const; | 82 | virtual QSize sizeHint() const; |
83 | 83 | ||
84 | protected: | 84 | protected: |
85 | virtual void showEvent( QShowEvent* ); | 85 | virtual void showEvent( QShowEvent* ); |
86 | virtual void hideEvent( QHideEvent* ); | 86 | virtual void hideEvent( QHideEvent* ); |
87 | void build(); | 87 | void build(); |
88 | 88 | ||
89 | private: | 89 | private: |
90 | 90 | ||
91 | QGridLayout* l; | 91 | QGridLayout* l; |
92 | }; | 92 | }; |
93 | 93 | ||
94 | 94 | ||
95 | class VolumeApplet : public Opie::Ui::OTaskbarApplet | 95 | class VolumeApplet : public Opie::Ui::OTaskbarApplet |
96 | { | 96 | { |
97 | public: | 97 | public: |
98 | VolumeApplet( QWidget* parent = 0, const char* name = 0 ); | 98 | VolumeApplet( QWidget* parent = 0, const char* name = 0 ); |
99 | ~VolumeApplet(); | 99 | ~VolumeApplet(); |
100 | 100 | ||
101 | static int position(); | 101 | static int position(); |
102 | protected: | 102 | protected: |
103 | virtual void paintEvent( QPaintEvent* ); | 103 | virtual void paintEvent( QPaintEvent* ); |
104 | virtual void mousePressEvent( QMouseEvent* ); | 104 | virtual void mousePressEvent( QMouseEvent* ); |
105 | 105 | ||
106 | private: | 106 | private: |
107 | VolumeAppletControl* _control; | 107 | VolumeAppletControl* _control; |
108 | QPixmap* _pixmap; | 108 | QPixmap _pixmap; |
109 | }; | 109 | }; |
110 | 110 | ||
111 | #endif | 111 | #endif |
112 | 112 | ||