00001 /*************************************************************************** 00002 * Copyright (C) 2003 by Tim Sutton * 00003 * tim@linfiniti.com * 00004 * * 00005 * This is a plugin generated from the QGIS plugin template * 00006 * * 00007 * This program is free software; you can redistribute it and/or modify * 00008 * it under the terms of the GNU General Public License as published by * 00009 * the Free Software Foundation; either version 2 of the License, or * 00010 * (at your option) any later version. * 00011 ***************************************************************************/ 00012 #include "plugingui.h" 00013 #include "qgscontexthelp.h" 00014 #include <QComboBox> 00015 #include <QColorDialog> 00016 00017 QgsScaleBarPluginGui::QgsScaleBarPluginGui( QWidget* parent, Qt::WFlags fl ) 00018 : QDialog( parent, fl ) 00019 { 00020 setupUi( this ); 00021 } 00022 00023 QgsScaleBarPluginGui::~QgsScaleBarPluginGui() 00024 { 00025 } 00026 00027 QSpinBox * QgsScaleBarPluginGui::getSpinSize() 00028 { 00029 return spnSize; 00030 } 00031 00032 void QgsScaleBarPluginGui::on_buttonBox_accepted() 00033 { 00034 hide(); 00035 emit changePlacement( cboPlacement->currentIndex() ); 00036 emit changePreferredSize( spnSize->value() ); 00037 emit changeSnapping( chkSnapping->isChecked() ); 00038 emit changeEnabled( chkEnable->isChecked() ); 00039 emit changeStyle( cboStyle->currentIndex() ); 00040 emit changeColour( pbnChangeColour->color() ); 00041 emit refreshCanvas(); 00042 accept(); 00043 } 00044 00045 void QgsScaleBarPluginGui::on_pbnChangeColour_clicked() 00046 { 00047 QColor colour = QColorDialog::getColor( pbnChangeColour->color(), this ); 00048 00049 if ( colour.isValid() ) 00050 setColour( colour ); 00051 } 00052 00053 void QgsScaleBarPluginGui::on_buttonBox_rejected() 00054 { 00055 reject(); 00056 } 00057 00058 void QgsScaleBarPluginGui::setPlacementLabels( QStringList& labels ) 00059 { 00060 cboPlacement->clear(); 00061 cboPlacement->addItems( labels ); 00062 } 00063 00064 void QgsScaleBarPluginGui::setPlacement( int placementIndex ) 00065 { 00066 cboPlacement->setCurrentIndex( placementIndex ); 00067 } 00068 00069 void QgsScaleBarPluginGui::setPreferredSize( int thePreferredSize ) 00070 { 00071 spnSize->setValue( thePreferredSize ); 00072 } 00073 00074 void QgsScaleBarPluginGui::setSnapping( bool theSnapping ) 00075 { 00076 chkSnapping->setChecked( theSnapping ); 00077 } 00078 void QgsScaleBarPluginGui::setEnabled( bool theBool ) 00079 { 00080 chkEnable->setChecked( theBool ); 00081 } 00082 00083 void QgsScaleBarPluginGui::setStyleLabels( QStringList& labels ) 00084 { 00085 cboStyle->clear(); 00086 cboStyle->addItems( labels ); 00087 } 00088 00089 void QgsScaleBarPluginGui::setStyle( int styleIndex ) 00090 { 00091 cboStyle->setCurrentIndex( styleIndex ); 00092 } 00093 00094 void QgsScaleBarPluginGui::setColour( QColor theQColor ) 00095 { 00096 pbnChangeColour->setColor( theQColor ); 00097 } 00098 00099 void QgsScaleBarPluginGui::on_buttonBox_helpRequested() 00100 { 00101 QgsContextHelp::run( context_id ); 00102 }
1.5.1