rename fields

This commit is contained in:
RickyRister 2026-01-05 01:38:01 -08:00 committed by Lukas Brübach
parent 001ed0d7d9
commit 0922d75d1e
4 changed files with 43 additions and 43 deletions

View file

@ -6,32 +6,32 @@
XMLEventObserver::XMLEventObserver(QObject *p) : pqEventObserver(p)
{
XMLStream = nullptr;
xmlStream = nullptr;
}
XMLEventObserver::~XMLEventObserver()
{
delete XMLStream;
delete xmlStream;
}
void XMLEventObserver::setStream(QTextStream *stream)
{
if (XMLStream) {
XMLStream->writeEndElement();
XMLStream->writeEndDocument();
delete XMLStream;
XMLStream = nullptr;
if (xmlStream) {
xmlStream->writeEndElement();
xmlStream->writeEndDocument();
delete xmlStream;
xmlStream = nullptr;
}
if (Stream) {
*Stream << XMLString;
*Stream << xmlString;
}
XMLString = QString();
xmlString = QString();
pqEventObserver::setStream(stream);
if (Stream) {
XMLStream = new QXmlStreamWriter(&XMLString);
XMLStream->setAutoFormatting(true);
XMLStream->writeStartDocument();
XMLStream->writeStartElement("events");
xmlStream = new QXmlStreamWriter(&xmlString);
xmlStream->setAutoFormatting(true);
xmlStream->writeStartDocument();
xmlStream->writeStartElement("events");
}
}
@ -40,34 +40,34 @@ void XMLEventObserver::onRecordEvent(const QString &widget,
const QString &arguments,
const int &eventType)
{
if (XMLStream) {
XMLStream->writeStartElement("event");
XMLStream->writeAttribute("widget", widget);
if (xmlStream) {
xmlStream->writeStartElement("event");
xmlStream->writeAttribute("widget", widget);
if (eventType == pqEventTypes::ACTION_EVENT) {
XMLStream->writeAttribute("command", command);
xmlStream->writeAttribute("command", command);
} else // if(eventType == pqEventTypes::CHECK_EVENT)
{
XMLStream->writeAttribute("property", command);
xmlStream->writeAttribute("property", command);
}
XMLStream->writeAttribute("arguments", arguments);
XMLStream->writeEndElement();
xmlStream->writeAttribute("arguments", arguments);
xmlStream->writeEndElement();
}
}
XMLEventSource::XMLEventSource(QObject *p) : pqEventSource(p)
{
XMLStream = nullptr;
xmlStream = nullptr;
}
XMLEventSource::~XMLEventSource()
{
delete XMLStream;
delete xmlStream;
}
void XMLEventSource::setContent(const QString &xmlFileName)
{
delete XMLStream;
XMLStream = nullptr;
delete xmlStream;
xmlStream = nullptr;
QFile xml(xmlFileName);
if (!xml.open(QIODevice::ReadOnly)) {
@ -75,7 +75,7 @@ void XMLEventSource::setContent(const QString &xmlFileName)
return;
}
QByteArray data = xml.readAll();
XMLStream = new QXmlStreamReader(data);
xmlStream = new QXmlStreamReader(data);
/* This checked for valid event objects, but also caused the first event
* to get dropped. Commenting this out in the example. If you wish to report
* empty XML test files a flag indicating whether valid events were found is
@ -91,30 +91,30 @@ void XMLEventSource::setContent(const QString &xmlFileName)
}
}
} */
if (XMLStream->atEnd()) {
if (xmlStream->atEnd()) {
qCWarning(RecordingLog) << "Invalid xml from" << xmlFileName;
}
}
int XMLEventSource::getNextEvent(QString &widget, QString &command, QString &arguments, int &eventType)
{
if (XMLStream->atEnd()) {
if (xmlStream->atEnd()) {
return DONE;
}
while (!XMLStream->atEnd()) {
QXmlStreamReader::TokenType token = XMLStream->readNext();
while (!xmlStream->atEnd()) {
QXmlStreamReader::TokenType token = xmlStream->readNext();
if (token == QXmlStreamReader::StartElement) {
if (XMLStream->name() == "event") {
if (xmlStream->name() == "event") {
break;
}
}
}
if (XMLStream->atEnd()) {
if (xmlStream->atEnd()) {
return DONE;
}
eventType = pqEventTypes::ACTION_EVENT;
widget = XMLStream->attributes().value("widget").toString();
command = XMLStream->attributes().value("command").toString();
arguments = XMLStream->attributes().value("arguments").toString();
widget = xmlStream->attributes().value("widget").toString();
command = xmlStream->attributes().value("command").toString();
arguments = xmlStream->attributes().value("arguments").toString();
return SUCCESS;
}

View file

@ -13,8 +13,8 @@ class QXmlStreamWriter;
class XMLEventObserver : public pqEventObserver
{
QXmlStreamWriter *XMLStream;
QString XMLString;
QXmlStreamWriter *xmlStream;
QString xmlString;
public:
explicit XMLEventObserver(QObject *p);
@ -30,7 +30,7 @@ protected:
class XMLEventSource : public pqEventSource
{
QXmlStreamReader *XMLStream;
QXmlStreamReader *xmlStream;
public:
explicit XMLEventSource(QObject *p);

View file

@ -380,7 +380,7 @@ void MainWindow::actRecord()
QString filename = QFileDialog::getSaveFileName(this, "Test File Name", QString(), "XML Files (*.xml)");
if (!filename.isEmpty()) {
QApplication::activeWindow();
this->TestUtility->recordTests(filename);
testUtility->recordTests(filename);
}
}
@ -388,7 +388,7 @@ void MainWindow::actPlayRecording()
{
QString filename = QFileDialog::getOpenFileName(this, "Test File Name", QString(), "XML Files (*.xml)");
if (!filename.isEmpty()) {
this->TestUtility->playTests(filename);
testUtility->playTests(filename);
}
}
@ -940,9 +940,9 @@ MainWindow::MainWindow(QWidget *parent)
// run startup check async
QTimer::singleShot(0, this, &MainWindow::startupConfigCheck);
this->TestUtility = new pqTestUtility(this);
this->TestUtility->addEventObserver("xml", new XMLEventObserver(this));
this->TestUtility->addEventSource("xml", new XMLEventSource(this));
testUtility = new pqTestUtility(this);
testUtility->addEventObserver("xml", new XMLEventObserver(this));
testUtility->addEventSource("xml", new XMLEventSource(this));
}
void MainWindow::startupConfigCheck()

View file

@ -166,7 +166,7 @@ private:
GameReplay *replay;
DlgTipOfTheDay *tip;
QUrl connectTo;
pqTestUtility *TestUtility;
pqTestUtility *testUtility;
public:
explicit MainWindow(QWidget *parent = nullptr);