author | chicken <chicken> | 2004-03-01 17:53:46 (UTC) |
---|---|---|
committer | chicken <chicken> | 2004-03-01 17:53:46 (UTC) |
commit | 5b4e342004537f84fa53911a46cd00d810378da7 (patch) (unidiff) | |
tree | 763c74ad41014de91c010fb996ec527f841ef3bc | |
parent | 5b640d3f070b0b2de361421abf93949410546e19 (diff) | |
download | opie-5b4e342004537f84fa53911a46cd00d810378da7.zip opie-5b4e342004537f84fa53911a46cd00d810378da7.tar.gz opie-5b4e342004537f84fa53911a46cd00d810378da7.tar.bz2 |
fix includes
-rw-r--r-- | core/settings/citytime/citytime.cpp | 5 | ||||
-rw-r--r-- | core/settings/citytime/citytimebase.cpp | 3 | ||||
-rw-r--r-- | core/settings/citytime/main.cpp | 1 | ||||
-rw-r--r-- | core/settings/citytime/stylusnormalizer.cpp | 1 | ||||
-rw-r--r-- | core/settings/citytime/zonemap.cpp | 7 | ||||
-rw-r--r-- | core/settings/light-and-power/light.cpp | 1 | ||||
-rw-r--r-- | libqtaux/ocolorbutton.cpp | 3 | ||||
-rw-r--r-- | libqtaux/ocolorpopupmenu.cpp | 1 | ||||
-rw-r--r-- | libqtaux/qcolordialog.cpp | 2 | ||||
-rw-r--r-- | libqtaux/qinputdialog.cpp | 1 | ||||
-rw-r--r-- | libqtaux/qsplitter.cpp | 4 |
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 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of 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 | 20 | ||
21 | // changes by Maximilian Reiss <harlekin@handhelds.org> | 21 | // changes by Maximilian Reiss <harlekin@handhelds.org> |
22 | 22 | ||
23 | #include "zonemap.h" | 23 | #include "zonemap.h" |
24 | #include "citytime.h" | 24 | #include "citytime.h" |
25 | 25 | ||
26 | #include <qpe/qpeapplication.h> | 26 | #include <qpe/qpeapplication.h> |
27 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
28 | #include <qpe/timestring.h> | ||
29 | #include <qpe/tzselect.h> | 28 | #include <qpe/tzselect.h> |
30 | #if !defined(QT_NO_COP) | 29 | #if !defined(QT_NO_COP) |
31 | #include <qpe/qcopenvelope_qws.h> | 30 | #include <qpe/qcopenvelope_qws.h> |
32 | #endif | 31 | #endif |
33 | 32 | ||
34 | #include <qdir.h> | ||
35 | #include <qfile.h> | ||
36 | #include <qlabel.h> | 33 | #include <qlabel.h> |
37 | #include <qmessagebox.h> | 34 | #include <qmessagebox.h> |
38 | #include <qregexp.h> | ||
39 | #include <qtextstream.h> | ||
40 | #include <qtoolbutton.h> | 35 | #include <qtoolbutton.h> |
41 | #include <qlayout.h> | 36 | #include <qlayout.h> |
42 | 37 | ||
43 | #include <stdlib.h> | 38 | #include <stdlib.h> |
44 | 39 | ||
45 | CityTime::CityTime( QWidget *parent, const char* name, | 40 | CityTime::CityTime( QWidget *parent, const char* name, |
46 | WFlags fl ) | 41 | WFlags fl ) |
47 | : CityTimeBase( parent, name, fl ), | 42 | : CityTimeBase( parent, name, fl ), |
48 | strRealTz(0), | 43 | strRealTz(0), |
49 | bAdded(false) | 44 | bAdded(false) |
50 | { | 45 | { |
51 | Config config( "qpe" ); | 46 | Config config( "qpe" ); |
52 | config.setGroup( "Time" ); | 47 | config.setGroup( "Time" ); |
53 | bWhichClock = config.readBoolEntry( "AMPM", TRUE ); | 48 | bWhichClock = config.readBoolEntry( "AMPM", TRUE ); |
54 | qDebug( QString("%1").arg(bWhichClock) ); | 49 | qDebug( QString("%1").arg(bWhichClock) ); |
55 | frmMap->changeClock( bWhichClock ); | 50 | frmMap->changeClock( bWhichClock ); |
56 | 51 | ||
57 | char *pEnv; | 52 | char *pEnv; |
58 | pEnv = NULL; | 53 | pEnv = NULL; |
59 | pEnv = getenv("TZ"); | 54 | pEnv = getenv("TZ"); |
60 | if ( pEnv ) | 55 | if ( pEnv ) |
61 | strRealTz = pEnv; | 56 | strRealTz = pEnv; |
62 | pEnv = NULL; | 57 | pEnv = NULL; |
63 | pEnv = getenv("HOME"); | 58 | pEnv = getenv("HOME"); |
64 | if ( pEnv ) | 59 | if ( pEnv ) |
65 | strHome = pEnv; | 60 | strHome = pEnv; |
66 | // append the labels to their respective lists... | 61 | // append the labels to their respective lists... |
67 | listCities.setAutoDelete( true ); | 62 | listCities.setAutoDelete( true ); |
68 | listTimes.setAutoDelete( true ); | 63 | listTimes.setAutoDelete( true ); |
69 | 64 | ||
70 | listCities.append( cmdCity1 ); | 65 | listCities.append( cmdCity1 ); |
71 | listCities.append( cmdCity2 ); | 66 | listCities.append( cmdCity2 ); |
72 | listCities.append( cmdCity3 ); | 67 | listCities.append( cmdCity3 ); |
73 | 68 | ||
74 | listTimes.append( lblCTime1 ); | 69 | listTimes.append( lblCTime1 ); |
75 | listTimes.append( lblCTime2 ); | 70 | listTimes.append( lblCTime2 ); |
76 | listTimes.append( lblCTime3 ); | 71 | listTimes.append( lblCTime3 ); |
77 | 72 | ||
78 | 73 | ||
79 | // kludgy way of getting the screen size so we don't have to depend | 74 | // kludgy way of getting the screen size so we don't have to depend |
80 | // on a resize event... | 75 | // on a resize event... |
81 | QWidget *d = QApplication::desktop(); | 76 | QWidget *d = QApplication::desktop(); |
82 | if ( d->width() < d->height() ) { | 77 | if ( d->width() < d->height() ) { |
83 | // append for that 4 down look | 78 | // append for that 4 down look |
84 | listCities.append( cmdCity4 ); | 79 | listCities.append( cmdCity4 ); |
85 | listCities.append( cmdCity5 ); | 80 | listCities.append( cmdCity5 ); |
86 | listCities.append( cmdCity6 ); | 81 | listCities.append( cmdCity6 ); |
87 | listTimes.append( lblCTime4 ); | 82 | listTimes.append( lblCTime4 ); |
88 | listTimes.append( lblCTime5 ); | 83 | listTimes.append( lblCTime5 ); |
89 | listTimes.append( lblCTime6 ); | 84 | listTimes.append( lblCTime6 ); |
90 | lblCTime7->hide(); | 85 | lblCTime7->hide(); |
91 | lblCTime8->hide(); | 86 | lblCTime8->hide(); |
92 | lblCTime9->hide(); | 87 | lblCTime9->hide(); |
93 | cmdCity7->hide(); | 88 | cmdCity7->hide(); |
94 | cmdCity8->hide(); | 89 | cmdCity8->hide(); |
95 | cmdCity9->hide(); | 90 | cmdCity9->hide(); |
96 | } else { | 91 | } else { |
97 | listCities.append( cmdCity7 ); | 92 | listCities.append( cmdCity7 ); |
98 | listCities.append( cmdCity8 ); | 93 | listCities.append( cmdCity8 ); |
99 | listCities.append( cmdCity9 ); | 94 | listCities.append( cmdCity9 ); |
100 | listTimes.append( lblCTime7 ); | 95 | listTimes.append( lblCTime7 ); |
101 | listTimes.append( lblCTime8 ); | 96 | listTimes.append( lblCTime8 ); |
102 | listTimes.append( lblCTime9 ); | 97 | listTimes.append( lblCTime9 ); |
103 | lblCTime4->hide(); | 98 | lblCTime4->hide(); |
104 | lblCTime5->hide(); | 99 | lblCTime5->hide(); |
105 | lblCTime6->hide(); | 100 | lblCTime6->hide(); |
106 | cmdCity4->hide(); | 101 | cmdCity4->hide(); |
107 | cmdCity5->hide(); | 102 | cmdCity5->hide(); |
108 | cmdCity6->hide(); | 103 | cmdCity6->hide(); |
109 | } | 104 | } |
110 | 105 | ||
111 | selWidget = frmMap->selectionWidget( this ); | 106 | selWidget = frmMap->selectionWidget( this ); |
112 | selWidget->hide(); | 107 | selWidget->hide(); |
113 | CityTimeBaseLayout->addWidget( selWidget ); | 108 | CityTimeBaseLayout->addWidget( selWidget ); |
114 | bAdded = true; | 109 | bAdded = true; |
115 | readInTimes(); | 110 | readInTimes(); |
116 | changed = FALSE; | 111 | changed = FALSE; |
117 | QObject::connect( qApp, SIGNAL( clockChanged( bool ) ), | 112 | QObject::connect( qApp, SIGNAL( clockChanged( bool ) ), |
118 | this, SLOT( changeClock( bool ) ) ); | 113 | this, SLOT( changeClock( bool ) ) ); |
119 | // now start the timer so we can update the time quickly every second | 114 | // now start the timer so we can update the time quickly every second |
120 | timerEvent( 0 ); | 115 | timerEvent( 0 ); |
121 | } | 116 | } |
122 | 117 | ||
123 | CityTime::~CityTime() | 118 | CityTime::~CityTime() |
124 | { | 119 | { |
125 | if ( changed ) { | 120 | if ( changed ) { |
126 | Config cfg("CityTime"); | 121 | Config cfg("CityTime"); |
127 | cfg.setGroup("TimeZones"); | 122 | cfg.setGroup("TimeZones"); |
128 | QListIterator<QToolButton> itCity( listCities ); | 123 | QListIterator<QToolButton> itCity( listCities ); |
129 | int i; | 124 | int i; |
130 | bool realTzWritten = FALSE; | 125 | bool realTzWritten = FALSE; |
131 | for ( i = 0, itCity.toFirst(); i < CITIES; i++, ++itCity ) { | 126 | for ( i = 0, itCity.toFirst(); i < CITIES; i++, ++itCity ) { |
132 | if ( !strCityTz[i].isNull() ) { | 127 | if ( !strCityTz[i].isNull() ) { |
133 | cfg.writeEntry("Zone"+QString::number(i), strCityTz[i]); | 128 | cfg.writeEntry("Zone"+QString::number(i), strCityTz[i]); |
134 | cfg.writeEntry("ZoneName"+QString::number(i), itCity.current()->text()); | 129 | cfg.writeEntry("ZoneName"+QString::number(i), itCity.current()->text()); |
135 | if ( strCityTz[i] == strRealTz ) | 130 | 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 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | // changes by Maximilian Reiss <harlekin@handhelds.org> | 3 | // changes by Maximilian Reiss <harlekin@handhelds.org> |
4 | 4 | ||
5 | #include "citytimebase.h" | 5 | #include "citytimebase.h" |
6 | 6 | ||
7 | #include <qlabel.h> | 7 | #include <qlabel.h> |
8 | #include <qpushbutton.h> | ||
9 | #include <qtoolbutton.h> | 8 | #include <qtoolbutton.h> |
10 | #include "zonemap.h" | 9 | #include "zonemap.h" |
11 | #include <qlayout.h> | 10 | #include <qlayout.h> |
12 | #include <qvariant.h> | ||
13 | #include <qtooltip.h> | ||
14 | #include <qwhatsthis.h> | 11 | #include <qwhatsthis.h> |
15 | 12 | ||
16 | 13 | ||
17 | /* | 14 | /* |
18 | * Constructs a CityTimeBase which is a child of 'parent', with the | 15 | * Constructs a CityTimeBase which is a child of 'parent', with the |
19 | * name 'name' and widget flags set to 'f' | 16 | * name 'name' and widget flags set to 'f' |
20 | */ | 17 | */ |
21 | CityTimeBase::CityTimeBase( QWidget* parent, const char* name, WFlags ) | 18 | CityTimeBase::CityTimeBase( QWidget* parent, const char* name, WFlags ) |
22 | : QWidget( parent, name, WStyle_ContextHelp ) | 19 | : QWidget( parent, name, WStyle_ContextHelp ) |
23 | { | 20 | { |
24 | if ( !name ) | 21 | if ( !name ) |
25 | setName( "CityTimeBase" ); | 22 | setName( "CityTimeBase" ); |
26 | setCaption( tr( "City Time" ) ); | 23 | setCaption( tr( "City Time" ) ); |
27 | CityTimeBaseLayout = new QVBoxLayout( this ); | 24 | CityTimeBaseLayout = new QVBoxLayout( this ); |
28 | CityTimeBaseLayout->setSpacing( 3 ); | 25 | CityTimeBaseLayout->setSpacing( 3 ); |
29 | CityTimeBaseLayout->setMargin( 0 ); | 26 | CityTimeBaseLayout->setMargin( 0 ); |
30 | 27 | ||
31 | frmMap = new ZoneMap( this, "frmMap" ); | 28 | frmMap = new ZoneMap( this, "frmMap" ); |
32 | frmMap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, frmMap->sizePolicy().hasHeightForWidth() ) ); | 29 | frmMap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, frmMap->sizePolicy().hasHeightForWidth() ) ); |
33 | CityTimeBaseLayout->addWidget( frmMap ); | 30 | CityTimeBaseLayout->addWidget( frmMap ); |
34 | 31 | ||
35 | buttonWidget = new QWidget( this ); | 32 | buttonWidget = new QWidget( this ); |
36 | QWhatsThis::add( buttonWidget, tr( "Click on one of the set cities to replace it" ) ); | 33 | QWhatsThis::add( buttonWidget, tr( "Click on one of the set cities to replace it" ) ); |
37 | Layout2 = new QGridLayout( buttonWidget ); | 34 | Layout2 = new QGridLayout( buttonWidget ); |
38 | Layout2->setSpacing( 3 ); | 35 | Layout2->setSpacing( 3 ); |
39 | Layout2->setMargin( 4 ); | 36 | Layout2->setMargin( 4 ); |
40 | 37 | ||
41 | cmdCity7 = new QToolButton( buttonWidget, "cmdCity7" ); | 38 | cmdCity7 = new QToolButton( buttonWidget, "cmdCity7" ); |
42 | cmdCity7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity7->sizePolicy().hasHeightForWidth() ) ); | 39 | cmdCity7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity7->sizePolicy().hasHeightForWidth() ) ); |
43 | QFont cmdCity7_font( cmdCity7->font() ); | 40 | QFont cmdCity7_font( cmdCity7->font() ); |
44 | cmdCity7_font.setBold( TRUE ); | 41 | cmdCity7_font.setBold( TRUE ); |
45 | cmdCity7->setFont( cmdCity7_font ); | 42 | cmdCity7->setFont( cmdCity7_font ); |
46 | cmdCity7->setFocusPolicy( QToolButton::TabFocus ); | 43 | cmdCity7->setFocusPolicy( QToolButton::TabFocus ); |
47 | cmdCity7->setText( tr( "" ) ); | 44 | cmdCity7->setText( tr( "" ) ); |
48 | cmdCity7->setToggleButton( TRUE ); | 45 | cmdCity7->setToggleButton( TRUE ); |
49 | cmdCity7->setToggleButton( TRUE ); | 46 | cmdCity7->setToggleButton( TRUE ); |
50 | 47 | ||
51 | Layout2->addWidget( cmdCity7, 0, 2 ); | 48 | Layout2->addWidget( cmdCity7, 0, 2 ); |
52 | 49 | ||
53 | lblCTime9 = new QLabel( buttonWidget, "lblCTime9" ); | 50 | lblCTime9 = new QLabel( buttonWidget, "lblCTime9" ); |
54 | lblCTime9->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, lblCTime9->sizePolicy().hasHeightForWidth() ) ); | 51 | lblCTime9->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, lblCTime9->sizePolicy().hasHeightForWidth() ) ); |
55 | QFont lblCTime9_font( lblCTime9->font() ); | 52 | QFont lblCTime9_font( lblCTime9->font() ); |
56 | lblCTime9_font.setPointSize( 10 ); | 53 | lblCTime9_font.setPointSize( 10 ); |
57 | lblCTime9->setFont( lblCTime9_font ); | 54 | lblCTime9->setFont( lblCTime9_font ); |
58 | lblCTime9->setText( tr( "" ) ); | 55 | lblCTime9->setText( tr( "" ) ); |
59 | lblCTime9->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); | 56 | lblCTime9->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); |
60 | 57 | ||
61 | Layout2->addWidget( lblCTime9, 2, 3 ); | 58 | Layout2->addWidget( lblCTime9, 2, 3 ); |
62 | 59 | ||
63 | cmdCity8 = new QToolButton( buttonWidget, "cmdCity8" ); | 60 | cmdCity8 = new QToolButton( buttonWidget, "cmdCity8" ); |
64 | cmdCity8->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity8->sizePolicy().hasHeightForWidth() ) ); | 61 | cmdCity8->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity8->sizePolicy().hasHeightForWidth() ) ); |
65 | QFont cmdCity8_font( cmdCity8->font() ); | 62 | QFont cmdCity8_font( cmdCity8->font() ); |
66 | cmdCity8_font.setBold( TRUE ); | 63 | cmdCity8_font.setBold( TRUE ); |
67 | cmdCity8->setFont( cmdCity8_font ); | 64 | cmdCity8->setFont( cmdCity8_font ); |
68 | cmdCity8->setFocusPolicy( QToolButton::TabFocus ); | 65 | cmdCity8->setFocusPolicy( QToolButton::TabFocus ); |
69 | cmdCity8->setText( tr( "" ) ); | 66 | cmdCity8->setText( tr( "" ) ); |
70 | cmdCity8->setToggleButton( TRUE ); | 67 | cmdCity8->setToggleButton( TRUE ); |
71 | cmdCity8->setToggleButton( TRUE ); | 68 | cmdCity8->setToggleButton( TRUE ); |
72 | 69 | ||
73 | Layout2->addWidget( cmdCity8, 1, 2 ); | 70 | Layout2->addWidget( cmdCity8, 1, 2 ); |
74 | 71 | ||
75 | cmdCity2 = new QToolButton( buttonWidget, "cmdCity2" ); | 72 | cmdCity2 = new QToolButton( buttonWidget, "cmdCity2" ); |
76 | QFont cmdCity2_font( cmdCity2->font() ); | 73 | QFont cmdCity2_font( cmdCity2->font() ); |
77 | cmdCity2_font.setBold( TRUE ); | 74 | cmdCity2_font.setBold( TRUE ); |
78 | cmdCity2->setFont( cmdCity2_font ); | 75 | cmdCity2->setFont( cmdCity2_font ); |
79 | cmdCity2->setFocusPolicy( QToolButton::TabFocus ); | 76 | cmdCity2->setFocusPolicy( QToolButton::TabFocus ); |
80 | cmdCity2->setText( tr( "" ) ); | 77 | cmdCity2->setText( tr( "" ) ); |
81 | cmdCity2->setToggleButton( TRUE ); | 78 | cmdCity2->setToggleButton( TRUE ); |
82 | cmdCity2->setToggleButton( TRUE ); | 79 | cmdCity2->setToggleButton( TRUE ); |
83 | 80 | ||
84 | Layout2->addWidget( cmdCity2, 1, 0 ); | 81 | Layout2->addWidget( cmdCity2, 1, 0 ); |
85 | 82 | ||
86 | lblCTime6 = new QLabel( buttonWidget, "lblCTime6" ); | 83 | lblCTime6 = new QLabel( buttonWidget, "lblCTime6" ); |
87 | QFont lblCTime6_font( lblCTime6->font() ); | 84 | QFont lblCTime6_font( lblCTime6->font() ); |
88 | lblCTime6_font.setPointSize( 10 ); | 85 | lblCTime6_font.setPointSize( 10 ); |
89 | lblCTime6->setFont( lblCTime6_font ); | 86 | lblCTime6->setFont( lblCTime6_font ); |
90 | lblCTime6->setText( tr( "" ) ); | 87 | lblCTime6->setText( tr( "" ) ); |
91 | lblCTime6->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); | 88 | lblCTime6->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); |
92 | 89 | ||
93 | Layout2->addWidget( lblCTime6, 5, 1 ); | 90 | Layout2->addWidget( lblCTime6, 5, 1 ); |
94 | 91 | ||
95 | cmdCity6 = new QToolButton( buttonWidget, "cmdCity6" ); | 92 | cmdCity6 = new QToolButton( buttonWidget, "cmdCity6" ); |
96 | cmdCity6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity6->sizePolicy().hasHeightForWidth() ) ); | 93 | cmdCity6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity6->sizePolicy().hasHeightForWidth() ) ); |
97 | QFont cmdCity6_font( cmdCity6->font() ); | 94 | QFont cmdCity6_font( cmdCity6->font() ); |
98 | cmdCity6_font.setBold( TRUE ); | 95 | cmdCity6_font.setBold( TRUE ); |
99 | cmdCity6->setFont( cmdCity6_font ); | 96 | cmdCity6->setFont( cmdCity6_font ); |
100 | cmdCity6->setFocusPolicy( QToolButton::TabFocus ); | 97 | cmdCity6->setFocusPolicy( QToolButton::TabFocus ); |
101 | cmdCity6->setText( tr( "" ) ); | 98 | cmdCity6->setText( tr( "" ) ); |
102 | cmdCity6->setToggleButton( TRUE ); | 99 | cmdCity6->setToggleButton( TRUE ); |
103 | cmdCity6->setToggleButton( TRUE ); | 100 | cmdCity6->setToggleButton( TRUE ); |
104 | 101 | ||
105 | Layout2->addWidget( cmdCity6, 5, 0 ); | 102 | Layout2->addWidget( cmdCity6, 5, 0 ); |
106 | 103 | ||
107 | cmdCity4 = new QToolButton( buttonWidget, "cmdCity4" ); | 104 | cmdCity4 = new QToolButton( buttonWidget, "cmdCity4" ); |
108 | cmdCity4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity4->sizePolicy().hasHeightForWidth() ) ); | 105 | cmdCity4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)1, cmdCity4->sizePolicy().hasHeightForWidth() ) ); |
109 | QFont cmdCity4_font( cmdCity4->font() ); | 106 | 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 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of 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 | 20 | ||
21 | #include "citytime.h" | 21 | #include "citytime.h" |
22 | #include <qpe/qpeapplication.h> | ||
23 | #include <opie/oapplicationfactory.h> | 22 | #include <opie/oapplicationfactory.h> |
24 | 23 | ||
25 | OPIE_EXPORT_APP( OApplicationFactory<CityTime> ) | 24 | 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 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of 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 | 20 | ||
21 | #include <qpoint.h> | ||
22 | #include <qtimer.h> | 21 | #include <qtimer.h> |
23 | 22 | ||
24 | #include "stylusnormalizer.h" | 23 | #include "stylusnormalizer.h" |
25 | 24 | ||
26 | static const int FLUSHTIME = 100; | 25 | static const int FLUSHTIME = 100; |
27 | 26 | ||
28 | _StylusEvent::_StylusEvent( const QPoint& newPt ) | 27 | _StylusEvent::_StylusEvent( const QPoint& newPt ) |
29 | : _pt( newPt ), | 28 | : _pt( newPt ), |
30 | _t( QTime::currentTime() ) | 29 | _t( QTime::currentTime() ) |
31 | { | 30 | { |
32 | } | 31 | } |
33 | 32 | ||
34 | _StylusEvent::~_StylusEvent() | 33 | _StylusEvent::~_StylusEvent() |
35 | { | 34 | { |
36 | } | 35 | } |
37 | 36 | ||
38 | StylusNormalizer::StylusNormalizer( QWidget *parent, const char* name ) | 37 | StylusNormalizer::StylusNormalizer( QWidget *parent, const char* name ) |
39 | : QWidget( parent, name ), | 38 | : QWidget( parent, name ), |
40 | _next( 0 ), | 39 | _next( 0 ), |
41 | bFirst( true ) | 40 | bFirst( true ) |
42 | { | 41 | { |
43 | // initialize _ptList | 42 | // initialize _ptList |
44 | int i; | 43 | int i; |
45 | for (i = 0; i < SAMPLES; i++ ) { | 44 | for (i = 0; i < SAMPLES; i++ ) { |
46 | _ptList[i].setPoint( -1, -1 ); | 45 | _ptList[i].setPoint( -1, -1 ); |
47 | } | 46 | } |
48 | _tExpire = new QTimer( this ); | 47 | _tExpire = new QTimer( this ); |
49 | QObject::connect( _tExpire, SIGNAL( timeout() ), | 48 | QObject::connect( _tExpire, SIGNAL( timeout() ), |
50 | this, SLOT( slotAveragePoint() ) ); | 49 | this, SLOT( slotAveragePoint() ) ); |
51 | } | 50 | } |
52 | 51 | ||
53 | StylusNormalizer::~StylusNormalizer() | 52 | StylusNormalizer::~StylusNormalizer() |
54 | { | 53 | { |
55 | } | 54 | } |
56 | 55 | ||
57 | void StylusNormalizer::addEvent( const QPoint& pt ) | 56 | void StylusNormalizer::addEvent( const QPoint& pt ) |
58 | { | 57 | { |
59 | _ptList[_next].setPoint( pt ); | 58 | _ptList[_next].setPoint( pt ); |
60 | _ptList[_next++].setTime( QTime::currentTime() ); | 59 | _ptList[_next++].setTime( QTime::currentTime() ); |
61 | if ( _next >= SAMPLES ) { | 60 | if ( _next >= SAMPLES ) { |
62 | _next = 0; | 61 | _next = 0; |
63 | } | 62 | } |
64 | // make a single mouse click work | 63 | // make a single mouse click work |
65 | if ( bFirst ) { | 64 | if ( bFirst ) { |
66 | slotAveragePoint(); | 65 | slotAveragePoint(); |
67 | bFirst = false; | 66 | bFirst = false; |
68 | } | 67 | } |
69 | } | 68 | } |
70 | 69 | ||
71 | void StylusNormalizer::slotAveragePoint( void ) | 70 | void StylusNormalizer::slotAveragePoint( void ) |
72 | { | 71 | { |
73 | QPoint pt( 0, 0 ); | 72 | QPoint pt( 0, 0 ); |
74 | QTime tCurr = QTime::currentTime(); | 73 | QTime tCurr = QTime::currentTime(); |
75 | int i, | 74 | int i, |
76 | size; | 75 | size; |
77 | size = 0; | 76 | size = 0; |
78 | for ( i = 0; i < SAMPLES; i++ ) { | 77 | for ( i = 0; i < SAMPLES; i++ ) { |
79 | if ( ( (_ptList[i]).time().msecsTo( tCurr ) < FLUSHTIME ) && | 78 | if ( ( (_ptList[i]).time().msecsTo( tCurr ) < FLUSHTIME ) && |
80 | ( _ptList[i].point() != QPoint( -1, -1 ) ) ) { | 79 | ( _ptList[i].point() != QPoint( -1, -1 ) ) ) { |
81 | pt += _ptList[i].point(); | 80 | pt += _ptList[i].point(); |
82 | size++; | 81 | size++; |
83 | } | 82 | } |
84 | } | 83 | } |
85 | if ( size > 0 ) | 84 | if ( size > 0 ) |
86 | emit signalNewPoint( pt /= size ); | 85 | emit signalNewPoint( pt /= size ); |
87 | } | 86 | } |
88 | 87 | ||
89 | void StylusNormalizer::start( void ) | 88 | void StylusNormalizer::start( void ) |
90 | { | 89 | { |
91 | _tExpire->start( FLUSHTIME ); | 90 | _tExpire->start( FLUSHTIME ); |
92 | } | 91 | } |
93 | 92 | ||
94 | void StylusNormalizer::stop( void ) | 93 | void StylusNormalizer::stop( void ) |
95 | { | 94 | { |
96 | _tExpire->stop(); | 95 | _tExpire->stop(); |
97 | bFirst = true; | 96 | bFirst = true; |
98 | } | 97 | } |
99 | 98 | ||
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 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of 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 | 20 | ||
21 | // changes by Maximilian Reiss <harlekin@handhelds.org> | 21 | // changes by Maximilian Reiss <harlekin@handhelds.org> |
22 | 22 | ||
23 | #include "sun.h" | 23 | #include "sun.h" |
24 | #include "zonemap.h" | 24 | #include "zonemap.h" |
25 | 25 | ||
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/timestring.h> | ||
28 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
29 | 28 | ||
30 | #include <qdatetime.h> | ||
31 | #include <qfile.h> | 29 | #include <qfile.h> |
32 | #include <qimage.h> | ||
33 | #include <qlabel.h> | 30 | #include <qlabel.h> |
34 | #include <qlist.h> | ||
35 | #include <qmessagebox.h> | 31 | #include <qmessagebox.h> |
36 | #include <qpixmap.h> | ||
37 | #include <qpainter.h> | ||
38 | #include <qregexp.h> | ||
39 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
40 | #include <qtimer.h> | 33 | #include <qtimer.h> |
41 | #include <qtoolbutton.h> | 34 | #include <qtoolbutton.h> |
42 | #include <qlayout.h> | 35 | #include <qlayout.h> |
43 | #include <qhbox.h> | 36 | #include <qhbox.h> |
44 | #include <qlistview.h> | 37 | #include <qlistview.h> |
45 | #include <qwhatsthis.h> | 38 | #include <qwhatsthis.h> |
46 | 39 | ||
47 | #include <limits.h> | 40 | #include <limits.h> |
48 | 41 | ||
49 | // the map file... | 42 | // the map file... |
50 | static const char strZONEINFO[] = "/usr/share/zoneinfo/zone.tab"; | 43 | static const char strZONEINFO[] = "/usr/share/zoneinfo/zone.tab"; |
51 | static const char strMAP[] = "citytime/simple_grid_400"; | 44 | static const char strMAP[] = "citytime/simple_grid_400"; |
52 | 45 | ||
53 | // the maximum distance we'll allow the pointer to be away from a city | 46 | // the maximum distance we'll allow the pointer to be away from a city |
54 | // and still show the city's time | 47 | // and still show the city's time |
55 | static const int iTHRESHOLD = 50000; | 48 | static const int iTHRESHOLD = 50000; |
56 | 49 | ||
57 | // The label offset (how far away from pointer) | 50 | // The label offset (how far away from pointer) |
58 | static const int iLABELOFFSET = 8; | 51 | static const int iLABELOFFSET = 8; |
59 | 52 | ||
60 | // the size of the dot to draw, and where to start it | 53 | // the size of the dot to draw, and where to start it |
61 | static const int iCITYSIZE = 3; | 54 | static const int iCITYSIZE = 3; |
62 | const int iCITYOFFSET = 2; | 55 | const int iCITYOFFSET = 2; |
63 | 56 | ||
64 | // the darkening function | 57 | // the darkening function |
65 | static inline void darken( QImage *pImage, int start, int stop, int row ); | 58 | static inline void darken( QImage *pImage, int start, int stop, int row ); |
66 | static void dayNight( QImage *pImage ); | 59 | static void dayNight( QImage *pImage ); |
67 | 60 | ||
68 | ZoneField::ZoneField( const QString& strLine ) | 61 | ZoneField::ZoneField( const QString& strLine ) |
69 | { | 62 | { |
70 | // make a bunch of RegExp's to match the data from the line | 63 | // make a bunch of RegExp's to match the data from the line |
71 | QRegExp regCoord( "[-+][0-9]+" );// the latitude | 64 | QRegExp regCoord( "[-+][0-9]+" );// the latitude |
72 | QRegExp regCountry( "[A-Za-z]+/" ); // the country (not good enough) | 65 | QRegExp regCountry( "[A-Za-z]+/" ); // the country (not good enough) |
73 | QRegExp regCity( "[A-Za-z_-]*" ); // the city | 66 | QRegExp regCity( "[A-Za-z_-]*" ); // the city |
74 | 67 | ||
75 | int iStart, | 68 | int iStart, |
76 | iStop, | 69 | iStop, |
77 | iLen, | 70 | iLen, |
78 | tmp; | 71 | tmp; |
79 | QString strTmp; | 72 | QString strTmp; |
80 | // we should be able to assume that the country code is always the first | 73 | // we should be able to assume that the country code is always the first |
81 | // two chars, so just grap them and let it go... | 74 | // two chars, so just grap them and let it go... |
82 | strCountryCode = strLine.left( 2 ); | 75 | strCountryCode = strLine.left( 2 ); |
83 | iStart = regCoord.match( strLine, 0, &iLen ); | 76 | iStart = regCoord.match( strLine, 0, &iLen ); |
84 | if ( iStart >= 0 ) { | 77 | if ( iStart >= 0 ) { |
85 | strTmp = strLine.mid( iStart, iLen ); | 78 | strTmp = strLine.mid( iStart, iLen ); |
86 | tmp = strTmp.toInt(); | 79 | tmp = strTmp.toInt(); |
87 | // okay, there are two versions of the format, make a decision based on | 80 | // okay, there are two versions of the format, make a decision based on |
88 | // the size... | 81 | // the size... |
89 | // Oh BTW, we are storing everything in seconds! | 82 | // Oh BTW, we are storing everything in seconds! |
90 | if ( iLen < 7 ) { | 83 | if ( iLen < 7 ) { |
91 | _y = tmp / 100; | 84 | _y = tmp / 100; |
92 | _y *= 60; | 85 | _y *= 60; |
93 | _y += tmp % 100; | 86 | _y += tmp % 100; |
94 | _y *= 60; | 87 | _y *= 60; |
95 | } else { | 88 | } else { |
96 | _y = tmp / 10000; | 89 | _y = tmp / 10000; |
97 | _y *= 60; | 90 | _y *= 60; |
98 | tmp %= 10000; | 91 | tmp %= 10000; |
99 | _y += tmp / 100; | 92 | _y += tmp / 100; |
100 | _y *= 60; | 93 | _y *= 60; |
101 | tmp %= 100; | 94 | tmp %= 100; |
102 | _y += tmp; | 95 | _y += tmp; |
103 | } | 96 | } |
104 | } | 97 | } |
105 | iStart = regCoord.match( strLine, iStart + iLen, &iLen ); | 98 | iStart = regCoord.match( strLine, iStart + iLen, &iLen ); |
106 | if ( iStart >= 0 ) { | 99 | if ( iStart >= 0 ) { |
107 | strTmp = strLine.mid( iStart, iLen ); | 100 | strTmp = strLine.mid( iStart, iLen ); |
108 | tmp = strTmp.toInt(); | 101 | tmp = strTmp.toInt(); |
109 | if ( iLen < 8 ) { | 102 | if ( iLen < 8 ) { |
110 | _x = tmp / 100; | 103 | _x = tmp / 100; |
111 | _x *= 60; | 104 | _x *= 60; |
112 | _x += tmp % 100; | 105 | _x += tmp % 100; |
113 | _x *= 60; | 106 | _x *= 60; |
114 | } else { | 107 | } else { |
115 | _x = tmp / 10000; | 108 | _x = tmp / 10000; |
116 | _x *= 60; | 109 | _x *= 60; |
117 | tmp %= 10000; | 110 | tmp %= 10000; |
118 | _x += tmp / 100; | 111 | _x += tmp / 100; |
119 | _x *= 60; | 112 | _x *= 60; |
120 | tmp %= 100; | 113 | tmp %= 100; |
121 | _x += tmp; | 114 | _x += tmp; |
122 | } | 115 | } |
123 | } | 116 | } |
124 | iStart = regCountry.match( strLine, 0, &iLen ); | 117 | iStart = regCountry.match( strLine, 0, &iLen ); |
125 | // help with the shortcoming in 2.x regexp... | 118 | // help with the shortcoming in 2.x regexp... |
126 | iStop = strLine.findRev( '/' ); | 119 | iStop = strLine.findRev( '/' ); |
127 | if ( iStart >= 0 ) { | 120 | if ( iStart >= 0 ) { |
128 | iLen = (iStop - iStart) + 1; | 121 | iLen = (iStop - iStart) + 1; |
129 | strCountry = strLine.mid( iStart, iLen ); | 122 | strCountry = strLine.mid( iStart, iLen ); |
130 | } | 123 | } |
131 | // now match the city... | 124 | // now match the city... |
132 | iStart = regCity.match( strLine, iStart + iLen, &iLen ); | 125 | iStart = regCity.match( strLine, iStart + iLen, &iLen ); |
133 | if ( iStart >= 0 ) { | 126 | if ( iStart >= 0 ) { |
134 | strCity = strLine.mid( iStart, iLen ); | 127 | 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 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org> | 3 | =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org> |
4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "light.h" | 29 | #include "light.h" |
30 | 30 | ||
31 | #include <qpe/config.h> | 31 | #include <qpe/config.h> |
32 | #include <qpe/power.h> | 32 | #include <qpe/power.h> |
33 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 33 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
34 | #include <qpe/qcopenvelope_qws.h> | 34 | #include <qpe/qcopenvelope_qws.h> |
35 | #endif | 35 | #endif |
36 | #include <qpe/qpeapplication.h> | ||
37 | 36 | ||
38 | #include <qlabel.h> | 37 | #include <qlabel.h> |
39 | #include <qcheckbox.h> | 38 | #include <qcheckbox.h> |
40 | #include <qtabwidget.h> | 39 | #include <qtabwidget.h> |
41 | #include <qslider.h> | 40 | #include <qslider.h> |
42 | #include <qspinbox.h> | 41 | #include <qspinbox.h> |
43 | #include <qpushbutton.h> | 42 | #include <qpushbutton.h> |
44 | #include <qgroupbox.h> | 43 | #include <qgroupbox.h> |
45 | #include <qcombobox.h> | 44 | #include <qcombobox.h> |
46 | 45 | ||
47 | #include <opie/odevice.h> | 46 | #include <opie/odevice.h> |
48 | 47 | ||
49 | #include "sensor.h" | 48 | #include "sensor.h" |
50 | 49 | ||
51 | using namespace Opie; | 50 | using namespace Opie; |
52 | 51 | ||
53 | LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | 52 | LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) |
54 | : LightSettingsBase( parent, name, false, WStyle_ContextHelp ) | 53 | : LightSettingsBase( parent, name, false, WStyle_ContextHelp ) |
55 | { | 54 | { |
56 | m_bres = ODevice::inst ( )-> displayBrightnessResolution ( ); | 55 | m_bres = ODevice::inst ( )-> displayBrightnessResolution ( ); |
57 | m_cres = ODevice::inst ( )-> displayContrastResolution ( ); | 56 | m_cres = ODevice::inst ( )-> displayContrastResolution ( ); |
58 | 57 | ||
59 | // check whether to show the light sensor stuff | 58 | // check whether to show the light sensor stuff |
60 | 59 | ||
61 | if ( !ODevice::inst ( )-> hasLightSensor ( )) { | 60 | if ( !ODevice::inst ( )-> hasLightSensor ( )) { |
62 | auto_brightness-> hide ( ); | 61 | auto_brightness-> hide ( ); |
63 | CalibrateLightSensor-> hide ( ); | 62 | CalibrateLightSensor-> hide ( ); |
64 | auto_brightness_ac-> hide ( ); | 63 | auto_brightness_ac-> hide ( ); |
65 | CalibrateLightSensor_ac-> hide ( ); | 64 | CalibrateLightSensor_ac-> hide ( ); |
66 | } | 65 | } |
67 | 66 | ||
68 | // check whether to show the contrast stuff | 67 | // check whether to show the contrast stuff |
69 | 68 | ||
70 | if (m_cres) { | 69 | if (m_cres) { |
71 | GroupLight->setTitle(tr("Backlight && Contrast")); | 70 | GroupLight->setTitle(tr("Backlight && Contrast")); |
72 | GroupLight_ac->setTitle(GroupLight->title()); | 71 | GroupLight_ac->setTitle(GroupLight->title()); |
73 | } else { | 72 | } else { |
74 | contrast->hide(); | 73 | contrast->hide(); |
75 | contrast_ac->hide(); | 74 | contrast_ac->hide(); |
76 | } | 75 | } |
77 | 76 | ||
78 | // check whether to show the cpu frequency stuff | 77 | // check whether to show the cpu frequency stuff |
79 | 78 | ||
80 | QStrList freq = ODevice::inst()->allowedCpuFrequencies(); | 79 | QStrList freq = ODevice::inst()->allowedCpuFrequencies(); |
81 | if ( freq.count() ) { | 80 | if ( freq.count() ) { |
82 | frequency->insertStrList( freq ); | 81 | frequency->insertStrList( freq ); |
83 | frequency_ac->insertStrList( freq ); | 82 | frequency_ac->insertStrList( freq ); |
84 | } else { | 83 | } else { |
85 | frequencyLabel->hide(); | 84 | frequencyLabel->hide(); |
86 | frequency->hide(); | 85 | frequency->hide(); |
87 | frequencyLabel_ac->hide(); | 86 | frequencyLabel_ac->hide(); |
88 | frequency_ac->hide(); | 87 | frequency_ac->hide(); |
89 | } | 88 | } |
90 | 89 | ||
91 | // check whether to show the hinge action stuff | 90 | // check whether to show the hinge action stuff |
92 | 91 | ||
93 | if ( !ODevice::inst()->hasHingeSensor() ) { | 92 | if ( !ODevice::inst()->hasHingeSensor() ) { |
94 | closeHingeLabel->hide(); | 93 | closeHingeLabel->hide(); |
95 | closeHingeAction->hide(); | 94 | closeHingeAction->hide(); |
96 | closeHingeLabel_ac->hide(); | 95 | closeHingeLabel_ac->hide(); |
97 | closeHingeAction_ac->hide(); | 96 | closeHingeAction_ac->hide(); |
98 | } | 97 | } |
99 | 98 | ||
100 | Config config ( "apm" ); | 99 | Config config ( "apm" ); |
101 | config. setGroup ( "Battery" ); | 100 | config. setGroup ( "Battery" ); |
102 | 101 | ||
103 | // battery spinboxes | 102 | // battery spinboxes |
104 | interval_dim-> setValue ( config. readNumEntry ( "Dim", 30 )); | 103 | interval_dim-> setValue ( config. readNumEntry ( "Dim", 30 )); |
105 | interval_lightoff-> setValue ( config. readNumEntry ( "LightOff", 20 )); | 104 | interval_lightoff-> setValue ( config. readNumEntry ( "LightOff", 20 )); |
106 | interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 )); | 105 | interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 )); |
107 | 106 | ||
108 | // battery check and slider | 107 | // battery check and slider |
109 | LcdOffOnly->setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); | 108 | LcdOffOnly->setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); |
110 | 109 | ||
111 | // CPU frequency | 110 | // CPU frequency |
112 | frequency->setCurrentItem( config.readNumEntry("Freq", 0) ); | 111 | frequency->setCurrentItem( config.readNumEntry("Freq", 0) ); |
113 | 112 | ||
114 | // hinge action | 113 | // hinge action |
115 | closeHingeAction->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); | 114 | closeHingeAction->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); |
116 | 115 | ||
117 | int bright = config. readNumEntry ( "Brightness", 127 ); | 116 | int bright = config. readNumEntry ( "Brightness", 127 ); |
118 | int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 ); | 117 | int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 ); |
119 | brightness-> setTickInterval ( QMAX( 16, 256 / m_bres )); | 118 | brightness-> setTickInterval ( QMAX( 16, 256 / m_bres )); |
120 | brightness-> setLineStep ( QMAX( 1, 256 / m_bres )); | 119 | brightness-> setLineStep ( QMAX( 1, 256 / m_bres )); |
121 | brightness-> setPageStep ( QMAX( 1, 256 / m_bres )); | 120 | brightness-> setPageStep ( QMAX( 1, 256 / m_bres )); |
122 | brightness-> setValue ( bright ); | 121 | brightness-> setValue ( bright ); |
123 | 122 | ||
124 | if (m_cres) { | 123 | if (m_cres) { |
125 | contrast-> setTickInterval ( QMAX( 16, 256 / m_cres )); | 124 | contrast-> setTickInterval ( QMAX( 16, 256 / m_cres )); |
126 | contrast-> setLineStep ( QMAX( 1, 256 / m_cres )); | 125 | contrast-> setLineStep ( QMAX( 1, 256 / m_cres )); |
127 | contrast-> setPageStep ( QMAX( 1, 256 / m_cres )); | 126 | contrast-> setPageStep ( QMAX( 1, 256 / m_cres )); |
128 | contrast-> setValue ( contr ); | 127 | contrast-> setValue ( contr ); |
129 | } | 128 | } |
130 | 129 | ||
131 | // light sensor | 130 | // light sensor |
132 | auto_brightness-> setChecked ( config. readBoolEntry ( "LightSensor", false )); | 131 | 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 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) Robert Griebl <sandman@handhelds.org> | 3 | Copyright (C) Robert Griebl <sandman@handhelds.org> |
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | 4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "ocolorpopupmenu.h" | 30 | #include "ocolorpopupmenu.h" |
31 | #include "ocolorbutton.h" | 31 | #include "ocolorbutton.h" |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <qpe/resource.h> | ||
35 | 34 | ||
36 | /* QT */ | 35 | /* QT */ |
37 | #include <qcolor.h> | ||
38 | #include <qpixmap.h> | ||
39 | #include <qimage.h> | 36 | #include <qimage.h> |
40 | 37 | ||
41 | using namespace Opie; | 38 | using namespace Opie; |
42 | 39 | ||
43 | struct OColorButtonPrivate | 40 | struct OColorButtonPrivate |
44 | { | 41 | { |
45 | QPopupMenu *m_menu; | 42 | QPopupMenu *m_menu; |
46 | QColor m_color; | 43 | QColor m_color; |
47 | }; | 44 | }; |
48 | 45 | ||
49 | /** | 46 | /** |
50 | * This concstructs a Color Button with @param color as the start color | 47 | * This concstructs a Color Button with @param color as the start color |
51 | * It'll use a OColorPopupMenu internally | 48 | * It'll use a OColorPopupMenu internally |
52 | * | 49 | * |
53 | * @param parent The parent of the Color Button | 50 | * @param parent The parent of the Color Button |
54 | * @param color The color from where to start on | 51 | * @param color The color from where to start on |
55 | * @param name @see QObject | 52 | * @param name @see QObject |
56 | */ | 53 | */ |
57 | OColorButton::OColorButton ( QWidget *parent, const QColor &color, const char *name ) | 54 | OColorButton::OColorButton ( QWidget *parent, const QColor &color, const char *name ) |
58 | : QPushButton ( parent, name ) | 55 | : QPushButton ( parent, name ) |
59 | { | 56 | { |
60 | d = new OColorButtonPrivate; | 57 | d = new OColorButtonPrivate; |
61 | 58 | ||
62 | d-> m_menu = new OColorPopupMenu ( color, 0, 0 ); | 59 | d-> m_menu = new OColorPopupMenu ( color, 0, 0 ); |
63 | setPopup ( d-> m_menu ); | 60 | setPopup ( d-> m_menu ); |
64 | //setPopupDelay ( 0 ); | 61 | //setPopupDelay ( 0 ); |
65 | connect ( d-> m_menu, SIGNAL( colorSelected ( const QColor & )), this, SLOT( updateColor ( const QColor & ))); | 62 | connect ( d-> m_menu, SIGNAL( colorSelected ( const QColor & )), this, SLOT( updateColor ( const QColor & ))); |
66 | 63 | ||
67 | updateColor ( color ); | 64 | updateColor ( color ); |
68 | 65 | ||
69 | QSize s = sizeHint ( ) + QSize ( 12, 0 ); | 66 | QSize s = sizeHint ( ) + QSize ( 12, 0 ); |
70 | setMinimumSize ( s ); | 67 | setMinimumSize ( s ); |
71 | setMaximumSize ( s. width ( ) * 2, s. height ( )); | 68 | setMaximumSize ( s. width ( ) * 2, s. height ( )); |
72 | } | 69 | } |
73 | 70 | ||
74 | /** | 71 | /** |
75 | * This destructs the object | 72 | * This destructs the object |
76 | */ | 73 | */ |
77 | OColorButton::~OColorButton ( ) | 74 | OColorButton::~OColorButton ( ) |
78 | { | 75 | { |
79 | delete d; | 76 | delete d; |
80 | } | 77 | } |
81 | 78 | ||
82 | /** | 79 | /** |
83 | * @return Returns the current color of the button | 80 | * @return Returns the current color of the button |
84 | */ | 81 | */ |
85 | QColor OColorButton::color ( ) const | 82 | QColor OColorButton::color ( ) const |
86 | { | 83 | { |
87 | return d-> m_color; | 84 | return d-> m_color; |
88 | } | 85 | } |
89 | 86 | ||
90 | /** | 87 | /** |
91 | * This method sets the color of the button | 88 | * This method sets the color of the button |
92 | * @param c The color to be set. | 89 | * @param c The color to be set. |
93 | */ | 90 | */ |
94 | void OColorButton::setColor ( const QColor &c ) | 91 | void OColorButton::setColor ( const QColor &c ) |
95 | { | 92 | { |
96 | updateColor ( c ); | 93 | updateColor ( c ); |
97 | } | 94 | } |
98 | 95 | ||
99 | /** | 96 | /** |
100 | * @internal | 97 | * @internal |
101 | */ | 98 | */ |
102 | void OColorButton::updateColor ( const QColor &c ) | 99 | void OColorButton::updateColor ( const QColor &c ) |
103 | { | 100 | { |
104 | d-> m_color = c; | 101 | d-> m_color = c; |
105 | 102 | ||
106 | QImage img ( 16, 16, 32 ); | 103 | QImage img ( 16, 16, 32 ); |
107 | img. fill ( 0 ); | 104 | img. fill ( 0 ); |
108 | 105 | ||
109 | int r, g, b; | 106 | int r, g, b; |
110 | c. rgb ( &r, &g, &b ); | 107 | c. rgb ( &r, &g, &b ); |
111 | 108 | ||
112 | int w = img. width ( ); | 109 | int w = img. width ( ); |
113 | int h = img. height ( ); | 110 | int h = img. height ( ); |
114 | 111 | ||
115 | int dx = w * 20 / 100; // 15% | 112 | int dx = w * 20 / 100; // 15% |
116 | int dy = h * 20 / 100; | 113 | int dy = h * 20 / 100; |
117 | 114 | ||
118 | for ( int y = 0; y < h; y++ ) | 115 | for ( int y = 0; y < h; y++ ) |
119 | { | 116 | { |
120 | for ( int x = 0; x < w; x++ ) | 117 | for ( int x = 0; x < w; x++ ) |
121 | { | 118 | { |
122 | double alpha = 1.0; | 119 | double alpha = 1.0; |
123 | 120 | ||
124 | if ( x < dx ) | 121 | if ( x < dx ) |
125 | alpha *= ( double ( x + 1 ) / dx ); | 122 | alpha *= ( double ( x + 1 ) / dx ); |
126 | else if ( x >= w - dx ) | 123 | else if ( x >= w - dx ) |
127 | alpha *= ( double ( w - x ) / dx ); | 124 | alpha *= ( double ( w - x ) / dx ); |
128 | if ( y < dy ) | 125 | if ( y < dy ) |
129 | alpha *= ( double ( y + 1 ) / dy ); | 126 | alpha *= ( double ( y + 1 ) / dy ); |
130 | else if ( y >= h - dy ) | 127 | else if ( y >= h - dy ) |
131 | alpha *= ( double ( h - y ) / dy ); | 128 | alpha *= ( double ( h - y ) / dy ); |
132 | 129 | ||
133 | int a = int ( alpha * 255.0 ); | 130 | int a = int ( alpha * 255.0 ); |
134 | if ( a < 0 ) | 131 | 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 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 S. Prud'homme <prudhomme@laposte.net> | 4 | Copyright (c) 2002 S. Prud'homme <prudhomme@laposte.net> |
5 | Dan Williams <williamsdr@acm.org> | 5 | Dan Williams <williamsdr@acm.org> |
6 | =. | 6 | =. |
7 | .=l. | 7 | .=l. |
8 | .>+-= | 8 | .>+-= |
9 | _;:, .> :=|. This program is free software; you can | 9 | _;:, .> :=|. This program is free software; you can |
10 | .> <`_, > . <= redistribute it and/or modify it under | 10 | .> <`_, > . <= redistribute it and/or modify it under |
11 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 11 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
12 | .="- .-=="i, .._ License as published by the Free Software | 12 | .="- .-=="i, .._ License as published by the Free Software |
13 | - . .-<_> .<> Foundation; either version 2 of the License, | 13 | - . .-<_> .<> Foundation; either version 2 of the License, |
14 | ._= =} : or (at your option) any later version. | 14 | ._= =} : or (at your option) any later version. |
15 | .%`+i> _;_. | 15 | .%`+i> _;_. |
16 | .i_,=:_. -<s. This program is distributed in the hope that | 16 | .i_,=:_. -<s. This program is distributed in the hope that |
17 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 17 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
18 | : .. .:, . . . without even the implied warranty of | 18 | : .. .:, . . . without even the implied warranty of |
19 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 19 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
20 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 20 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
21 | ..}^=.= = ; Library General Public License for more | 21 | ..}^=.= = ; Library General Public License for more |
22 | ++= -. .` .: details. | 22 | ++= -. .` .: details. |
23 | : = ...= . :.=- | 23 | : = ...= . :.=- |
24 | -. .:....=;==+<; You should have received a copy of the GNU | 24 | -. .:....=;==+<; You should have received a copy of the GNU |
25 | -_. . . )=. = Library General Public License along with | 25 | -_. . . )=. = Library General Public License along with |
26 | -- :-=` this library; see the file COPYING.LIB. | 26 | -- :-=` this library; see the file COPYING.LIB. |
27 | If not, write to the Free Software Foundation, | 27 | If not, write to the Free Software Foundation, |
28 | Inc., 59 Temple Place - Suite 330, | 28 | Inc., 59 Temple Place - Suite 330, |
29 | Boston, MA 02111-1307, USA. | 29 | Boston, MA 02111-1307, USA. |
30 | 30 | ||
31 | */ | 31 | */ |
32 | 32 | ||
33 | #include "ocolorpopupmenu.h" | 33 | #include "ocolorpopupmenu.h" |
34 | #include "qcolordialog.h" | 34 | #include "qcolordialog.h" |
35 | 35 | ||
36 | /* QT */ | 36 | /* QT */ |
37 | #include <qaction.h> | ||
38 | #include <qlayout.h> | 37 | #include <qlayout.h> |
39 | #include <qpainter.h> | 38 | #include <qpainter.h> |
40 | 39 | ||
41 | using namespace Opie; | 40 | using namespace Opie; |
42 | 41 | ||
43 | OColorPanelButton::OColorPanelButton( const QColor& color, QWidget* parent, const char* name ) | 42 | OColorPanelButton::OColorPanelButton( const QColor& color, QWidget* parent, const char* name ) |
44 | : QFrame( parent, name ) | 43 | : QFrame( parent, name ) |
45 | { | 44 | { |
46 | m_color = color; | 45 | m_color = color; |
47 | 46 | ||
48 | setFixedSize( 16, 16 ); | 47 | setFixedSize( 16, 16 ); |
49 | setActive( FALSE ); | 48 | setActive( FALSE ); |
50 | } | 49 | } |
51 | 50 | ||
52 | OColorPanelButton::~OColorPanelButton() | 51 | OColorPanelButton::~OColorPanelButton() |
53 | { | 52 | { |
54 | } | 53 | } |
55 | 54 | ||
56 | void OColorPanelButton::setActive( bool active ) | 55 | void OColorPanelButton::setActive( bool active ) |
57 | { | 56 | { |
58 | m_active = active; | 57 | m_active = active; |
59 | 58 | ||
60 | if ( m_active ) { | 59 | if ( m_active ) { |
61 | setFrameStyle( Panel | Sunken ); | 60 | setFrameStyle( Panel | Sunken ); |
62 | } else { | 61 | } else { |
63 | setFrameStyle( NoFrame ); | 62 | setFrameStyle( NoFrame ); |
64 | } | 63 | } |
65 | } | 64 | } |
66 | 65 | ||
67 | void OColorPanelButton::enterEvent( QEvent* ) | 66 | void OColorPanelButton::enterEvent( QEvent* ) |
68 | { | 67 | { |
69 | if ( !m_active ) { | 68 | if ( !m_active ) { |
70 | setFrameStyle( Panel | Sunken ); | 69 | setFrameStyle( Panel | Sunken ); |
71 | } | 70 | } |
72 | } | 71 | } |
73 | 72 | ||
74 | void OColorPanelButton::leaveEvent( QEvent* ) | 73 | void OColorPanelButton::leaveEvent( QEvent* ) |
75 | { | 74 | { |
76 | if ( !m_active ) { | 75 | if ( !m_active ) { |
77 | setFrameStyle( NoFrame ); | 76 | setFrameStyle( NoFrame ); |
78 | } | 77 | } |
79 | } | 78 | } |
80 | 79 | ||
81 | void OColorPanelButton::paintEvent( QPaintEvent* e ) | 80 | void OColorPanelButton::paintEvent( QPaintEvent* e ) |
82 | { | 81 | { |
83 | QFrame::paintEvent( e ); | 82 | QFrame::paintEvent( e ); |
84 | 83 | ||
85 | QPainter painter; | 84 | QPainter painter; |
86 | painter.begin( this ); | 85 | painter.begin( this ); |
87 | painter.fillRect( 2, 2, 12, 12, m_color ); | 86 | painter.fillRect( 2, 2, 12, 12, m_color ); |
88 | painter.setPen( Qt::black ); | 87 | painter.setPen( Qt::black ); |
89 | painter.drawRect( 2, 2, 12, 12 ); | 88 | painter.drawRect( 2, 2, 12, 12 ); |
90 | painter.end(); | 89 | painter.end(); |
91 | } | 90 | } |
92 | 91 | ||
93 | void OColorPanelButton::mouseReleaseEvent( QMouseEvent* ) | 92 | void OColorPanelButton::mouseReleaseEvent( QMouseEvent* ) |
94 | { | 93 | { |
95 | emit selected( m_color ); | 94 | emit selected( m_color ); |
96 | } | 95 | } |
97 | 96 | ||
98 | OColorPopupMenu::OColorPopupMenu( const QColor& color, QWidget* parent, const char* name ) | 97 | OColorPopupMenu::OColorPopupMenu( const QColor& color, QWidget* parent, const char* name ) |
99 | : QPopupMenu( parent, name ) | 98 | : QPopupMenu( parent, name ) |
100 | { | 99 | { |
101 | m_color = color; | 100 | m_color = color; |
102 | 101 | ||
103 | colorPanel = new QWidget( this ); | 102 | colorPanel = new QWidget( this ); |
104 | 103 | ||
105 | colorLayout = new QGridLayout(colorPanel, 5, 6); | 104 | colorLayout = new QGridLayout(colorPanel, 5, 6); |
106 | 105 | ||
107 | addColor(QColor(255, 255, 255), 0, 1); | 106 | addColor(QColor(255, 255, 255), 0, 1); |
108 | addColor(QColor(192, 192, 192), 0, 2); | 107 | addColor(QColor(192, 192, 192), 0, 2); |
109 | addColor(QColor(128, 128, 128), 0, 3); | 108 | addColor(QColor(128, 128, 128), 0, 3); |
110 | addColor(QColor(64, 64, 64), 0, 4); | 109 | addColor(QColor(64, 64, 64), 0, 4); |
111 | addColor(QColor(0, 0, 0), 0, 5); | 110 | addColor(QColor(0, 0, 0), 0, 5); |
112 | 111 | ||
113 | addColor(QColor(255, 0, 0), 1, 0); | 112 | addColor(QColor(255, 0, 0), 1, 0); |
114 | addColor(QColor(255, 128, 0), 1, 1); | 113 | addColor(QColor(255, 128, 0), 1, 1); |
115 | addColor(QColor(255, 255, 0), 1, 2); | 114 | addColor(QColor(255, 255, 0), 1, 2); |
116 | addColor(QColor(128, 255, 0), 1, 3); | 115 | addColor(QColor(128, 255, 0), 1, 3); |
117 | addColor(QColor(0, 255, 0), 1, 4); | 116 | addColor(QColor(0, 255, 0), 1, 4); |
118 | addColor(QColor(0, 255, 128), 1, 5); | 117 | addColor(QColor(0, 255, 128), 1, 5); |
119 | 118 | ||
120 | addColor(QColor(128, 0, 0), 2, 0); | 119 | addColor(QColor(128, 0, 0), 2, 0); |
121 | addColor(QColor(128, 64, 0), 2, 1); | 120 | addColor(QColor(128, 64, 0), 2, 1); |
122 | addColor(QColor(128, 128, 0), 2, 2); | 121 | addColor(QColor(128, 128, 0), 2, 2); |
123 | addColor(QColor(64, 128, 0), 2, 3); | 122 | addColor(QColor(64, 128, 0), 2, 3); |
124 | addColor(QColor(0, 128, 0), 2, 4); | 123 | addColor(QColor(0, 128, 0), 2, 4); |
125 | addColor(QColor(0, 128, 64), 2, 5); | 124 | addColor(QColor(0, 128, 64), 2, 5); |
126 | 125 | ||
127 | addColor(QColor(0, 255, 255), 3, 0); | 126 | addColor(QColor(0, 255, 255), 3, 0); |
128 | addColor(QColor(0, 128, 255), 3, 1); | 127 | addColor(QColor(0, 128, 255), 3, 1); |
129 | addColor(QColor(0, 0, 255), 3, 2); | 128 | addColor(QColor(0, 0, 255), 3, 2); |
130 | addColor(QColor(128, 0, 255), 3, 3); | 129 | addColor(QColor(128, 0, 255), 3, 3); |
131 | addColor(QColor(255, 0, 255), 3, 4); | 130 | addColor(QColor(255, 0, 255), 3, 4); |
132 | addColor(QColor(255, 0, 128), 3, 5); | 131 | addColor(QColor(255, 0, 128), 3, 5); |
133 | 132 | ||
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 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Implementation of QColorDialog class | 4 | ** Implementation of QColorDialog class |
5 | ** | 5 | ** |
6 | ** Created : 990222 | 6 | ** Created : 990222 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1999-2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1999-2000 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the dialogs module of the Qt GUI Toolkit. | 10 | ** This file is part of the dialogs module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
23 | ** Agreement provided with the Software. | 23 | ** Agreement provided with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #include "qcolordialog.h" | 38 | #include "qcolordialog.h" |
39 | 39 | ||
40 | #include "qpainter.h" | 40 | #include "qpainter.h" |
41 | #include "qlayout.h" | 41 | #include "qlayout.h" |
42 | #include "qlabel.h" | 42 | #include "qlabel.h" |
43 | #include "qpushbutton.h" | 43 | #include "qpushbutton.h" |
44 | #include "qlineedit.h" | 44 | #include "qlineedit.h" |
45 | #include "qimage.h" | 45 | #include "qimage.h" |
46 | #include "qpixmap.h" | 46 | #include "qpixmap.h" |
47 | #include "qdrawutil.h" | 47 | #include "qdrawutil.h" |
48 | #include "qvalidator.h" | 48 | #include "qvalidator.h" |
49 | #include "qdragobject.h" | ||
50 | #include "qapplication.h" | 49 | #include "qapplication.h" |
51 | #include "qdragobject.h" | ||
52 | 50 | ||
53 | //////////// QWellArray BEGIN | 51 | //////////// QWellArray BEGIN |
54 | 52 | ||
55 | #include "qobjectdict.h" | 53 | #include "qobjectdict.h" |
56 | 54 | ||
57 | // | 55 | // |
58 | // W A R N I N G | 56 | // W A R N I N G |
59 | // ------------- | 57 | // ------------- |
60 | // | 58 | // |
61 | // This file is not part of the Qt API. It exists for the convenience | 59 | // This file is not part of the Qt API. It exists for the convenience |
62 | // of qwellarray.cpp and qcolordialog.cpp. | 60 | // of qwellarray.cpp and qcolordialog.cpp. |
63 | // This header file may change from version to version without notice, | 61 | // This header file may change from version to version without notice, |
64 | // or even be removed. | 62 | // or even be removed. |
65 | // | 63 | // |
66 | // | 64 | // |
67 | 65 | ||
68 | 66 | ||
69 | #include "qtableview.h" | 67 | #include "qtableview.h" |
70 | 68 | ||
71 | 69 | ||
72 | struct QWellArrayData; | 70 | struct QWellArrayData; |
73 | 71 | ||
74 | class QWellArray : public QTableView | 72 | class QWellArray : public QTableView |
75 | { | 73 | { |
76 | Q_OBJECT | 74 | Q_OBJECT |
77 | Q_PROPERTY( int numCols READ numCols ) | 75 | Q_PROPERTY( int numCols READ numCols ) |
78 | Q_PROPERTY( int numRows READ numRows ) | 76 | Q_PROPERTY( int numRows READ numRows ) |
79 | Q_PROPERTY( int selectedColumn READ selectedColumn ) | 77 | Q_PROPERTY( int selectedColumn READ selectedColumn ) |
80 | Q_PROPERTY( int selectedRow READ selectedRow ) | 78 | Q_PROPERTY( int selectedRow READ selectedRow ) |
81 | 79 | ||
82 | public: | 80 | public: |
83 | QWellArray( QWidget *parent=0, const char *name=0, bool popup = FALSE ); | 81 | QWellArray( QWidget *parent=0, const char *name=0, bool popup = FALSE ); |
84 | 82 | ||
85 | ~QWellArray() {} | 83 | ~QWellArray() {} |
86 | QString cellContent( int row, int col ) const; | 84 | QString cellContent( int row, int col ) const; |
87 | // ### Paul !!! virtual void setCellContent( int row, int col, const QString &); | 85 | // ### Paul !!! virtual void setCellContent( int row, int col, const QString &); |
88 | 86 | ||
89 | // ##### Obsolete since not const | 87 | // ##### Obsolete since not const |
90 | int numCols() { return nCols; } | 88 | int numCols() { return nCols; } |
91 | int numRows() { return nRows; } | 89 | int numRows() { return nRows; } |
92 | 90 | ||
93 | int numCols() const { return nCols; } | 91 | int numCols() const { return nCols; } |
94 | int numRows() const { return nRows; } | 92 | int numRows() const { return nRows; } |
95 | 93 | ||
96 | // ##### Obsolete since not const | 94 | // ##### Obsolete since not const |
97 | int selectedColumn() { return selCol; } | 95 | int selectedColumn() { return selCol; } |
98 | int selectedRow() { return selRow; } | 96 | int selectedRow() { return selRow; } |
99 | 97 | ||
100 | int selectedColumn() const { return selCol; } | 98 | int selectedColumn() const { return selCol; } |
101 | int selectedRow() const { return selRow; } | 99 | int selectedRow() const { return selRow; } |
102 | 100 | ||
103 | virtual void setSelected( int row, int col ); | 101 | virtual void setSelected( int row, int col ); |
104 | 102 | ||
105 | void setCellSize( int w, int h ) { setCellWidth(w);setCellHeight( h ); } | 103 | void setCellSize( int w, int h ) { setCellWidth(w);setCellHeight( h ); } |
106 | 104 | ||
107 | QSize sizeHint() const; | 105 | QSize sizeHint() const; |
108 | 106 | ||
109 | virtual void setDimension( int rows, int cols ); | 107 | virtual void setDimension( int rows, int cols ); |
110 | virtual void setCellBrush( int row, int col, const QBrush & ); | 108 | virtual void setCellBrush( int row, int col, const QBrush & ); |
111 | QBrush cellBrush( int row, int col ); | 109 | QBrush cellBrush( int row, int col ); |
112 | 110 | ||
113 | signals: | 111 | signals: |
114 | void selected( int row, int col ); | 112 | void selected( int row, int col ); |
115 | 113 | ||
116 | protected: | 114 | protected: |
117 | virtual void setCurrent( int row, int col ); | 115 | virtual void setCurrent( int row, int col ); |
118 | 116 | ||
119 | virtual void drawContents( QPainter *, int row, int col, const QRect& ); | 117 | virtual void drawContents( QPainter *, int row, int col, const QRect& ); |
120 | void drawContents( QPainter * ); | 118 | void drawContents( QPainter * ); |
121 | 119 | ||
122 | void paintCell( QPainter*, int row, int col ); | 120 | void paintCell( QPainter*, int row, int col ); |
123 | void mousePressEvent( QMouseEvent* ); | 121 | void mousePressEvent( QMouseEvent* ); |
124 | void mouseReleaseEvent( QMouseEvent* ); | 122 | void mouseReleaseEvent( QMouseEvent* ); |
125 | void mouseMoveEvent( QMouseEvent* ); | 123 | void mouseMoveEvent( QMouseEvent* ); |
126 | void keyPressEvent( QKeyEvent* ); | 124 | void keyPressEvent( QKeyEvent* ); |
127 | void focusInEvent( QFocusEvent* ); | 125 | void focusInEvent( QFocusEvent* ); |
128 | void focusOutEvent( QFocusEvent* ); | 126 | void focusOutEvent( QFocusEvent* ); |
129 | 127 | ||
130 | private: | 128 | private: |
131 | int curRow; | 129 | int curRow; |
132 | int curCol; | 130 | int curCol; |
133 | int selRow; | 131 | int selRow; |
134 | int selCol; | 132 | int selCol; |
135 | int nCols; | 133 | int nCols; |
136 | int nRows; | 134 | int nRows; |
137 | bool smallStyle; | 135 | bool smallStyle; |
138 | QWellArrayData *d; | 136 | QWellArrayData *d; |
139 | 137 | ||
140 | private:// Disabled copy constructor and operator= | 138 | private:// Disabled copy constructor and operator= |
141 | #if defined(Q_DISABLE_COPY) | 139 | #if defined(Q_DISABLE_COPY) |
142 | QWellArray( const QWellArray & ); | 140 | QWellArray( const QWellArray & ); |
143 | QWellArray& operator=( const QWellArray & ); | 141 | QWellArray& operator=( const QWellArray & ); |
144 | #endif | 142 | #endif |
145 | }; | 143 | }; |
146 | 144 | ||
147 | 145 | ||
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 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Implementation of QInputDialog class | 4 | ** Implementation of QInputDialog class |
5 | ** | 5 | ** |
6 | ** Created : 991212 | 6 | ** Created : 991212 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the dialogs module of the Qt GUI Toolkit. | 10 | ** This file is part of the dialogs module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
23 | ** Agreement provided with the Software. | 23 | ** Agreement provided with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #include "qinputdialog.h" | 38 | #include "qinputdialog.h" |
39 | 39 | ||
40 | #include <qlayout.h> | 40 | #include <qlayout.h> |
41 | #include <qlabel.h> | 41 | #include <qlabel.h> |
42 | #include <qlineedit.h> | ||
43 | #include <qpushbutton.h> | 42 | #include <qpushbutton.h> |
44 | #include <qspinbox.h> | 43 | #include <qspinbox.h> |
45 | #include <qcombobox.h> | 44 | #include <qcombobox.h> |
46 | #include <qwidgetstack.h> | 45 | #include <qwidgetstack.h> |
47 | #include <qvalidator.h> | 46 | #include <qvalidator.h> |
48 | #include <qapplication.h> | 47 | #include <qapplication.h> |
49 | 48 | ||
50 | class QInputDialogPrivate | 49 | class QInputDialogPrivate |
51 | { | 50 | { |
52 | public: | 51 | public: |
53 | friend class QInputDialog; | 52 | friend class QInputDialog; |
54 | QLineEdit *lineEdit; | 53 | QLineEdit *lineEdit; |
55 | QSpinBox *spinBox; | 54 | QSpinBox *spinBox; |
56 | QComboBox *comboBox, *editComboBox; | 55 | QComboBox *comboBox, *editComboBox; |
57 | QPushButton *ok; | 56 | QPushButton *ok; |
58 | QWidgetStack *stack; | 57 | QWidgetStack *stack; |
59 | QInputDialog::Type type; | 58 | QInputDialog::Type type; |
60 | }; | 59 | }; |
61 | 60 | ||
62 | /*! | 61 | /*! |
63 | \class QInputDialog qinputdialog.h | 62 | \class QInputDialog qinputdialog.h |
64 | \brief A convenience dialog to get a simple input from the user | 63 | \brief A convenience dialog to get a simple input from the user |
65 | \ingroup dialogs | 64 | \ingroup dialogs |
66 | 65 | ||
67 | The QInputDialog is a simple dialog which can be used if you | 66 | The QInputDialog is a simple dialog which can be used if you |
68 | need a simple input from the user. This can be text, a number or | 67 | need a simple input from the user. This can be text, a number or |
69 | an item from a list. Also a label has to be set to tell the user | 68 | an item from a list. Also a label has to be set to tell the user |
70 | what he/she should input. | 69 | what he/she should input. |
71 | 70 | ||
72 | In this Qt version only the 4 static convenience functions | 71 | In this Qt version only the 4 static convenience functions |
73 | getText(), getInteger(), getDouble() and getItem() of QInputDialog | 72 | getText(), getInteger(), getDouble() and getItem() of QInputDialog |
74 | are available. | 73 | are available. |
75 | 74 | ||
76 | Use it like this: | 75 | Use it like this: |
77 | 76 | ||
78 | \code | 77 | \code |
79 | bool ok = FALSE; | 78 | bool ok = FALSE; |
80 | QString text = QInputDialog::getText( tr( "Make an input" ), tr( "Please enter your name" ), QString::null, &ok, this ); | 79 | QString text = QInputDialog::getText( tr( "Make an input" ), tr( "Please enter your name" ), QString::null, &ok, this ); |
81 | if ( ok && !text.isEmpty() ) | 80 | if ( ok && !text.isEmpty() ) |
82 | ;// user entered something and pressed ok | 81 | ;// user entered something and pressed ok |
83 | else | 82 | else |
84 | ;// user entered nothing or pressed cancel | 83 | ;// user entered nothing or pressed cancel |
85 | \endcode | 84 | \endcode |
86 | 85 | ||
87 | There are more static convenience methods! | 86 | There are more static convenience methods! |
88 | 87 | ||
89 | \sa getText(), getInteger(), getDouble(), getItem() | 88 | \sa getText(), getInteger(), getDouble(), getItem() |
90 | */ | 89 | */ |
91 | 90 | ||
92 | /*! | 91 | /*! |
93 | \enum QInputDialog::Type | 92 | \enum QInputDialog::Type |
94 | 93 | ||
95 | This enum type specifies the type of the dialog | 94 | This enum type specifies the type of the dialog |
96 | (which kind of input can be done): | 95 | (which kind of input can be done): |
97 | 96 | ||
98 | <ul> | 97 | <ul> |
99 | <li>\c LineEdit - A QLineEdit is used for taking the input, so a textual or | 98 | <li>\c LineEdit - A QLineEdit is used for taking the input, so a textual or |
100 | (e.g. using a QValidator) a numerical input can be done. Using lineEdit() | 99 | (e.g. using a QValidator) a numerical input can be done. Using lineEdit() |
101 | the QLineEdit can be accessed. | 100 | the QLineEdit can be accessed. |
102 | <li>\c SpinBox - A QSpinBox is used for taking the input, so a decimal | 101 | <li>\c SpinBox - A QSpinBox is used for taking the input, so a decimal |
103 | input can be done. Using spinBox() the QSpinBox can be accessed. | 102 | input can be done. Using spinBox() the QSpinBox can be accessed. |
104 | <li>\c ComboBox - A read-only QComboBox is used for taking the input, | 103 | <li>\c ComboBox - A read-only QComboBox is used for taking the input, |
105 | so one item of a list can be chosen. Using comboBox() the QComboBox | 104 | so one item of a list can be chosen. Using comboBox() the QComboBox |
106 | can be accessed. | 105 | can be accessed. |
107 | <li>\c EditableComboBox - An editable QComboBox is used for taking the input, | 106 | <li>\c EditableComboBox - An editable QComboBox is used for taking the input, |
108 | so either one item of a list can be chosen or a text can be entered. Using | 107 | so either one item of a list can be chosen or a text can be entered. Using |
109 | editableComboBox() the QComboBox can be accessed. | 108 | editableComboBox() the QComboBox can be accessed. |
110 | </ul> | 109 | </ul> |
111 | */ | 110 | */ |
112 | 111 | ||
113 | /*! | 112 | /*! |
114 | Constructs the dialog. \a label is the text which is shown to the user (it should mention | 113 | Constructs the dialog. \a label is the text which is shown to the user (it should mention |
115 | to the user what he/she should input), \a parent the parent widget of the dialog, \a name | 114 | to the user what he/she should input), \a parent the parent widget of the dialog, \a name |
116 | the name of it and if you set \a modal to TRUE, the dialog pops up modally, else it pops | 115 | the name of it and if you set \a modal to TRUE, the dialog pops up modally, else it pops |
117 | up modeless. With \a type you specify the type of the dialog. | 116 | up modeless. With \a type you specify the type of the dialog. |
118 | 117 | ||
119 | \sa getText(), getInteger(), getDouble(), getItem() | 118 | \sa getText(), getInteger(), getDouble(), getItem() |
120 | */ | 119 | */ |
121 | 120 | ||
122 | QInputDialog::QInputDialog( const QString &label, QWidget* parent, const char* name, | 121 | QInputDialog::QInputDialog( const QString &label, QWidget* parent, const char* name, |
123 | bool modal, Type type) | 122 | bool modal, Type type) |
124 | : QDialog( parent, name, modal ) | 123 | : QDialog( parent, name, modal ) |
125 | { | 124 | { |
126 | if ( parent && parent->icon() &&!parent->icon()->isNull() ) | 125 | if ( parent && parent->icon() &&!parent->icon()->isNull() ) |
127 | setIcon( *parent->icon() ); | 126 | setIcon( *parent->icon() ); |
128 | else if ( qApp->mainWidget() && qApp->mainWidget()->icon() && !qApp->mainWidget()->icon()->isNull() ) | 127 | else if ( qApp->mainWidget() && qApp->mainWidget()->icon() && !qApp->mainWidget()->icon()->isNull() ) |
129 | QDialog::setIcon( *qApp->mainWidget()->icon() ); | 128 | QDialog::setIcon( *qApp->mainWidget()->icon() ); |
130 | 129 | ||
131 | d = new QInputDialogPrivate; | 130 | d = new QInputDialogPrivate; |
132 | d->lineEdit = 0; | 131 | d->lineEdit = 0; |
133 | d->spinBox = 0; | 132 | d->spinBox = 0; |
134 | d->comboBox = 0; | 133 | d->comboBox = 0; |
135 | 134 | ||
136 | QVBoxLayout *vbox = new QVBoxLayout( this, 6, 6 ); | 135 | QVBoxLayout *vbox = new QVBoxLayout( this, 6, 6 ); |
137 | 136 | ||
138 | QLabel* l = new QLabel( label, this ); | 137 | 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 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Splitter widget | 4 | ** Splitter widget |
5 | ** | 5 | ** |
6 | ** Created: 980105 | 6 | ** Created: 980105 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the widgets module of the Qt GUI Toolkit. | 10 | ** This file is part of the widgets module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
23 | ** Agreement provided with the Software. | 23 | ** Agreement provided with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | #include "qsplitter.h" | 37 | #include "qsplitter.h" |
38 | 38 | ||
39 | #include "qpainter.h" | ||
40 | #include "qdrawutil.h" | 39 | #include "qdrawutil.h" |
41 | #include "qbitmap.h" | ||
42 | #include "qlayoutengine_p.h" | 40 | #include "qlayoutengine_p.h" |
43 | #include "qlist.h" | ||
44 | #include "qarray.h" | ||
45 | #include "qobjectlist.h" | 41 | #include "qobjectlist.h" |
46 | #include "qapplication.h" //sendPostedEvents | 42 | #include "qapplication.h" //sendPostedEvents |
47 | 43 | ||
48 | class QSplitterHandle : public QWidget | 44 | class QSplitterHandle : public QWidget |
49 | { | 45 | { |
50 | public: | 46 | public: |
51 | QSplitterHandle( Qt::Orientation o, | 47 | QSplitterHandle( Qt::Orientation o, |
52 | QSplitter *parent, const char* name=0 ); | 48 | QSplitter *parent, const char* name=0 ); |
53 | void setOrientation( Qt::Orientation o ); | 49 | void setOrientation( Qt::Orientation o ); |
54 | Qt::Orientation orientation() const { return orient; } | 50 | Qt::Orientation orientation() const { return orient; } |
55 | 51 | ||
56 | bool opaque() const { return s->opaqueResize(); } | 52 | bool opaque() const { return s->opaqueResize(); } |
57 | 53 | ||
58 | QSize sizeHint() const; | 54 | QSize sizeHint() const; |
59 | QSizePolicy sizePolicy() const; | 55 | QSizePolicy sizePolicy() const; |
60 | 56 | ||
61 | int id() const { return myId; } // data->list.at(id())->wid == this | 57 | int id() const { return myId; } // data->list.at(id())->wid == this |
62 | void setId( int i ) { myId = i; } | 58 | void setId( int i ) { myId = i; } |
63 | 59 | ||
64 | protected: | 60 | protected: |
65 | void paintEvent( QPaintEvent * ); | 61 | void paintEvent( QPaintEvent * ); |
66 | void mouseMoveEvent( QMouseEvent * ); | 62 | void mouseMoveEvent( QMouseEvent * ); |
67 | void mousePressEvent( QMouseEvent * ); | 63 | void mousePressEvent( QMouseEvent * ); |
68 | void mouseReleaseEvent( QMouseEvent * ); | 64 | void mouseReleaseEvent( QMouseEvent * ); |
69 | 65 | ||
70 | private: | 66 | private: |
71 | Qt::Orientation orient; | 67 | Qt::Orientation orient; |
72 | bool opaq; | 68 | bool opaq; |
73 | int myId; | 69 | int myId; |
74 | 70 | ||
75 | QSplitter *s; | 71 | QSplitter *s; |
76 | }; | 72 | }; |
77 | 73 | ||
78 | static int mouseOffset; | 74 | static int mouseOffset; |
79 | static int opaqueOldPos = -1; //### there's only one mouse, but this is a bit risky | 75 | static int opaqueOldPos = -1; //### there's only one mouse, but this is a bit risky |
80 | 76 | ||
81 | 77 | ||
82 | QSplitterHandle::QSplitterHandle( Qt::Orientation o, | 78 | QSplitterHandle::QSplitterHandle( Qt::Orientation o, |
83 | QSplitter *parent, const char * name ) | 79 | QSplitter *parent, const char * name ) |
84 | : QWidget( parent, name ) | 80 | : QWidget( parent, name ) |
85 | { | 81 | { |
86 | s = parent; | 82 | s = parent; |
87 | setOrientation(o); | 83 | setOrientation(o); |
88 | } | 84 | } |
89 | 85 | ||
90 | QSizePolicy QSplitterHandle::sizePolicy() const | 86 | QSizePolicy QSplitterHandle::sizePolicy() const |
91 | { | 87 | { |
92 | //### removeme 3.0 | 88 | //### removeme 3.0 |
93 | return QWidget::sizePolicy(); | 89 | return QWidget::sizePolicy(); |
94 | } | 90 | } |
95 | 91 | ||
96 | QSize QSplitterHandle::sizeHint() const | 92 | QSize QSplitterHandle::sizeHint() const |
97 | { | 93 | { |
98 | int sw = style().splitterWidth(); | 94 | int sw = style().splitterWidth(); |
99 | return QSize(sw,sw).expandedTo( QApplication::globalStrut() ); | 95 | return QSize(sw,sw).expandedTo( QApplication::globalStrut() ); |
100 | } | 96 | } |
101 | 97 | ||
102 | void QSplitterHandle::setOrientation( Qt::Orientation o ) | 98 | void QSplitterHandle::setOrientation( Qt::Orientation o ) |
103 | { | 99 | { |
104 | orient = o; | 100 | orient = o; |
105 | #ifndef QT_NO_CURSOR | 101 | #ifndef QT_NO_CURSOR |
106 | if ( o == QSplitter::Horizontal ) | 102 | if ( o == QSplitter::Horizontal ) |
107 | setCursor( splitHCursor ); | 103 | setCursor( splitHCursor ); |
108 | else | 104 | else |
109 | setCursor( splitVCursor ); | 105 | setCursor( splitVCursor ); |
110 | #endif | 106 | #endif |
111 | } | 107 | } |
112 | 108 | ||
113 | 109 | ||
114 | void QSplitterHandle::mouseMoveEvent( QMouseEvent *e ) | 110 | void QSplitterHandle::mouseMoveEvent( QMouseEvent *e ) |
115 | { | 111 | { |
116 | if ( !(e->state()&LeftButton) ) | 112 | if ( !(e->state()&LeftButton) ) |
117 | return; | 113 | return; |
118 | QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos())) | 114 | QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos())) |
119 | - mouseOffset; | 115 | - mouseOffset; |
120 | if ( opaque() ) { | 116 | if ( opaque() ) { |
121 | s->moveSplitter( pos, id() ); | 117 | s->moveSplitter( pos, id() ); |
122 | } else { | 118 | } else { |
123 | int min = pos; int max = pos; | 119 | int min = pos; int max = pos; |
124 | s->getRange( id(), &min, &max ); | 120 | s->getRange( id(), &min, &max ); |
125 | s->setRubberband( QMAX( min, QMIN(max, pos ))); | 121 | s->setRubberband( QMAX( min, QMIN(max, pos ))); |
126 | } | 122 | } |
127 | } | 123 | } |
128 | 124 | ||
129 | void QSplitterHandle::mousePressEvent( QMouseEvent *e ) | 125 | void QSplitterHandle::mousePressEvent( QMouseEvent *e ) |
130 | { | 126 | { |
131 | if ( e->button() == LeftButton ) | 127 | if ( e->button() == LeftButton ) |
132 | mouseOffset = s->pick(e->pos()); | 128 | mouseOffset = s->pick(e->pos()); |
133 | } | 129 | } |
134 | 130 | ||
135 | void QSplitterHandle::mouseReleaseEvent( QMouseEvent *e ) | 131 | void QSplitterHandle::mouseReleaseEvent( QMouseEvent *e ) |
136 | { | 132 | { |
137 | if ( !opaque() && e->button() == LeftButton ) { | 133 | if ( !opaque() && e->button() == LeftButton ) { |
138 | QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos())); | 134 | QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos())); |
139 | s->setRubberband( -1 ); | 135 | s->setRubberband( -1 ); |
140 | s->moveSplitter( pos, id() ); | 136 | s->moveSplitter( pos, id() ); |