author | drw <drw> | 2004-02-22 17:17:08 (UTC) |
---|---|---|
committer | drw <drw> | 2004-02-22 17:17:08 (UTC) |
commit | 5b27ef38d45ae4aa751c6e364cb62ed428808e3f (patch) (unidiff) | |
tree | 14e149df51b9016c0128b277eb698cf14582d639 | |
parent | f31e19e2d828dc6d8563b2540e45ee60184f91aa (diff) | |
download | opie-5b27ef38d45ae4aa751c6e364cb62ed428808e3f.zip opie-5b27ef38d45ae4aa751c6e364cb62ed428808e3f.tar.gz opie-5b27ef38d45ae4aa751c6e364cb62ed428808e3f.tar.bz2 |
Memory Applet: libopie->libopie2
-rw-r--r-- | noncore/applets/memoryapplet/config.in | 2 | ||||
-rw-r--r-- | noncore/applets/memoryapplet/memoryapplet.pro | 2 | ||||
-rw-r--r-- | noncore/applets/memoryapplet/memorystatus.cpp | 31 | ||||
-rw-r--r-- | noncore/applets/memoryapplet/memorystatus.h | 10 | ||||
-rw-r--r-- | noncore/applets/memoryapplet/opie-memoryapplet.control | 2 |
5 files changed, 24 insertions, 23 deletions
diff --git a/noncore/applets/memoryapplet/config.in b/noncore/applets/memoryapplet/config.in index 578aaf9..4fc13ba 100644 --- a/noncore/applets/memoryapplet/config.in +++ b/noncore/applets/memoryapplet/config.in | |||
@@ -1,6 +1,6 @@ | |||
1 | config MEMORYAPPLET | 1 | config MEMORYAPPLET |
2 | boolean "opie-memoryapplet (view memory status and manage a swap file)" | 2 | boolean "opie-memoryapplet (view memory status and manage a swap file)" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && SYSINFO | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2UI && SYSINFO |
5 | comment "opie-memoryapplet needs a libqpe, libopie and sysinfo" | 5 | comment "opie-memoryapplet needs a libqpe, libopie and sysinfo" |
6 | depends ! ( LIBOPIE && SYSINFO ) | 6 | depends ! ( LIBOPIE && SYSINFO ) |
diff --git a/noncore/applets/memoryapplet/memoryapplet.pro b/noncore/applets/memoryapplet/memoryapplet.pro index cd3f4a5..6031386 100644 --- a/noncore/applets/memoryapplet/memoryapplet.pro +++ b/noncore/applets/memoryapplet/memoryapplet.pro | |||
@@ -1,24 +1,24 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt plugin warn_on release | 2 | CONFIG += qt plugin warn_on release |
3 | HEADERS = ../../settings/sysinfo/graph.h \ | 3 | HEADERS = ../../settings/sysinfo/graph.h \ |
4 | ../../settings/sysinfo/load.h \ | 4 | ../../settings/sysinfo/load.h \ |
5 | ../../settings/sysinfo/memory.h \ | 5 | ../../settings/sysinfo/memory.h \ |
6 | memoryappletimpl.h \ | 6 | memoryappletimpl.h \ |
7 | memorymeter.h \ | 7 | memorymeter.h \ |
8 | memorystatus.h \ | 8 | memorystatus.h \ |
9 | swapfile.h | 9 | swapfile.h |
10 | SOURCES = ../../settings/sysinfo/graph.cpp \ | 10 | SOURCES = ../../settings/sysinfo/graph.cpp \ |
11 | ../../settings/sysinfo/load.cpp \ | 11 | ../../settings/sysinfo/load.cpp \ |
12 | ../../settings/sysinfo/memory.cpp \ | 12 | ../../settings/sysinfo/memory.cpp \ |
13 | memoryappletimpl.cpp \ | 13 | memoryappletimpl.cpp \ |
14 | memorymeter.cpp \ | 14 | memorymeter.cpp \ |
15 | memorystatus.cpp \ | 15 | memorystatus.cpp \ |
16 | swapfile.cpp | 16 | swapfile.cpp |
17 | TARGET = memoryapplet | 17 | TARGET = memoryapplet |
18 | DESTDIR = $(OPIEDIR)/plugins/applets | 18 | DESTDIR = $(OPIEDIR)/plugins/applets |
19 | INCLUDEPATH += $(OPIEDIR)/include | 19 | INCLUDEPATH += $(OPIEDIR)/include |
20 | DEPENDPATH += ../$(OPIEDIR)/include | 20 | DEPENDPATH += ../$(OPIEDIR)/include |
21 | VERSION = 1.0.0 | 21 | VERSION = 1.0.0 |
22 | LIBS += -lqpe -lopie | 22 | LIBS += -lqpe -lopieui2 |
23 | 23 | ||
24 | include ( $(OPIEDIR)/include.pro ) | 24 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/applets/memoryapplet/memorystatus.cpp b/noncore/applets/memoryapplet/memorystatus.cpp index b738312..c01ba28 100644 --- a/noncore/applets/memoryapplet/memorystatus.cpp +++ b/noncore/applets/memoryapplet/memorystatus.cpp | |||
@@ -1,82 +1,81 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "memorystatus.h" | 20 | #include "memorystatus.h" |
21 | #include "../../settings/sysinfo/memory.h" | 21 | #include "../../settings/sysinfo/memory.h" |
22 | #include "swapfile.h" | 22 | #include "swapfile.h" |
23 | 23 | ||
24 | #include <qpainter.h> | 24 | #include <qpainter.h> |
25 | #include <qpushbutton.h> | 25 | #include <qpushbutton.h> |
26 | #include <qdrawutil.h> | 26 | #include <qdrawutil.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | 28 | ||
29 | #include <opie/otabwidget.h> | ||
30 | #include <qlayout.h> | 29 | #include <qlayout.h> |
31 | 30 | ||
32 | MemoryStatus::MemoryStatus(QWidget *parent, WFlags f ) | 31 | MemoryStatus::MemoryStatus(QWidget *parent, WFlags f ) |
33 | : QFrame(parent, 0, f), mi(0), sf(0) | 32 | : QFrame(parent, 0, f), mi(0), sf(0) |
34 | { | 33 | { |
35 | setCaption( tr("Memory Status") ); | 34 | setCaption( tr("Memory Status") ); |
36 | //resize( 220, 180 ); | 35 | //resize( 220, 180 ); |
37 | 36 | ||
38 | QVBoxLayout *lay = new QVBoxLayout( this ); | 37 | QVBoxLayout *lay = new QVBoxLayout( this ); |
39 | tab = new OTabWidget( this, "tabwidget", OTabWidget::Global ); | 38 | tab = new OTabWidget( this, "tabwidget", OTabWidget::Global ); |
40 | lay->addWidget( tab ); | 39 | lay->addWidget( tab ); |
41 | tab->addTab( mi = new MemoryInfo( tab ), "memory/memorytabicon", tr("Memory") ); | 40 | tab->addTab( mi = new MemoryInfo( tab ), "memory/memorytabicon", tr("Memory") ); |
42 | tab->addTab( sf = new Swapfile( tab ), "memory/storagetabicon", tr("Swapfile") ); | 41 | tab->addTab( sf = new Swapfile( tab ), "memory/storagetabicon", tr("Swapfile") ); |
43 | 42 | ||
44 | QLabel* about = new QLabel(tr("<center><b>Memory Monitor Plugin</b><br>" | 43 | QLabel* about = new QLabel(tr("<center><b>Memory Monitor Plugin</b><br>" |
45 | "Copyright (C) 2003 Anton Maslovsky<br>" | 44 | "Copyright (C) 2003 Anton Maslovsky<br>" |
46 | "<<a href=\"mailto:my-zaurus@narod.ru\">my-zaurus@narod.ru</a>><br>" | 45 | "<<a href=\"mailto:my-zaurus@narod.ru\">my-zaurus@narod.ru</a>><br>" |
47 | "<a href=\"http://my-zaurus.narod.ru\">http://my-zaurus.narod.ru</a><br>" | 46 | "<a href=\"http://my-zaurus.narod.ru\">http://my-zaurus.narod.ru</a><br>" |
48 | "Based on source code from:<br> qswap (udoseidel@gmx.de) <br> Battery Applet (trolltech.com) <br> SysInfo (OPIE)<br><br>" | 47 | "Based on source code from:<br> qswap (udoseidel@gmx.de) <br> Battery Applet (trolltech.com) <br> SysInfo (OPIE)<br><br>" |
49 | "This program is licensed under GNU GPL.</center>"), tab); | 48 | "This program is licensed under GNU GPL.</center>"), tab); |
50 | 49 | ||
51 | tab->addTab( about, "memory/info", tr("About") ); | 50 | tab->addTab( about, "memory/info", tr("About") ); |
52 | 51 | ||
53 | tab->setCurrentTab( tr( "Memory" ) ); | 52 | tab->setCurrentTab( tr( "Memory" ) ); |
54 | } | 53 | } |
55 | 54 | ||
56 | int MemoryStatus::percent() | 55 | int MemoryStatus::percent() |
57 | { | 56 | { |
58 | if (mi == 0) | 57 | if (mi == 0) |
59 | return 100; | 58 | return 100; |
60 | 59 | ||
61 | int total = mi->total; | 60 | int total = mi->total; |
62 | if (mi->swaptotal > 0) | 61 | if (mi->swaptotal > 0) |
63 | total += mi->swaptotal; | 62 | total += mi->swaptotal; |
64 | 63 | ||
65 | int used = mi->realUsed; | 64 | int used = mi->realUsed; |
66 | if (mi->swapused > 0) | 65 | if (mi->swapused > 0) |
67 | total += mi->swapused; | 66 | total += mi->swapused; |
68 | 67 | ||
69 | return ((total - used) * 100)/total; | 68 | return ((total - used) * 100)/total; |
70 | } | 69 | } |
71 | 70 | ||
72 | QSize MemoryStatus::sizeHint() const | 71 | QSize MemoryStatus::sizeHint() const |
73 | { | 72 | { |
74 | QSize s = tab->size(); | 73 | QSize s = tab->size(); |
75 | s.setWidth(200); | 74 | s.setWidth(200); |
76 | s.setHeight((mi->swaptotal > 0) ? 220 : 200); | 75 | s.setHeight((mi->swaptotal > 0) ? 220 : 200); |
77 | return s; | 76 | return s; |
78 | } | 77 | } |
79 | 78 | ||
80 | MemoryStatus::~MemoryStatus() | 79 | MemoryStatus::~MemoryStatus() |
81 | { | 80 | { |
82 | } | 81 | } |
diff --git a/noncore/applets/memoryapplet/memorystatus.h b/noncore/applets/memoryapplet/memorystatus.h index 5c73833..c3926db 100644 --- a/noncore/applets/memoryapplet/memorystatus.h +++ b/noncore/applets/memoryapplet/memorystatus.h | |||
@@ -1,47 +1,49 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef MEMORY_STATUS_H | 20 | #ifndef MEMORY_STATUS_H |
21 | #define MEMORY_STATUS_H | 21 | #define MEMORY_STATUS_H |
22 | 22 | ||
23 | #include <qframe.h> | 23 | #include <qframe.h> |
24 | 24 | ||
25 | #include <opie2/otabwidget.h> | ||
26 | |||
25 | class MemoryInfo; | 27 | class MemoryInfo; |
26 | class Swapfile; | 28 | class Swapfile; |
27 | class OTabWidget; | 29 | using Opie::OTabWidget; |
28 | 30 | ||
29 | class MemoryStatus : public QFrame | 31 | class MemoryStatus : public QFrame |
30 | { | 32 | { |
31 | Q_OBJECT | 33 | Q_OBJECT |
32 | public: | 34 | public: |
33 | MemoryStatus(QWidget *parent = 0, WFlags f = 0); | 35 | MemoryStatus(QWidget *parent = 0, WFlags f = 0); |
34 | ~MemoryStatus(); | 36 | ~MemoryStatus(); |
35 | 37 | ||
36 | QSize sizeHint() const; | 38 | QSize sizeHint() const; |
37 | MemoryInfo* mi; | 39 | MemoryInfo* mi; |
38 | Swapfile* sf; | 40 | Swapfile* sf; |
39 | 41 | ||
40 | int percent(); | 42 | int percent(); |
41 | 43 | ||
42 | private: | 44 | private: |
43 | OTabWidget *tab; | 45 | OTabWidget *tab; |
44 | }; | 46 | }; |
45 | 47 | ||
46 | #endif | 48 | #endif |
47 | 49 | ||
diff --git a/noncore/applets/memoryapplet/opie-memoryapplet.control b/noncore/applets/memoryapplet/opie-memoryapplet.control index 12026a4..c01a93f 100644 --- a/noncore/applets/memoryapplet/opie-memoryapplet.control +++ b/noncore/applets/memoryapplet/opie-memoryapplet.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Package: opie-memoryapplet | 1 | Package: opie-memoryapplet |
2 | Files: plugins/applets/libmemoryapplet.so* pics/memory | 2 | Files: plugins/applets/libmemoryapplet.so* pics/memory |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applets | 4 | Section: opie/applets |
5 | Maintainer: Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | 5 | Maintainer: Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal | 7 | Depends: task-opie-minimal, libopieui2 |
8 | Description: Memory Applet | 8 | Description: Memory Applet |
9 | This applet displays the amount of free memory and manages the swap partition | 9 | This applet displays the amount of free memory and manages the swap partition |
10 | Version: $QPE_VERSION$EXTRAVERSION | 10 | Version: $QPE_VERSION$EXTRAVERSION |