10 QGridLayout*
layout =
new QGridLayout(
this);
16 QPushButton* addSubItem =
new QPushButton(tr(
"add"),
this);
17 connect(addSubItem, SIGNAL(clicked(
bool)),
this, SLOT(
onAddSubItem(
bool)));
18 layout->addWidget(addSubItem, 1, 0);
20 QPushButton* delSubItem =
new QPushButton(tr(
"delete"),
this);
21 connect(delSubItem, SIGNAL(clicked(
bool)),
this, SLOT(
onDeleteSubItem(
bool)));
22 layout->addWidget(delSubItem, 1, 1);
77 QVBoxLayout*
layout =
new QVBoxLayout(
this);
79 layout->addWidget(
new QLabel(tr(
"Connection number:"),
this));
80 myEdit =
new QLineEdit(
this);
81 myEdit->setValidator(
new QIntValidator(1, 65000,
myEdit));
82 connect(
myEdit, SIGNAL(textChanged(
const QString&)),
this, SLOT(
editChanged(
const QString&)));
99 int value = data[1].toInt(&ok);
100 if (!ok || value <= 0 || value > 65000)
102 showWarning(tr(
"Invalid number %1, must be a number between 1 and 65000").arg(data[1]));
107 myEdit->setText(QString::number(value));
119 int value = text.toInt(&ok);
120 if (!ok || value <= 0 || value > 65000)
122 showWarning(tr(
"Invalid number %1, must be a number between 1 and 65000").arg(text));
136 QVBoxLayout*
layout =
new QVBoxLayout(
this);
138 layout->addWidget(
new QLabel(tr(
"Quest:"),
this));
145 myAtStep =
new QRadioButton(tr(
"at step"),
this);
147 myFromStep =
new QRadioButton(tr(
"from step"),
this);
149 myStepRange =
new QRadioButton(tr(
"from step to step"),
this);
158 layout->addWidget(
new QLabel(tr(
"new step:"),
this));
174 layout->addStretch();
193 int index =
myQuestList->findData(data[1], Qt::UserRole);
209 QString steps = data[2];
210 int idx = steps.indexOf(
'-');
215 if (steps.startsWith(
'='))
252 desc = tr(
"%1 (%2)").arg(QString::number(step->
step()), step->
description().left(30));
298 if (checked ==
false)
315 QVBoxLayout*
layout =
new QVBoxLayout(
this);
317 layout->addWidget(
new QLabel(tr(
"Token:"),
this));
320 connect(
myToken, SIGNAL(textChanged(
const QString&)),
this, SLOT(
tokenChanged(
const QString&)));
324 layout->addWidget(
new QLabel(tr(
"Values the token can be (one per line):"),
this));
333 layout->addWidget(
new QLabel(tr(
"Value to set for the token:"),
this));
336 connect(
myValue, SIGNAL(textChanged(
const QString&)),
this, SLOT(
tokenChanged(
const QString&)));
339 layout->addStretch();
344 QStringList copy(data);
357 myToken->setText(copy.takeFirst());
360 else if (copy.size() > 0)
369 values.append(
myToken->text());
371 values.append(
myValues->toPlainText().split(
"\n"));
373 values.append(
myValue->text());
390 QGridLayout*
layout =
new QGridLayout(
this);
392 myItems =
new QListWidget(
this);
394 layout->addWidget(
myItems, 0, 0, 3, 2);
396 QPushButton* addItem =
new QPushButton(tr(
"add"),
this);
397 connect(addItem, SIGNAL(clicked(
bool)),
this, SLOT(
onAddItem(
bool)));
398 layout->addWidget(addItem, 3, 0);
400 QPushButton* delItem =
new QPushButton(tr(
"delete"),
this);
401 connect(delItem, SIGNAL(clicked(
bool)),
this, SLOT(
onDeleteItem(
bool)));
402 layout->addWidget(delItem, 3, 1);
404 layout->addWidget(
new QLabel(tr(
"Script:"),
this), 0, 2);
410 for(
int script = 0; script < scripts.size(); script++)
412 myChoices->addItem(scripts[script]->name());
413 myChoices->setItemData(script, scripts[script]->comment(), Qt::ToolTipRole);
439 foreach(QStringList list, data)
444 myItems->addItem(tr(
"(empty)"));
450 myData.append(QStringList(
"quest"));
469 if (index < 0 || index >=
myData.size())
472 QStringList data =
myData[index];
473 if (data.size() == 0)
487 if (data.size() == 0)
491 myItems->currentItem()->setText(data[0]);
505 while (item.size() > 1)
514 if (!isPre && script->
name() ==
"connection")
517 if (script->
name() ==
"quest")
520 if (script->
name() ==
"token" || script->
name() ==
"settoken" || script->
name() ==
"npctoken" || script->
name() ==
"setnpctoken")
Post-condition panel displaying a connection (number).
QList< QStringList > myData
Pre- or post- conditions we're working on.
Pre- or post- conditions panel displaying a token, either as read or write.
void showWarning(const QString &warning)
QRadioButton * myFromStep
QStringList myData
Current arguments.
void editChanged(const QString &text)
QLineEdit * myItemEdit
Argument edit zone.
QComboBox * myQuestList
List of quests.
virtual void setData(const QStringList &data)
CREPrePostPanel(bool isPre, const QList< QuestConditionScript * > scripts, const QuestManager *quests, QWidget *parent)
Standard constructor.
QList< const QuestStep * > steps() const
virtual void setData(const QStringList &data)
const QString & code() const
QComboBox * myChoices
Available conditions types.
Pre- or post- panel displaying script arguments as a string list.
const QString & name() const
CRESubItemConnection(QWidget *parent)
CRESubItemWidget * createSubItemWidget(bool isPre, const QuestConditionScript *script, const QuestManager *quests)
Creates a CRESubItemWidget for the specified script.
const QString & title() const
virtual ~CREPrePostPanel()
void selectedStepChanged(int index)
QList< CRESubItemWidget * > mySubWidgets
Matching between index of myChoices and the variable subpanels.
QListWidget * mySubItems
For one condition, arguments to the script.
QListWidget * myItems
The first item of each condition.
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-).
void setData(const QList< QStringList > data)
QList< QStringList > getData()
void subItemChanged(const QString &text)
const QuestManager * myQuests
CRESubItemList(QWidget *parent)
const QString & description() const
void onDeleteSubItem(bool)
void subItemChanged(const QStringList &data)
void dataModified()
Emitted when the data this panel manages was changed.
CRESubItemToken(bool isPre, QWidget *parent)
void currentItemChanged(int index)
QList< const Quest * > quests() const
void tokenChanged(const QString &)
bool isCompletion() const
void currentChoiceChanged(int index)
void selectedQuestChanged(int index)
static quest_definition * quests
All known quests.
QRadioButton * myStepRange
Pre- or post- conditions panel displaying a quest step.
void setData(const QStringList &data)
void checkToggled(bool checked)
virtual void setData(const QStringList &data)
CRESubItemQuest(bool isPre, const QuestManager *quests, QWidget *parent)
void currentSubItemChanged(int)