summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/settings/citytime/citytime.cpp5
-rw-r--r--core/settings/citytime/citytimebase.cpp3
-rw-r--r--core/settings/citytime/main.cpp1
-rw-r--r--core/settings/citytime/stylusnormalizer.cpp1
-rw-r--r--core/settings/citytime/zonemap.cpp7
-rw-r--r--core/settings/light-and-power/light.cpp1
-rw-r--r--libqtaux/ocolorbutton.cpp3
-rw-r--r--libqtaux/ocolorpopupmenu.cpp1
-rw-r--r--libqtaux/qcolordialog.cpp2
-rw-r--r--libqtaux/qinputdialog.cpp1
-rw-r--r--libqtaux/qsplitter.cpp4
11 files changed, 0 insertions, 29 deletions
diff --git a/core/settings/citytime/citytime.cpp b/core/settings/citytime/citytime.cpp
index b359ae1..e7f0c46 100644
--- a/core/settings/citytime/citytime.cpp
+++ b/core/settings/citytime/citytime.cpp
@@ -1,135 +1,130 @@
/**********************************************************************
** 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 "zonemap.h"
#include "citytime.h"
#include <qpe/qpeapplication.h>
#include <qpe/config.h>
-#include <qpe/timestring.h>
#include <qpe/tzselect.h>
#if !defined(QT_NO_COP)
#include <qpe/qcopenvelope_qws.h>
#endif
-#include <qdir.h>
-#include <qfile.h>
#include <qlabel.h>
#include <qmessagebox.h>
-#include <qregexp.h>
-#include <qtextstream.h>
#include <qtoolbutton.h>
#include <qlayout.h>
#include <stdlib.h>
CityTime::CityTime( QWidget *parent, const char* name,
WFlags fl )
: CityTimeBase( parent, name, fl ),
strRealTz(0),
bAdded(false)
{
Config config( "qpe" );
config.setGroup( "Time" );
bWhichClock = config.readBoolEntry( "AMPM", TRUE );
qDebug( QString("%1").arg(bWhichClock) );
frmMap->changeClock( bWhichClock );
char *pEnv;
pEnv = NULL;
pEnv = getenv("TZ");
if ( pEnv )
strRealTz = pEnv;
pEnv = NULL;
pEnv = getenv("HOME");
if ( pEnv )
strHome = pEnv;
// append the labels to their respective lists...
listCities.setAutoDelete( true );
listTimes.setAutoDelete( true );
listCities.append( cmdCity1 );
listCities.append( cmdCity2 );
listCities.append( cmdCity3 );
listTimes.append( lblCTime1 );
listTimes.append( lblCTime2 );
listTimes.append( lblCTime3 );
// kludgy way of getting the screen size so we don't have to depend
// on a resize event...
QWidget *d = QApplication::desktop();
if ( d->width() < d->height() ) {
// append for that 4 down look
listCities.append( cmdCity4 );
listCities.append( cmdCity5 );
listCities.append( cmdCity6 );
listTimes.append( lblCTime4 );
listTimes.append( lblCTime5 );
listTimes.append( lblCTime6 );
lblCTime7->hide();
lblCTime8->hide();
lblCTime9->hide();
cmdCity7->hide();
cmdCity8->hide();
cmdCity9->hide();
} else {
listCities.append( cmdCity7 );
listCities.append( cmdCity8 );
listCities.append( cmdCity9 );
listTimes.append( lblCTime7 );
listTimes.append( lblCTime8 );
listTimes.append( lblCTime9 );
lblCTime4->hide();
lblCTime5->hide();
lblCTime6->hide();
cmdCity4->hide();
cmdCity5->hide();
cmdCity6->hide();
}
selWidget = frmMap->selectionWidget( this );
selWidget->hide();
CityTimeBaseLayout->addWidget( selWidget );
bAdded = true;
readInTimes();
changed = FALSE;
QObject::connect( qApp, SIGNAL( clockChanged( bool ) ),
this, SLOT( changeClock( bool ) ) );
// now start the timer so we can update the time quickly every second
timerEvent( 0 );
}
CityTime::~CityTime()
{
if ( changed ) {
Config cfg("CityTime");
cfg.setGroup("TimeZones");
QListIterator<QToolButton> itCity( listCities );
int i;
bool realTzWritten = FALSE;
for ( i = 0, itCity.toFirst(); i < CITIES; i++, ++itCity ) {
if ( !strCityTz[i].isNull() ) {
cfg.writeEntry("Zone"+QString::number(i), strCityTz[i]);
cfg.writeEntry("ZoneName"+QString::number(i), itCity.current()->text());
if ( strCityTz[i] == strRealTz )
diff --git a/core/settings/citytime/citytimebase.cpp b/core/settings/citytime/citytimebase.cpp
index d734cf3..a3483cc 100644
--- a/core/settings/citytime/citytimebase.cpp
+++ b/core/settings/citytime/citytimebase.cpp
@@ -1,109 +1,106 @@
// changes by Maximilian Reiss <harlekin@handhelds.org>
#include "citytimebase.h"
#include <qlabel.h>
-#include <qpushbutton.h>
#include <qtoolbutton.h>
#include "zonemap.h"
#include <qlayout.h>
-#include <qvariant.h>
-#include <qtooltip.h>
#include <qwhatsthis.h>
/*
* Constructs a CityTimeBase which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*/
CityTimeBase::CityTimeBase( QWidget* parent, const char* name, WFlags )
: QWidget( parent, name, WStyle_ContextHelp )
{
if ( !name )
setName( "CityTimeBase" );
setCaption( tr( "City Time" ) );
CityTimeBaseLayout = new QVBoxLayout( this );
CityTimeBaseLayout->setSpacing( 3 );
CityTimeBaseLayout->setMargin( 0 );
frmMap = new ZoneMap( this, "frmMap" );
frmMap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, frmMap->sizePolicy().hasHeightForWidth() ) );
CityTimeBaseLayout->addWidget( frmMap );
buttonWidget = new QWidget( this );
QWhatsThis::add( buttonWidget, tr( "Click on one of the set cities to replace it" ) );
Layout2 = new QGridLayout( buttonWidget );
Layout2->setSpacing( 3 );
Layout2->setMargin( 4 );
cmdCity7 = new QToolButton( buttonWidget, "cmdCity7" );
cmdCity7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity7->sizePolicy().hasHeightForWidth() ) );
QFont cmdCity7_font( cmdCity7->font() );
cmdCity7_font.setBold( TRUE );
cmdCity7->setFont( cmdCity7_font );
cmdCity7->setFocusPolicy( QToolButton::TabFocus );
cmdCity7->setText( tr( "" ) );
cmdCity7->setToggleButton( TRUE );
cmdCity7->setToggleButton( TRUE );
Layout2->addWidget( cmdCity7, 0, 2 );
lblCTime9 = new QLabel( buttonWidget, "lblCTime9" );
lblCTime9->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, lblCTime9->sizePolicy().hasHeightForWidth() ) );
QFont lblCTime9_font( lblCTime9->font() );
lblCTime9_font.setPointSize( 10 );
lblCTime9->setFont( lblCTime9_font );
lblCTime9->setText( tr( "" ) );
lblCTime9->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
Layout2->addWidget( lblCTime9, 2, 3 );
cmdCity8 = new QToolButton( buttonWidget, "cmdCity8" );
cmdCity8->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity8->sizePolicy().hasHeightForWidth() ) );
QFont cmdCity8_font( cmdCity8->font() );
cmdCity8_font.setBold( TRUE );
cmdCity8->setFont( cmdCity8_font );
cmdCity8->setFocusPolicy( QToolButton::TabFocus );
cmdCity8->setText( tr( "" ) );
cmdCity8->setToggleButton( TRUE );
cmdCity8->setToggleButton( TRUE );
Layout2->addWidget( cmdCity8, 1, 2 );
cmdCity2 = new QToolButton( buttonWidget, "cmdCity2" );
QFont cmdCity2_font( cmdCity2->font() );
cmdCity2_font.setBold( TRUE );
cmdCity2->setFont( cmdCity2_font );
cmdCity2->setFocusPolicy( QToolButton::TabFocus );
cmdCity2->setText( tr( "" ) );
cmdCity2->setToggleButton( TRUE );
cmdCity2->setToggleButton( TRUE );
Layout2->addWidget( cmdCity2, 1, 0 );
lblCTime6 = new QLabel( buttonWidget, "lblCTime6" );
QFont lblCTime6_font( lblCTime6->font() );
lblCTime6_font.setPointSize( 10 );
lblCTime6->setFont( lblCTime6_font );
lblCTime6->setText( tr( "" ) );
lblCTime6->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) );
Layout2->addWidget( lblCTime6, 5, 1 );
cmdCity6 = new QToolButton( buttonWidget, "cmdCity6" );
cmdCity6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity6->sizePolicy().hasHeightForWidth() ) );
QFont cmdCity6_font( cmdCity6->font() );
cmdCity6_font.setBold( TRUE );
cmdCity6->setFont( cmdCity6_font );
cmdCity6->setFocusPolicy( QToolButton::TabFocus );
cmdCity6->setText( tr( "" ) );
cmdCity6->setToggleButton( TRUE );
cmdCity6->setToggleButton( TRUE );
Layout2->addWidget( cmdCity6, 5, 0 );
cmdCity4 = new QToolButton( buttonWidget, "cmdCity4" );
cmdCity4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity4->sizePolicy().hasHeightForWidth() ) );
QFont cmdCity4_font( cmdCity4->font() );
diff --git a/core/settings/citytime/main.cpp b/core/settings/citytime/main.cpp
index 69bfe44..59498b7 100644
--- a/core/settings/citytime/main.cpp
+++ b/core/settings/citytime/main.cpp
@@ -1,25 +1,24 @@
/**********************************************************************
** 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 "citytime.h"
-#include <qpe/qpeapplication.h>
#include <opie/oapplicationfactory.h>
OPIE_EXPORT_APP( OApplicationFactory<CityTime> )
diff --git a/core/settings/citytime/stylusnormalizer.cpp b/core/settings/citytime/stylusnormalizer.cpp
index c6c65d2..281a0bc 100644
--- a/core/settings/citytime/stylusnormalizer.cpp
+++ b/core/settings/citytime/stylusnormalizer.cpp
@@ -1,99 +1,98 @@
/**********************************************************************
** 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 <qpoint.h>
#include <qtimer.h>
#include "stylusnormalizer.h"
static const int FLUSHTIME = 100;
_StylusEvent::_StylusEvent( const QPoint& newPt )
: _pt( newPt ),
_t( QTime::currentTime() )
{
}
_StylusEvent::~_StylusEvent()
{
}
StylusNormalizer::StylusNormalizer( QWidget *parent, const char* name )
: QWidget( parent, name ),
_next( 0 ),
bFirst( true )
{
// initialize _ptList
int i;
for (i = 0; i < SAMPLES; i++ ) {
_ptList[i].setPoint( -1, -1 );
}
_tExpire = new QTimer( this );
QObject::connect( _tExpire, SIGNAL( timeout() ),
this, SLOT( slotAveragePoint() ) );
}
StylusNormalizer::~StylusNormalizer()
{
}
void StylusNormalizer::addEvent( const QPoint& pt )
{
_ptList[_next].setPoint( pt );
_ptList[_next++].setTime( QTime::currentTime() );
if ( _next >= SAMPLES ) {
_next = 0;
}
// make a single mouse click work
if ( bFirst ) {
slotAveragePoint();
bFirst = false;
}
}
void StylusNormalizer::slotAveragePoint( void )
{
QPoint pt( 0, 0 );
QTime tCurr = QTime::currentTime();
int i,
size;
size = 0;
for ( i = 0; i < SAMPLES; i++ ) {
if ( ( (_ptList[i]).time().msecsTo( tCurr ) < FLUSHTIME ) &&
( _ptList[i].point() != QPoint( -1, -1 ) ) ) {
pt += _ptList[i].point();
size++;
}
}
if ( size > 0 )
emit signalNewPoint( pt /= size );
}
void StylusNormalizer::start( void )
{
_tExpire->start( FLUSHTIME );
}
void StylusNormalizer::stop( void )
{
_tExpire->stop();
bFirst = true;
}
diff --git a/core/settings/citytime/zonemap.cpp b/core/settings/citytime/zonemap.cpp
index 872e786..b83da59 100644
--- a/core/settings/citytime/zonemap.cpp
+++ b/core/settings/citytime/zonemap.cpp
@@ -1,134 +1,127 @@
/**********************************************************************
** 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"
#include <qpe/resource.h>
-#include <qpe/timestring.h>
#include <qpe/qpeapplication.h>
-#include <qdatetime.h>
#include <qfile.h>
-#include <qimage.h>
#include <qlabel.h>
-#include <qlist.h>
#include <qmessagebox.h>
-#include <qpixmap.h>
-#include <qpainter.h>
-#include <qregexp.h>
#include <qtextstream.h>
#include <qtimer.h>
#include <qtoolbutton.h>
#include <qlayout.h>
#include <qhbox.h>
#include <qlistview.h>
#include <qwhatsthis.h>
#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
// two chars, so just grap them and let it go...
strCountryCode = strLine.left( 2 );
iStart = regCoord.match( strLine, 0, &iLen );
if ( iStart >= 0 ) {
strTmp = strLine.mid( iStart, iLen );
tmp = strTmp.toInt();
// okay, there are two versions of the format, make a decision based on
// the size...
// Oh BTW, we are storing everything in seconds!
if ( iLen < 7 ) {
_y = tmp / 100;
_y *= 60;
_y += tmp % 100;
_y *= 60;
} else {
_y = tmp / 10000;
_y *= 60;
tmp %= 10000;
_y += tmp / 100;
_y *= 60;
tmp %= 100;
_y += tmp;
}
}
iStart = regCoord.match( strLine, iStart + iLen, &iLen );
if ( iStart >= 0 ) {
strTmp = strLine.mid( iStart, iLen );
tmp = strTmp.toInt();
if ( iLen < 8 ) {
_x = tmp / 100;
_x *= 60;
_x += tmp % 100;
_x *= 60;
} else {
_x = tmp / 10000;
_x *= 60;
tmp %= 10000;
_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 );
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp
index 60f7417..4baff8e 100644
--- a/core/settings/light-and-power/light.cpp
+++ b/core/settings/light-and-power/light.cpp
@@ -1,132 +1,131 @@
/*
This file is part of the OPIE Project
               =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org>
             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
           .>+-=
 _;:,     .>    :=|. This file is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This file is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
..}^=.=       =       ; Public License for more details.
++=   -.     .`     .:
 :     =  ...= . :.=- You should have received a copy of the GNU
 -.   .:....=;==+<; General Public License along with this file;
  -_. . .   )=.  = see the file COPYING. If not, write to the
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "light.h"
#include <qpe/config.h>
#include <qpe/power.h>
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
#include <qpe/qcopenvelope_qws.h>
#endif
-#include <qpe/qpeapplication.h>
#include <qlabel.h>
#include <qcheckbox.h>
#include <qtabwidget.h>
#include <qslider.h>
#include <qspinbox.h>
#include <qpushbutton.h>
#include <qgroupbox.h>
#include <qcombobox.h>
#include <opie/odevice.h>
#include "sensor.h"
using namespace Opie;
LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
: LightSettingsBase( parent, name, false, WStyle_ContextHelp )
{
m_bres = ODevice::inst ( )-> displayBrightnessResolution ( );
m_cres = ODevice::inst ( )-> displayContrastResolution ( );
// check whether to show the light sensor stuff
if ( !ODevice::inst ( )-> hasLightSensor ( )) {
auto_brightness-> hide ( );
CalibrateLightSensor-> hide ( );
auto_brightness_ac-> hide ( );
CalibrateLightSensor_ac-> hide ( );
}
// check whether to show the contrast stuff
if (m_cres) {
GroupLight->setTitle(tr("Backlight && Contrast"));
GroupLight_ac->setTitle(GroupLight->title());
} else {
contrast->hide();
contrast_ac->hide();
}
// check whether to show the cpu frequency stuff
QStrList freq = ODevice::inst()->allowedCpuFrequencies();
if ( freq.count() ) {
frequency->insertStrList( freq );
frequency_ac->insertStrList( freq );
} else {
frequencyLabel->hide();
frequency->hide();
frequencyLabel_ac->hide();
frequency_ac->hide();
}
// check whether to show the hinge action stuff
if ( !ODevice::inst()->hasHingeSensor() ) {
closeHingeLabel->hide();
closeHingeAction->hide();
closeHingeLabel_ac->hide();
closeHingeAction_ac->hide();
}
Config config ( "apm" );
config. setGroup ( "Battery" );
// battery spinboxes
interval_dim-> setValue ( config. readNumEntry ( "Dim", 30 ));
interval_lightoff-> setValue ( config. readNumEntry ( "LightOff", 20 ));
interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 ));
// battery check and slider
LcdOffOnly->setChecked ( config. readBoolEntry ( "LcdOffOnly", false ));
// CPU frequency
frequency->setCurrentItem( config.readNumEntry("Freq", 0) );
// hinge action
closeHingeAction->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) );
int bright = config. readNumEntry ( "Brightness", 127 );
int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 );
brightness-> setTickInterval ( QMAX( 16, 256 / m_bres ));
brightness-> setLineStep ( QMAX( 1, 256 / m_bres ));
brightness-> setPageStep ( QMAX( 1, 256 / m_bres ));
brightness-> setValue ( bright );
if (m_cres) {
contrast-> setTickInterval ( QMAX( 16, 256 / m_cres ));
contrast-> setLineStep ( QMAX( 1, 256 / m_cres ));
contrast-> setPageStep ( QMAX( 1, 256 / m_cres ));
contrast-> setValue ( contr );
}
// light sensor
auto_brightness-> setChecked ( config. readBoolEntry ( "LightSensor", false ));
diff --git a/libqtaux/ocolorbutton.cpp b/libqtaux/ocolorbutton.cpp
index d2ad873..fd3f963 100644
--- a/libqtaux/ocolorbutton.cpp
+++ b/libqtaux/ocolorbutton.cpp
@@ -1,134 +1,131 @@
/*
This file is part of the Opie Project
Copyright (C) Robert Griebl <sandman@handhelds.org>
=. Copyright (C) The Opie Team <opie-devel@handhelds.org>
.=l.
           .>+-=
 _;:,     .>    :=|. This program is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This program is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.=       =       ; Library General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = Library General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "ocolorpopupmenu.h"
#include "ocolorbutton.h"
/* OPIE */
-#include <qpe/resource.h>
/* QT */
-#include <qcolor.h>
-#include <qpixmap.h>
#include <qimage.h>
using namespace Opie;
struct OColorButtonPrivate
{
QPopupMenu *m_menu;
QColor m_color;
};
/**
* This concstructs a Color Button with @param color as the start color
* It'll use a OColorPopupMenu internally
*
* @param parent The parent of the Color Button
* @param color The color from where to start on
* @param name @see QObject
*/
OColorButton::OColorButton ( QWidget *parent, const QColor &color, const char *name )
: QPushButton ( parent, name )
{
d = new OColorButtonPrivate;
d-> m_menu = new OColorPopupMenu ( color, 0, 0 );
setPopup ( d-> m_menu );
// setPopupDelay ( 0 );
connect ( d-> m_menu, SIGNAL( colorSelected ( const QColor & )), this, SLOT( updateColor ( const QColor & )));
updateColor ( color );
QSize s = sizeHint ( ) + QSize ( 12, 0 );
setMinimumSize ( s );
setMaximumSize ( s. width ( ) * 2, s. height ( ));
}
/**
* This destructs the object
*/
OColorButton::~OColorButton ( )
{
delete d;
}
/**
* @return Returns the current color of the button
*/
QColor OColorButton::color ( ) const
{
return d-> m_color;
}
/**
* This method sets the color of the button
* @param c The color to be set.
*/
void OColorButton::setColor ( const QColor &c )
{
updateColor ( c );
}
/**
* @internal
*/
void OColorButton::updateColor ( const QColor &c )
{
d-> m_color = c;
QImage img ( 16, 16, 32 );
img. fill ( 0 );
int r, g, b;
c. rgb ( &r, &g, &b );
int w = img. width ( );
int h = img. height ( );
int dx = w * 20 / 100; // 15%
int dy = h * 20 / 100;
for ( int y = 0; y < h; y++ )
{
for ( int x = 0; x < w; x++ )
{
double alpha = 1.0;
if ( x < dx )
alpha *= ( double ( x + 1 ) / dx );
else if ( x >= w - dx )
alpha *= ( double ( w - x ) / dx );
if ( y < dy )
alpha *= ( double ( y + 1 ) / dy );
else if ( y >= h - dy )
alpha *= ( double ( h - y ) / dy );
int a = int ( alpha * 255.0 );
if ( a < 0 )
diff --git a/libqtaux/ocolorpopupmenu.cpp b/libqtaux/ocolorpopupmenu.cpp
index 6c5f99c..c5b2b88 100644
--- a/libqtaux/ocolorpopupmenu.cpp
+++ b/libqtaux/ocolorpopupmenu.cpp
@@ -1,133 +1,132 @@
/*
                This file is part of the Opie Project
              Copyright (c) 2002 S. Prud'homme <prudhomme@laposte.net>
              Dan Williams <williamsdr@acm.org>
=.
.=l.
           .>+-=
 _;:,     .>    :=|. This program is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This program is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.=       =       ; Library General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = Library General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "ocolorpopupmenu.h"
#include "qcolordialog.h"
/* QT */
-#include <qaction.h>
#include <qlayout.h>
#include <qpainter.h>
using namespace Opie;
OColorPanelButton::OColorPanelButton( const QColor& color, QWidget* parent, const char* name )
: QFrame( parent, name )
{
m_color = color;
setFixedSize( 16, 16 );
setActive( FALSE );
}
OColorPanelButton::~OColorPanelButton()
{
}
void OColorPanelButton::setActive( bool active )
{
m_active = active;
if ( m_active ) {
setFrameStyle( Panel | Sunken );
} else {
setFrameStyle( NoFrame );
}
}
void OColorPanelButton::enterEvent( QEvent* )
{
if ( !m_active ) {
setFrameStyle( Panel | Sunken );
}
}
void OColorPanelButton::leaveEvent( QEvent* )
{
if ( !m_active ) {
setFrameStyle( NoFrame );
}
}
void OColorPanelButton::paintEvent( QPaintEvent* e )
{
QFrame::paintEvent( e );
QPainter painter;
painter.begin( this );
painter.fillRect( 2, 2, 12, 12, m_color );
painter.setPen( Qt::black );
painter.drawRect( 2, 2, 12, 12 );
painter.end();
}
void OColorPanelButton::mouseReleaseEvent( QMouseEvent* )
{
emit selected( m_color );
}
OColorPopupMenu::OColorPopupMenu( const QColor& color, QWidget* parent, const char* name )
: QPopupMenu( parent, name )
{
m_color = color;
colorPanel = new QWidget( this );
colorLayout = new QGridLayout(colorPanel, 5, 6);
addColor(QColor(255, 255, 255), 0, 1);
addColor(QColor(192, 192, 192), 0, 2);
addColor(QColor(128, 128, 128), 0, 3);
addColor(QColor(64, 64, 64), 0, 4);
addColor(QColor(0, 0, 0), 0, 5);
addColor(QColor(255, 0, 0), 1, 0);
addColor(QColor(255, 128, 0), 1, 1);
addColor(QColor(255, 255, 0), 1, 2);
addColor(QColor(128, 255, 0), 1, 3);
addColor(QColor(0, 255, 0), 1, 4);
addColor(QColor(0, 255, 128), 1, 5);
addColor(QColor(128, 0, 0), 2, 0);
addColor(QColor(128, 64, 0), 2, 1);
addColor(QColor(128, 128, 0), 2, 2);
addColor(QColor(64, 128, 0), 2, 3);
addColor(QColor(0, 128, 0), 2, 4);
addColor(QColor(0, 128, 64), 2, 5);
addColor(QColor(0, 255, 255), 3, 0);
addColor(QColor(0, 128, 255), 3, 1);
addColor(QColor(0, 0, 255), 3, 2);
addColor(QColor(128, 0, 255), 3, 3);
addColor(QColor(255, 0, 255), 3, 4);
addColor(QColor(255, 0, 128), 3, 5);
diff --git a/libqtaux/qcolordialog.cpp b/libqtaux/qcolordialog.cpp
index b960b04..907c2aa 100644
--- a/libqtaux/qcolordialog.cpp
+++ b/libqtaux/qcolordialog.cpp
@@ -1,147 +1,145 @@
/****************************************************************************
** $Id$
**
** Implementation of QColorDialog class
**
** Created : 990222
**
** Copyright (C) 1999-2000 Trolltech AS. All rights reserved.
**
** This file is part of the dialogs module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** 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.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses may use this file in accordance with the Qt Commercial License
** Agreement provided with the Software.
**
** 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/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** 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 "qcolordialog.h"
#include "qpainter.h"
#include "qlayout.h"
#include "qlabel.h"
#include "qpushbutton.h"
#include "qlineedit.h"
#include "qimage.h"
#include "qpixmap.h"
#include "qdrawutil.h"
#include "qvalidator.h"
-#include "qdragobject.h"
#include "qapplication.h"
-#include "qdragobject.h"
//////////// QWellArray BEGIN
#include "qobjectdict.h"
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of qwellarray.cpp and qcolordialog.cpp.
// This header file may change from version to version without notice,
// or even be removed.
//
//
#include "qtableview.h"
struct QWellArrayData;
class QWellArray : public QTableView
{
Q_OBJECT
Q_PROPERTY( int numCols READ numCols )
Q_PROPERTY( int numRows READ numRows )
Q_PROPERTY( int selectedColumn READ selectedColumn )
Q_PROPERTY( int selectedRow READ selectedRow )
public:
QWellArray( QWidget *parent=0, const char *name=0, bool popup = FALSE );
~QWellArray() {}
QString cellContent( int row, int col ) const;
// ### Paul !!! virtual void setCellContent( int row, int col, const QString &);
// ##### Obsolete since not const
int numCols() { return nCols; }
int numRows() { return nRows; }
int numCols() const { return nCols; }
int numRows() const { return nRows; }
// ##### Obsolete since not const
int selectedColumn() { return selCol; }
int selectedRow() { return selRow; }
int selectedColumn() const { return selCol; }
int selectedRow() const { return selRow; }
virtual void setSelected( int row, int col );
void setCellSize( int w, int h ) { setCellWidth(w);setCellHeight( h ); }
QSize sizeHint() const;
virtual void setDimension( int rows, int cols );
virtual void setCellBrush( int row, int col, const QBrush & );
QBrush cellBrush( int row, int col );
signals:
void selected( int row, int col );
protected:
virtual void setCurrent( int row, int col );
virtual void drawContents( QPainter *, int row, int col, const QRect& );
void drawContents( QPainter * );
void paintCell( QPainter*, int row, int col );
void mousePressEvent( QMouseEvent* );
void mouseReleaseEvent( QMouseEvent* );
void mouseMoveEvent( QMouseEvent* );
void keyPressEvent( QKeyEvent* );
void focusInEvent( QFocusEvent* );
void focusOutEvent( QFocusEvent* );
private:
int curRow;
int curCol;
int selRow;
int selCol;
int nCols;
int nRows;
bool smallStyle;
QWellArrayData *d;
private: // Disabled copy constructor and operator=
#if defined(Q_DISABLE_COPY)
QWellArray( const QWellArray & );
QWellArray& operator=( const QWellArray & );
#endif
};
diff --git a/libqtaux/qinputdialog.cpp b/libqtaux/qinputdialog.cpp
index 821c74d..43e243f 100644
--- a/libqtaux/qinputdialog.cpp
+++ b/libqtaux/qinputdialog.cpp
@@ -1,138 +1,137 @@
/****************************************************************************
** $Id$
**
** Implementation of QInputDialog class
**
** Created : 991212
**
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
**
** This file is part of the dialogs module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** 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.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses may use this file in accordance with the Qt Commercial License
** Agreement provided with the Software.
**
** 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/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** 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 "qinputdialog.h"
#include <qlayout.h>
#include <qlabel.h>
-#include <qlineedit.h>
#include <qpushbutton.h>
#include <qspinbox.h>
#include <qcombobox.h>
#include <qwidgetstack.h>
#include <qvalidator.h>
#include <qapplication.h>
class QInputDialogPrivate
{
public:
friend class QInputDialog;
QLineEdit *lineEdit;
QSpinBox *spinBox;
QComboBox *comboBox, *editComboBox;
QPushButton *ok;
QWidgetStack *stack;
QInputDialog::Type type;
};
/*!
\class QInputDialog qinputdialog.h
\brief A convenience dialog to get a simple input from the user
\ingroup dialogs
The QInputDialog is a simple dialog which can be used if you
need a simple input from the user. This can be text, a number or
an item from a list. Also a label has to be set to tell the user
what he/she should input.
In this Qt version only the 4 static convenience functions
getText(), getInteger(), getDouble() and getItem() of QInputDialog
are available.
Use it like this:
\code
bool ok = FALSE;
QString text = QInputDialog::getText( tr( "Make an input" ), tr( "Please enter your name" ), QString::null, &ok, this );
if ( ok && !text.isEmpty() )
;// user entered something and pressed ok
else
;// user entered nothing or pressed cancel
\endcode
There are more static convenience methods!
\sa getText(), getInteger(), getDouble(), getItem()
*/
/*!
\enum QInputDialog::Type
This enum type specifies the type of the dialog
(which kind of input can be done):
<ul>
<li>\c LineEdit - A QLineEdit is used for taking the input, so a textual or
(e.g. using a QValidator) a numerical input can be done. Using lineEdit()
the QLineEdit can be accessed.
<li>\c SpinBox - A QSpinBox is used for taking the input, so a decimal
input can be done. Using spinBox() the QSpinBox can be accessed.
<li>\c ComboBox - A read-only QComboBox is used for taking the input,
so one item of a list can be chosen. Using comboBox() the QComboBox
can be accessed.
<li>\c EditableComboBox - An editable QComboBox is used for taking the input,
so either one item of a list can be chosen or a text can be entered. Using
editableComboBox() the QComboBox can be accessed.
</ul>
*/
/*!
Constructs the dialog. \a label is the text which is shown to the user (it should mention
to the user what he/she should input), \a parent the parent widget of the dialog, \a name
the name of it and if you set \a modal to TRUE, the dialog pops up modally, else it pops
up modeless. With \a type you specify the type of the dialog.
\sa getText(), getInteger(), getDouble(), getItem()
*/
QInputDialog::QInputDialog( const QString &label, QWidget* parent, const char* name,
bool modal, Type type)
: QDialog( parent, name, modal )
{
if ( parent && parent->icon() &&!parent->icon()->isNull() )
setIcon( *parent->icon() );
else if ( qApp->mainWidget() && qApp->mainWidget()->icon() && !qApp->mainWidget()->icon()->isNull() )
QDialog::setIcon( *qApp->mainWidget()->icon() );
d = new QInputDialogPrivate;
d->lineEdit = 0;
d->spinBox = 0;
d->comboBox = 0;
QVBoxLayout *vbox = new QVBoxLayout( this, 6, 6 );
QLabel* l = new QLabel( label, this );
diff --git a/libqtaux/qsplitter.cpp b/libqtaux/qsplitter.cpp
index ab6e01b..39321f8 100644
--- a/libqtaux/qsplitter.cpp
+++ b/libqtaux/qsplitter.cpp
@@ -1,140 +1,136 @@
/****************************************************************************
** $Id$
**
** Splitter widget
**
** Created: 980105
**
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
**
** This file is part of the widgets module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** 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.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses may use this file in accordance with the Qt Commercial License
** Agreement provided with the Software.
**
** 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/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** 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 "qsplitter.h"
-#include "qpainter.h"
#include "qdrawutil.h"
-#include "qbitmap.h"
#include "qlayoutengine_p.h"
-#include "qlist.h"
-#include "qarray.h"
#include "qobjectlist.h"
#include "qapplication.h" //sendPostedEvents
class QSplitterHandle : public QWidget
{
public:
QSplitterHandle( Qt::Orientation o,
QSplitter *parent, const char* name=0 );
void setOrientation( Qt::Orientation o );
Qt::Orientation orientation() const { return orient; }
bool opaque() const { return s->opaqueResize(); }
QSize sizeHint() const;
QSizePolicy sizePolicy() const;
int id() const { return myId; } // data->list.at(id())->wid == this
void setId( int i ) { myId = i; }
protected:
void paintEvent( QPaintEvent * );
void mouseMoveEvent( QMouseEvent * );
void mousePressEvent( QMouseEvent * );
void mouseReleaseEvent( QMouseEvent * );
private:
Qt::Orientation orient;
bool opaq;
int myId;
QSplitter *s;
};
static int mouseOffset;
static int opaqueOldPos = -1; //### there's only one mouse, but this is a bit risky
QSplitterHandle::QSplitterHandle( Qt::Orientation o,
QSplitter *parent, const char * name )
: QWidget( parent, name )
{
s = parent;
setOrientation(o);
}
QSizePolicy QSplitterHandle::sizePolicy() const
{
//### removeme 3.0
return QWidget::sizePolicy();
}
QSize QSplitterHandle::sizeHint() const
{
int sw = style().splitterWidth();
return QSize(sw,sw).expandedTo( QApplication::globalStrut() );
}
void QSplitterHandle::setOrientation( Qt::Orientation o )
{
orient = o;
#ifndef QT_NO_CURSOR
if ( o == QSplitter::Horizontal )
setCursor( splitHCursor );
else
setCursor( splitVCursor );
#endif
}
void QSplitterHandle::mouseMoveEvent( QMouseEvent *e )
{
if ( !(e->state()&LeftButton) )
return;
QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos()))
- mouseOffset;
if ( opaque() ) {
s->moveSplitter( pos, id() );
} else {
int min = pos; int max = pos;
s->getRange( id(), &min, &max );
s->setRubberband( QMAX( min, QMIN(max, pos )));
}
}
void QSplitterHandle::mousePressEvent( QMouseEvent *e )
{
if ( e->button() == LeftButton )
mouseOffset = s->pick(e->pos());
}
void QSplitterHandle::mouseReleaseEvent( QMouseEvent *e )
{
if ( !opaque() && e->button() == LeftButton ) {
QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos()));
s->setRubberband( -1 );
s->moveSplitter( pos, id() );