-rw-r--r-- | libopie/colordialog.cpp | 56 | ||||
-rw-r--r-- | libopie/colordialog.h | 22 | ||||
-rw-r--r-- | libopie/colorpopupmenu.cpp | 2 |
3 files changed, 40 insertions, 40 deletions
diff --git a/libopie/colordialog.cpp b/libopie/colordialog.cpp index 6d72ff6..684d6ea 100644 --- a/libopie/colordialog.cpp +++ b/libopie/colordialog.cpp @@ -1,20 +1,20 @@ /**************************************************************************** ** $Id$ ** -** Implementation of QColorDialog class +** Implementation of OColorDialog class ** ** Created : 990222 ** ** Copyright (C) 1999-2000 Trolltech AS. All rights reserved. ** ** This file is part of the dialogs module of the Qt GUI Toolkit. ** ** This file may be distributed under the terms of the Q Public License ** as defined by Trolltech AS of Norway and appearing in the file ** LICENSE.QPL included in the packaging of this file. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** @@ -463,75 +463,75 @@ QColorShower::QColorShower( QWidget *parent, const char *name ) curCol = qRgb( -1, -1, -1 ); QColIntValidator *val256 = new QColIntValidator( 0, 255, this ); QColIntValidator *val360 = new QColIntValidator( 0, 360, this ); QGridLayout *gl = new QGridLayout( this, 1, 1, 2 ); gl->setMargin( 0 ); lab = new QColorShowLabel( this ); lab->setMinimumWidth( 60 ); //### gl->addMultiCellWidget(lab, 0,-1,0,0); connect( lab, SIGNAL( colorDropped( QRgb ) ), this, SIGNAL( newCol( QRgb ) ) ); connect( lab, SIGNAL( colorDropped( QRgb ) ), this, SLOT( setRgb( QRgb ) ) ); hEd = new QColNumLineEdit( this ); hEd->setValidator( val360 ); - QLabel *l = new QLabel( hEd, QColorDialog::tr("Hue:"), this ); + QLabel *l = new QLabel( hEd, OColorDialog::tr("Hue:"), this ); l->setAlignment( AlignRight|AlignVCenter ); gl->addWidget( l, 0, 1 ); gl->addWidget( hEd, 0, 2 ); sEd = new QColNumLineEdit( this ); sEd->setValidator( val256 ); - l = new QLabel( sEd, QColorDialog::tr("Sat:"), this ); + l = new QLabel( sEd, OColorDialog::tr("Sat:"), this ); l->setAlignment( AlignRight|AlignVCenter ); gl->addWidget( l, 1, 1 ); gl->addWidget( sEd, 1, 2 ); vEd = new QColNumLineEdit( this ); vEd->setValidator( val256 ); - l = new QLabel( vEd, QColorDialog::tr("Val:"), this ); + l = new QLabel( vEd, OColorDialog::tr("Val:"), this ); l->setAlignment( AlignRight|AlignVCenter ); gl->addWidget( l, 2, 1 ); gl->addWidget( vEd, 2, 2 ); rEd = new QColNumLineEdit( this ); rEd->setValidator( val256 ); - l = new QLabel( rEd, QColorDialog::tr("Red:"), this ); + l = new QLabel( rEd, OColorDialog::tr("Red:"), this ); l->setAlignment( AlignRight|AlignVCenter ); gl->addWidget( l, 0, 3 ); gl->addWidget( rEd, 0, 4 ); gEd = new QColNumLineEdit( this ); gEd->setValidator( val256 ); - l = new QLabel( gEd, QColorDialog::tr("Green:"), this ); + l = new QLabel( gEd, OColorDialog::tr("Green:"), this ); l->setAlignment( AlignRight|AlignVCenter ); gl->addWidget( l, 1, 3 ); gl->addWidget( gEd, 1, 4 ); bEd = new QColNumLineEdit( this ); bEd->setValidator( val256 ); - l = new QLabel( bEd, QColorDialog::tr("Blue:"), this ); + l = new QLabel( bEd, OColorDialog::tr("Blue:"), this ); l->setAlignment( AlignRight|AlignVCenter ); gl->addWidget( l, 2, 3 ); gl->addWidget( bEd, 2, 4 ); alphaEd = new QColNumLineEdit( this ); alphaEd->setValidator( val256 ); - alphaLab = new QLabel( alphaEd, QColorDialog::tr("Alpha channel:"), this ); + alphaLab = new QLabel( alphaEd, OColorDialog::tr("Alpha channel:"), this ); alphaLab->setAlignment( AlignRight|AlignVCenter ); gl->addMultiCellWidget( alphaLab, 3, 3, 1, 3 ); gl->addWidget( alphaEd, 3, 4 ); alphaEd->hide(); alphaLab->hide(); connect( hEd, SIGNAL(textChanged(const QString&)), this, SLOT(hsvEd()) ); connect( sEd, SIGNAL(textChanged(const QString&)), this, SLOT(hsvEd()) ); connect( vEd, SIGNAL(textChanged(const QString&)), this, SLOT(hsvEd()) ); connect( rEd, SIGNAL(textChanged(const QString&)), this, SLOT(rgbEd()) ); connect( gEd, SIGNAL(textChanged(const QString&)), this, SLOT(rgbEd()) ); connect( bEd, SIGNAL(textChanged(const QString&)), this, SLOT(rgbEd()) ); } void QColorShower::showCurrentColor() @@ -594,258 +594,258 @@ void QColorShower::setHsv( int h, int s, int v ) rgbOriginal = FALSE; hue = h; val = v; sat = s; //Range check### curCol = QColor( hue, sat, val, QColor::Hsv ).rgb(); hEd->setNum( hue ); sEd->setNum( sat ); vEd->setNum( val ); rEd->setNum( qRed(currentColor()) ); gEd->setNum( qGreen(currentColor()) ); bEd->setNum( qBlue(currentColor()) ); showCurrentColor(); } -class QColorDialogPrivate : public QObject +class OColorDialogPrivate : public QObject { Q_OBJECT public: - QColorDialogPrivate( QColorDialog *p ); + OColorDialogPrivate( OColorDialog *p ); QRgb currentColor() const { return cs->currentColor(); } void setCurrentColor( QRgb rgb ); int currentAlpha() const { return cs->currentAlpha(); } void setCurrentAlpha( int a ) { cs->setCurrentAlpha( a ); } void showAlpha( bool b ) { cs->showAlpha( b ); } private slots: void newHsv( int h, int s, int v ); void newColorTypedIn( QRgb rgb ); private: QColorPicker *cp; QColorLuminancePicker *lp; QColorShower *cs; }; //sets all widgets to display h,s,v -void QColorDialogPrivate::newHsv( int h, int s, int v ) +void OColorDialogPrivate::newHsv( int h, int s, int v ) { cs->setHsv( h, s, v ); cp->setCol( h, s ); lp->setCol( h, s, v ); } //sets all widgets to display rgb -void QColorDialogPrivate::setCurrentColor( QRgb rgb ) +void OColorDialogPrivate::setCurrentColor( QRgb rgb ) { cs->setRgb( rgb ); newColorTypedIn( rgb ); } //sets all widgets exept cs to display rgb -void QColorDialogPrivate::newColorTypedIn( QRgb rgb ) +void OColorDialogPrivate::newColorTypedIn( QRgb rgb ) { int h, s, v; rgb2hsv(rgb, h, s, v ); cp->setCol( h, s ); lp->setCol( h, s, v); } -QColorDialogPrivate::QColorDialogPrivate( QColorDialog *dialog ) : +OColorDialogPrivate::OColorDialogPrivate( OColorDialog *dialog ) : QObject(dialog) { int border = 2; QVBoxLayout *topLay = new QVBoxLayout( dialog, border, 2 ); QHBoxLayout *pickLay = new QHBoxLayout( topLay ); cp = new QColorPicker( dialog ); cp->setFrameStyle( QFrame::Panel + QFrame::Sunken ); pickLay->addWidget( cp ); pickLay->addStretch(); lp = new QColorLuminancePicker( dialog ); lp->setFixedWidth( 20 ); //### pickLay->addWidget( lp ); connect( cp, SIGNAL(newCol(int,int)), lp, SLOT(setCol(int,int)) ); connect( lp, SIGNAL(newHsv(int,int,int)), this, SLOT(newHsv(int,int,int)) ); topLay->addStretch(); cs = new QColorShower( dialog ); connect( cs, SIGNAL(newCol(QRgb)), this, SLOT(newColorTypedIn(QRgb))); topLay->addWidget( cs ); } // BEING REVISED: jo /*! - \class QColorDialog qcolordialog.h - \brief The QColorDialog class provides a dialog widget for specifying colors. + \class OColorDialog OColorDialog.h + \brief The OColorDialog class provides a dialog widget for specifying colors. \ingroup dialogs The color dialog's function is to allow users to choose colors - for instance, you might use this in a drawing program to allow the user to set the brush color. This version of Qt only provides modal color dialogs. The static getColor() function shows the dialog and allows the user to specify a color, while getRgba() does the same but allows the user to specify a color with an alpha channel (transparency) value. The user can store customCount() different custom colors. The custom colors are shared by all color dialogs, and remembered during the execution of the program. Use setCustomColor() to set the custom colors, and customColor() to get them. <img src=qcolordlg-m.png> <img src=qcolordlg-w.png> */ /*! Constructs a default color dialog. Use setColor() for setting an initial value. \sa getColor() */ -QColorDialog::QColorDialog(QWidget* parent, const char* name, bool modal) : +OColorDialog::OColorDialog(QWidget* parent, const char* name, bool modal) : QDialog(parent, name, modal ) { - d = new QColorDialogPrivate( this ); + d = new OColorDialogPrivate( this ); } /*! Pops up a modal color dialog letting the user choose a color and returns that color. The color is initially set to \a initial. Returns an \link QColor::isValid() invalid\endlink color if the user cancels the dialog. All colors allocated by the dialog will be deallocated before this function returns. */ -QColor QColorDialog::getColor( QColor initial, QWidget *parent, +QColor OColorDialog::getColor( QColor initial, QWidget *parent, const char *name ) { int allocContext = QColor::enterAllocContext(); - QColorDialog *dlg = new QColorDialog( parent, name, TRUE ); //modal + OColorDialog *dlg = new OColorDialog( parent, name, TRUE ); //modal if ( parent && parent->icon() && !parent->icon()->isNull() ) dlg->setIcon( *parent->icon() ); else if ( qApp->mainWidget() && qApp->mainWidget()->icon() && !qApp->mainWidget()->icon()->isNull() ) dlg->setIcon( *qApp->mainWidget()->icon() ); - dlg->setCaption( QColorDialog::tr( "Select color" ) ); + dlg->setCaption( OColorDialog::tr( "Select color" ) ); dlg->setColor( initial ); dlg->showMaximized(); int resultCode = dlg->exec(); QColor::leaveAllocContext(); QColor result; if ( resultCode == QDialog::Accepted ) { result = dlg->color(); } else { result = initial; } QColor::destroyAllocContext(allocContext); delete dlg; return result; } /*! Pops up a modal color dialog, letting the user choose a color and an alpha channel value. The color+alpha is initially set to \a initial. If \a ok is non-null, \c *ok is set to TRUE if the user clicked OK, and FALSE if the user clicked Cancel. If the user clicks Cancel the \a initial value is returned. */ -QRgb QColorDialog::getRgba( QRgb initial, bool *ok, +QRgb OColorDialog::getRgba( QRgb initial, bool *ok, QWidget *parent, const char* name ) { int allocContext = QColor::enterAllocContext(); - QColorDialog *dlg = new QColorDialog( parent, name, TRUE ); //modal + OColorDialog *dlg = new OColorDialog( parent, name, TRUE ); //modal dlg->setColor( initial ); dlg->setSelectedAlpha( qAlpha(initial) ); dlg->showMaximized(); int resultCode = dlg->exec(); QColor::leaveAllocContext(); QRgb result = initial; if ( resultCode == QDialog::Accepted ) { QRgb c = dlg->color().rgb(); int alpha = dlg->selectedAlpha(); result = qRgba( qRed(c), qGreen(c), qBlue(c), alpha ); } if ( ok ) *ok = resultCode == QDialog::Accepted; QColor::destroyAllocContext(allocContext); delete dlg; return result; } /*! Returns the color currently selected in the dialog. \sa setColor() */ -QColor QColorDialog::color() const +QColor OColorDialog::color() const { return QColor(d->currentColor()); } /*! Destructs the dialog and frees any memory it allocated. */ -QColorDialog::~QColorDialog() +OColorDialog::~OColorDialog() { //d inherits QObject, so it is deleted by Qt. } /*! Sets the color shown in the dialog to \a c. \sa color() */ -void QColorDialog::setColor( QColor c ) +void OColorDialog::setColor( QColor c ) { d->setCurrentColor( c.rgb() ); } /*! Sets the initial alpha channel value to \a a, and show the alpha channel entry box. */ -void QColorDialog::setSelectedAlpha( int a ) +void OColorDialog::setSelectedAlpha( int a ) { d->showAlpha( TRUE ); d->setCurrentAlpha( a ); } /*! Returns the value selected for the alpha channel. */ -int QColorDialog::selectedAlpha() const +int OColorDialog::selectedAlpha() const { return d->currentAlpha(); } #include "colordialog.moc" diff --git a/libopie/colordialog.h b/libopie/colordialog.h index a2d4d30..474bc61 100644 --- a/libopie/colordialog.h +++ b/libopie/colordialog.h @@ -1,20 +1,20 @@ /**************************************************************************** ** $Id$ ** -** Definition of QColorDialog class +** Definition of OColorDialog class ** ** Created : 990222 ** ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. ** ** This file is part of the dialogs module of the Qt GUI Toolkit. ** ** This file may be distributed under the terms of the Q Public License ** as defined by Trolltech AS of Norway and appearing in the file ** LICENSE.QPL included in the packaging of this file. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** @@ -22,56 +22,56 @@ ** licenses may use this file in accordance with the Qt Commercial License ** Agreement provided with the Software. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for ** information about Qt Commercial License Agreements. ** See http://www.trolltech.com/qpl/ for QPL licensing information. ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ -#ifndef QCOLORDIALOG_H -#define QCOLORDIALOG_H +#ifndef OColorDialog_H +#define OColorDialog_H #ifndef QT_H #include <qdialog.h> #endif // QT_H -class QColorDialogPrivate; +class OColorDialogPrivate; -class Q_EXPORT QColorDialog : public QDialog +class Q_EXPORT OColorDialog : public QDialog { Q_OBJECT public: static QColor getColor( QColor, QWidget *parent=0, const char* name=0 ); // ### 3.0: make const QColor& static QRgb getRgba( QRgb, bool* ok = 0, QWidget *parent=0, const char* name=0 ); private: - ~QColorDialog(); + ~OColorDialog(); - QColorDialog( QWidget* parent=0, const char* name=0, bool modal=FALSE ); + OColorDialog( QWidget* parent=0, const char* name=0, bool modal=FALSE ); void setColor( QColor ); // ### 3.0: make const QColor& QColor color() const; private: void setSelectedAlpha( int ); int selectedAlpha() const; private: - QColorDialogPrivate *d; - friend class QColorDialogPrivate; + OColorDialogPrivate *d; + friend class OColorDialogPrivate; private: // Disabled copy constructor and operator= #if defined(Q_DISABLE_COPY) - QColorDialog( const QColorDialog & ); - QColorDialog& operator=( const QColorDialog & ); + OColorDialog( const OColorDialog & ); + OColorDialog& operator=( const OColorDialog & ); #endif }; #endif diff --git a/libopie/colorpopupmenu.cpp b/libopie/colorpopupmenu.cpp index 35e91f4..9b50a8b 100644 --- a/libopie/colorpopupmenu.cpp +++ b/libopie/colorpopupmenu.cpp @@ -145,21 +145,21 @@ ColorPopupMenu::~ColorPopupMenu() void ColorPopupMenu::addColor( const QColor& color, int row, int col ) { ColorPanelButton* panelButton = new ColorPanelButton( color, colorPanel ); connect( panelButton, SIGNAL( selected( const QColor& ) ), this, SLOT( buttonSelected( const QColor& ) ) ); colorLayout->addWidget( panelButton, row, col ); } void ColorPopupMenu::buttonSelected( const QColor& color ) { m_color = color; emit colorSelected( color ); hide(); } void ColorPopupMenu::moreColorClicked() { - QColor color = QColorDialog::getColor( m_color ); + QColor color = OColorDialog::getColor( m_color ); m_color = color; emit colorSelected( color ); hide(); } |