Crossfire Server, Trunk  R20513
CREPrePostPanel.h
Go to the documentation of this file.
1 #ifndef _CREPREPOSTPANEL_H
2 #define _CREPREPOSTPANEL_H
3 
4 #include <QWidget>
5 #include <QObject>
6 #include <QtGui>
7 
8 #include "MessageManager.h"
9 
10 class QListWidget;
11 class QComboBox;
12 class QLineEdit;
14 class QuestManager;
15 
19 class CRESubItemWidget : public QWidget
20 {
21  Q_OBJECT
22 
23  public:
24  CRESubItemWidget(QWidget* parent) : QWidget(parent) { };
25 
26  virtual void setData(const QStringList& data) = 0;
27 
28  signals:
29  void dataModified(const QStringList& data);
30 };
31 
36 {
37  Q_OBJECT
38 
39  public:
40  CRESubItemConnection(QWidget* parent);
41 
42  virtual void setData(const QStringList& data);
43 
44  private:
45  QLineEdit* myEdit;
46  QLabel* myWarning;
47 
48  void showWarning(const QString& warning);
49 
50  private slots:
51  void editChanged(const QString& text);
52 };
53 
58 {
59  Q_OBJECT
60 
61  public:
62  CRESubItemQuest(bool isPre, const QuestManager* quests, QWidget* parent);
63 
64  virtual void setData(const QStringList& data);
65 
66  private:
68  bool myIsPre;
70  QComboBox* myQuestList;
72  QComboBox* myFirstStep;
74  QComboBox* mySecondStep;
75  QRadioButton* myAtStep;
76  QRadioButton* myFromStep;
77  QRadioButton* myStepRange;
78  bool myInit;
79 
80  void fillQuestSteps();
81  void updateData();
82 
83  private slots:
84  void selectedQuestChanged(int index);
85  void checkToggled(bool checked);
86  void selectedStepChanged(int index);
87 };
88 
93 {
94  Q_OBJECT
95 
96  public:
97  CRESubItemToken(bool isPre, QWidget* parent);
98 
99  virtual void setData(const QStringList& data);
100 
101  private:
102  QLineEdit* myToken;
103  QLineEdit* myValue;
104  QTextEdit* myValues;
105 
106  void updateData();
107 
108  private slots:
109  void tokenChanged(const QString&);
110  void valuesChanged();
111 };
112 
117 {
118  Q_OBJECT
119 
120  public:
121  CRESubItemList(QWidget* parent);
122  void setData(const QStringList& data);
123 
124  private:
126  QListWidget* mySubItems;
128  QLineEdit* myItemEdit;
130  QStringList myData;
131 
132  private slots:
133  void currentSubItemChanged(int);
134  void subItemChanged(const QString& text);
135  void onAddSubItem(bool);
136  void onDeleteSubItem(bool);
137 };
138 
142 class CREPrePostPanel : public QWidget
143 {
144  Q_OBJECT
145 
146  public:
153  CREPrePostPanel(bool isPre, const QList<QuestConditionScript*> scripts, const QuestManager* quests, QWidget* parent);
154  virtual ~CREPrePostPanel();
155 
156  QList<QStringList> getData();
157  void setData(const QList<QStringList> data);
158 
159  signals:
161  void dataModified();
162 
163  private:
165  QList<QStringList> myData;
167  QListWidget* myItems;
169  QComboBox* myChoices;
171  QList<CRESubItemWidget*> mySubWidgets;
173  QStackedWidget* mySubItemsStack;
174 
182  CRESubItemWidget* createSubItemWidget(bool isPre, const QuestConditionScript* script, const QuestManager* quests);
183 
184  private slots:
185  void onAddItem(bool);
186  void onDeleteItem(bool);
187  void currentItemChanged(int index);
188  void currentChoiceChanged(int index);
189  void subItemChanged(const QStringList& data);
190 };
191 
192 #endif /* _CREPREPOSTPANEL_H */
193 
Post-condition panel displaying a connection (number).
QList< QStringList > myData
Pre- or post- conditions we&#39;re working on.
Pre- or post- conditions panel displaying a token, either as read or write.
QRadioButton * myFromStep
QStringList myData
Current arguments.
QLineEdit * myItemEdit
Argument edit zone.
QLineEdit * myToken
QComboBox * myQuestList
List of quests.
void dataModified(const QStringList &data)
QComboBox * myChoices
Available conditions types.
Pre- or post- panel displaying script arguments as a string list.
Base class for a pre- or post- panel displaying script arguments.
QList< CRESubItemWidget * > mySubWidgets
Matching between index of myChoices and the variable subpanels.
QTextEdit * myValues
QListWidget * mySubItems
For one condition, arguments to the script.
QListWidget * myItems
The first item of each condition.
This panel is the &#39;pre&#39; or &#39;post&#39; subpanel in the messages panel.
QComboBox * myFirstStep
Steps of the current quest for new step (post-) or at/frop step (pre-).
QStackedWidget * mySubItemsStack
Arguments panels, only one visible based on the choice.
QComboBox * mySecondStep
Steps of the current quest for up to step (pre-).
QRadioButton * myAtStep
const QuestManager * myQuests
QLineEdit * myValue
static quest_definition * quests
All known quests.
Definition: quest.c:93
QRadioButton * myStepRange
Pre- or post- conditions panel displaying a quest step.
virtual void setData(const QStringList &data)=0
CRESubItemWidget(QWidget *parent)