44 changes: 2 additions & 42 deletions src/app/qgsoptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,8 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
int myBlue = settings.value( "/qgis/default_selection_color_blue", 0 ).toInt();
int myAlpha = settings.value( "/qgis/default_selection_color_alpha", 255 ).toInt();
pbnSelectionColor->setColor( QColor( myRed, myGreen, myBlue, myAlpha ) );
pbnSelectionColor->setColorDialogTitle( tr( "Selection color" ) );
pbnSelectionColor->setColorDialogOptions( QColorDialog::ShowAlphaChannel );

//set the default color for canvas background
myRed = settings.value( "/qgis/default_canvas_color_red", 255 ).toInt();
Expand Down Expand Up @@ -856,48 +858,6 @@ void QgsOptions::on_pbnTemplateFolderReset_pressed( )
leTemplateFolder->setText( QgsApplication::qgisSettingsDirPath() + QString( "project_templates" ) );
}


void QgsOptions::on_pbnSelectionColor_clicked()
{
#if QT_VERSION >= 0x040500
QColor color = QColorDialog::getColor( pbnSelectionColor->color(), 0, tr( "Selection color" ), QColorDialog::ShowAlphaChannel );
#else
QColor color = QColorDialog::getColor( pbnSelectionColor->color() );
#endif

if ( color.isValid() )
{
pbnSelectionColor->setColor( color );
}
}

void QgsOptions::on_pbnCanvasColor_clicked()
{
QColor color = QColorDialog::getColor( pbnCanvasColor->color(), this );
if ( color.isValid() )
{
pbnCanvasColor->setColor( color );
}
}

void QgsOptions::on_pbnMeasureColor_clicked()
{
QColor color = QColorDialog::getColor( pbnMeasureColor->color(), this );
if ( color.isValid() )
{
pbnMeasureColor->setColor( color );
}
}

void QgsOptions::on_mLineColorToolButton_clicked()
{
QColor color = QColorDialog::getColor( mLineColorToolButton->color(), this );
if ( color.isValid() )
{
mLineColorToolButton->setColor( color );
}
}

void QgsOptions::themeChanged( const QString &newThemeName )
{
// Slot to change the theme as user scrolls through the choices
Expand Down
20 changes: 0 additions & 20 deletions src/app/qgsoptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,26 +128,6 @@ class QgsOptions : public QDialog, private Ui::QgsOptionsBase
*/
void on_mBoldGroupBoxTitleChkBx_clicked( bool chkd );

/*!
* Slot to select the default map selection color
*/
void on_pbnSelectionColor_clicked();

/*!
* Slot to select the default measure tool color
*/
void on_pbnMeasureColor_clicked();

/*!
* Slot to select the default map selection color
*/
void on_pbnCanvasColor_clicked();

/*!
* Slot to select the color of the digitizing rubber band
*/
void on_mLineColorToolButton_clicked();

/**Add a new URL to exclude from Proxy*/
void on_mAddUrlPushButton_clicked();

Expand Down
25 changes: 2 additions & 23 deletions src/app/qgsprojectproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
int myAlphaInt = QgsProject::instance()->readNumEntry( "Gui", "/SelectionColorAlphaPart", 255 );
QColor myColor = QColor( myRedInt, myGreenInt, myBlueInt, myAlphaInt );
pbnSelectionColor->setColor( myColor );
pbnSelectionColor->setColorDialogTitle( tr( "Selection color" ) );
pbnSelectionColor->setColorDialogOptions( QColorDialog::ShowAlphaChannel );

//get the color for map canvas background and set button color accordingly (default white)
myRedInt = QgsProject::instance()->readNumEntry( "Gui", "/CanvasColorRedPart", 255 );
Expand Down Expand Up @@ -793,29 +795,6 @@ void QgsProjectProperties::showProjectionsTab()
tabWidget->setCurrentIndex( 1 );
}

void QgsProjectProperties::on_pbnSelectionColor_clicked()
{
#if QT_VERSION >= 0x040500
QColor color = QColorDialog::getColor( pbnSelectionColor->color(), 0, tr( "Selection color" ), QColorDialog::ShowAlphaChannel );
#else
QColor color = QColorDialog::getColor( pbnSelectionColor->color() );
#endif

if ( color.isValid() )
{
pbnSelectionColor->setColor( color );
}
}

void QgsProjectProperties::on_pbnCanvasColor_clicked()
{
QColor color = QColorDialog::getColor( pbnCanvasColor->color(), this );
if ( color.isValid() )
{
pbnCanvasColor->setColor( color );
}
}

void QgsProjectProperties::on_cbxProjectionEnabled_stateChanged( int state )
{
projectionSelector->setEnabled( state == Qt::Checked );
Expand Down
10 changes: 0 additions & 10 deletions src/app/qgsprojectproperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,6 @@ class QgsProjectProperties : public QDialog, private Ui::QgsProjectPropertiesBas
*/
void showProjectionsTab();

/*!
* Slot to select the map selection color
*/
void on_pbnSelectionColor_clicked();

/*!
* Slot to select the map selection color
*/
void on_pbnCanvasColor_clicked();

/*! Let the user add a scale to the list of project scales
* used in scale combobox instead of global ones
* @note added in QGIS 2.0
Expand Down
38 changes: 8 additions & 30 deletions src/app/qgssinglesymboldialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ QgsSingleSymbolDialog::QgsSingleSymbolDialog( QgsVectorLayer * layer, bool disab
lstSymbols->setContextMenuPolicy( Qt::ActionsContextMenu );

//do the signal/slot connections
connect( btnOutlineColor, SIGNAL( clicked() ), this, SLOT( selectOutlineColor() ) );
connect( btnFillColor, SIGNAL( clicked() ), this, SLOT( selectFillColor() ) );
connect( btnOutlineColor, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( selectOutlineColor( const QColor& ) ) );
connect( btnFillColor, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( selectFillColor( const QColor& ) ) );
connect( outlinewidthspinbox, SIGNAL( valueChanged( double ) ), this, SLOT( resendSettingsChanged() ) );
connect( mLabelEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( resendSettingsChanged() ) );
connect( mPointSizeSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( resendSettingsChanged() ) );
Expand Down Expand Up @@ -248,39 +248,17 @@ QgsSingleSymbolDialog::~QgsSingleSymbolDialog()
QgsDebugMsg( "entered." );
}

void QgsSingleSymbolDialog::selectOutlineColor()
void QgsSingleSymbolDialog::selectOutlineColor( const QColor& color )
{
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QColor c = QColorDialog::getColor( btnOutlineColor->color(), this, "", QColorDialog::DontUseNativeDialog );
#else
QColor c = QColorDialog::getColor( btnOutlineColor->color(), this );
#endif

if ( c.isValid() )
{
btnOutlineColor->setColor( c );
emit settingsChanged();
}

Q_UNUSED( color )
emit settingsChanged();
activateWindow();
}

void QgsSingleSymbolDialog::selectFillColor()
void QgsSingleSymbolDialog::selectFillColor( const QColor& color )
{
#if defined(Q_WS_MAC) && QT_VERSION >= 0x040500 && defined(QT_MAC_USE_COCOA)
// Native Mac dialog works only for Qt Carbon
QColor c = QColorDialog::getColor( btnFillColor->color(), this, "", QColorDialog::DontUseNativeDialog );
#else
QColor c = QColorDialog::getColor( btnFillColor->color(), this );
#endif

if ( c.isValid() )
{
btnFillColor->setColor( c );
emit settingsChanged();
}

Q_UNUSED( color )
emit settingsChanged();
activateWindow();
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/qgssinglesymboldialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ class QgsSingleSymbolDialog: public QDialog, private Ui::QgsSingleSymbolDialogBa
void refreshMarkers();

protected slots:
void selectOutlineColor();
void selectFillColor();
void selectOutlineColor( const QColor& color );
void selectFillColor( const QColor& color );
void selectTextureImage();
void symbolChanged( const QModelIndex &current, const QModelIndex &previous );
private:
Expand Down
15 changes: 4 additions & 11 deletions src/app/qgstextannotationdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ QgsTextAnnotationDialog::QgsTextAnnotationDialog( QgsTextAnnotationItem* item, Q
mTextDocument = mItem->document();
mTextEdit->setDocument( mTextDocument );
}
mFontColorButton->setColorDialogTitle( tr( "Select font color" ) );
mFontColorButton->setColorDialogOptions( QColorDialog::ShowAlphaChannel );
setCurrentFontPropertiesToGui();

QObject::connect( mButtonBox, SIGNAL( accepted() ), this, SLOT( applyTextToItem() ) );
Expand Down Expand Up @@ -100,18 +102,9 @@ void QgsTextAnnotationDialog::changeCurrentFormat()
mTextEdit->setTextColor( mFontColorButton->color() );
}

void QgsTextAnnotationDialog::on_mFontColorButton_clicked()
void QgsTextAnnotationDialog::on_mFontColorButton_colorChanged( const QColor& color )
{
#if QT_VERSION >= 0x040500
QColor newColor = QColorDialog::getColor( mFontColorButton->color(), 0, tr( "Select font color" ), QColorDialog::ShowAlphaChannel );
#else
QColor newColor = QColorDialog::getColor( mFontColorButton->color() );
#endif
if ( !newColor.isValid() )
{
return; //dialog canceled
}
mFontColorButton->setColor( newColor );
Q_UNUSED( color )
changeCurrentFormat();
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgstextannotationdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class QgsTextAnnotationDialog: public QDialog, private Ui::QgsTextAnnotationDial
private slots:
void applyTextToItem();
void changeCurrentFormat();
void on_mFontColorButton_clicked();
void on_mFontColorButton_colorChanged( const QColor& color );
void setCurrentFontPropertiesToGui();
void deleteItem();
};
Expand Down