diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-12-15 23:05:22 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-12-15 23:05:22 +0300 |
commit | ddfa72d8d01dacdcd38c159ea8dc024fe9d5562a (patch) | |
tree | e31dd8579d45512435dd42d19d027411b10ffef5 /src/gui/windows | |
parent | f39bae9825936b3205396ee32fc50393c48d608f (diff) | |
download | plus-ddfa72d8d01dacdcd38c159ea8dc024fe9d5562a.tar.gz plus-ddfa72d8d01dacdcd38c159ea8dc024fe9d5562a.tar.bz2 plus-ddfa72d8d01dacdcd38c159ea8dc024fe9d5562a.tar.xz plus-ddfa72d8d01dacdcd38c159ea8dc024fe9d5562a.zip |
Add special skills tab for unknown skills.
Diffstat (limited to 'src/gui/windows')
-rw-r--r-- | src/gui/windows/skilldialog.cpp | 20 | ||||
-rw-r--r-- | src/gui/windows/skilldialog.h | 2 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index 291836f48..a18ab3b3e 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -130,6 +130,24 @@ SkillDialog::~SkillDialog() clearSkills(); } +void SkillDialog::addDefaultTab() +{ + mDefaultModel = new SkillModel; + SkillListBox *const listbox = new SkillListBox(this, + mDefaultModel); + listbox->setActionEventId("sel"); + listbox->addActionListener(this); + ScrollArea *const scroll = new ScrollArea(this, + listbox, + Opaque_false); + scroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); + scroll->setVerticalScrollPolicy(ScrollArea::SHOW_ALWAYS); + // TRANSLATORS: unknown skills tab name + mDefaultTab = new SkillTab(this, _("Unknown"), listbox); + mDeleteTabs.push_back(mDefaultTab); + mTabs->addTab(mDefaultTab, scroll); +} + void SkillDialog::action(const ActionEvent &event) { const std::string &eventId = event.getId(); @@ -256,6 +274,7 @@ void SkillDialog::clearSkills() { mTabs->removeAll(); mDeleteTabs.clear(); + mDefaultTab = nullptr; mDefaultModel = nullptr; delete_all(mSkills); @@ -285,6 +304,7 @@ void SkillDialog::loadSkills() loadXmlFile(paths.getStringValue("skillsFile2"), SkipError_false); loadXmlFile(paths.getStringValue("skillsPatchFile"), SkipError_true); loadXmlDir("skillsPatchDir", loadXmlFile); + addDefaultTab(); update(); } diff --git a/src/gui/windows/skilldialog.h b/src/gui/windows/skilldialog.h index 5a28d5a74..347e45a36 100644 --- a/src/gui/windows/skilldialog.h +++ b/src/gui/windows/skilldialog.h @@ -215,6 +215,8 @@ class SkillDialog final : public Window, void loadSkillData(XmlNodePtr node, SkillInfo *const skill); + void addDefaultTab(); + typedef std::map<int, SkillInfo*> SkillMap; SkillMap mSkills; std::vector<SkillInfo*> mDurations; |