author | mickeyl <mickeyl> | 2004-01-04 17:15:57 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-01-04 17:15:57 (UTC) |
commit | 7c358bb7f19991dff1fd0a68161b411bd808b280 (patch) (unidiff) | |
tree | ac1eada9f68b545e854a3db68e010b3f0af0f77d | |
parent | ee46be7501081a10d744471582426db92ec22a9e (diff) | |
download | opie-7c358bb7f19991dff1fd0a68161b411bd808b280.zip opie-7c358bb7f19991dff1fd0a68161b411bd808b280.tar.gz opie-7c358bb7f19991dff1fd0a68161b411bd808b280.tar.bz2 |
smoothscale to current resolution
-rw-r--r-- | noncore/applets/networkapplet/networkapplet.cpp | 22 | ||||
-rw-r--r-- | noncore/applets/networkapplet/networkapplet.h | 2 |
2 files changed, 17 insertions, 7 deletions
diff --git a/noncore/applets/networkapplet/networkapplet.cpp b/noncore/applets/networkapplet/networkapplet.cpp index 4e658da..9a08568 100644 --- a/noncore/applets/networkapplet/networkapplet.cpp +++ b/noncore/applets/networkapplet/networkapplet.cpp | |||
@@ -20,38 +20,43 @@ | |||
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include "networkapplet.h" | 31 | #include "networkapplet.h" |
32 | |||
33 | /* OPIE */ | ||
34 | #include <opie2/odebug.h> | ||
35 | #include <opie2/onetwork.h> | ||
32 | #include <opie2/otaskbarapplet.h> | 36 | #include <opie2/otaskbarapplet.h> |
37 | #include <qpe/applnk.h> | ||
33 | #include <qpe/qlibrary.h> | 38 | #include <qpe/qlibrary.h> |
34 | #include <qpe/resource.h> | 39 | #include <qpe/resource.h> |
35 | #include <qpainter.h> | 40 | #include <qpainter.h> |
36 | #include <opie2/odebug.h> | ||
37 | #include <opie2/onetwork.h> | ||
38 | 41 | ||
39 | #include <qpushbutton.h> | 42 | /* QT */ |
43 | #include <qhostaddress.h> | ||
44 | #include <qimage.h> | ||
40 | #include <qlabel.h> | 45 | #include <qlabel.h> |
41 | #include <qlayout.h> | 46 | #include <qlayout.h> |
42 | #include <qlineedit.h> | 47 | #include <qlineedit.h> |
43 | #include <qtoolbutton.h> | ||
44 | #include <qhostaddress.h> | ||
45 | #include <qobjectlist.h> | 48 | #include <qobjectlist.h> |
49 | #include <qpushbutton.h> | ||
50 | #include <qtoolbutton.h> | ||
46 | 51 | ||
47 | #include <assert.h> | 52 | #include <assert.h> |
48 | 53 | ||
49 | IfaceUpDownButton::IfaceUpDownButton( QWidget* parent, const char* name ) | 54 | IfaceUpDownButton::IfaceUpDownButton( QWidget* parent, const char* name ) |
50 | :QToolButton( parent, name ) | 55 | :QToolButton( parent, name ) |
51 | { | 56 | { |
52 | _iface = ONetwork::instance()->interface( name ); | 57 | _iface = ONetwork::instance()->interface( name ); |
53 | assert( _iface ); | 58 | assert( _iface ); |
54 | setToggleButton( true ); | 59 | setToggleButton( true ); |
55 | //setAutoRaise( true ); | 60 | //setAutoRaise( true ); |
56 | setOnIconSet( QIconSet( Resource::loadPixmap( "up" ) ) ); | 61 | setOnIconSet( QIconSet( Resource::loadPixmap( "up" ) ) ); |
57 | setOffIconSet( QIconSet( Resource::loadPixmap( "down" ) ) ); | 62 | setOffIconSet( QIconSet( Resource::loadPixmap( "down" ) ) ); |
@@ -201,43 +206,46 @@ void NetworkAppletControl::hideEvent( QHideEvent* e ) | |||
201 | 206 | ||
202 | QSize NetworkAppletControl::sizeHint() const | 207 | QSize NetworkAppletControl::sizeHint() const |
203 | { | 208 | { |
204 | ONetwork::instance()->synchronize(); // rebuild interface database | 209 | ONetwork::instance()->synchronize(); // rebuild interface database |
205 | qDebug( "sizeHint (#ifaces=%d)", ONetwork::instance()->count() ); | 210 | qDebug( "sizeHint (#ifaces=%d)", ONetwork::instance()->count() ); |
206 | return QSize( 14+35+105+14 + 8, ONetwork::instance()->count() * 26 ); | 211 | return QSize( 14+35+105+14 + 8, ONetwork::instance()->count() * 26 ); |
207 | } | 212 | } |
208 | 213 | ||
209 | 214 | ||
210 | NetworkApplet::NetworkApplet( QWidget *parent, const char *name ) | 215 | NetworkApplet::NetworkApplet( QWidget *parent, const char *name ) |
211 | :OTaskbarApplet( parent, name ) | 216 | :OTaskbarApplet( parent, name ) |
212 | { | 217 | { |
213 | _control = new NetworkAppletControl( this, "control" ); | 218 | setFixedHeight( AppLnk::smallIconSize() ); |
219 | setFixedWidth( AppLnk::smallIconSize() ); | ||
220 | _pixmap.convertFromImage( Resource::loadImage( "networkapplet/network" ).smoothScale( height(), width() ) ); | ||
221 | _control = new NetworkAppletControl( this, "control" ); | ||
214 | } | 222 | } |
215 | 223 | ||
216 | 224 | ||
217 | NetworkApplet::~NetworkApplet() | 225 | NetworkApplet::~NetworkApplet() |
218 | { | 226 | { |
219 | } | 227 | } |
220 | 228 | ||
221 | 229 | ||
222 | int NetworkApplet::position() | 230 | int NetworkApplet::position() |
223 | { | 231 | { |
224 | return 4; | 232 | return 4; |
225 | } | 233 | } |
226 | 234 | ||
227 | 235 | ||
228 | void NetworkApplet::paintEvent( QPaintEvent* ) | 236 | void NetworkApplet::paintEvent( QPaintEvent* ) |
229 | { | 237 | { |
230 | QPainter p(this); | 238 | QPainter p(this); |
231 | p.drawPixmap(0, 2, Resource::loadPixmap( "networkapplet/network" ) ); | 239 | p.drawPixmap(0, 2, _pixmap ); |
232 | } | 240 | } |
233 | 241 | ||
234 | 242 | ||
235 | void NetworkApplet::mousePressEvent( QMouseEvent* ) | 243 | void NetworkApplet::mousePressEvent( QMouseEvent* ) |
236 | { | 244 | { |
237 | if ( !_control->isVisible() ) | 245 | if ( !_control->isVisible() ) |
238 | { | 246 | { |
239 | popup( _control ); | 247 | popup( _control ); |
240 | } | 248 | } |
241 | else | 249 | else |
242 | { | 250 | { |
243 | _control->hide(); | 251 | _control->hide(); |
diff --git a/noncore/applets/networkapplet/networkapplet.h b/noncore/applets/networkapplet/networkapplet.h index 7b5fa97..8022537 100644 --- a/noncore/applets/networkapplet/networkapplet.h +++ b/noncore/applets/networkapplet/networkapplet.h | |||
@@ -27,24 +27,25 @@ | |||
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | 28 | ||
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef NETWORKAPPLET_H | 31 | #ifndef NETWORKAPPLET_H |
32 | #define NETWORKAPPLET_H | 32 | #define NETWORKAPPLET_H |
33 | 33 | ||
34 | #include <opie2/otaskbarapplet.h> | 34 | #include <opie2/otaskbarapplet.h> |
35 | #include <qframe.h> | 35 | #include <qframe.h> |
36 | #include <qstring.h> | 36 | #include <qstring.h> |
37 | #include <qtoolbutton.h> | 37 | #include <qtoolbutton.h> |
38 | #include <qlineedit.h> | 38 | #include <qlineedit.h> |
39 | #include <qpixmap.h> | ||
39 | 40 | ||
40 | class ONetworkInterface; | 41 | class ONetworkInterface; |
41 | class QShowEvent; | 42 | class QShowEvent; |
42 | class QHideEvent; | 43 | class QHideEvent; |
43 | class QVBoxLayout; | 44 | class QVBoxLayout; |
44 | 45 | ||
45 | class IfaceUpDownButton : public QToolButton | 46 | class IfaceUpDownButton : public QToolButton |
46 | { | 47 | { |
47 | Q_OBJECT | 48 | Q_OBJECT |
48 | 49 | ||
49 | public: | 50 | public: |
50 | IfaceUpDownButton( QWidget* parent, const char* name ); | 51 | IfaceUpDownButton( QWidget* parent, const char* name ); |
@@ -97,16 +98,17 @@ class NetworkApplet : public OTaskbarApplet | |||
97 | { | 98 | { |
98 | public: | 99 | public: |
99 | NetworkApplet( QWidget* parent = 0, const char* name = 0 ); | 100 | NetworkApplet( QWidget* parent = 0, const char* name = 0 ); |
100 | ~NetworkApplet(); | 101 | ~NetworkApplet(); |
101 | 102 | ||
102 | static int position(); | 103 | static int position(); |
103 | protected: | 104 | protected: |
104 | virtual void paintEvent( QPaintEvent* ); | 105 | virtual void paintEvent( QPaintEvent* ); |
105 | virtual void mousePressEvent( QMouseEvent* ); | 106 | virtual void mousePressEvent( QMouseEvent* ); |
106 | 107 | ||
107 | private: | 108 | private: |
108 | NetworkAppletControl* _control; | 109 | NetworkAppletControl* _control; |
110 | QPixmap _pixmap; | ||
109 | }; | 111 | }; |
110 | 112 | ||
111 | #endif | 113 | #endif |
112 | 114 | ||