Skip to content
Permalink
Browse files

Merge pull request #2644 from nirvn/move_save_btn

[ui] move the save symbol button
  • Loading branch information
nyalldawson committed Jan 12, 2016
2 parents 0491996 + 653a1e6 commit e29c7e519e77e4957cf8e31a494ebc85845dc404
@@ -51,6 +51,7 @@ class QgsSymbolsListWidget : QWidget
void setMarkerSize( double size );
void setLineWidth( double width );
void addSymbolToStyle();
void saveSymbol();
void symbolAddedToStyle( const QString& name, QgsSymbolV2* symbol );
void on_mSymbolUnitWidget_changed();
void on_mTransparencySlider_valueChanged( int value );
@@ -64,9 +64,10 @@ class QgsSymbolV2SelectorDialog : QDialog
void addLayer();
void removeLayer();

void saveSymbol();
void lockLayer();

void saveSymbol() /Deprecated/;

//! Duplicates the current symbol layer and places the duplicated layer above the current symbol layer
//! @note added in QGIS 2.14
void duplicateLayer();
@@ -118,6 +118,8 @@ QgsSymbolsListWidget::QgsSymbolsListWidget( QgsSymbolV2* symbol, QgsStyleV2* sty
btnColor->setAllowAlpha( true );
btnColor->setColorDialogTitle( tr( "Select color" ) );
btnColor->setContext( "symbology" );

connect( btnSaveSymbol, SIGNAL( clicked() ), this, SLOT( saveSymbol() ) );
}

QgsSymbolsListWidget::~QgsSymbolsListWidget()
@@ -360,6 +362,34 @@ void QgsSymbolsListWidget::addSymbolToStyle()
populateSymbolView();
}

void QgsSymbolsListWidget::saveSymbol()
{
bool ok;
QString name = QInputDialog::getText( this, tr( "Symbol name" ),
tr( "Please enter name for the symbol:" ), QLineEdit::Normal, tr( "New symbol" ), &ok );
if ( !ok || name.isEmpty() )
return;

// check if there is no symbol with same name
if ( mStyle->symbolNames().contains( name ) )
{
int res = QMessageBox::warning( this, tr( "Save symbol" ),
tr( "Symbol with name '%1' already exists. Overwrite?" )
.arg( name ),
QMessageBox::Yes | QMessageBox::No );
if ( res != QMessageBox::Yes )
{
return;
}
}

// add new symbol to style and re-populate the list
mStyle->addSymbol( name, mSymbol->clone() );

// make sure the symbol is stored
mStyle->saveSymbol( name, mSymbol->clone(), 0, QStringList() );
}

void QgsSymbolsListWidget::on_mSymbolUnitWidget_changed()
{
if ( mSymbol )
@@ -81,6 +81,7 @@ class GUI_EXPORT QgsSymbolsListWidget : public QWidget, private Ui::SymbolsListW
void setMarkerSize( double size );
void setLineWidth( double width );
void addSymbolToStyle();
void saveSymbol();
void symbolAddedToStyle( const QString& name, QgsSymbolV2* symbol );
void on_mSymbolUnitWidget_changed();
void on_mTransparencySlider_valueChanged( int value );
@@ -262,7 +262,6 @@ QgsSymbolV2SelectorDialog::QgsSymbolV2SelectorDialog( QgsSymbolV2* symbol, QgsSt
connect( btnRemoveLayer, SIGNAL( clicked() ), this, SLOT( removeLayer() ) );
connect( btnLock, SIGNAL( clicked() ), this, SLOT( lockLayer() ) );
connect( btnDuplicate, SIGNAL( clicked() ), this, SLOT( duplicateLayer() ) );
connect( btnSaveSymbol, SIGNAL( clicked() ), this, SLOT( saveSymbol() ) );

updateUi();

@@ -136,9 +136,10 @@ class GUI_EXPORT QgsSymbolV2SelectorDialog : public QDialog, private Ui::QgsSymb
void addLayer();
void removeLayer();

void saveSymbol();
void lockLayer();

Q_DECL_DEPRECATED void saveSymbol();

//! Duplicates the current symbol layer and places the duplicated layer above the current symbol layer
//! @note added in QGIS 2.14
void duplicateLayer();
@@ -159,22 +159,6 @@
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btnSaveSymbol">
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Save symbol</string>
</property>
<property name="text">
<string>Save</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
@@ -337,6 +337,22 @@
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btnSaveSymbol">
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Save symbol</string>
</property>
<property name="text">
<string>Save</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnAdvanced">
<property name="text">
@@ -391,6 +407,7 @@
<tabstop>groupsCombo</tabstop>
<tabstop>openStyleManagerButton</tabstop>
<tabstop>viewSymbols</tabstop>
<tabstop>btnSaveSymbol</tabstop>
<tabstop>btnAdvanced</tabstop>
</tabstops>
<resources/>

0 comments on commit e29c7e5

Please sign in to comment.
You can’t perform that action at this time.