1 /*
2     SPDX-FileCopyrightText: 2021 Jean-Baptiste Mardelle <jb@kdenlive.org>
3 
4 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
5 */
6 
7 #ifndef PROXYTEST_H
8 #define PROXYTEST_H
9 
10 #include "ui_testproxy_ui.h"
11 
12 #include "definitions.h"
13 #include "timecode.h"
14 #include "timecodedisplay.h"
15 
16 #include <QProcess>
17 #include <QMutex>
18 
19 class MyTreeWidgetItem : public QTreeWidgetItem {
20   public:
MyTreeWidgetItem(QTreeWidget * parent,const QStringList & list)21   MyTreeWidgetItem(QTreeWidget* parent, const QStringList &list):QTreeWidgetItem(parent, list){}
MyTreeWidgetItem(QTreeWidgetItem * parent,const QStringList & list)22   MyTreeWidgetItem(QTreeWidgetItem* parent, const QStringList &list):QTreeWidgetItem(parent, list){}
23   private:
24   bool operator<(const QTreeWidgetItem &other)const override {
25      int column = treeWidget()->sortColumn();
26      if (column == 0) {
27          // Sorting by name
28          return text(column).toLower() < other.text(column).toLower();
29      }
30      return data(column, Qt::UserRole).toInt() < other.data(column, Qt::UserRole).toInt();
31   }
32 };
33 
34 /**
35  * @class ProxyTest
36  * @brief A dialog to compare the proxy profiles.
37  * @author Jean-Baptiste Mardelle
38  */
39 class ProxyTest : public QDialog, public Ui::TestProxy_UI
40 {
41     Q_OBJECT
42 
43 public:
44     explicit ProxyTest(QWidget *parent = nullptr);
45     ~ProxyTest() override;
46 
47 private slots:
48     void startTest();
49     void addAnalysis(const QStringList &data);
50     void showMessage(const QString &message);
51 
52 private:
53     bool m_closing;
54     std::unique_ptr<QProcess> m_process;
55     MyTreeWidgetItem *m_failedProfiles;
56     QMutex m_locker;
57 };
58 
59 #endif
60