summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2005-08-12 06:29:54 (UTC)
committer llornkcor <llornkcor>2005-08-12 06:29:54 (UTC)
commit6ee18e3d11d5204ca6c8e885bc563ab34befdaec (patch) (unidiff)
tree02e437a5f232e99ac87c72c8ebacb301275ef962
parent374d60dacd347a947d5833b21cd73793ffb057ca (diff)
downloadopie-6ee18e3d11d5204ca6c8e885bc563ab34befdaec.zip
opie-6ee18e3d11d5204ca6c8e885bc563ab34befdaec.tar.gz
opie-6ee18e3d11d5204ca6c8e885bc563ab34befdaec.tar.bz2
revert
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/volumeapplet2/volumeapplet.cpp3
-rw-r--r--noncore/applets/volumeapplet2/volumeapplet.h2
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
@@ -92,125 +92,126 @@ void VolumeAppletControl::build()
92// OMixerInterface* 92// OMixerInterface*
93 mixer = new OMixerInterface( this, "/dev/mixer" ); 93 mixer = new OMixerInterface( this, "/dev/mixer" );
94 94
95 QStringList channels = mixer->allChannels(); 95 QStringList channels = mixer->allChannels();
96 96
97 int x = 0; 97 int x = 0;
98 // int y = 0; 98 // int y = 0;
99 99
100 for ( QStringList::Iterator it = channels.begin(); it != channels.end(); ++it ) 100 for ( QStringList::Iterator it = channels.begin(); it != channels.end(); ++it )
101 { 101 {
102 if((*it) == mixer->volume( "Vol")) { 102 if((*it) == mixer->volume( "Vol")) {
103 m_vol_percent=mixer->volume( *it ) >> 8; 103 m_vol_percent=mixer->volume( *it ) >> 8;
104 } 104 }
105 owarn << "OSSDEMO: Mixer has channel " << *it << "" << oendl; 105 owarn << "OSSDEMO: Mixer has channel " << *it << "" << oendl;
106 owarn << "OSSDEMO: +--- volume " << ( mixer->volume( *it ) & 0xff ) 106 owarn << "OSSDEMO: +--- volume " << ( mixer->volume( *it ) & 0xff )
107 << " (left) | " << ( mixer->volume( *it ) >> 8 ) << " (right)" << oendl; 107 << " (left) | " << ( mixer->volume( *it ) >> 8 ) << " (right)" << oendl;
108 108
109 l->addWidget( new Channel( mixer, this, *it ), 0, x++, AlignCenter ); 109 l->addWidget( new Channel( mixer, this, *it ), 0, x++, AlignCenter );
110 } 110 }
111 111
112} 112}
113 113
114 114
115VolumeAppletControl::~VolumeAppletControl() 115VolumeAppletControl::~VolumeAppletControl()
116{ 116{
117} 117}
118 118
119int VolumeAppletControl::volPercent ( ) const 119int VolumeAppletControl::volPercent ( ) const
120{ 120{
121 return m_vol_percent; 121 return m_vol_percent;
122} 122}
123 123
124bool VolumeAppletControl::volMuted ( ) const 124bool VolumeAppletControl::volMuted ( ) const
125{ 125{
126 return m_vol_muted; 126 return m_vol_muted;
127} 127}
128 128
129 129
130void VolumeAppletControl::showEvent( QShowEvent* e ) 130void 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
137void VolumeAppletControl::hideEvent( QHideEvent* e ) 137void 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
151VolumeApplet::VolumeApplet( QWidget *parent, const char *name ) 151VolumeApplet::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
161VolumeApplet::~VolumeApplet() 162VolumeApplet::~VolumeApplet()
162{ 163{
163} 164}
164 165
165 166
166int VolumeApplet::position() 167int VolumeApplet::position()
167{ 168{
168 return 4; 169 return 4;
169} 170}
170 171
171 172
172void VolumeApplet::paintEvent( QPaintEvent* ) 173void 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 );
189*/ 190*/
190 191
191// if ( _control-> volMuted ( )) { 192// if ( _control-> volMuted ( )) {
192// p. setPen ( red ); 193// p. setPen ( red );
193// p. drawLine ( 1, 2, width() - 2, height() - 5 ); 194// p. drawLine ( 1, 2, width() - 2, height() - 5 );
194// p. drawLine ( 1, 3, width() - 2, height() - 4 ); 195// p. drawLine ( 1, 3, width() - 2, height() - 4 );
195// p. drawLine ( width() - 2, 2, 1, height() - 5 ); 196// p. drawLine ( width() - 2, 2, 1, height() - 5 );
196// p. drawLine ( width() - 2, 3, 1, height() - 4 ); 197// p. drawLine ( width() - 2, 3, 1, height() - 4 );
197// } 198// }
198 199
199// QPainter p(this); 200// QPainter p(this);
200 // p.drawPixmap(0, 2, _pixmap ); 201 // p.drawPixmap(0, 2, _pixmap );
201} 202}
202 203
203 204
204void VolumeApplet::mousePressEvent( QMouseEvent* ) 205void VolumeApplet::mousePressEvent( QMouseEvent* )
205{ 206{
206 if ( !_control->isVisible() ) 207 if ( !_control->isVisible() )
207 { 208 {
208 popup( _control ); 209 popup( _control );
209 } 210 }
210 else 211 else
211 { 212 {
212 _control->hide(); 213 _control->hide();
213 } 214 }
214} 215}
215 216
216EXPORT_OPIE_APPLET_v1( VolumeApplet ) 217EXPORT_OPIE_APPLET_v1( VolumeApplet )
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
@@ -44,69 +44,69 @@ namespace Opie
44 namespace Ui { class OLedBox; } 44 namespace Ui { class OLedBox; }
45// namespace MM { class OMixerInterface; } 45// namespace MM { class OMixerInterface; }
46} 46}
47class QLabel; 47class QLabel;
48class QSlider; 48class QSlider;
49class QShowEvent; 49class QShowEvent;
50class QHideEvent; 50class QHideEvent;
51class QGridLayout; 51class QGridLayout;
52 52
53class Channel : public QVBox 53class Channel : public QVBox
54{ 54{
55 public: 55 public:
56 Channel( Opie::MM::OMixerInterface* mixer, QWidget* parent, const char* name ); 56 Channel( Opie::MM::OMixerInterface* mixer, QWidget* parent, const char* name );
57 virtual ~Channel(); 57 virtual ~Channel();
58 58
59 // public slots: 59 // public slots:
60 // virtual void clicked(); 60 // virtual void clicked();
61 61
62 private: 62 private:
63 QLabel* _name; 63 QLabel* _name;
64 QSlider* _volume; 64 QSlider* _volume;
65 Opie::Ui::OLedBox* _mute; 65 Opie::Ui::OLedBox* _mute;
66 Opie::MM::OMixerInterface* _mixer; 66 Opie::MM::OMixerInterface* _mixer;
67}; 67};
68 68
69class VolumeAppletControl : public QFrame 69class VolumeAppletControl : public QFrame
70{ 70{
71 public: 71 public:
72 VolumeAppletControl( Opie::Ui::OTaskbarApplet* parent, const char* name = 0 ); 72 VolumeAppletControl( Opie::Ui::OTaskbarApplet* parent, const char* name = 0 );
73 ~VolumeAppletControl(); 73 ~VolumeAppletControl();
74 bool volMuted() const; 74 bool volMuted() const;
75 int volPercent() const; 75 int volPercent() const;
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
95class VolumeApplet : public Opie::Ui::OTaskbarApplet 95class 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