File indexing completed on 2024-04-21 16:12:21

0001 /*******************************************************************
0002  * debugpackageinstaller.h
0003  * SPDX-FileCopyrightText: 2009 Dario Andres Rodriguez <andresbajotierra@gmail.com>
0004  *
0005  * SPDX-License-Identifier: GPL-2.0-or-later
0006  *
0007  ******************************************************************/
0008 #ifndef DEBUGPACKAGEINSTALLER__H
0009 #define DEBUGPACKAGEINSTALLER__H
0010 
0011 #include <QObject>
0012 #include <QProcess>
0013 
0014 class KProcess;
0015 class QProgressDialog;
0016 
0017 class DebugPackageInstaller : public QObject
0018 {
0019     Q_OBJECT
0020     Q_PROPERTY(bool canInstallDebugPackages READ canInstallDebugPackages CONSTANT)
0021 
0022 public:
0023     enum Results {
0024         ResultInstalled = 0,
0025         ResultError = 1,
0026         ResultSymbolsNotFound = 2,
0027         ResultCanceled = 3,
0028     };
0029     Q_ENUM(Results)
0030 
0031     explicit DebugPackageInstaller(QObject *parent = nullptr);
0032     bool canInstallDebugPackages() const;
0033     Q_INVOKABLE void setMissingLibraries(const QStringList &);
0034     Q_INVOKABLE void installDebugPackages();
0035 
0036 private Q_SLOTS:
0037     void processFinished(int, QProcess::ExitStatus);
0038     void progressDialogCanceled();
0039 
0040 Q_SIGNALS:
0041     void packagesInstalled();
0042     void error(const QString &);
0043     void canceled();
0044 
0045 private:
0046     KProcess *m_installerProcess = nullptr;
0047     QProgressDialog *m_progressDialog = nullptr;
0048     QString m_executablePath;
0049     QStringList m_missingLibraries;
0050 };
0051 
0052 #endif