summaryrefslogtreecommitdiff
authorsandman <sandman>2002-09-24 23:53:23 (UTC)
committer sandman <sandman>2002-09-24 23:53:23 (UTC)
commit5ae62a1def1d21c4827560607b208033d6054ed0 (patch) (side-by-side diff)
tree445b34a539ec9f377d36ba9fb1587c72dafa46b0
parenta390040768072b4b2b931ec0bcdaaa55daae0b4c (diff)
downloadopie-5ae62a1def1d21c4827560607b208033d6054ed0.zip
opie-5ae62a1def1d21c4827560607b208033d6054ed0.tar.gz
opie-5ae62a1def1d21c4827560607b208033d6054ed0.tar.bz2
- updated all copyright headers
- use new OColorButton - rearranged editScheme a bit
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/appearance2/appearance.cpp62
-rw-r--r--noncore/settings/appearance2/appearance.h50
-rw-r--r--noncore/settings/appearance2/colorlistitem.h28
-rw-r--r--noncore/settings/appearance2/decolistitem.h27
-rw-r--r--noncore/settings/appearance2/editScheme.cpp104
-rw-r--r--noncore/settings/appearance2/editScheme.h71
-rw-r--r--noncore/settings/appearance2/main.cpp46
-rw-r--r--noncore/settings/appearance2/sample.cpp29
-rw-r--r--noncore/settings/appearance2/sample.h29
-rw-r--r--noncore/settings/appearance2/stylelistitem.h28
10 files changed, 311 insertions, 163 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp
index 23630c5..66cf2c3 100644
--- a/noncore/settings/appearance2/appearance.cpp
+++ b/noncore/settings/appearance2/appearance.cpp
@@ -1,87 +1,91 @@
-/**********************************************************************
-** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
-**
-** This file is part of the Qtopia Environment.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.trolltech.com/gpl/ for GPL licensing information.
-**
-** Contact info@trolltech.com if any conditions of this licensing are
-** not clear to you.
-**
-***********************************************************************
-**
-** Enhancements by: Dan Williams, <williamsdr@acm.org>
-**
-**********************************************************************/
+/*
+               =. This file is part of the OPIE Project
+             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
+           .>+-=
+ _;:,     .>    :=|. This library is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This library is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
#include "appearance.h"
#include "editScheme.h"
#include <opie/ofiledialog.h>
#include <opie/otabwidget.h>
#include <qpe/applnk.h>
#include <qpe/config.h>
#include <qpe/global.h>
#include <qpe/resource.h>
#include <qpe/qpeapplication.h>
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
#include <qpe/qcopenvelope_qws.h>
#endif
#include <qaction.h>
#include <qbuttongroup.h>
#include <qcheckbox.h>
#include <qcombobox.h>
#include <qdialog.h>
#include <qdir.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qlistbox.h>
#include <qmessagebox.h>
#include <qmultilineedit.h>
#include <qpopupmenu.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#if QT_VERSION >= 300
#include <qstylefactory.h>
#else
#include <qwindowsstyle.h>
#include <qpe/qpestyle.h>
#include <qpe/lightstyle.h>
#include <qpe/qlibrary.h>
#include <qpe/styleinterface.h>
#endif
#include <qtabwidget.h>
#include <qtoolbutton.h>
#include <qvgroupbox.h>
#include <qwidget.h>
#include "stylelistitem.h"
#include "decolistitem.h"
#include "colorlistitem.h"
#include "sample.h"
#include <opie/ofontselector.h>
class DefaultWindowDecoration : public WindowDecorationInterface
{
public:
DefaultWindowDecoration() : ref(0) {}
QString name() const {
return "Default";
}
QPixmap icon() const {
return QPixmap();
}
@@ -429,151 +433,151 @@ void Appearance::styleClicked ( int index )
m_style_changed |= ( index != m_original_style );
}
void Appearance::styleSettingsClicked ( )
{
StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( ));
if ( item && item-> hasSettings ( )) {
QDialog *d = new QDialog ( this, "SETTINGS-DLG", true );
QVBoxLayout *vbox = new QVBoxLayout ( d, 4, 0 );
QWidget *w = item-> settings ( d );
if ( w ) {
vbox-> addWidget ( w );
d-> setCaption ( w-> caption ( ));
d-> showMaximized ( );
bool accepted = ( d-> exec ( ) == QDialog::Accepted );
if ( item-> setSettings ( accepted ))
m_style_changed = true;
}
delete d;
}
}
void Appearance::decoClicked ( int index )
{
DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index );
if ( m_sample ) {
if ( dli && dli-> interface ( ))
m_sample-> setDecoration ( dli-> interface ( ));
else
m_sample-> setDecoration ( new DefaultWindowDecoration ( ));
}
m_deco_changed |= ( index != m_original_deco );
}
void Appearance::fontClicked ( const QFont &f )
{
m_font_changed |= ( f != m_sample-> font ( ));
m_sample-> setFont ( f );
}
void Appearance::colorClicked ( int index )
{
ColorListItem *item = (ColorListItem *) m_color_list-> item ( index );
if ( item )
m_sample-> setPalette ( item-> palette ( ));
m_color_changed |= ( item-> palette ( ) != qApp-> palette ( ));
}
void Appearance::editSchemeClicked ( )
{
ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
int cnt = 0;
- QString controlLabel [QColorGroup::NColorRoles];
- QString controlColor [QColorGroup::NColorRoles];
+ QString labels [QColorGroup::NColorRoles];
+ QColor colors [QColorGroup::NColorRoles];
for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) {
QColor col = item-> color ( role );
if ( col. isValid ( )) {
- controlLabel [cnt] = item-> label ( role );
- controlColor [cnt] = col. name ( );
+ labels [cnt] = item-> label ( role );
+ colors [cnt] = col;
cnt++;
}
}
- EditScheme* editdlg = new EditScheme( this, "editScheme", true, 0, cnt, controlLabel, controlColor );
+ EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true );
editdlg-> showMaximized ( );
if ( editdlg-> exec ( ) == QDialog::Accepted ) {
ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 );
cnt = 0;
for ( QColorGroup::ColorRole role = (QColorGroup::ColorRole) 0; role != QColorGroup::NColorRoles; ((int) role )++ ) {
if ( item-> color ( role ). isValid ( )) {
- citem-> setColor ( role, QColor ( controlColor [cnt] ));
+ citem-> setColor ( role, colors [cnt] );
cnt++;
}
}
m_color_list-> setCurrentItem ( 0 );
colorClicked ( 0 );
m_color_changed = true;
}
delete editdlg;
}
void Appearance::saveSchemeClicked()
{
ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
if ( !item )
return;
QDialog *d = new QDialog ( this, 0, true );
d-> setCaption ( tr( "Save Scheme" ));
QLineEdit *ed = new QLineEdit ( this );
( new QVBoxLayout ( d, 4, 4 ))-> addWidget ( ed );
if ( d-> exec ( ) == QDialog::Accepted ) {
QString schemename = ed-> text ( );
QFile file ( QPEApplication::qpeDir() + "/etc/colors/" + schemename + ".scheme" );
if ( !file. exists ( ))
{
QPalette p = item-> palette ( );
Config config ( file.name(), Config::File );
config. setGroup( "Colors" );
item-> save ( config );
config. write ( ); // need to flush the config info first
loadColors ( m_color_list );
}
else
{
QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." ));
}
}
delete d;
}
void Appearance::deleteSchemeClicked()
{
ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( ));
if ( !item )
return;
if ( m_color_list-> currentItem ( ) > 0 )
{
if ( QMessageBox::warning ( this, tr( "Delete scheme" ), tr( "Do you really want to delete\n" ) + item-> text ( ) + "?",
tr( "Yes" ), tr( "No" ), 0, 0, 1 ) == 0 ) {
QFile::remove ( QPEApplication::qpeDir ( ) + "/etc/colors/" + item-> text ( ) + ".scheme" );
loadColors ( m_color_list );
}
}
else
diff --git a/noncore/settings/appearance2/appearance.h b/noncore/settings/appearance2/appearance.h
index 4a86e57..ddf94f2 100644
--- a/noncore/settings/appearance2/appearance.h
+++ b/noncore/settings/appearance2/appearance.h
@@ -1,87 +1,91 @@
-/**********************************************************************
-** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
-**
-** This file is part of the Qtopia Environment.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.trolltech.com/gpl/ for GPL licensing information.
-**
-** Contact info@trolltech.com if any conditions of this licensing are
-** not clear to you.
-**
-***********************************************************************
-**
-** Enhancements by: Dan Williams, <williamsdr@acm.org>
-**
-**********************************************************************/
+/*
+               =. This file is part of the OPIE Project
+             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
+           .>+-=
+ _;:,     .>    :=|. This library is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This library is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
#ifndef APPEARANCESETTINGS_H
#define APPEARANCESETTINGS_H
#include <qpe/fontdatabase.h>
#include <qmainwindow.h>
#include <qdialog.h>
class QCheckBox;
class QComboBox;
class QLabel;
class QLineEdit;
class QListBox;
class QMultiLineEdit;
class QPushButton;
class QRadioButton;
class QToolButton;
class SampleWindow;
class OFontSelector;
class Appearance : public QDialog
{
Q_OBJECT
public:
Appearance( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~Appearance();
protected:
virtual void accept ( );
virtual void done ( int r );
protected slots:
void styleClicked ( int );
void styleSettingsClicked ( );
void decoClicked ( int );
void fontClicked ( const QFont & );
void colorClicked ( int );
void editSchemeClicked();
void saveSchemeClicked();
void deleteSchemeClicked();
private:
void loadStyles ( QListBox * );
void loadDecos ( QListBox * );
void loadColors ( QListBox * );
void changeText();
QWidget *createStyleTab ( QWidget *parent );
QWidget *createDecoTab ( QWidget *parent );
QWidget *createFontTab ( QWidget *parent );
QWidget *createColorTab ( QWidget *parent );
QWidget *createGuiTab ( QWidget *parent );
private:
bool m_style_changed;
bool m_font_changed;
bool m_scheme_changed;
bool m_deco_changed;
bool m_color_changed;
diff --git a/noncore/settings/appearance2/colorlistitem.h b/noncore/settings/appearance2/colorlistitem.h
index 1ff6ecc..1df541b 100644
--- a/noncore/settings/appearance2/colorlistitem.h
+++ b/noncore/settings/appearance2/colorlistitem.h
@@ -1,64 +1,92 @@
+/*
+               =. This file is part of the OPIE Project
+             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
+           .>+-=
+ _;:,     .>    :=|. This library is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This library is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+
#ifndef COLORLISTITEM_H
#define COLORLISTITEM_H
#include <qlistbox.h>
#include <qpalette.h>
#include <qapplication.h>
#include <qpe/config.h>
class Appearance;
class ColorListItem : public QListBoxText {
public:
ColorListItem ( const QString &t, Config &cfg ) : QListBoxText ( t )
{
m_colors = new QColor [s_colorcount];
load ( cfg );
}
virtual ~ColorListItem ( )
{
delete [] m_colors;
}
QPalette palette ( )
{
return m_palette;
}
bool load ( Config &cfg )
{
for ( int i = 0; i < s_colorcount; i++ )
m_colors [i] = QColor ( cfg. readEntry ( s_colorlut [i]. m_key, s_colorlut [i]. m_def ));
buildPalette ( );
return true;
}
void buildPalette ( )
{
m_palette = QPalette ( m_colors [r2i(QColorGroup::Button)], m_colors [r2i(QColorGroup::Background)] );
m_palette. setColor ( QColorGroup::Highlight, m_colors [r2i(QColorGroup::Highlight)] );
m_palette. setColor ( QColorGroup::HighlightedText, m_colors [r2i(QColorGroup::HighlightedText)] );
m_palette. setColor ( QColorGroup::Text, m_colors [r2i(QColorGroup::Text)] );
m_palette. setColor ( QPalette::Active, QColorGroup::ButtonText, m_colors [r2i(QColorGroup::ButtonText)] );
m_palette. setColor ( QColorGroup::Base, m_colors [r2i(QColorGroup::Base)] );
m_palette. setColor ( QPalette::Disabled, QColorGroup::Text, m_palette. color ( QPalette::Active, QColorGroup::Background ). dark ( ));
}
bool save ( Config &cfg )
{
for ( int i = 0; i < s_colorcount; i++ )
cfg. writeEntry ( s_colorlut [i]. m_key, m_colors [i]. name ( ));
return true;
}
QColor color ( QColorGroup::ColorRole role )
{
int i = r2i ( role );
return i >= 0 ? m_colors [i] : QColor ( );
}
void setColor ( QColorGroup::ColorRole role, QColor c )
{
diff --git a/noncore/settings/appearance2/decolistitem.h b/noncore/settings/appearance2/decolistitem.h
index dfdce47..953a939 100644
--- a/noncore/settings/appearance2/decolistitem.h
+++ b/noncore/settings/appearance2/decolistitem.h
@@ -1,64 +1,91 @@
+/*
+               =. This file is part of the OPIE Project
+             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
+           .>+-=
+ _;:,     .>    :=|. This library is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This library is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
#ifndef DECOLISTITEM_H
#define DECOLISTITEM_H
#include <qpe/windowdecorationinterface.h>
#include <qlistbox.h>
class DecoListItem : public QListBoxText {
public:
DecoListItem ( const QString &t ) : QListBoxText ( t )
{
m_lib = 0;
m_window_if = 0;
// m_settings_if = 0;
}
DecoListItem ( QLibrary *lib, WindowDecorationInterface *iface ) : QListBoxText ( iface-> name ( ))
{
m_lib = lib;
m_window_if = iface;
// iface-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &m_settings_if );
}
virtual ~DecoListItem ( )
{
// if ( m_settings_if )
// m_settings_if-> release ( );
if ( m_window_if )
m_window_if-> release ( );
delete m_lib;
}
bool hasSettings ( ) const
{
// return ( m_settings_if );
return false;
}
QWidget *settings ( QWidget * /*parent*/ )
{
// return m_settings_if ? m_settings_if-> create ( parent ) : 0;
return 0;
}
bool setSettings ( bool /*accepted*/ )
{
// if ( !m_settings_if )
// return false;
// if ( accepted )
// return m_settings_if-> accept ( );
// else {
// m_settings_if-> reject ( );
// return false;
// }
return false;
}
QString key ( )
{
if ( m_window_if )
return QString ( m_window_if-> name ( ));
else
return text ( );
diff --git a/noncore/settings/appearance2/editScheme.cpp b/noncore/settings/appearance2/editScheme.cpp
index 4f2ac2c..8cb0f1c 100644
--- a/noncore/settings/appearance2/editScheme.cpp
+++ b/noncore/settings/appearance2/editScheme.cpp
@@ -1,87 +1,73 @@
-/**********************************************************************
-** EditScheme
-**
-** Dialog for editing color scheme
-**
-** Copyright (C) 2002, Dan Williams
-** williamsdr@acm.org
-** http://draknor.net
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-**********************************************************************/
+/*
+               =. This file is part of the OPIE Project
+             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
+           .>+-=
+ _;:,     .>    :=|. This library is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This library is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
#include "editScheme.h"
-#include "opie/colorpopupmenu.h"
+#include <opie/ocolorbutton.h>
#include <qaction.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qpopupmenu.h>
#include <qscrollview.h>
#include <qtoolbutton.h>
-EditScheme::EditScheme( QWidget* parent, const char* name, bool modal, WFlags fl,
- int max, QString *list, QString *colors )
+EditScheme::EditScheme ( int cnt, const QString *labels, QColor *colors, QWidget* parent, const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, fl )
{
setCaption( tr( "Edit scheme" ) );
- QGridLayout* layout = new QGridLayout( this );
- layout->setSpacing( 4 );
- layout->setMargin( 4 );
+ QGridLayout *layout = new QGridLayout ( this, 0, 0, 4, 4 );
+ m_count = cnt;
+ m_buttons = new OColorButton * [cnt];
+ m_colors = colors;
- maxCount = max;
- colorList = colors;
- surfaceList = list;
- colorButtons = new QToolButton * [max];
- int i;
- QLabel* label;
- ColorPopupMenu* colorPopupMenu;
- for ( i = 0; i < max; i++ )
+ for ( int i = 0; i < cnt; i++ )
{
-// colorList[i] = colors[i];
-// surfaceList[i] = list[i];
- label = new QLabel( tr( surfaceList[i] ), this );
- layout->addWidget( label, i, 0 );
- colorButtons[i] = new QToolButton( this, list[i] );
- colorButtons[i]->setPalette( QPalette( QColor( colors[i] ) ) );
- layout->addWidget( colorButtons[i], i, 1 );
+ QLabel *l = new QLabel ( labels [i], this );
+ layout-> addWidget ( l, i, 0 );
- colorPopupMenu = new ColorPopupMenu( colors[i], 0, list[i] );
- colorButtons[i]->setPopup( colorPopupMenu );
- colorButtons[i]->setPopupDelay( 0 );
- connect( colorPopupMenu, SIGNAL( colorSelected( const QColor& ) ), this, SLOT( changeColor( const QColor& ) ) );
+ m_buttons [i] = new OColorButton ( this );
+ m_buttons [i]-> setColor ( colors [i] );
+ layout-> addWidget ( m_buttons [i], i, 1 );
}
}
EditScheme::~EditScheme()
{
- delete [] colorButtons;
+ delete [] m_buttons;
}
-void EditScheme::changeColor( const QColor& color )
+void EditScheme::accept ( )
{
- QString name( sender()->name() );
- int i;
+ for ( int i = 0; i < m_count; i++ )
+ m_colors [i] = m_buttons [i]-> color ( );
- for ( i = 0; i < maxCount; i++ )
- {
- if ( name == colorButtons[i]->name() )
- {
- break;
- }
- }
- if ( i < maxCount && name == colorButtons[i]->name() )
- {
- colorList[i] = color.name();
- colorButtons[i]->setPalette( QPalette( QColor( colorList[i] ) ) );
- }
+ QDialog::accept ( );
}
+
diff --git a/noncore/settings/appearance2/editScheme.h b/noncore/settings/appearance2/editScheme.h
index 583050f..0a025bd 100644
--- a/noncore/settings/appearance2/editScheme.h
+++ b/noncore/settings/appearance2/editScheme.h
@@ -1,48 +1,53 @@
-/**********************************************************************
-** EditScheme
-**
-** Dialog for editing color scheme
-**
-** Copyright (C) 2002, Dan Williams
-** williamsdr@acm.org
-** http://draknor.net
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-**********************************************************************/
+/*
+               =. This file is part of the OPIE Project
+             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
+           .>+-=
+ _;:,     .>    :=|. This library is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This library is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
#ifndef EDITSCHEME_H
#define EDITSCHEME_H
#include <qdialog.h>
-#include <qtoolbutton.h>
class QColor;
+class OColorButton;
-class EditScheme : public QDialog
-{
+class EditScheme : public QDialog {
Q_OBJECT
public:
- EditScheme( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0,
- int = 0, QString * = 0, QString * = 0 );
- ~EditScheme();
-
- int maxCount;
- QString * surfaceList;
- QString * colorList;
-
-
- QToolButton** colorButtons;
+ EditScheme ( int cnt, const QString *labels, QColor *colors, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ virtual ~EditScheme ( );
protected slots:
- void changeColor( const QColor& );
+ virtual void accept ( );
+
+private:
+ int m_count;
+ QColor *m_colors;
+ OColorButton **m_buttons;
};
-#endif // EDITSCHEME_H
+#endif
diff --git a/noncore/settings/appearance2/main.cpp b/noncore/settings/appearance2/main.cpp
index cfbab0b..3afec46 100644
--- a/noncore/settings/appearance2/main.cpp
+++ b/noncore/settings/appearance2/main.cpp
@@ -1,35 +1,43 @@
-/**********************************************************************
-** Copyright (C) 2000 Trolltech AS. All rights reserved.
-**
-** This file is part of Qtopia Environment.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.trolltech.com/gpl/ for GPL licensing information.
-**
-** Contact info@trolltech.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
+/*
+               =. This file is part of the OPIE Project
+             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
+           .>+-=
+ _;:,     .>    :=|. This library is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This library is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
#include "appearance.h"
#include <qpe/qpeapplication.h>
int main ( int argc, char **argv )
{
QPEApplication app ( argc, argv );
Appearance m;
app. showMainDocumentWidget ( &m );
return app. exec ( );
}
diff --git a/noncore/settings/appearance2/sample.cpp b/noncore/settings/appearance2/sample.cpp
index e447002..0d8b003 100644
--- a/noncore/settings/appearance2/sample.cpp
+++ b/noncore/settings/appearance2/sample.cpp
@@ -1,64 +1,93 @@
+/*
+                This file is part of the OPIE Project
+ =. Copyright (c) 2002 Trolltech AS <info@trolltech.com>
+             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
+           .>+-=
+ _;:,     .>    :=|. This library is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This library is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+
#include <qvbox.h>
#include <qpopupmenu.h>
#include <qpainter.h>
#include <qmenubar.h>
#include <qcheckbox.h>
#include <qpushbutton.h>
#include <qscrollbar.h>
#include <qlayout.h>
#include <qwhatsthis.h>
#include <qpixmapcache.h>
#include <qtimer.h>
#include <qobjectlist.h>
#include <qcommonstyle.h>
#include "sample.h"
class SampleText : public QWidget
{
public:
SampleText( const QString &t, bool h, QWidget *parent )
: QWidget( parent ), hl(h), text(t)
{
if ( hl )
setBackgroundMode( PaletteHighlight );
else
setBackgroundMode( PaletteBase );
}
QSize sizeHint() const
{
QFontMetrics fm(font());
return QSize( fm.width(text)+10, fm.height()+4 );
}
void paintEvent( QPaintEvent * )
{
QPainter p(this);
if ( hl )
p.setPen( colorGroup().highlightedText() );
else
p.setPen( colorGroup().text() );
p.drawText( rect(), AlignCenter, text );
}
private:
bool hl;
QString text;
};
SampleWindow::SampleWindow( QWidget *parent ) : QWidget(parent), iface(0)
{
init();
}
QSize SampleWindow::sizeHint() const
{
return container->sizeHint() + QSize( 10, 35 );
}
void SampleWindow::setFont( const QFont &f )
{
QWidget::setFont( f );
diff --git a/noncore/settings/appearance2/sample.h b/noncore/settings/appearance2/sample.h
index c6f9b5a..a189f69 100644
--- a/noncore/settings/appearance2/sample.h
+++ b/noncore/settings/appearance2/sample.h
@@ -1,49 +1,78 @@
+/*
+                This file is part of the OPIE Project
+ =. Copyright (c) 2002 Trolltech AS <info@trolltech.com>
+             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
+           .>+-=
+ _;:,     .>    :=|. This library is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This library is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+
#ifndef __PREVIEW_H__
#define __PREVIEW_H__
#include <qwidget.h>
#include <qpe/windowdecorationinterface.h>
class QVBox;
class QPopupMenu;
class SampleText;
class SampleWindow : public QWidget
{
Q_OBJECT
public:
SampleWindow( QWidget *parent );
QSize sizeHint() const;
virtual void setFont( const QFont &f );
void setStyle2 ( QStyle *sty );
void setDecoration( WindowDecorationInterface *i );
void setPalette ( const QPalette & );
virtual void paintEvent( QPaintEvent * );
void init();
virtual bool eventFilter( QObject *, QEvent *e );
virtual void paletteChange( const QPalette &old );
virtual void resizeEvent( QResizeEvent *re );
public slots:
void fixGeometry();
protected:
WindowDecorationInterface *iface;
WindowDecorationInterface::WindowData wd;
QVBox *container;
QPopupMenu *popup;
int th;
int tb;
int lb;
int rb;
int bb;
};
#endif
diff --git a/noncore/settings/appearance2/stylelistitem.h b/noncore/settings/appearance2/stylelistitem.h
index 3cc63dc..bbfbd41 100644
--- a/noncore/settings/appearance2/stylelistitem.h
+++ b/noncore/settings/appearance2/stylelistitem.h
@@ -1,64 +1,92 @@
+/*
+               =. This file is part of the OPIE Project
+             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
+           .>+-=
+ _;:,     .>    :=|. This library is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This library is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+
#ifndef STYLELISTITEM_H
#define STYLELISTITEM_H
#include <qlistbox.h>
#include <qpe/styleinterface.h>
#include <stdio.h>
class StyleListItem : public QListBoxText {
public:
StyleListItem ( const QString &t, QStyle *sty ) : QListBoxText ( t )
{
m_lib = 0;
m_style_if = 0;
m_settings_if = 0;
m_style = sty;
}
StyleListItem ( QLibrary *lib, StyleInterface *iface ) : QListBoxText ( iface-> name ( ))
{
m_lib = lib;
m_style_if = iface;
m_settings_if = 0;
m_style = iface-> create ( );
iface-> queryInterface ( IID_StyleSettings, (QUnknownInterface **) &m_settings_if );
}
virtual ~StyleListItem ( )
{
delete m_style;
if ( m_settings_if )
m_settings_if-> release ( );
if ( m_style_if )
m_style_if-> release ( );
delete m_lib;
}
bool hasSettings ( ) const
{
return ( m_settings_if );
}
QWidget *settings ( QWidget *parent )
{
return m_settings_if ? m_settings_if-> create ( parent ) : 0;
}
bool setSettings ( bool accepted )
{
if ( !m_settings_if )
return false;
if ( accepted )
return m_settings_if-> accept ( );
else {
m_settings_if-> reject ( );
return false;
}
}
QString key ( )
{