From 12429b0c526195fca2f9e99e49f94821271b76e8 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 13 Dec 2016 22:41:57 +0300 Subject: Add support for possible new skill set types. --- src/gui/windows/skilldialog.cpp | 49 +++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 14 deletions(-) (limited to 'src/gui') diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index 7e474a982..cfcf60b1b 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -31,6 +31,8 @@ #include "const/resources/spriteaction.h" +#include "enums/resources/skill/skillsettype.h" + #include "gui/shortcut/itemshortcut.h" #include "gui/windows/setupwindow.h" @@ -318,6 +320,14 @@ void SkillDialog::loadXmlFile(const std::string &fileName, // TRANSLATORS: skills dialog default skill tab strprintf(_("Skill Set %d"), setCount)); + const std::string setTypeStr = XML::getProperty(set, "type", ""); + SkillSetTypeT setType = SkillSetType::VerticalList; + if (setTypeStr == "list" || + setTypeStr == "vertical") + { + setType = SkillSetType::VerticalList; + } + SkillModel *const model = new SkillModel; if (!mDefaultModel) mDefaultModel = model; @@ -340,20 +350,31 @@ void SkillDialog::loadXmlFile(const std::string &fileName, model->updateVisibilities(); - // possible leak listbox, scroll - SkillListBox *const listbox = new SkillListBox(this, model); - 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); - - SkillTab *const tab = new SkillTab(this, setName, listbox); - mDeleteTabs.push_back(tab); - - mTabs->addTab(tab, scroll); + switch (setType) + { + case SkillSetType::VerticalList: + { + // possible leak listbox, scroll + SkillListBox *const listbox = new SkillListBox(this, + model); + 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); + SkillTab *const tab = new SkillTab(this, setName, listbox); + mDeleteTabs.push_back(tab); + mTabs->addTab(tab, scroll); + break; + } + case SkillSetType::Rectangle: + default: + reportAlways("Unsupported skillset type: %s", + setTypeStr.c_str()); + break; + } } } } -- cgit v1.2.3-70-g09d2