mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-21 11:20:49 +08:00
add: added more plugin UI functions
This commit is contained in:
parent
597944c84b
commit
322734d9c9
@ -1 +1 @@
|
|||||||
5052
|
5054
|
@ -11,7 +11,7 @@ namespace Qv2ray::components::plugins
|
|||||||
{
|
{
|
||||||
struct QvPluginInfo
|
struct QvPluginInfo
|
||||||
{
|
{
|
||||||
bool canLoadPlugin;
|
bool isLoaded;
|
||||||
QString libraryPath;
|
QString libraryPath;
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
QPluginLoader *pluginLoader;
|
QPluginLoader *pluginLoader;
|
||||||
|
@ -1008,5 +1008,5 @@ void MainWindow::on_action_RCM_ClearUsage_triggered()
|
|||||||
|
|
||||||
void MainWindow::on_pluginsBtn_clicked()
|
void MainWindow::on_pluginsBtn_clicked()
|
||||||
{
|
{
|
||||||
w_PluginManager(this).exec();
|
PluginManageWindow(this).exec();
|
||||||
}
|
}
|
||||||
|
@ -64,6 +64,8 @@ class MainWindow
|
|||||||
void on_connectionListWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
|
void on_connectionListWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
|
||||||
void on_masterLogBrowser_textChanged();
|
void on_masterLogBrowser_textChanged();
|
||||||
|
|
||||||
|
void on_pluginsBtn_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void on_actionExit_triggered();
|
void on_actionExit_triggered();
|
||||||
void on_action_StartThis_triggered();
|
void on_action_StartThis_triggered();
|
||||||
@ -99,8 +101,6 @@ class MainWindow
|
|||||||
//
|
//
|
||||||
void SortConnectionList(MW_ITEM_COL byCol, bool asending);
|
void SortConnectionList(MW_ITEM_COL byCol, bool asending);
|
||||||
|
|
||||||
void on_pluginsBtn_clicked();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void timerEvent(QTimerEvent *event) override;
|
void timerEvent(QTimerEvent *event) override;
|
||||||
void keyPressEvent(QKeyEvent *e) override;
|
void keyPressEvent(QKeyEvent *e) override;
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<widget class="QWidget" name="centralWidget">
|
<widget class="QWidget" name="centralWidget">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1,0">
|
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1,0">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0">
|
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0,0">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "components/plugins/QvPluginHost.hpp"
|
#include "components/plugins/QvPluginHost.hpp"
|
||||||
|
|
||||||
w_PluginManager::w_PluginManager(QWidget *parent) : QDialog(parent)
|
PluginManageWindow::PluginManageWindow(QWidget *parent) : QDialog(parent)
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
for (auto &plugin : PluginHost->AvailablePlugins())
|
for (auto &plugin : PluginHost->AvailablePlugins())
|
||||||
@ -15,26 +15,30 @@ w_PluginManager::w_PluginManager(QWidget *parent) : QDialog(parent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
w_PluginManager::~w_PluginManager()
|
PluginManageWindow::~PluginManageWindow()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void w_PluginManager::on_pluginListWidget_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous)
|
void PluginManageWindow::on_pluginListWidget_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous)
|
||||||
{
|
{
|
||||||
Q_UNUSED(previous)
|
Q_UNUSED(previous)
|
||||||
auto &info = PluginHost->GetPluginInfo(current->data(Qt::UserRole).toString());
|
auto &info = PluginHost->GetPluginInfo(current->data(Qt::UserRole).toString());
|
||||||
if (info.interface != nullptr)
|
if (info.interface != nullptr)
|
||||||
{
|
{
|
||||||
|
pluginIconLabel->setPixmap(info.interface->Icon().pixmap(pluginIconLabel->size() * devicePixelRatio()));
|
||||||
|
//
|
||||||
pluginNameLabel->setText(info.interface->Name());
|
pluginNameLabel->setText(info.interface->Name());
|
||||||
pluginAuthorLabel->setText(info.interface->Author());
|
pluginAuthorLabel->setText(info.interface->Author());
|
||||||
pluginDescriptionLabel->setText(info.interface->Description());
|
pluginDescriptionLabel->setText(info.interface->Description());
|
||||||
|
pluginLibPathLabel->setText(info.libraryPath);
|
||||||
|
pluginStateLabel->setText(info.isLoaded ? tr("Loaded") : tr("Not loaded"));
|
||||||
pluginTypeLabel->setText("No impl");
|
pluginTypeLabel->setText("No impl");
|
||||||
pluginStateTxt->setPlainText(info.errorMessage.isEmpty() ? "OK" : info.errorMessage);
|
pluginHookTypeLabel->setText("No impl");
|
||||||
pluginIconLabel->setPixmap(info.interface->Icon().pixmap(pluginIconLabel->size() * devicePixelRatio()));
|
pluginErrMessageTxt->setPlainText(info.errorMessage.isEmpty() ? "OK" : info.errorMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void w_PluginManager::on_pluginListWidget_itemClicked(QListWidgetItem *item)
|
void PluginManageWindow::on_pluginListWidget_itemClicked(QListWidgetItem *item)
|
||||||
{
|
{
|
||||||
on_pluginListWidget_currentItemChanged(item, nullptr);
|
on_pluginListWidget_currentItemChanged(item, nullptr);
|
||||||
}
|
}
|
||||||
|
@ -4,15 +4,15 @@
|
|||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
class w_PluginManager
|
class PluginManageWindow
|
||||||
: public QDialog
|
: public QDialog
|
||||||
, private Ui::w_PluginManager
|
, private Ui::w_PluginManager
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit w_PluginManager(QWidget *parent = nullptr);
|
explicit PluginManageWindow(QWidget *parent = nullptr);
|
||||||
~w_PluginManager();
|
~PluginManageWindow();
|
||||||
private slots:
|
private slots:
|
||||||
void on_pluginListWidget_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
|
void on_pluginListWidget_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
|
||||||
void on_pluginListWidget_itemClicked(QListWidgetItem *item);
|
void on_pluginListWidget_itemClicked(QListWidgetItem *item);
|
||||||
|
@ -39,41 +39,8 @@
|
|||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Plugin Info</string>
|
<string>Plugin Info</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item>
|
<item row="0" column="1">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="pluginIconLabel">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>64</width>
|
|
||||||
<height>64</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>ICON!</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3">
|
||||||
@ -117,65 +84,119 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QLabel" name="label_5">
|
<widget class="QLabel" name="label_5">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>State</string>
|
<string>State</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
|
||||||
<widget class="QLabel" name="label_9">
|
|
||||||
<property name="text">
|
|
||||||
<string>Type</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1">
|
<item row="4" column="1">
|
||||||
<widget class="QLabel" name="pluginTypeLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0">
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>Message</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="1">
|
|
||||||
<widget class="QPlainTextEdit" name="pluginStateTxt">
|
|
||||||
<property name="readOnly">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QLabel" name="pluginStateLabel">
|
<widget class="QLabel" name="pluginStateLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0" colspan="2">
|
<item row="5" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<widget class="QLabel" name="label_9">
|
||||||
<item>
|
<property name="text">
|
||||||
<widget class="QPushButton" name="pushButton_2">
|
<string>Type</string>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>Reload</string>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
</widget>
|
<item row="5" column="1">
|
||||||
</item>
|
<widget class="QLabel" name="pluginTypeLabel">
|
||||||
<item>
|
<property name="text">
|
||||||
<widget class="QPushButton" name="pushButton">
|
<string/>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>Unload</string>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
</widget>
|
<item row="6" column="0">
|
||||||
</item>
|
<widget class="QLabel" name="label_6">
|
||||||
</layout>
|
<property name="text">
|
||||||
|
<string>Hook Type</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Message</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="1">
|
||||||
|
<widget class="QPlainTextEdit" name="pluginErrMessageTxt">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="1">
|
||||||
|
<widget class="QLabel" name="pluginHookTypeLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_8">
|
||||||
|
<property name="text">
|
||||||
|
<string>Library Path</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QLabel" name="pluginLibPathLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="pluginIconLabel">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>64</width>
|
||||||
|
<height>64</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>ICON!</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="3">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="reloadPluginBtn">
|
||||||
|
<property name="text">
|
||||||
|
<string>Reload</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user