author | mickeyl <mickeyl> | 2005-08-29 21:27:26 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-08-29 21:27:26 (UTC) |
commit | 142e7e82efa6dd45884805c34fadec2160225e4b (patch) (side-by-side diff) | |
tree | 6fcb324d0b3bc02f3a966119cee7780bbc4942b1 | |
parent | 96298fa5b396be9309e9e45c86d55a5e7e1d8fc9 (diff) | |
download | opie-142e7e82efa6dd45884805c34fadec2160225e4b.zip opie-142e7e82efa6dd45884805c34fadec2160225e4b.tar.gz opie-142e7e82efa6dd45884805c34fadec2160225e4b.tar.bz2 |
- paint discovery pixmap if applicable
- Resource -> OResource
- fix off-by-one bug in paint()
-rw-r--r-- | noncore/net/opietooth/applet/bluezapplet.cpp | 16 | ||||
-rw-r--r-- | noncore/net/opietooth/applet/bluezapplet.h | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp index 48698b6..e1c2341 100644 --- a/noncore/net/opietooth/applet/bluezapplet.cpp +++ b/noncore/net/opietooth/applet/bluezapplet.cpp @@ -1,114 +1,114 @@ /* =. This file is part of the OPIE Project .=l. Copyright (c) 2002 Maximilian Reiss <max.reiss@gmx.de> .>+-= _;:, .> :=|. This library is free software; you can .> <, > . <= redistribute it and/or modify it under :=1 )Y*s>-.-- : the terms of the GNU Library General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; version 2 of the License. ._= =} : .%+i> _;_. .i_,=:_. -<s. This library is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=| MERCHANTABILITY or FITNESS FOR A _.=:. : :=>: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. . .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-= this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bluezapplet.h" /* OPIE */ #include <opie2/otaskbarapplet.h> #include <opie2/odevice.h> #include <opie2/odebug.h> +#include <opie2/oresource.h> #include <qpe/applnk.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/config.h> -#include <qpe/resource.h> using namespace Opie::Core; /* QT */ #include <qapplication.h> #include <qpoint.h> #include <qpainter.h> #include <qlayout.h> #include <qframe.h> #include <qpixmap.h> #include <qstring.h> #include <qtimer.h> #include <qpopupmenu.h> /* STD */ #include <device.h> namespace OpieTooth { BluezApplet::BluezApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) { setFixedHeight( AppLnk::smallIconSize() ); setFixedWidth( AppLnk::smallIconSize() ); - bluezOnPixmap = Resource::loadImage( "bluetoothapplet/bluezon" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); - bluezOffPixmap = Resource::loadImage( "bluetoothapplet/bluezoff" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); - //bluezDiscoveryOnPixmap = Resource::loadImage( "bluetoothapplet/magglass" )smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize()); + bluezOnPixmap = OResource::loadImage( "bluetoothapplet/bluezon", OResource::SmallIcon ); + bluezOffPixmap = OResource::loadImage( "bluetoothapplet/bluezoff", Opie::Core::OResource::SmallIcon ); + bluezDiscoveryOnPixmap = OResource::loadImage( "bluetoothapplet/bluezondiscovery", Opie::Core::OResource::SmallIcon ); startTimer(4000); btDevice = 0; - btManager = 0; + btManager = 0; bluezactive = false; bluezDiscoveryActive = false; // TODO: determine whether this channel has to be closed at destruction time. QCopChannel* chan = new QCopChannel("QPE/Bluetooth", this ); connect(chan, SIGNAL(received(const QCString&,const QByteArray&) ), this, SLOT(slotMessage(const QCString&,const QByteArray&) ) ); } BluezApplet::~BluezApplet() { if ( btDevice ) { delete btDevice; } if ( btManager ) { delete btManager; } } int BluezApplet::position() { return 6; } bool BluezApplet::checkBluezStatus() { if (btDevice) { if (btDevice->isLoaded() ) { return true; } else { return false; } } else { return false; } } int BluezApplet::setBluezStatus(int c) { if ( c == 1 ) { switch ( ODevice::inst()->model() ) { case Model_iPAQ_H39xx: btDevice = new Device( "/dev/tts/1", "bcsp", "921600" ); break; case Model_iPAQ_H5xxx: btDevice = new Device( "/dev/tts/1", "any", "921600" ); break; @@ -225,61 +225,61 @@ int BluezApplet::position() timerEvent( 0 ); break; case 4: setBluezDiscoveryStatus(1); timerEvent(0 ); break; //case 7: // With table of currently-detected devices. } delete signal; delete menu; } /** * Launches the bluetooth manager */ void BluezApplet::launchManager() { QCopEnvelope e("QPE/System", "execute(QString)"); e << QString("bluetooth-manager"); } /** * Refresh timer * @param the timer event */ void BluezApplet::timerEvent( QTimerEvent * ) { bool oldactive = bluezactive; int olddiscovery = bluezDiscoveryActive; bluezactive = checkBluezStatus(); bluezDiscoveryActive = checkBluezDiscoveryStatus(); if ((bluezactive != oldactive) || (bluezDiscoveryActive != olddiscovery)) { update(); } } /** * Implementation of the paint event * @param the QPaintEvent */ void BluezApplet::paintEvent( QPaintEvent* ) { QPainter p(this); odebug << "paint bluetooth pixmap" << oendl; if (bluezactive > 0) { - p.drawPixmap( 0, 1, bluezOnPixmap ); + p.drawPixmap( 0, 0, bluezOnPixmap ); } else { - p.drawPixmap( 0, 1, bluezOffPixmap ); + p.drawPixmap( 0, 0, bluezOffPixmap ); } if (bluezDiscoveryActive > 0) { - p.drawPixmap( 0, 1, bluezDiscoveryOnPixmap ); + p.drawPixmap( 0, 0, bluezDiscoveryOnPixmap ); } } }; EXPORT_OPIE_APPLET_v1( OpieTooth::BluezApplet ) diff --git a/noncore/net/opietooth/applet/bluezapplet.h b/noncore/net/opietooth/applet/bluezapplet.h index 3b99c0f..c096e29 100644 --- a/noncore/net/opietooth/applet/bluezapplet.h +++ b/noncore/net/opietooth/applet/bluezapplet.h @@ -15,65 +15,65 @@ =_ + =;=| MERCHANTABILITY or FITNESS FOR A _.=:. : :=>: PARTICULAR PURPOSE. See the GNU ..}^=.= = ; Library General Public License for more ++= -. . .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-= this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __BLUEZAPPLET_H__ #define __BLUEZAPPLET_H__ #include <qwidget.h> #include <qpixmap.h> #include <qtimer.h> #include <manager.h> namespace OpieTooth { class Device; class BluezApplet : public QWidget { Q_OBJECT public: BluezApplet( QWidget *parent = 0, const char *name=0 ); ~BluezApplet(); static int position(); protected: void timerEvent(QTimerEvent *te ); public slots: void fillList( const QString& device, RemoteDevice::ValueList list ); private: void mousePressEvent( QMouseEvent * ); void paintEvent( QPaintEvent* ); void launchManager(); bool checkBluezStatus(); int setBluezStatus(int); int checkBluezDiscoveryStatus(); int setBluezDiscoveryStatus(int); private: Device* btDevice; - Manager *btManager; + Manager *btManager; QPixmap bluezOnPixmap; QPixmap bluezOffPixmap; QPixmap bluezDiscoveryOnPixmap; bool bluezactive; bool bluezDiscoveryActive; private slots: void slotMessage( const QCString& , const QByteArray& ); }; }; #endif |