Skip to content

Commit

Permalink
Add Qt6 compatibility
Browse files Browse the repository at this point in the history
Signed-off-by: Maxime Gervais <[email protected]>
  • Loading branch information
g-maxime committed Jan 10, 2024
1 parent d3393c3 commit fc8ec29
Show file tree
Hide file tree
Showing 14 changed files with 192 additions and 229 deletions.
23 changes: 7 additions & 16 deletions Source/GUI/Qt/WebCommonPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <QFileDialog>
#include <QTextStream>
#include <QDesktopServices>
#include <QRegularExpression>

namespace MediaConch
{
Expand Down Expand Up @@ -82,7 +83,6 @@ namespace MediaConch
return;

QTextStream out(&file);
out.setCodec("UTF-8");
out << report;
}

Expand Down Expand Up @@ -785,34 +785,25 @@ namespace MediaConch
//---------------------------------------------------------------------------
bool WebCommonPage::report_is_html(const QString& report)
{
QRegExp reg("^(<\\!DOCTYPE.*html|<html>.*</html>$)", Qt::CaseInsensitive);
QRegularExpression reg("^(<\\!DOCTYPE.*html|<html>.*</html>$)", QRegularExpression::CaseInsensitiveOption);

if (reg.indexIn(report.trimmed(), 0) != -1)
return true;

return false;
return reg.match(report.trimmed()).hasMatch();
}

//---------------------------------------------------------------------------
bool WebCommonPage::report_is_xml(const QString& report)
{
QRegExp reg("<\\?xml ", Qt::CaseInsensitive);

if (reg.indexIn(report, 0) != -1)
return true;
QRegularExpression reg("<\\?xml ", QRegularExpression::CaseInsensitiveOption);

return false;
return reg.match(report).hasMatch();
}

//---------------------------------------------------------------------------
bool WebCommonPage::report_is_json(const QString& report)
{
QRegExp reg("^\\{.*\\}$", Qt::CaseInsensitive);

if (reg.indexIn(report.trimmed(), 0) != -1)
return true;
QRegularExpression reg("^\\{.*\\}$", QRegularExpression::CaseInsensitiveOption);

return false;
return reg.match(report.trimmed()).hasMatch();
}

QString WebCommonPage::get_file_tool(const QString& file)
Expand Down
6 changes: 3 additions & 3 deletions Source/GUI/Qt/WebEnginePage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ namespace MediaConch
{
QString value_input;
if (select_file_name == "checkerRepository_directory")
value_input = QFileDialog::getExistingDirectory(view(), NULL, suggested);
value_input = QFileDialog::getExistingDirectory(NULL, NULL, suggested);
else
value_input = QFileDialog::getOpenFileName(view(), NULL, suggested);
value_input = QFileDialog::getOpenFileName(NULL, NULL, suggested);

QMap<QString, QStringList>::iterator it = file_selector.find(select_file_name);
if (!value_input.length())
Expand All @@ -103,7 +103,7 @@ namespace MediaConch
}
else
{
QStringList names = QFileDialog::getOpenFileNames(view(), QString::null, suggested);
QStringList names = QFileDialog::getOpenFileNames(NULL, QString(), suggested);

if (names.size())
{
Expand Down
Loading

0 comments on commit fc8ec29

Please sign in to comment.