summaryrefslogtreecommitdiff
authordrw <drw>2005-05-04 22:11:13 (UTC)
committer drw <drw>2005-05-04 22:11:13 (UTC)
commit4d719fdcf636f855cb2def7c715a13420ce8a1b6 (patch) (side-by-side diff)
treeafc8110e06cb32fa8218d281b84fb69b1d68ece2
parent6378f86d96d8d0003cdb9242871066b2db640cec (diff)
downloadopie-4d719fdcf636f855cb2def7c715a13420ce8a1b6.zip
opie-4d719fdcf636f855cb2def7c715a13420ce8a1b6.tar.gz
opie-4d719fdcf636f855cb2def7c715a13420ce8a1b6.tar.bz2
Resource -> OResource and add missing lib dependencies
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/citytime/opie-citytime.control2
-rw-r--r--core/settings/citytime/zonemap.cpp10
2 files changed, 7 insertions, 5 deletions
diff --git a/core/settings/citytime/opie-citytime.control b/core/settings/citytime/opie-citytime.control
index 03fa555..71ee7d0 100644
--- a/core/settings/citytime/opie-citytime.control
+++ b/core/settings/citytime/opie-citytime.control
@@ -1,10 +1,10 @@
Package: opie-citytime
Files: plugins/application/libcitytime.so* bin/citytime apps/Settings/citytime.desktop pics/citytime
Priority: optional
Section: opie/settings
Maintainer: Maximilian Reiss <harlekin@handhelds.org>
Architecture: arm
-Depends: task-opie-minimal
+Depends: task-opie-minimal, libopiecore2
Description: Time-zone / world clock settings
The time-zone manager for the Opie environment.
Version: $QPE_VERSION$EXTRAVERSION
diff --git a/core/settings/citytime/zonemap.cpp b/core/settings/citytime/zonemap.cpp
index e4a25ef..7edc45f 100644
--- a/core/settings/citytime/zonemap.cpp
+++ b/core/settings/citytime/zonemap.cpp
@@ -1,77 +1,78 @@
/**********************************************************************
** 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.
**
**********************************************************************/
// changes by Maximilian Reiss <harlekin@handhelds.org>
#include "sun.h"
#include "zonemap.h"
/* OPIE */
-#include <qpe/resource.h>
-#include <qpe/qpeapplication.h>
#include <opie2/odebug.h>
+#include <opie2/oresource.h>
+
+#include <qpe/qpeapplication.h>
/* QT */
#include <qfile.h>
#include <qlabel.h>
#include <qmessagebox.h>
#include <qtextstream.h>
#include <qtimer.h>
#include <qtoolbutton.h>
#include <qlayout.h>
#include <qhbox.h>
#include <qlistview.h>
#include <qwhatsthis.h>
/* STD */
#include <limits.h>
// the map file...
static const char strZONEINFO[] = "/usr/share/zoneinfo/zone.tab";
static const char strMAP[] = "citytime/simple_grid_400";
// the maximum distance we'll allow the pointer to be away from a city
// and still show the city's time
static const int iTHRESHOLD = 50000;
// The label offset (how far away from pointer)
static const int iLABELOFFSET = 8;
// the size of the dot to draw, and where to start it
static const int iCITYSIZE = 3;
const int iCITYOFFSET = 2;
// the darkening function
static inline void darken( QImage *pImage, int start, int stop, int row );
static void dayNight( QImage *pImage );
ZoneField::ZoneField( const QString& strLine )
{
// make a bunch of RegExp's to match the data from the line
QRegExp regCoord( "[-+][0-9]+" ); // the latitude
QRegExp regCountry( "[A-Za-z]+/" ); // the country (not good enough)
QRegExp regCity( "[A-Za-z_-]*" ); // the city
int iStart,
iStop,
iLen,
tmp;
QString strTmp;
// we should be able to assume that the country code is always the first
@@ -115,99 +116,100 @@ ZoneField::ZoneField( const QString& strLine )
_x += tmp / 100;
_x *= 60;
tmp %= 100;
_x += tmp;
}
}
iStart = regCountry.match( strLine, 0, &iLen );
// help with the shortcoming in 2.x regexp...
iStop = strLine.findRev( '/' );
if ( iStart >= 0 ) {
iLen = (iStop - iStart) + 1;
strCountry = strLine.mid( iStart, iLen );
}
// now match the city...
iStart = regCity.match( strLine, iStart + iLen, &iLen );
if ( iStart >= 0 ) {
strCity = strLine.mid( iStart, iLen );
}
}
void ZoneField::showStructure( void ) const
{
odebug << "Country: " << strCountry << "" << oendl;
odebug << "City: " << strCity << "" << oendl;
odebug << "x: " << _x << "" << oendl;
odebug << "y: " << _y << "\n" << oendl;
}
ZoneMap::ZoneMap( QWidget *parent, const char* name )
: QScrollView( parent, name ),
pLast( 0 ),
pRepaint( 0 ),
ox( 0 ),
oy( 0 ),
drawableW( -1 ),
drawableH( -1 ),
bZoom( FALSE ),
bIllum( TRUE ),
cursor( 0 )
{
viewport()->setFocusPolicy( StrongFocus );
// set mouse tracking so we can use the mouse move event
zones.setAutoDelete( true );
// get the map loaded
// just set the current image to point
pixCurr = new QPixmap();
- QPixmap pixZoom = Resource::loadPixmap( "mag" );
+ QPixmap pixZoom = Opie::Core::OResource::loadPixmap( "mag", Opie::Core::OResource::SmallIcon );
cmdZoom = new QToolButton( this, "Zoom command" );
+ cmdZoom->setUsesBigPixmap( qApp->desktop()->size().width() > 330 );
cmdZoom->setPixmap( pixZoom );
cmdZoom->setToggleButton( true );
cmdZoom->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0,
(QSizePolicy::SizeType)0,
cmdZoom->sizePolicy().hasHeightForWidth() ) );
cmdZoom->setMaximumSize( cmdZoom->sizeHint() );
// probably don't need this, but just in case...
cmdZoom->move( width() - cmdZoom->width(), height() - cmdZoom->height() );
lblCity = new QLabel( tr( "CITY" ), this, "City Label" );
lblCity->setMinimumSize( lblCity->sizeHint() );
lblCity->setFrameStyle( QFrame::Plain | QFrame::Box );
lblCity->setBackgroundColor( yellow );
lblCity->hide();
// A timer to make sure the label gets hidden
tHide = new QTimer( this, "Label Timer" );
QObject::connect( tHide, SIGNAL( timeout() ),
lblCity, SLOT( hide() ) );
QObject::connect( tHide, SIGNAL( timeout() ),
this, SLOT( slotRedraw() ) );
QTimer *tUpdate = new QTimer( this, "Update Timer" );
QObject::connect( tUpdate, SIGNAL( timeout() ),
this, SLOT( slotUpdate() ) );
QObject::connect( qApp, SIGNAL( timeChanged() ),
this, SLOT( slotUpdate() ) );
QObject::connect( cmdZoom, SIGNAL( toggled(bool) ),
this, SLOT( slotZoom(bool) ) );
QObject::connect( &norm, SIGNAL( signalNewPoint(const QPoint&) ),
this, SLOT( slotFindCity(const QPoint&) ) );
QObject::connect( qApp, SIGNAL( clockChanged(bool) ),
this, SLOT( changeClock(bool) ) );
// update the sun's movement every 5 minutes
tUpdate->start( 5 * 60 * 1000 );
// May as well read in the timezone information too...
readZones();
}
ZoneMap::~ZoneMap()
{
}
void ZoneMap::readZones( void )
{
QFile fZone( strZONEINFO );
if ( !fZone.open( IO_ReadOnly ) ) {
@@ -557,97 +559,97 @@ static void dayNight(QImage *pImage)
tCurrent = time( NULL );
pTm = gmtime( &tCurrent );
dJulian = jtime( pTm );
sunpos( dJulian, 0, &dSunRad, &dSunDecl, &dSunRadius, &dSunLong );
// now get the projected illumination
projillum( wtab, wImage, hImage, dSunDecl );
relw = wImage - int( wImage * 0.0275 );
// draw the map, keeping in mind that we may go too far off the map...
iMid = ( relw * ( 24*60 - pTm->tm_hour * 60 - pTm->tm_min ) ) / ( 24*60 );
for ( i = 0; i < hImage; i++ ) {
if ( wtab[i] > 0 ) {
iStart = iMid - wtab[i];
iStop = iMid + wtab[i];
if ( iStart < 0 ) {
darken( pImage, iStop, wImage + iStart, i );
} else if ( iStop > wImage ) {
darken( pImage, iStop - wImage, iStart, i );
} else {
darken( pImage, 0, iStart, i );
darken( pImage, iStop, wImage, i );
}
} else {
darken( pImage, 0, wImage, i );
}
}
}
static inline void darken( QImage *pImage, int start, int stop, int row )
{
int colors,
j;
uchar *p;
// assume that the image is similar to the one we have...
colors = pImage->numColors() / 2;
p = pImage->scanLine( row );
for ( j = start; j <= stop; j++ ) {
if ( p[j] < colors )
p[j] += colors;
}
}
void ZoneMap::makeMap( int w, int h )
{
- QImage imgOrig = Resource::loadImage( strMAP );
+ QImage imgOrig = Opie::Core::OResource::loadImage( strMAP );
if ( imgOrig.isNull() ) {
QMessageBox::warning( this,
tr( "Couldn't Find Map" ),
tr( "<p>Couldn't load map: %1, exiting")
.arg( strMAP ) );
exit(-1);
}
// set up the color table for darkening...
imgOrig = imgOrig.convertDepth( 8 );
int numColors = imgOrig.numColors();
// double the colors
imgOrig.setNumColors( 2 * numColors );
// darken the new ones...
for ( int i = 0; i < numColors; i++ ) {
QRgb rgb = imgOrig.color( i );
imgOrig.setColor ( i + numColors, qRgb( 2 * qRed( rgb ) / 3,
2 * qGreen( rgb ) / 3, 2 * qBlue( rgb ) / 3 ) );
}
// else go one with making the map...
if ( bIllum ) {
// do a daylight mask
dayNight(&imgOrig);
}
// redo the width and height
wImg = w;
hImg = h;
ox = ( wImg / 2 ) - int( wImg * 0.0275 );
oy = hImg / 2;
pixCurr->convertFromImage( imgOrig.smoothScale(w, h),
QPixmap::ThresholdDither );
}
void ZoneMap::drawCity( QPainter *p, const ZoneField *pCity )
{
int x,
y;
p->setPen( red );
zoneToWin( pCity->x(), pCity->y(), x, y );
p->drawRect( x - iCITYOFFSET, y - iCITYOFFSET, iCITYSIZE, iCITYSIZE );
}
void ZoneMap::drawContents( QPainter *p, int cx, int cy, int cw, int ch )
{
// if there is a need to resize, then do it...
// get our drawable area