Diffstat (limited to 'noncore/applets/memoryapplet') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/applets/memoryapplet/memoryapplet.pro | 4 | ||||
-rw-r--r-- | noncore/applets/memoryapplet/memoryappletimpl.cpp | 65 | ||||
-rw-r--r-- | noncore/applets/memoryapplet/memoryappletimpl.h | 43 | ||||
-rw-r--r-- | noncore/applets/memoryapplet/memorymeter.cpp | 14 | ||||
-rw-r--r-- | noncore/applets/memoryapplet/memorymeter.h | 1 |
5 files changed, 13 insertions, 114 deletions
diff --git a/noncore/applets/memoryapplet/memoryapplet.pro b/noncore/applets/memoryapplet/memoryapplet.pro index 6031386..3cd7839 100644 --- a/noncore/applets/memoryapplet/memoryapplet.pro +++ b/noncore/applets/memoryapplet/memoryapplet.pro @@ -1,24 +1,22 @@ TEMPLATE = lib CONFIG += qt plugin warn_on release HEADERS = ../../settings/sysinfo/graph.h \ ../../settings/sysinfo/load.h \ ../../settings/sysinfo/memory.h \ - memoryappletimpl.h \ memorymeter.h \ memorystatus.h \ swapfile.h SOURCES = ../../settings/sysinfo/graph.cpp \ ../../settings/sysinfo/load.cpp \ ../../settings/sysinfo/memory.cpp \ - memoryappletimpl.cpp \ memorymeter.cpp \ memorystatus.cpp \ swapfile.cpp TARGET = memoryapplet DESTDIR = $(OPIEDIR)/plugins/applets INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += ../$(OPIEDIR)/include VERSION = 1.0.0 -LIBS += -lqpe -lopieui2 +LIBS += -lqpe -lopiecore2 -lopieui2 include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/applets/memoryapplet/memoryappletimpl.cpp b/noncore/applets/memoryapplet/memoryappletimpl.cpp deleted file mode 100644 index a117e7f..0000000 --- a/noncore/applets/memoryapplet/memoryappletimpl.cpp +++ b/dev/null @@ -1,65 +0,0 @@ -/********************************************************************** -** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. -** -** This file is part of the Qtopia Environment. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.trolltech.com/gpl/ for GPL licensing information. -** -** Contact info@trolltech.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ -#include "memorymeter.h" -#include "memoryappletimpl.h" - -MemoryAppletImpl::MemoryAppletImpl() - : memory(0) -{ -} - -MemoryAppletImpl::~MemoryAppletImpl() -{ - delete memory; -} - -QWidget *MemoryAppletImpl::applet( QWidget *parent ) -{ - if ( !memory ) - memory = new MemoryMeter( parent ); - - return memory; -} - -int MemoryAppletImpl::position() const -{ - return 8; -} - -QRESULT MemoryAppletImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) -{ - *iface = 0; - if ( uuid == IID_QUnknown ) - *iface = this; - else if ( uuid == IID_TaskbarApplet ) - *iface = this; - else - return QS_FALSE; - - (*iface)->addRef(); - - return QS_OK; -} - -Q_EXPORT_INTERFACE() -{ - Q_CREATE_INSTANCE( MemoryAppletImpl ) -} - diff --git a/noncore/applets/memoryapplet/memoryappletimpl.h b/noncore/applets/memoryapplet/memoryappletimpl.h deleted file mode 100644 index 2db7dbe..0000000 --- a/noncore/applets/memoryapplet/memoryappletimpl.h +++ b/dev/null @@ -1,43 +0,0 @@ -/********************************************************************** -** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. -** -** This file is part of the Qtopia Environment. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.trolltech.com/gpl/ for GPL licensing information. -** -** Contact info@trolltech.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ -#ifndef MEMORYAPPLETIMPL_H -#define MEMORYAPPLETIMPL_H - -#include <qtopia/taskbarappletinterface.h> - -class MemoryMeter; - -class /*QTOPIA_PLUGIN_EXPORT*/ MemoryAppletImpl : public TaskbarAppletInterface -{ -public: - MemoryAppletImpl(); - virtual ~MemoryAppletImpl(); - - QRESULT queryInterface( const QUuid&, QUnknownInterface** ); - Q_REFCOUNT - - virtual QWidget *applet( QWidget *parent ); - virtual int position() const; - -private: - MemoryMeter *memory; -}; - -#endif diff --git a/noncore/applets/memoryapplet/memorymeter.cpp b/noncore/applets/memoryapplet/memorymeter.cpp index 54b5c52..9299f49 100644 --- a/noncore/applets/memoryapplet/memorymeter.cpp +++ b/noncore/applets/memoryapplet/memorymeter.cpp @@ -11,30 +11,28 @@ ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "memorymeter.h" #include "memorystatus.h" +#include <opie2/otaskbarapplet.h> #include <qtopia/power.h> #include <qtopia/config.h> - -#if defined(Q_WS_QWS) && !defined(QT_NO_COP) #include <qtopia/qcopenvelope_qws.h> -#endif #include <qpainter.h> #include <qtimer.h> #include <qapplication.h> #include <qtopia/applnk.h> MemoryMeter::MemoryMeter( QWidget *parent ) : QWidget( parent ), memoryView(0) { bvsz = QSize(); if ( qApp->desktop()->height() >= 300 ) @@ -57,24 +55,29 @@ MemoryMeter::MemoryMeter( QWidget *parent ) setFixedWidth(10); setFixedHeight(AppLnk::smallIconSize()); usageTimer = new QTimer( this ); connect( usageTimer, SIGNAL(timeout()), this, SLOT(usageTimeout()) ); timerEvent(0); } MemoryMeter::~MemoryMeter() { delete (QWidget *) memoryView; } +int MemoryMeter::position() +{ + return 7; +} + QSize MemoryMeter::sizeHint() const { return QSize(10, AppLnk::smallIconSize()); } bool MemoryMeter::updateMemoryViewGeometry() { if (memoryView != 0) { QSize sz = memoryView->sizeHint(); if ( sz != bvsz ) { @@ -228,12 +231,17 @@ void MemoryMeter::paintEvent( QPaintEvent* ) p.setBrush(c); p.drawRect(batt_xoffset, unused_offset, band_width, unused_height); p.drawRect(batt_xoffset + 2 * band_width, unused_offset, band_width, unused_height); p.setBrush(lightc); p.drawRect(batt_xoffset + band_width, unused_offset, band_width, unused_height); p.setBrush(darkc); p.drawRect(batt_xoffset + 3 * band_width, unused_offset, band_width, unused_height); } } +Q_EXPORT_INTERFACE() +{ + Q_CREATE_INSTANCE( OTaskbarAppletWrapper<MemoryMeter> ); +} + diff --git a/noncore/applets/memoryapplet/memorymeter.h b/noncore/applets/memoryapplet/memorymeter.h index 0f3cb0b..ed541f0 100644 --- a/noncore/applets/memoryapplet/memorymeter.h +++ b/noncore/applets/memoryapplet/memorymeter.h @@ -22,24 +22,25 @@ #include <qwidget.h> class MemoryStatus; class QTimer; class MemoryMeter : public QWidget { Q_OBJECT public: MemoryMeter( QWidget *parent = 0 ); ~MemoryMeter(); + static int position(); QSize sizeHint() const; MemoryStatus* memoryView; protected: void timerEvent( QTimerEvent * ); void paintEvent( QPaintEvent* ); void mousePressEvent( QMouseEvent * ); protected slots: void usageTimeout(); |