38 lines
1.0 KiB
C++
38 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include <QObject>
|
|
#include <QProcess>
|
|
#include <QProcessEnvironment>
|
|
#include <QStringList>
|
|
|
|
class InstallManager : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit InstallManager(QObject* parent = nullptr);
|
|
|
|
public:
|
|
void yay(const QString& name, const QString& askpass);
|
|
void pacman(const QString& name, const QString& askpass);
|
|
|
|
private:
|
|
void start_process(const QString& program, const QStringList& args,
|
|
const QString& name, const QString& askpass);
|
|
void fail(const QString& reason);
|
|
void on_ready_read();
|
|
void on_process_finished(int exit_code, QProcess::ExitStatus status);
|
|
void on_process_error(QProcess::ProcessError error);
|
|
QProcessEnvironment install_environment(const QString& askpass) const;
|
|
void stop_install(bool success, const QString& reason);
|
|
|
|
private:
|
|
QProcess m_process;
|
|
|
|
signals:
|
|
void append_update_log(const QByteArray& chunk);
|
|
void add_log_line(const QString& line);
|
|
void console_clear();
|
|
void finished();
|
|
};
|