feat(ui): add Qt6 graphical interface
This commit is contained in:
1 parent
6dd3bc7b8f
commit
7541b29996
3 files changed
+858
No files matched your search
@@ -0,0 +1,111 @@
|
||||
#pragma once
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QStackedWidget>
|
||||
#include <QLineEdit>
|
||||
#include <QListWidget>
|
||||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
#include <QComboBox>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QProgressBar>
|
||||
#include <QStatusBar>
|
||||
#include <QMenuBar>
|
||||
#include <QMenu>
|
||||
#include <QAction>
|
||||
#include <QTabWidget>
|
||||
#include <QTextEdit>
|
||||
#include <QThread>
|
||||
|
||||
#include "IPackageManager.h"
|
||||
#include "PluginManager.h"
|
||||
#include "HistoryManager.h"
|
||||
#include "PackageModel.h"
|
||||
|
||||
class SearchWorker : public QThread {
|
||||
Q_OBJECT
|
||||
public:
|
||||
SearchWorker(IPackageManager* pm, const std::string& query);
|
||||
void run() override;
|
||||
signals:
|
||||
void finished(std::vector<PackageInfo> results);
|
||||
private:
|
||||
IPackageManager* m_pm;
|
||||
std::string m_query;
|
||||
};
|
||||
|
||||
class InstallWorker : public QThread {
|
||||
Q_OBJECT
|
||||
public:
|
||||
InstallWorker(IPackageManager* pm, const std::string& package, bool remove = false);
|
||||
void run() override;
|
||||
signals:
|
||||
void progress(const QString& message);
|
||||
void finished(bool success);
|
||||
private:
|
||||
IPackageManager* m_pm;
|
||||
std::string m_package;
|
||||
bool m_remove;
|
||||
};
|
||||
|
||||
class MainWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MainWindow(QWidget* parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
private slots:
|
||||
void onSearch();
|
||||
void onInstall();
|
||||
void onRemove();
|
||||
void onUpdate();
|
||||
void onUpdateAll();
|
||||
void onRefresh();
|
||||
void onPluginChanged(int index);
|
||||
void onSearchFinished(std::vector<PackageInfo> results);
|
||||
void onInstallFinished(bool success);
|
||||
void onPackageSelected(int row);
|
||||
void onToggleInstalledView();
|
||||
void onShowHistory();
|
||||
|
||||
private:
|
||||
void setupUI();
|
||||
void setupMenuBar();
|
||||
void updatePackageInfo(const PackageInfo& pkg);
|
||||
void updateStatusBar();
|
||||
void loadPlugins();
|
||||
void performSearch(const std::string& query);
|
||||
void performInstall(const std::string& package);
|
||||
void performRemove(const std::string& package);
|
||||
|
||||
// UI Elements
|
||||
QLineEdit* m_searchBar;
|
||||
QPushButton* m_searchButton;
|
||||
QComboBox* m_pluginSelector;
|
||||
QListWidget* m_packageList;
|
||||
QLabel* m_packageName;
|
||||
QLabel* m_packageVersion;
|
||||
QLabel* m_packageRepo;
|
||||
QLabel* m_packageSize;
|
||||
QLabel* m_packageDescription;
|
||||
QPushButton* m_installButton;
|
||||
QPushButton* m_removeButton;
|
||||
QPushButton* m_updateButton;
|
||||
QPushButton* m_updateAllButton;
|
||||
QPushButton* m_refreshButton;
|
||||
QPushButton* m_historyButton;
|
||||
QProgressBar* m_progressBar;
|
||||
QTabWidget* m_mainTabs;
|
||||
QTextEdit* m_historyView;
|
||||
QStackedWidget* m_stackedWidget;
|
||||
|
||||
// Backend
|
||||
PluginManager* m_pluginManager;
|
||||
HistoryManager* m_historyManager;
|
||||
PackageModel* m_packageModel;
|
||||
IPackageManager* m_currentPlugin;
|
||||
|
||||
std::vector<PackageInfo> m_currentResults;
|
||||
PackageInfo m_selectedPackage;
|
||||
};
|
||||
Reference in new issue
Block a user