Crossfire Server, Trunk
CREPrePostPanel.h
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 2022 the Crossfire Development Team
5  *
6  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
7  * welcome to redistribute it under certain conditions. For details, please
8  * see COPYING and LICENSE.
9  *
10  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
11  */
12 
13 #ifndef _CREPREPOSTPANEL_H
14 #define _CREPREPOSTPANEL_H
15 
16 #include <QWidget>
17 #include <QObject>
18 #include <QtWidgets>
19 
20 #include "MessageManager.h"
21 #include "CREPrePostList.h"
22 
23 class QListWidget;
24 class QComboBox;
25 class QLineEdit;
27 
31 class CRESubItemWidget : public QWidget
32 {
33  Q_OBJECT
34 
35  public:
36  CRESubItemWidget(QWidget* parent) : QWidget(parent) { };
37 
38  virtual void setData(const QStringList& data) = 0;
39 
40  signals:
41  void dataModified(const QStringList& data);
42 };
43 
48 {
49  Q_OBJECT
50 
51  public:
52  CRESubItemConnection(QWidget* parent);
53 
54  virtual void setData(const QStringList& data);
55 
56  private:
57  QLineEdit* myEdit;
58  QLabel* myWarning;
59 
60  void showWarning(const QString& warning);
61 
62  private slots:
63  void editChanged(const QString& text);
64 };
65 
70 {
71  Q_OBJECT
72 
73  public:
74  CRESubItemQuest(PrePostWidget::Mode mode, QWidget* parent);
75 
76  virtual void setData(const QStringList& data);
77 
78  private:
81  QComboBox* myQuestList;
83  QComboBox* myFirstStep;
85  QComboBox* mySecondStep;
86  QRadioButton* myAtStep;
87  QRadioButton* myBelowStep;
88  QRadioButton* myFromStep;
89  QRadioButton* myStepRange;
90  bool myInit;
91 
92  void fillQuestSteps();
93  void updateData();
94 
95  private slots:
96  void selectedQuestChanged(int index);
97  void checkToggled(bool checked);
98  void selectedStepChanged(int index);
99 };
100 
105 {
106  Q_OBJECT
107 
108  public:
109  CRESubItemToken(bool isPre, QWidget* parent);
110 
111  virtual void setData(const QStringList& data);
112 
113  private:
114  QLineEdit* myToken;
115  QLineEdit* myValue;
116  QTextEdit* myValues;
117 
118  void updateData();
119 
120  private slots:
121  void tokenChanged(const QString&);
122  void valuesChanged();
123 };
124 
129 {
130  Q_OBJECT
131 
132  public:
133  CRESubItemList(QWidget* parent);
134  void setData(const QStringList& data);
135 
136  private:
137  void addItem(const QString& item);
138  QStringList data() const;
139 
141  QListWidget* mySubItems;
142 
143  private slots:
144  void endEdition(QWidget* editor, QAbstractItemDelegate::EndEditHint hint);
145  void onAddSubItem(bool);
146  void onDeleteSubItem(bool);
147 };
148 
152 class CREPrePostPanel : public QDialog
153 {
154  Q_OBJECT
155 
156  public:
163  CREPrePostPanel(PrePostWidget::Mode mode, const QList<QuestConditionScript*> scripts, QWidget* parent);
164  virtual ~CREPrePostPanel();
165 
166  QStringList getData();
167  void setData(const QStringList& data);
168 
169  private:
171  QStringList myData;
173  QStringList myOriginal;
175  QComboBox* myChoices;
177  QList<CRESubItemWidget*> mySubWidgets;
179  QStackedWidget* mySubItemsStack;
182 
189 
190  private slots:
191  void currentChoiceChanged(int index);
192  void subItemChanged(const QStringList& data);
193  void onReset(bool);
194 };
195 
196 #endif /* _CREPREPOSTPANEL_H */
CRESubItemQuest
Definition: CREPrePostPanel.h:69
CRESubItemList::addItem
void addItem(const QString &item)
Definition: CREPrePostPanel.cpp:40
QuestConditionScript
Definition: QuestConditionScript.h:21
CREPrePostList.h
CRESubItemToken
Definition: CREPrePostPanel.h:104
CRESubItemQuest::selectedStepChanged
void selectedStepChanged(int index)
Definition: CREPrePostPanel.cpp:344
python_init.scripts
scripts
Definition: python_init.py:11
CREPrePostPanel::myChoices
QComboBox * myChoices
Definition: CREPrePostPanel.h:175
CRESubItemToken::myValues
QTextEdit * myValues
Definition: CREPrePostPanel.h:116
MessageManager.h
CRESubItemList::data
QStringList data() const
Definition: CREPrePostPanel.cpp:56
CRESubItemList::CRESubItemList
CRESubItemList(QWidget *parent)
Definition: CREPrePostPanel.cpp:21
CREPrePostPanel::getData
QStringList getData()
Definition: CREPrePostPanel.cpp:479
CRESubItemConnection::CRESubItemConnection
CRESubItemConnection(QWidget *parent)
Definition: CREPrePostPanel.cpp:88
CRESubItemToken::valuesChanged
void valuesChanged()
Definition: CREPrePostPanel.cpp:421
CRESubItemToken::setData
virtual void setData(const QStringList &data)
Definition: CREPrePostPanel.cpp:381
CRESubItemList::onDeleteSubItem
void onDeleteSubItem(bool)
Definition: CREPrePostPanel.cpp:78
CRESubItemQuest::mySecondStep
QComboBox * mySecondStep
Definition: CREPrePostPanel.h:85
CRESubItemConnection
Definition: CREPrePostPanel.h:47
CRESubItemList::mySubItems
QListWidget * mySubItems
Definition: CREPrePostPanel.h:141
CREPrePostPanel::mySubItemsStack
QStackedWidget * mySubItemsStack
Definition: CREPrePostPanel.h:179
CREPrePostPanel::CREPrePostPanel
CREPrePostPanel(PrePostWidget::Mode mode, const QList< QuestConditionScript * > scripts, QWidget *parent)
Definition: CREPrePostPanel.cpp:426
CRESubItemToken::updateData
void updateData()
Definition: CREPrePostPanel.cpp:405
CREPrePostPanel::myMode
PrePostWidget::Mode myMode
Definition: CREPrePostPanel.h:181
CRESubItemList::setData
void setData(const QStringList &data)
Definition: CREPrePostPanel.cpp:47
CRESubItemConnection::editChanged
void editChanged(const QString &text)
Definition: CREPrePostPanel.cpp:129
CREPrePostPanel::onReset
void onReset(bool)
Definition: CREPrePostPanel.cpp:530
CRESubItemQuest::CRESubItemQuest
CRESubItemQuest(PrePostWidget::Mode mode, QWidget *parent)
Definition: CREPrePostPanel.cpp:143
CRESubItemToken::myToken
QLineEdit * myToken
Definition: CREPrePostPanel.h:114
CREPrePostPanel::myOriginal
QStringList myOriginal
Definition: CREPrePostPanel.h:173
CRESubItemConnection::myEdit
QLineEdit * myEdit
Definition: CREPrePostPanel.h:57
CRESubItemToken::CRESubItemToken
CRESubItemToken(bool isPre, QWidget *parent)
Definition: CREPrePostPanel.cpp:352
CREPrePostPanel::mySubWidgets
QList< CRESubItemWidget * > mySubWidgets
Definition: CREPrePostPanel.h:177
navar-midane_time.data
data
Definition: navar-midane_time.py:11
CRESubItemConnection::setData
virtual void setData(const QStringList &data)
Definition: CREPrePostPanel.cpp:103
CRESubItemQuest::updateData
void updateData()
Definition: CREPrePostPanel.cpp:298
guild_entry.text
text
Definition: guild_entry.py:41
CRESubItemConnection::myWarning
QLabel * myWarning
Definition: CREPrePostPanel.h:58
CRESubItemQuest::myFromStep
QRadioButton * myFromStep
Definition: CREPrePostPanel.h:88
CREPrePostPanel
Definition: CREPrePostPanel.h:152
CRESubItemQuest::myMode
PrePostWidget::Mode myMode
Definition: CREPrePostPanel.h:79
CRESubItemToken::tokenChanged
void tokenChanged(const QString &)
Definition: CREPrePostPanel.cpp:416
CRESubItemQuest::myInit
bool myInit
Definition: CREPrePostPanel.h:90
item
Definition: item.py:1
CRESubItemQuest::myAtStep
QRadioButton * myAtStep
Definition: CREPrePostPanel.h:86
CREPrePostPanel::setData
void setData(const QStringList &data)
Definition: CREPrePostPanel.cpp:484
PrePostWidget::Mode
Mode
Definition: CREPrePostList.h:27
CRESubItemWidget::setData
virtual void setData(const QStringList &data)=0
CRESubItemList
Definition: CREPrePostPanel.h:128
CRESubItemList::endEdition
void endEdition(QWidget *editor, QAbstractItemDelegate::EndEditHint hint)
Definition: CREPrePostPanel.cpp:64
CRESubItemQuest::selectedQuestChanged
void selectedQuestChanged(int index)
Definition: CREPrePostPanel.cpp:266
npc_dialog.index
int index
Definition: npc_dialog.py:102
CRESubItemWidget::CRESubItemWidget
CRESubItemWidget(QWidget *parent)
Definition: CREPrePostPanel.h:36
CRESubItemQuest::setData
virtual void setData(const QStringList &data)
Definition: CREPrePostPanel.cpp:208
CREPrePostPanel::subItemChanged
void subItemChanged(const QStringList &data)
Definition: CREPrePostPanel.cpp:509
CRESubItemConnection::showWarning
void showWarning(const QString &warning)
Definition: CREPrePostPanel.cpp:123
CRESubItemToken::myValue
QLineEdit * myValue
Definition: CREPrePostPanel.h:115
CRESubItemWidget::dataModified
void dataModified(const QStringList &data)
CRESubItemList::onAddSubItem
void onAddSubItem(bool)
Definition: CREPrePostPanel.cpp:69
CREPrePostPanel::currentChoiceChanged
void currentChoiceChanged(int index)
Definition: CREPrePostPanel.cpp:498
CREPrePostPanel::myData
QStringList myData
Definition: CREPrePostPanel.h:171
CRESubItemQuest::fillQuestSteps
void fillQuestSteps()
CRESubItemWidget
Definition: CREPrePostPanel.h:31
CREPrePostPanel::~CREPrePostPanel
virtual ~CREPrePostPanel()
Definition: CREPrePostPanel.cpp:475
CRESubItemQuest::myStepRange
QRadioButton * myStepRange
Definition: CREPrePostPanel.h:89
CRESubItemQuest::myBelowStep
QRadioButton * myBelowStep
Definition: CREPrePostPanel.h:87
CRESubItemQuest::checkToggled
void checkToggled(bool checked)
Definition: CREPrePostPanel.cpp:335
CREPrePostPanel::createSubItemWidget
CRESubItemWidget * createSubItemWidget(const QuestConditionScript *script)
Definition: CREPrePostPanel.cpp:516
CRESubItemQuest::myQuestList
QComboBox * myQuestList
Definition: CREPrePostPanel.h:81
CRESubItemQuest::myFirstStep
QComboBox * myFirstStep
Definition: CREPrePostPanel.h:83