summaryrefslogtreecommitdiff
path: root/src/gui/windows/skilldialog.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-12-15 23:05:22 +0300
committerAndrei Karas <akaras@inbox.ru>2016-12-15 23:05:22 +0300
commitddfa72d8d01dacdcd38c159ea8dc024fe9d5562a (patch)
treee31dd8579d45512435dd42d19d027411b10ffef5 /src/gui/windows/skilldialog.cpp
parentf39bae9825936b3205396ee32fc50393c48d608f (diff)
downloadmv-ddfa72d8d01dacdcd38c159ea8dc024fe9d5562a.tar.gz
mv-ddfa72d8d01dacdcd38c159ea8dc024fe9d5562a.tar.bz2
mv-ddfa72d8d01dacdcd38c159ea8dc024fe9d5562a.tar.xz
mv-ddfa72d8d01dacdcd38c159ea8dc024fe9d5562a.zip
Add special skills tab for unknown skills.
Diffstat (limited to 'src/gui/windows/skilldialog.cpp')
-rw-r--r--src/gui/windows/skilldialog.cpp20
1 files changed, 20 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();
}