Exemplo n.º 1
0
void SkillEditor::_ReloadTab()
{

    if(_GetCurrentSkillList().empty()) {
        return;
    }

    GlobalSkill *skill = _GetCurrentSkillList()[_current_skill_index[_current_tab]];

    string text = MakeStandardString(skill->GetName());
    _le_skill_names[_current_tab]->setText(QString(text.c_str()));

    text = MakeStandardString(skill->GetDescription());
    _le_description[_current_tab]->setText(QString(text.c_str()));

    text = NumberToString<uint32>(skill->GetSPRequired());
    _le_sp_required[_current_tab]->setText(QString(text.c_str()));

    text = NumberToString<uint32>(skill->GetWarmupTime());
    _le_warmup_time[_current_tab]->setText(QString(text.c_str()));

    text = NumberToString<uint32>(skill->GetCooldownTime());
    _le_cooldown_time[_current_tab]->setText(QString(text.c_str()));

    _cb_target_type[_current_tab]->setCurrentIndex(static_cast<int32>(skill->GetTargetType()));

    // TODO: as more controls are added to the tab, reload them here.
}
Exemplo n.º 2
0
void SkillEditor::_CreateTab(GLOBAL_SKILL type, vector<GlobalSkill *>skills, QString tab_name)
{
    _gl_layouts[type] = new QGridLayout();
    // add the labels for the different parts of the skill
    _lbl_skill_names[type] = new QLabel();
    _lbl_skill_names[type]->setText("Skill Name:");
    _gl_layouts[type]->addWidget(_lbl_skill_names[type], 0, 0);

    _lbl_description[type] = new QLabel();
    _lbl_description[type]->setText("Description:");
    _gl_layouts[type]->addWidget(_lbl_description[type], 1, 0);

    _lbl_sp_required[type] = new QLabel();
    _lbl_sp_required[type]->setText("SP Required:");
    _gl_layouts[type]->addWidget(_lbl_sp_required[type], 2, 0);

    _lbl_warmup_time[type] = new QLabel();
    _lbl_warmup_time[type]->setText("Warmup Time:");
    _gl_layouts[type]->addWidget(_lbl_warmup_time[type], 2, 2);

    _lbl_cooldown_time[type] = new QLabel();
    _lbl_cooldown_time[type]->setText("Cooldown Time:");
    _gl_layouts[type]->addWidget(_lbl_cooldown_time[type], 3, 0);

    _lbl_target_type[type] = new QLabel();
    _lbl_target_type[type]->setText("Target Type:");
    _gl_layouts[type]->addWidget(_lbl_target_type[type], 4, 0);

    // add the line edits for the skill
    _le_skill_names[type] = new QLineEdit();
    _le_description[type] = new QLineEdit();
    _le_sp_required[type] = new QLineEdit();
    _le_warmup_time[type] = new QLineEdit();
    _le_cooldown_time[type] = new QLineEdit();
    _cb_target_type[type] = new QComboBox();

    if(_current_skill_index[type] != -1) {
        GlobalSkill *skill = skills[_current_skill_index[type]];
        // this skill is enabled so set the text
        string text = MakeStandardString(skill->GetName());
        // get the char array from the standard string, because otherwise the QString ends up with
        // some gibberish text at the beginning of it
        _le_skill_names[type]->setText(QString(text.c_str()));

        text = MakeStandardString(skill->GetDescription());
        _le_description[type]->setText(QString(text.c_str()));

        text = NumberToString<uint32>(skill->GetSPRequired());
        _le_sp_required[type]->setText(QString(text.c_str()));

        text = NumberToString<uint32>(skill->GetWarmupTime());
        _le_warmup_time[type]->setText(QString(text.c_str()));

        text = NumberToString<uint32>(skill->GetCooldownTime());
        _le_cooldown_time[type]->setText(QString(text.c_str()));

        _cb_target_type[type]->insertItem("Attack Point");
        _cb_target_type[type]->insertItem("Actor");
        _cb_target_type[type]->insertItem("Party");
        _cb_target_type[type]->setCurrentIndex(static_cast<int32>(skill->GetTargetType()));
    } else {
        // disable the line edits (no skills for this group)
        _le_skill_names[type]->setDisabled(true);
        _le_description[type]->setDisabled(true);
        _le_sp_required[type]->setDisabled(true);
        _le_warmup_time[type]->setDisabled(true);
        _le_cooldown_time[type]->setDisabled(true);
        _cb_target_type[type]->setDisabled(true);
        _rb_target_ally_false[type]->setDisabled(true);
        _rb_target_ally_true[type]->setDisabled(true);
    }

    // add above widgets to grid layout
    _gl_layouts[type]->addWidget(_le_skill_names[type], 0, 1, 1, 3);
    _gl_layouts[type]->addWidget(_le_description[type], 1, 1, 1, 3);
    _gl_layouts[type]->addWidget(_le_sp_required[type], 2, 1);
    _gl_layouts[type]->addWidget(_le_warmup_time[type], 2, 3);
    _gl_layouts[type]->addWidget(_le_cooldown_time[type], 3, 1);
    _gl_layouts[type]->addWidget(_cb_target_type[type], 4, 1);
    _hbox_target_ally[type] = new QHBoxLayout();
    _hbox_target_ally[type]->addWidget(_rb_target_ally_true[type]);
    _hbox_target_ally[type]->addWidget(_rb_target_ally_false[type]);
    _target_ally_spacers[type] = new QSpacerItem(10, 5, QSizePolicy::Expanding);
    _hbox_target_ally[type]->addItem(_target_ally_spacers[type]);
    _gl_layouts[type]->addLayout(_hbox_target_ally[type], 3, 3);

    // create the vertical layout for the tab
    _tab_vboxes[type] = new QVBoxLayout();
    _tab_vboxes[type]->addLayout(_gl_layouts[type]);

    // add a spacer to the vbox to push up the grid layout
    _tab_spacers[type] = new QSpacerItem(10, 5, QSizePolicy::Minimum, QSizePolicy::Expanding);
    _tab_vboxes[type]->addItem(_tab_spacers[type]);

    // create the horizontal layout underneath the grid in the tab
    _tab_bottom_hboxes[type] = new QHBoxLayout();

    _CreateTabBottomButtons(type);

    _tab_vboxes[type]->addLayout(_tab_bottom_hboxes[type]);

    _tab_pages[type] = new QWidget();
    _tab_pages[type]->setLayout(_tab_vboxes[type]);
    _tab_skill_groups->addTab(_tab_pages[type], tab_name);
} // _CreateTab(GLOBAL_SKILL)