Crossfire Server, Trunk
CREGeneralMessagePanel.cpp
Go to the documentation of this file.
1 #include <Qt>
2 #include <QtWidgets>
3 
5 #include "FaceComboBox.h"
6 extern "C" {
7 #include "global.h"
8 #include "book.h"
9 }
10 
11 #define LINE(label, exp) \
12  layout->addWidget(new QLabel(tr(label), this), line, 0); \
13  layout->addWidget(exp, line++, 1);
14 
16 {
17  QGridLayout* layout = new QGridLayout(this);
18  setLayout(layout);
19 
20  int line = 0;
21 
22  LINE("Title:", myTitle = new QLineEdit(this));
23  LINE("Identifier:", myIdentifier = new QLineEdit(this));
24  LINE("Quest:", myQuest = new QLineEdit(this));
25  LINE("Chance:", myChance = new QLineEdit(this));
26  LINE("Face:", myFace = new FaceComboBox(this, true));
27 
28  layout->addWidget(new QLabel(tr("Message:"), this), line++, 0, 1, 2);
29  layout->addWidget(myBody = new QTextEdit(this), line++, 0, 1, 2);
30 
31  myTitle->setReadOnly(true);
32  myIdentifier->setReadOnly(true);
33  myQuest->setReadOnly(true);
34  myChance->setReadOnly(true);
35  myFace->setEnabled(false);
36  myBody->setReadOnly(true);
37 }
38 
40 {
41  myTitle->setText(message->title ? message->title : "");
42  myIdentifier->setText((message->identifier && message->identifier[0] != '\n') ? message->identifier : "");
43  myQuest->setText(message->quest_code);
44  myChance->setText(QString::number(message->chance));
45  myFace->setFace(message->face);
46  myBody->setText(message->message);
47 }
CRETPanel
Definition: CREPanel.h:20
global.h
LINE
#define LINE(label, exp)
Definition: CREGeneralMessagePanel.cpp:11
GeneralMessage
Definition: book.h:44
layout
Definition: main.c:85
FaceComboBox
Definition: FaceComboBox.h:11
CREGeneralMessagePanel.h
is_valid_types_gen.line
line
Definition: is_valid_types_gen.py:34
FaceComboBox::setFace
void setFace(const Face *face)
Definition: FaceComboBox.cpp:32
book.h
CREGeneralMessagePanel::myChance
QLineEdit * myChance
Definition: CREGeneralMessagePanel.h:20
CREGeneralMessagePanel::myTitle
QLineEdit * myTitle
Definition: CREGeneralMessagePanel.h:17
diamondslots.message
string message
Definition: diamondslots.py:57
CREGeneralMessagePanel::setItem
virtual void setItem(const GeneralMessage *item) override
Definition: CREGeneralMessagePanel.cpp:39
CREGeneralMessagePanel::myBody
QTextEdit * myBody
Definition: CREGeneralMessagePanel.h:22
FaceComboBox.h
CREGeneralMessagePanel::myQuest
QLineEdit * myQuest
Definition: CREGeneralMessagePanel.h:19
CREGeneralMessagePanel::myFace
FaceComboBox * myFace
Definition: CREGeneralMessagePanel.h:21
CREGeneralMessagePanel::myIdentifier
QLineEdit * myIdentifier
Definition: CREGeneralMessagePanel.h:18
CREGeneralMessagePanel::CREGeneralMessagePanel
CREGeneralMessagePanel(QWidget *parent)
Definition: CREGeneralMessagePanel.cpp:15