Commit 7455073e authored by Matthias Möller's avatar Matthias Möller

fix: removes error message at start, when all materials were erased

!! renamed save key !!

refs #1148

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@15728 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 7d3c23c7
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
MaterialPicker::MaterialPicker() MaterialPicker::MaterialPicker()
: :
pickModeName_("MaterialPicker"), pickModeName_("MaterialPicker"),
propName_(name()+QString("/Material/Materials")), propName_(name()+QString("/Materials")),
pickMaterialButton_(0), pickMaterialButton_(0),
fillMaterialButton_(0), fillMaterialButton_(0),
materialListWidget_(0), materialListWidget_(0),
...@@ -175,7 +175,10 @@ void MaterialPicker::removeItem(QListWidgetItem* _item) ...@@ -175,7 +175,10 @@ void MaterialPicker::removeItem(QListWidgetItem* _item)
materialListWidget_->takeItem(index); materialListWidget_->takeItem(index);
materialList_.erase(materialList_.begin()+index); materialList_.erase(materialList_.begin()+index);
materialStrings_.erase(materialStrings_.begin()+index); materialStrings_.erase(materialStrings_.begin()+index);
OpenFlipperSettings().setValue(propName_, materialStrings_); if (materialStrings_.isEmpty())
OpenFlipperSettings().remove(propName_);
else
OpenFlipperSettings().setValue(propName_, materialStrings_);
fillMaterialButton_->setEnabled(materialListWidget_->count()); fillMaterialButton_->setEnabled(materialListWidget_->count());
//update hotkey table //update hotkey table
...@@ -189,6 +192,7 @@ void MaterialPicker::removeItem(QListWidgetItem* _item) ...@@ -189,6 +192,7 @@ void MaterialPicker::removeItem(QListWidgetItem* _item)
} }
if (eraseIter != shortKeyRow_.end()) if (eraseIter != shortKeyRow_.end())
shortKeyRow_.erase(eraseIter); shortKeyRow_.erase(eraseIter);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -199,6 +203,7 @@ void MaterialPicker::clearList() { ...@@ -199,6 +203,7 @@ void MaterialPicker::clearList() {
materialStrings_.clear(); materialStrings_.clear();
OpenFlipperSettings().setValue(propName_, materialStrings_); OpenFlipperSettings().setValue(propName_, materialStrings_);
fillMaterialButton_->setEnabled(false); fillMaterialButton_->setEnabled(false);
OpenFlipperSettings().remove(propName_);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment