Skip to content

Commit

Permalink
Merge pull request #912 from ElderOrb/xml_parsing_fix
Browse files Browse the repository at this point in the history
analysis GUI blank until forced to generate new xml #869
  • Loading branch information
dericed authored Jul 28, 2024
2 parents e47d8a9 + 5e96945 commit 8e09e0e
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
31 changes: 29 additions & 2 deletions Source/GUI/dvrescue/dvrescue.tests/xmlparsingtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ XmlParsingTest::XmlParsingTest(QObject *parent) : QObject(parent)

}

void XmlParsingTest::f1()
int XmlParsingTest::parse(QString fileName)
{
QFile file(":/testdata/sample.xml");
QFile file(fileName);
bool opened = file.open(QIODevice::ReadOnly);

qDebug() << "file: " << opened << file.size();
Expand All @@ -41,6 +41,14 @@ void XmlParsingTest::f1()

parser.exec(&file);

return totalFrames;
}

void XmlParsingTest::f1()
{
auto fileName = ":/testdata/sample.xml";
auto totalFrames = parse(fileName);

#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)

QXmlQuery query;
Expand Down Expand Up @@ -74,3 +82,22 @@ void XmlParsingTest::f2()
{

}

void XmlParsingTest::parseFile()
{
auto totalFrames = parse(fileName());
qDebug() << "totalFrames: " << totalFrames;
}

QString XmlParsingTest::fileName() const
{
return m_fileName;
}

void XmlParsingTest::setFileName(const QString &newFileName)
{
if (m_fileName == newFileName)
return;
m_fileName = newFileName;
emit fileNameChanged();
}
12 changes: 12 additions & 0 deletions Source/GUI/dvrescue/dvrescue.tests/xmlparsingtest.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,26 @@
class XmlParsingTest : public QObject
{
Q_OBJECT
Q_PROPERTY(QString fileName READ fileName WRITE setFileName NOTIFY fileNameChanged FINAL)
public:
explicit XmlParsingTest(QObject *parent = nullptr);

QString fileName() const;
void setFileName(const QString &newFileName);

Q_SIGNALS:
void fileNameChanged();

private Q_SLOTS:
void f1();
void f2();
void parseFile();

private:
int parse(QString fileName);

private:
QString m_fileName;
};

#endif // XMLPARSINGTEST_H
2 changes: 2 additions & 0 deletions Source/GUI/dvrescue/dvrescue/xmlparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ void XmlParser::parseMedia(QXmlStreamReader &xml)
if(firstFrames)
firstFrames = false;
}

xml.skipCurrentElement();
}
}

Expand Down

0 comments on commit 8e09e0e

Please sign in to comment.