summaryrefslogtreecommitdiff
authorsimon <simon>2002-03-25 19:33:07 (UTC)
committer simon <simon>2002-03-25 19:33:07 (UTC)
commit25fd130f6e411585e222c1bc0fe068344745ab77 (patch) (side-by-side diff)
treeb1c23cdeaf7227b0fe712b2478ed4ec44043c106
parent2cc5e1007a57212f4beaac1980436979d85fad3f (diff)
downloadopie-25fd130f6e411585e222c1bc0fe068344745ab77.zip
opie-25fd130f6e411585e222c1bc0fe068344745ab77.tar.gz
opie-25fd130f6e411585e222c1bc0fe068344745ab77.tar.bz2
- no default arguments in method implementations
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/batteryapplet/battery.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/applets/batteryapplet/battery.cpp b/core/applets/batteryapplet/battery.cpp
index 3d254fc..3b329c6 100644
--- a/core/applets/batteryapplet/battery.cpp
+++ b/core/applets/batteryapplet/battery.cpp
@@ -1,125 +1,125 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of 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 "battery.h"
#include "batterystatus.h"
#include <qpe/power.h>
#include <qpainter.h>
#include <qtimer.h>
-BatteryMeter::BatteryMeter( QWidget *parent = 0 )
+BatteryMeter::BatteryMeter( QWidget *parent )
: QWidget( parent ), charging(false)
{
ps = new PowerStatus;
startTimer( 10000 );
setFixedHeight(12);
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);
}
void BatteryMeter::mouseReleaseEvent( QMouseEvent *)
{
if ( batteryView && batteryView->isVisible() ) {
delete (QWidget *) batteryView;
} else {
if ( !batteryView )
batteryView = new BatteryStatus( ps );
batteryView->showMaximized();
batteryView->raise();
batteryView->show();
}
}
void BatteryMeter::timerEvent( QTimerEvent * )
{
PowerStatus prev = *ps;
*ps = PowerStatusManager::readStatus();
if ( prev != *ps ) {
percent = ps->batteryPercentRemaining();
if ( !charging && ps->batteryStatus() == PowerStatus::Charging && percent < 0 ) {
percent = 0;
charging = true;
chargeTimer->start( 500 );
} else if ( charging && ps->batteryStatus() != PowerStatus::Charging ) {
charging = false;
chargeTimer->stop();
if ( batteryView )
batteryView->updatePercent( percent );
}
repaint(FALSE);
if ( batteryView )
batteryView->repaint();
}
}
void BatteryMeter::chargeTimeout()
{
percent += 20;
if ( percent > 100 )
percent = 0;
repaint(FALSE);
if ( batteryView )
batteryView->updatePercent( percent );
}
void BatteryMeter::paintEvent( QPaintEvent* )
{
QPainter p(this);
QColor c;
QColor darkc;
QColor lightc;
if ( ps->acStatus() == PowerStatus::Offline ) {
c = blue.light(120);
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 pix = (percent * h) / 100;
int y2 = height() - 2;
int y = y2 - pix;
int x1 = (width() - w) / 2;