mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-21 03:10:24 +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
|
||||
{
|
||||
bool canLoadPlugin;
|
||||
bool isLoaded;
|
||||
QString libraryPath;
|
||||
QString errorMessage;
|
||||
QPluginLoader *pluginLoader;
|
||||
|
@ -1008,5 +1008,5 @@ void MainWindow::on_action_RCM_ClearUsage_triggered()
|
||||
|
||||
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_masterLogBrowser_textChanged();
|
||||
|
||||
void on_pluginsBtn_clicked();
|
||||
|
||||
private:
|
||||
void on_actionExit_triggered();
|
||||
void on_action_StartThis_triggered();
|
||||
@ -99,8 +101,6 @@ class MainWindow
|
||||
//
|
||||
void SortConnectionList(MW_ITEM_COL byCol, bool asending);
|
||||
|
||||
void on_pluginsBtn_clicked();
|
||||
|
||||
protected:
|
||||
void timerEvent(QTimerEvent *event) override;
|
||||
void keyPressEvent(QKeyEvent *e) override;
|
||||
|
@ -22,7 +22,7 @@
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1,0">
|
||||
<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">
|
||||
<number>5</number>
|
||||
</property>
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include "components/plugins/QvPluginHost.hpp"
|
||||
|
||||
w_PluginManager::w_PluginManager(QWidget *parent) : QDialog(parent)
|
||||
PluginManageWindow::PluginManageWindow(QWidget *parent) : QDialog(parent)
|
||||
{
|
||||
setupUi(this);
|
||||
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)
|
||||
auto &info = PluginHost->GetPluginInfo(current->data(Qt::UserRole).toString());
|
||||
if (info.interface != nullptr)
|
||||
{
|
||||
pluginIconLabel->setPixmap(info.interface->Icon().pixmap(pluginIconLabel->size() * devicePixelRatio()));
|
||||
//
|
||||
pluginNameLabel->setText(info.interface->Name());
|
||||
pluginAuthorLabel->setText(info.interface->Author());
|
||||
pluginDescriptionLabel->setText(info.interface->Description());
|
||||
pluginLibPathLabel->setText(info.libraryPath);
|
||||
pluginStateLabel->setText(info.isLoaded ? tr("Loaded") : tr("Not loaded"));
|
||||
pluginTypeLabel->setText("No impl");
|
||||
pluginStateTxt->setPlainText(info.errorMessage.isEmpty() ? "OK" : info.errorMessage);
|
||||
pluginIconLabel->setPixmap(info.interface->Icon().pixmap(pluginIconLabel->size() * devicePixelRatio()));
|
||||
pluginHookTypeLabel->setText("No impl");
|
||||
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);
|
||||
}
|
||||
|
@ -4,15 +4,15 @@
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class w_PluginManager
|
||||
class PluginManageWindow
|
||||
: public QDialog
|
||||
, private Ui::w_PluginManager
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit w_PluginManager(QWidget *parent = nullptr);
|
||||
~w_PluginManager();
|
||||
explicit PluginManageWindow(QWidget *parent = nullptr);
|
||||
~PluginManageWindow();
|
||||
private slots:
|
||||
void on_pluginListWidget_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
|
||||
void on_pluginListWidget_itemClicked(QListWidgetItem *item);
|
||||
|
@ -39,41 +39,8 @@
|
||||
<property name="title">
|
||||
<string>Plugin Info</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
|
||||
<item>
|
||||
<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="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="1">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
@ -117,65 +84,119 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>State</string>
|
||||
</property>
|
||||
</widget>
|
||||
</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">
|
||||
<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">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="text">
|
||||
<string>Reload</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Unload</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLabel" name="pluginTypeLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<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>
|
||||
</layout>
|
||||
</item>
|
||||
|
Loading…
Reference in New Issue
Block a user