1 ///////////////////////////////////////////////////////////////////////////////
2 //            Copyright (C) 2004-2010 by The Allacrost Project
3 //                         All Rights Reserved
4 //
5 // This code is licensed under the GNU GPL version 2. It is free software
6 // and you may modify it and/or redistribute it under the terms of this license.
7 // See http://www.gnu.org/copyleft/gpl.html for details.
8 ///////////////////////////////////////////////////////////////////////////////
9 
10 /*!****************************************************************************
11 * \file    skill_editor.h
12 * \author  Daniel Steuernol, steu@allacrost.org
13 * \brief   Header file for editor's skill editor dialog
14 *****************************************************************************/
15 
16 #ifndef __SKILL_EDITOR_HEADER__
17 #define __SKILL_EDITOR_HEADER__
18 
19 #include <string>
20 #include <vector>
21 
22 #include <QDialog>
23 #include <QTabWidget>
24 #include <QPushButton>
25 #include <QHBoxLayout>
26 #include <QLabel>
27 #include <QGridLayout>
28 #include <QLineEdit>
29 #include <QComboBox>
30 #include <QButtonGroup>
31 #include <QRadioButton>
32 
33 #include "global_skills.h"
34 #include "script.h"
35 
36 namespace hoa_editor
37 {
38 
39 class SkillEditor : public QWidget
40 {
41 	//! Macro needed to use Qt's slots and signals
42 	Q_OBJECT
43 
44 public:
45 	SkillEditor(QWidget *parent, const QString &name);
46 	~SkillEditor();
47 
48 private slots:
49 	//! \brief slot to handle tab changes
50 	void _ChangeCurrentTab(int index);
51 	//! \brief button clicked slots
52 	//@{
53 	void _LeftButtonClicked();
54 	void _RightButtonClicked();
55 	//@}
56 
57 private:
58 	//! \brief Loads the skills from the game
59 	void _LoadSkills();
60 	//! \brief Loads the skills from an individual file
61 	//! the ReadScriptDescriptor must already be opened.
62 	//! this function closes the script when finished.
63 	void _LoadSkills(hoa_script::ReadScriptDescriptor &script, std::vector<hoa_global::GlobalSkill *> &skills, hoa_global::GLOBAL_SKILL type);
64 	//! \brief Create the UI for the given tab page.
65 	void _CreateTab(hoa_global::GLOBAL_SKILL type, std::vector<hoa_global::GlobalSkill *> skills, QString name);
66 	//! \brief Create the buttons at the bottom of the tab
67 	void _CreateTabBottomButtons(hoa_global::GLOBAL_SKILL type);
68 	//! \brief clean up functions, to delete all the controls on the individual tab pages
69 	void _CleanupTab(hoa_global::GLOBAL_SKILL type);
70 	//! \brief returns the skill list associated with the current tab
71 	std::vector<hoa_global::GlobalSkill *> &_GetCurrentSkillList();
72 	//! \brief Reloads the current tab with the currently selected skill
73 	void _ReloadTab();
74 
75 	//! \brief a tab control to hold the tabs for attack skills, support skills, and defense skills
76 	QTabWidget *_tab_skill_groups;
77 	//! \brief this is the layout control that the tab control lives in.
78 	QHBoxLayout *_hbox;
79 	//! \brief vectors to hold the global skills
80 	//@{
81 	std::vector<hoa_global::GlobalSkill *> _attack_skills;
82 	std::vector<hoa_global::GlobalSkill *> _defense_skills;
83 	std::vector<hoa_global::GlobalSkill *> _support_skills;
84 	//@}
85 
86 	//! \brief the currently selected tab
87 	hoa_global::GLOBAL_SKILL _current_tab;
88 
89 	//! \brief tab page controls
90 	//@{
91 	int32 _current_skill_index[3];
92 	QVBoxLayout * _tab_vboxes[3];
93 	QHBoxLayout * _tab_bottom_hboxes[3];
94 	QGridLayout * _gl_layouts[3];
95 	QWidget * _tab_pages[3];
96 	QPushButton * _left_buttons[3];
97 	QPushButton * _right_buttons[3];
98 	QPushButton * _save_buttons[3];
99 	QPushButton * _new_buttons[3];
100 	QSpacerItem * _button_spacers[3];
101 	QSpacerItem * _tab_spacers[3];
102 	QLabel * _lbl_skill_names[3];
103 	QLineEdit * _le_skill_names[3];
104 	QLabel * _lbl_description[3];
105 	QLineEdit * _le_description[3];
106 	QLabel * _lbl_sp_required[3];
107 	QLineEdit * _le_sp_required[3];
108 	QLabel * _lbl_warmup_time[3];
109 	QLineEdit * _le_warmup_time[3];
110 	QLabel * _lbl_cooldown_time[3];
111 	QLineEdit * _le_cooldown_time[3];
112 	QLabel * _lbl_target_type[3];
113 	QComboBox * _cb_target_type[3];
114 	QLabel * _lbl_target_ally[3];
115 	QButtonGroup * _bg_target_ally[3];
116 	QRadioButton * _rb_target_ally_true[3];
117 	QRadioButton * _rb_target_ally_false[3];
118 	QHBoxLayout * _hbox_target_ally[3];
119 	QSpacerItem * _target_ally_spacers[3];
120 	//@}
121 };
122 
123 } // namespace hoa_editor
124 
125 #endif
126 // __SKILL_EDITOR_HEADER__
127