File indexing completed on 2024-03-24 05:28:19
0001 /* 0002 * SPDX-FileCopyrightText: 2019-2020 Aditya Mehra <aix.m@outlook.com> 0003 * 0004 * SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #ifndef PROCESSCOMMANDER_H 0008 #define PROCESSCOMMANDER_H 0009 0010 #include <QObject> 0011 #include <QProcess> 0012 #include <QThread> 0013 0014 class ProcessCommand : public QObject 0015 { 0016 Q_OBJECT 0017 public: 0018 explicit ProcessCommand(QObject *parent=nullptr); 0019 0020 public slots: 0021 void processRemoteGit(const QString url, const QString branch); 0022 void processLocalGit(const QString skillpath); 0023 void readFromStdOutRemote(); 0024 void readFromStdOutLocal(); 0025 QString getRemoteCommitId(); 0026 QString getLocalCommitId(); 0027 0028 signals: 0029 void processedCommandRemoteChanged(const QString &result); 0030 void processedCommandLocalChanged(const QString &result); 0031 void processCommandResultCompleted(); 0032 0033 private: 0034 QProcess ExecRemoteCmd; 0035 QProcess ExecLocalCmd; 0036 QProcess ExecSafeList; 0037 0038 QString m_commitIdRemote; 0039 QString m_commitIdLocal; 0040 }; 0041 0042 class ProcessCommander : public QObject 0043 { 0044 Q_OBJECT 0045 0046 public: 0047 explicit ProcessCommander(QObject *parent = nullptr); 0048 ~ProcessCommander(); 0049 bool runUpdateCheck(const QString url, const QString branch, const QString skillpath); 0050 bool compareCommits(const QString remoteId, const QString localId); 0051 0052 signals: 0053 void processRemoteGit(const QString url, const QString branch); 0054 void processLocalGit(const QString skillpath); 0055 0056 void processResult(const bool result); 0057 void processResultCompleted(); 0058 0059 private: 0060 QThread mThread; 0061 ProcessCommand m_processCommand; 0062 }; 0063 0064 #endif // PROCESSCOMMANDER_H