summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-04-26 18:09:02 (UTC)
committer harlekin <harlekin>2003-04-26 18:09:02 (UTC)
commite2d44ce9293a3db6710753c2e7e2c38a54f60faf (patch) (side-by-side diff)
tree0934dcd9e1af931a3e61f6f0d09e9aaa838b53e1
parentfb10c3a3ba4e509db788cee5009b2480a8381190 (diff)
downloadopie-e2d44ce9293a3db6710753c2e7e2c38a54f60faf.zip
opie-e2d44ce9293a3db6710753c2e7e2c38a54f60faf.tar.gz
opie-e2d44ce9293a3db6710753c2e7e2c38a54f60faf.tar.bz2
make applets more flexible regarding size
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/applets/batteryapplet/battery.cpp9
-rw-r--r--core/applets/cardmon/cardmon.cpp11
-rw-r--r--core/applets/cardmon/cardmon.h2
-rw-r--r--core/applets/clipboardapplet/clipboard.cpp194
-rw-r--r--core/applets/volumeapplet/volume.cpp5
5 files changed, 21 insertions, 200 deletions
diff --git a/core/applets/batteryapplet/battery.cpp b/core/applets/batteryapplet/battery.cpp
index 3b329c6..f3a95ed 100644
--- a/core/applets/batteryapplet/battery.cpp
+++ b/core/applets/batteryapplet/battery.cpp
@@ -12,48 +12,49 @@
** 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 "battery.h"
#include "batterystatus.h"
#include <qpe/power.h>
+#include <qpe/applnk.h>
#include <qpainter.h>
#include <qtimer.h>
BatteryMeter::BatteryMeter( QWidget *parent )
: QWidget( parent ), charging(false)
{
ps = new PowerStatus;
startTimer( 10000 );
- setFixedHeight(12);
+ setFixedHeight( AppLnk::smallIconSize() );
chargeTimer = new QTimer( this );
connect( chargeTimer, SIGNAL(timeout()), this, SLOT(chargeTimeout()) );
timerEvent(0);
}
BatteryMeter::~BatteryMeter()
{
delete ps;
}
QSize BatteryMeter::sizeHint() const
{
- return QSize(10,12);
+ return QSize(10, height() );
}
void BatteryMeter::mouseReleaseEvent( QMouseEvent *)
{
if ( batteryView && batteryView->isVisible() ) {
delete (QWidget *) batteryView;
} else {
if ( !batteryView )
batteryView = new BatteryStatus( ps );
batteryView->showMaximized();
batteryView->raise();
batteryView->show();
@@ -107,26 +108,26 @@ void BatteryMeter::paintEvent( QPaintEvent* )
darkc = c.dark(120);
lightc = c.light(140);
} else if ( ps->acStatus() == PowerStatus::Online ) {
c = green.dark(130);
darkc = c.dark(120);
lightc = c.light(180);
} else {
c = red;
darkc = c.dark(120);
lightc = c.light(160);
}
- int w = 6;
- int h = height()-3;
+ int w = height() / 2 ;
+ int h = height() - 4;
int pix = (percent * h) / 100;
int y2 = height() - 2;
int y = y2 - pix;
int x1 = (width() - w) / 2;
p.setPen(QColor(80,80,80));
p.drawLine(x1+w/4,0,x1+w/4+w/2,0);
p.drawRect(x1,1,w,height()-1);
p.setBrush(c);
int extra = ((percent * h) % 100)/(100/4);
diff --git a/core/applets/cardmon/cardmon.cpp b/core/applets/cardmon/cardmon.cpp
index f3f9044..b8c4553 100644
--- a/core/applets/cardmon/cardmon.cpp
+++ b/core/applets/cardmon/cardmon.cpp
@@ -14,66 +14,71 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "cardmon.h"
#include <qpe/resource.h>
#include <opie/odevice.h>
+#include <qpe/applnk.h>
+
#include <qcopchannel_qws.h>
#include <qpainter.h>
#include <qmessagebox.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qtimer.h>
#include <qapplication.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <qsound.h>
#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
#include <sys/vfs.h>
#include <mntent.h>
#endif
using namespace Opie;
CardMonitor::CardMonitor(QWidget * parent):QWidget(parent),
-pm(Resource::
- loadPixmap("cardmon/pcmcia"))
+ pm( Resource::loadPixmap("cardmon/pcmcia") )
{
QCopChannel *pcmciaChannel = new QCopChannel("QPE/Card", this);
connect(pcmciaChannel,
SIGNAL(received(const QCString &, const QByteArray &)), this,
SLOT(cardMessage(const QCString &, const QByteArray &)));
QCopChannel *sdChannel = new QCopChannel("QPE/Card", this);
connect(sdChannel,
SIGNAL(received(const QCString &, const QByteArray &)), this,
SLOT(cardMessage(const QCString &, const QByteArray &)));
cardInPcmcia0 = FALSE;
cardInPcmcia1 = FALSE;
cardInSd = FALSE;
- setFixedSize(pm.size());
+ setFocusPolicy( NoFocus );
+
+ setFixedWidth ( AppLnk::smallIconSize() );
+ setFixedHeight ( AppLnk::smallIconSize() );
+
getStatusPcmcia(TRUE);
getStatusSd(TRUE);
repaint(FALSE);
popupMenu = 0;
}
CardMonitor::~CardMonitor()
{
if (popupMenu) {
delete popupMenu;
}
}
diff --git a/core/applets/cardmon/cardmon.h b/core/applets/cardmon/cardmon.h
index 49bcae8..4f00920 100644
--- a/core/applets/cardmon/cardmon.h
+++ b/core/applets/cardmon/cardmon.h
@@ -1,18 +1,18 @@
/*
* cardmon.h
*
* ---------------------
*
- * copyright : (c) 2002 by Maximilian Reiss
+ * copyright : (c) 2003 by Maximilian Reiss
* email : max.reiss@gmx.de
* based on two apps by Devin Butterfield
*/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
diff --git a/core/applets/clipboardapplet/clipboard.cpp b/core/applets/clipboardapplet/clipboard.cpp
index b83e16e..21b68e3 100644
--- a/core/applets/clipboardapplet/clipboard.cpp
+++ b/core/applets/clipboardapplet/clipboard.cpp
@@ -12,227 +12,41 @@
** 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 "clipboard.h"
#include <qpe/resource.h>
+#include <qpe/applnk.h>
#include <qpainter.h>
#include <qpopupmenu.h>
#include <qwindowsystem_qws.h>
#include <qapplication.h>
#include <qclipboard.h>
#include <qtimer.h>
//===========================================================================
-/* XPM */
-static const char * paste_xpm[] = {
-"14 16 167 2",
-" c None",
-". c #96A0AC",
-"+ c #9BB0D4",
-"@ c #5E7095",
-"# c #F1CA79",
-"$ c #EFC56D",
-"% c #C9AF76",
-"& c #9FABBA",
-"* c #AEBFDD",
-"= c #8899BA",
-"- c #726E68",
-"; c #D19A33",
-"> c #DA9524",
-", c #EFC065",
-"' c #F3DDA6",
-") c #E9D192",
-"! c #ADA895",
-"~ c #9AA8BF",
-"{ c #B4C2D8",
-"] c #AEBED7",
-"^ c #797E8A",
-"/ c #B78534",
-"( c #DE8516",
-"_ c #8A4308",
-": c #F0C470",
-"< c #F5EFD3",
-"[ c #DFD7B4",
-"} c #8F9BA6",
-"| c #7C8BA3",
-"1 c #808A9A",
-"2 c #828892",
-"3 c #727582",
-"4 c #9A6435",
-"5 c #F37004",
-"6 c #A24104",
-"7 c #F0C36E",
-"8 c #F4EBCC",
-"9 c #ECDCAF",
-"0 c #CDC29B",
-"a c #C1B486",
-"b c #C3A86B",
-"c c #B8924A",
-"d c #B17B31",
-"e c #C66C1C",
-"f c #DE6610",
-"g c #944311",
-"h c #F3E8C6",
-"i c #F3E0AB",
-"j c #F2DB9B",
-"k c #F1D382",
-"l c #F0C056",
-"m c #CCA354",
-"n c #B7B09D",
-"o c #C2A898",
-"p c #BCA298",
-"q c #9A959F",
-"r c #526C8F",
-"s c #F3E4B9",
-"t c #F3DA99",
-"u c #F4D78A",
-"v c #F5CA6A",
-"w c #F4B032",
-"x c #C19A56",
-"y c #C2D7EA",
-"z c #C0D0E7",
-"A c #B0C6E8",
-"B c #A6C1EB",
-"C c #6AA1E3",
-"D c #F0C36D",
-"E c #F3E2B0",
-"F c #F3D891",
-"G c #F3CF7A",
-"H c #F4BC4C",
-"I c #F3A51C",
-"J c #BC9758",
-"K c #CAE4FE",
-"L c #C5DDFB",
-"M c #B5D3FB",
-"N c #A8CCFC",
-"O c #63A6F6",
-"P c #2180E3",
-"Q c #F3E1AE",
-"R c #F3D488",
-"S c #F3C664",
-"T c #F4B63C",
-"U c #F2A61C",
-"V c #BC9A5C",
-"W c #CCE6FE",
-"X c #C8DEFB",
-"Y c #B9D6FB",
-"Z c #B2D0FC",
-"` c #84B6FB",
-" . c #479DFB",
-".. c #F3DFAC",
-"+. c #F3CC76",
-"@. c #F3BE52",
-"#. c #F4B53A",
-"$. c #F2AB24",
-"%. c #BC9D61",
-"&. c #CBE5FE",
-"*. c #C3DBFB",
-"=. c #B0D0FB",
-"-. c #ACCBFC",
-";. c #A0C3FD",
-">. c #6EB1FF",
-",. c #F3DCA4",
-"'. c #F3C35F",
-"). c #F3BC4A",
-"!. c #F3AC26",
-"~. c #BC9E63",
-"{. c #CAE4FF",
-"]. c #BCD7FB",
-"^. c #A3C7FB",
-"/. c #94BCFB",
-"(. c #92BAFB",
-"_. c #74B4FE",
-":. c #F1C46D",
-"<. c #F4D99A",
-"[. c #F4BE52",
-"}. c #F4BB47",
-"|. c #F4B63D",
-"1. c #F4AD27",
-"2. c #BC9E64",
-"3. c #CAE5FF",
-"4. c #BAD6FB",
-"5. c #A1C5FB",
-"6. c #9AC1FB",
-"7. c #9DC1FC",
-"8. c #7CBAFE",
-"9. c #F5C870",
-"0. c #F8DC9B",
-"a. c #F8C65C",
-"b. c #F8C252",
-"c. c #F8BE49",
-"d. c #F7B534",
-"e. c #BFA46C",
-"f. c #CBE4FF",
-"g. c #B7D3FB",
-"h. c #A4C6FB",
-"i. c #A0C4FB",
-"j. c #A2C4FC",
-"k. c #80BDFF",
-"l. c #BC9250",
-"m. c #BF9461",
-"n. c #BD8944",
-"o. c #BD863D",
-"p. c #BD8438",
-"q. c #BC7C2C",
-"r. c #988269",
-"s. c #C5E7FF",
-"t. c #C0DDFE",
-"u. c #B2D4FE",
-"v. c #ACD1FE",
-"w. c #ACD0FE",
-"x. c #7DC0FF",
-"y. c #805835",
-"z. c #754D26",
-"A. c #754C22",
-"B. c #754B20",
-"C. c #75471A",
-"D. c #534D4F",
-"E. c #619BCE",
-"F. c #6295C8",
-"G. c #5C91C8",
-"H. c #598FC8",
-"I. c #588FC8",
-"J. c #3E87CD",
-" . + @ ",
-" # $ % & * = - ; > ",
-", ' ) ! ~ { ] ^ / ( _ ",
-": < [ } | 1 2 3 4 5 6 ",
-"7 8 9 0 a b c d e f g ",
-"7 h i j k l m n o p q r ",
-"7 s t u v w x y z A B C ",
-"D E F G H I J K L M N O P ",
-"D Q R S T U V W X Y Z ` . ",
-"D ..+.@.#.$.%.&.*.=.-.;.>. ",
-"7 ,.'.).T !.~.{.].^./.(._. ",
-":.<.[.}.|.1.2.3.4.5.6.7.8. ",
-"9.0.a.b.c.d.e.f.g.h.i.j.k. ",
-"l.m.n.o.p.q.r.s.t.u.v.w.x. ",
-" y.z.A.B.C.D.E.F.G.H.I.J. ",
-" "};
-
ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( parent, name )
{
- setFixedWidth ( 14 );
- setFixedHeight ( 18 );
- m_clipboardPixmap = QPixmap ( paste_xpm );
+ setFixedWidth ( AppLnk::smallIconSize() );
+ setFixedHeight ( AppLnk::smallIconSize() );
+ m_clipboardPixmap = QPixmap ( Resource::loadPixmap( "paste" ) );
m_timer = new QTimer ( this );
connect ( QApplication::clipboard ( ), SIGNAL( dataChanged ( )), this, SLOT( newData ( )));
connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( newData ( )));
connect ( qApp, SIGNAL( aboutToQuit ( )), this, SLOT( shutdown ( )));
m_menu = 0;
m_dirty = true;
m_lasttext = QString::null;
m_timer-> start ( 0, true );
diff --git a/core/applets/volumeapplet/volume.cpp b/core/applets/volumeapplet/volume.cpp
index ed07ec4..906bb77 100644
--- a/core/applets/volumeapplet/volume.cpp
+++ b/core/applets/volumeapplet/volume.cpp
@@ -15,24 +15,25 @@
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <stdio.h>
#include "volume.h"
#include <qpe/resource.h>
#include <qpe/qpeapplication.h>
+#include <qpe/applnk.h>
#include <qpe/config.h>
#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
#include <qpe/qcopenvelope_qws.h>
#endif
#include <qpainter.h>
#include <qcheckbox.h>
#include <qslider.h>
#include <qlayout.h>
#include <qframe.h>
#include <qpixmap.h>
#include <qvbox.h>
@@ -716,26 +717,26 @@ void VolumeControl::writeConfigEntry ( const char *entry, int val, eUpdate upd )
case UPD_None:
break;
}
#endif
}
//===========================================================================
VolumeApplet::VolumeApplet( QWidget *parent, const char *name )
: QWidget( parent, name )
{
- setFixedHeight ( 18 );
- setFixedWidth ( 14 );
+ setFixedWidth ( AppLnk::smallIconSize() );
+ setFixedHeight ( AppLnk::smallIconSize() );
m_pixmap = new QPixmap ( Resource::loadPixmap ( "volume" ));
m_dialog = new VolumeControl ( this, true, this, "volumecontrol" );
connect ( qApp, SIGNAL( volumeChanged ( bool )), m_dialog, SLOT( volumeChanged( bool )));
connect ( qApp, SIGNAL( micChanged ( bool )), m_dialog, SLOT ( micChanged( bool )));
}
VolumeApplet::~VolumeApplet()
{
delete m_pixmap;
}