18 #include "DebugConsolePlugin.h"
20 DebugConsolePlugin::DebugConsolePlugin()
22 window =
new QWidget();
23 QGridLayout *layout =
new QGridLayout(window);
24 QPushButton *bt =
new QPushButton(window);
25 bt->setText(tr(
"Clear"));
26 layout->addWidget(bt);
27 list =
new QListWidget(window);
28 list->setAlternatingRowColors(
true);
29 layout->addWidget(list);
30 connect(bt, SIGNAL(clicked()), list, SLOT(clear()));
31 connect(bt, SIGNAL(clicked()),
this, SLOT(sendToAll()));
32 window->setLayout(layout);
33 window->setWindowIcon(QIcon(
":/images/icon.png"));
38 DebugConsolePlugin::~DebugConsolePlugin()
55 void DebugConsolePlugin::onEntityAdded(QString ID, Entity *entity)
57 QString line =
"PLUGIN (" + ID +
") added the Entity (" +
58 entity->getType() +
" - " + entity->getUniqueId() +
")";
59 list->insertItem(0,
new QListWidgetItem(line));
66 void DebugConsolePlugin::errorMessage(QString error)
70 list->item(0)->setText(error);
72 list->addItem(
new QListWidgetItem(error));
75 void DebugConsolePlugin::onEntityChanged(QString ID, Entity * entity)
77 QString line =
"PLUGIN (" + ID +
") changed the Entity (" +
78 entity->getType() +
" - " + entity->getUniqueId() +
")";
79 list->insertItem(0,
new QListWidgetItem(line));
91 void DebugConsolePlugin::onEntityRemoved(QString ID, QString entityID)
93 QString line =
"PLUGIN (" + ID +
") removed Entity (" +
95 list->insertItem(0,
new QListWidgetItem(line));
108 void DebugConsolePlugin::sendToAll()