diff --git a/source/app/documentmanager.cpp b/source/app/documentmanager.cpp index 7108a1a78..3d61b4563 100644 --- a/source/app/documentmanager.cpp +++ b/source/app/documentmanager.cpp @@ -51,7 +51,7 @@ Document &DocumentManager::addDefaultDocument() Instrument instrument; instrument.setDescription(settings.value( Settings::DEFAULT_INSTRUMENT_NAME, - Settings::DEFAULT_INSTRUMENT_NAME_DEFAULT).toString().toStdString()); + Settings::DEFAULT_INSTRUMENT_NAME_DEFAULT).toString().toStdString() + " 1"); instrument.setMidiPreset(settings.value(Settings::DEFAULT_INSTRUMENT_PRESET, Settings::DEFAULT_INSTRUMENT_PRESET_DEFAULT).toInt()); score.insertInstrument(instrument); diff --git a/source/app/powertabeditor.cpp b/source/app/powertabeditor.cpp index a56096e4c..c6ccd416d 100644 --- a/source/app/powertabeditor.cpp +++ b/source/app/powertabeditor.cpp @@ -1406,24 +1406,18 @@ void PowerTabEditor::addInstrument() Settings::DEFAULT_INSTRUMENT_NAME, Settings::DEFAULT_INSTRUMENT_NAME_DEFAULT).toString().toStdString(); - // Try to directly use the default name if possible. - if (std::find(names.begin(), names.end(), defaultName) == names.end()) - instrument.setDescription(defaultName); - else + size_t i = score.getInstruments().size() + 1; + while (true) { - size_t i = score.getInstruments().size() + 1; - while (true) - { - const std::string name = defaultName + " " + std::to_string(i); + const std::string name = defaultName + " " + std::to_string(i); - if (std::find(names.begin(), names.end(), name) == names.end()) - { - instrument.setDescription(name); - break; - } - else - ++i; + if (std::find(names.begin(), names.end(), name) == names.end()) + { + instrument.setDescription(name); + break; } + else + ++i; } }