62 lines
1.8 KiB
C++
62 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include <QObject>
|
|
#include <QProcess>
|
|
#include <QProcessEnvironment>
|
|
#include <QStringList>
|
|
#include <QVariantList>
|
|
|
|
class RemoveManager : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit RemoveManager(QObject* parent = nullptr);
|
|
|
|
public:
|
|
void load_installed();
|
|
void filter_installed(const QString& query);
|
|
QVariantList installed_packages() const;
|
|
bool loading() const;
|
|
QString error() const;
|
|
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 on_installed_finished(int exit_code, QProcess::ExitStatus status);
|
|
void on_installed_error(QProcess::ProcessError error);
|
|
void parse_installed(const QByteArray& output);
|
|
void apply_filter();
|
|
void remove_from_installed(const QString& name);
|
|
|
|
void on_ready_read();
|
|
void on_process_finished(int exit_code, QProcess::ExitStatus status);
|
|
void on_process_error(QProcess::ProcessError error);
|
|
QProcessEnvironment remove_environment(const QString& askpass) const;
|
|
void fail(const QString& reason);
|
|
void stop_remove(bool success, const QString& reason);
|
|
void set_loading(bool value);
|
|
void set_error(const QString& error);
|
|
|
|
private:
|
|
QProcess m_installed_process;
|
|
QProcess m_remove_process;
|
|
QVariantList m_all_installed;
|
|
QVariantList m_installed;
|
|
QString m_filter;
|
|
QString m_error;
|
|
QString m_removing_name;
|
|
bool m_loading = false;
|
|
|
|
signals:
|
|
void installed_changed();
|
|
void loading_changed();
|
|
void error_changed();
|
|
void append_update_log(const QByteArray& chunk);
|
|
void add_log_line(const QString& line);
|
|
void console_clear();
|
|
void finished();
|
|
};
|