mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-20 02:40:20 +08:00
Revert "add: changed to use the new QvMsgBus scheme."
This reverts commit 7d8ae76a16
.
This commit is contained in:
parent
9cf9f3489e
commit
e236f47a4a
@ -1 +1 @@
|
|||||||
3807
|
3780
|
@ -138,6 +138,7 @@ Qv2rayAddSource(base, models, QvConfigIdentifier, hpp)
|
|||||||
Qv2rayAddSource(base, models, QvSafeType, hpp)
|
Qv2rayAddSource(base, models, QvSafeType, hpp)
|
||||||
Qv2rayAddSource(base, models, QvRuntimeConfig, hpp)
|
Qv2rayAddSource(base, models, QvRuntimeConfig, hpp)
|
||||||
Qv2rayAddSource(base, models, QvStartupConfig, hpp)
|
Qv2rayAddSource(base, models, QvStartupConfig, hpp)
|
||||||
|
Qv2rayAddSource(base, messaging, QvGlobalMessageBus, cpp, hpp)
|
||||||
Qv2rayAddSource(common, _, CommandArgs, cpp, hpp)
|
Qv2rayAddSource(common, _, CommandArgs, cpp, hpp)
|
||||||
Qv2rayAddSource(common, _, HTTPRequestHelper, cpp, hpp)
|
Qv2rayAddSource(common, _, HTTPRequestHelper, cpp, hpp)
|
||||||
Qv2rayAddSource(common, _, LogHighlighter, cpp, hpp)
|
Qv2rayAddSource(common, _, LogHighlighter, cpp, hpp)
|
||||||
@ -162,7 +163,6 @@ Qv2rayAddSource(core, connection, Serialization, cpp, hpp)
|
|||||||
Qv2rayAddSource(core, _, CoreUtils, cpp, hpp)
|
Qv2rayAddSource(core, _, CoreUtils, cpp, hpp)
|
||||||
Qv2rayAddSource(core, kernel, KernelInteractions, cpp, hpp)
|
Qv2rayAddSource(core, kernel, KernelInteractions, cpp, hpp)
|
||||||
Qv2rayAddSource(core, kernel, APIBackend, cpp, hpp)
|
Qv2rayAddSource(core, kernel, APIBackend, cpp, hpp)
|
||||||
Qv2rayAddSource(ui, uibase, QvMessageBus, cpp, hpp)
|
|
||||||
Qv2rayAddSource(ui, editors, w_InboundEditor, cpp, hpp, ui)
|
Qv2rayAddSource(ui, editors, w_InboundEditor, cpp, hpp, ui)
|
||||||
Qv2rayAddSource(ui, editors, w_JsonEditor, cpp, hpp, ui)
|
Qv2rayAddSource(ui, editors, w_JsonEditor, cpp, hpp, ui)
|
||||||
Qv2rayAddSource(ui, editors, w_OutboundEditor, cpp, hpp, ui)
|
Qv2rayAddSource(ui, editors, w_OutboundEditor, cpp, hpp, ui)
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "base/models/QvRuntimeConfig.hpp"
|
#include "base/models/QvRuntimeConfig.hpp"
|
||||||
#include "base/models/QvStartupConfig.hpp"
|
#include "base/models/QvStartupConfig.hpp"
|
||||||
#include "base/models/QvConfigModel.hpp"
|
#include "base/models/QvConfigModel.hpp"
|
||||||
#include "ui/uibase/QvMessageBus.hpp"
|
#include "base/messaging/QvGlobalMessageBus.hpp"
|
||||||
|
|
||||||
// Instantiation for Qv2ray global objects.
|
// Instantiation for Qv2ray global objects.
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
@ -17,6 +17,7 @@ namespace Qv2ray
|
|||||||
// Qv2ray runtime config
|
// Qv2ray runtime config
|
||||||
inline bool isExiting = false;
|
inline bool isExiting = false;
|
||||||
inline QString Qv2rayConfigPath = "/";
|
inline QString Qv2rayConfigPath = "/";
|
||||||
|
// Danger, new is used here. Possible memory leak (hope not so much leak)
|
||||||
inline base::QvMessageBusObject messageBus = base::QvMessageBusObject();
|
inline base::QvMessageBusObject messageBus = base::QvMessageBusObject();
|
||||||
inline base::Qv2rayRuntimeConfig RuntimeConfig = base::Qv2rayRuntimeConfig();
|
inline base::Qv2rayRuntimeConfig RuntimeConfig = base::Qv2rayRuntimeConfig();
|
||||||
inline base::config::Qv2rayConfig GlobalConfig = base::config::Qv2rayConfig();
|
inline base::config::Qv2rayConfig GlobalConfig = base::config::Qv2rayConfig();
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "base/Qv2rayFeatures.hpp"
|
#include "base/Qv2rayFeatures.hpp"
|
||||||
#include "base/JsonHelpers.hpp"
|
#include "base/JsonHelpers.hpp"
|
||||||
#include "base/GlobalInstances.hpp"
|
#include "base/GlobalInstances.hpp"
|
||||||
|
#include "base/messaging/QvGlobalMessageBus.hpp"
|
||||||
// Code Models
|
// Code Models
|
||||||
#include "base/models/QvSafeType.hpp"
|
#include "base/models/QvSafeType.hpp"
|
||||||
#include "base/models/CoreObjectModels.hpp"
|
#include "base/models/CoreObjectModels.hpp"
|
||||||
|
@ -25,7 +25,7 @@ namespace Qv2ray::base
|
|||||||
#define Qv2ray_PRETTY_FUNCTION __FUNCSIG__
|
#define Qv2ray_PRETTY_FUNCTION __FUNCSIG__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define __LOG_IMPL(LEVEL, MODULE, MSG) ::Qv2ray::base::__QV2RAY_LOG_FUNC__(LEVEL, Qv2ray_PRETTY_FUNCTION, __LINE__, MODULE, MSG);
|
#define __LOG_IMPL(LEVEL, MODULE, MSG) __QV2RAY_LOG_FUNC__(LEVEL, Qv2ray_PRETTY_FUNCTION, __LINE__, MODULE, MSG);
|
||||||
|
|
||||||
#define LOG(MODULE, MSG) __LOG_IMPL(QV2RAY_LOG_NORMAL, (MODULE), (MSG));
|
#define LOG(MODULE, MSG) __LOG_IMPL(QV2RAY_LOG_NORMAL, (MODULE), (MSG));
|
||||||
#define DEBUG(MODULE, MSG) __LOG_IMPL(QV2RAY_LOG_DEBUG, (MODULE), (MSG));
|
#define DEBUG(MODULE, MSG) __LOG_IMPL(QV2RAY_LOG_DEBUG, (MODULE), (MSG));
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#include <QMetaEnum>
|
#include <QMetaEnum>
|
||||||
|
|
||||||
#include "QvMessageBus.hpp"
|
#include "QvGlobalMessageBus.hpp"
|
||||||
#include "base/Qv2rayBase.hpp"
|
#include "base/Qv2rayBase.hpp"
|
||||||
|
|
||||||
namespace Qv2ray::base
|
namespace Qv2ray::base
|
||||||
{
|
{
|
||||||
QvMessageBusObject::QvMessageBusObject()
|
QvMessageBusObject::QvMessageBusObject()
|
||||||
{
|
{
|
||||||
QvMsgBusConnect(QvMsgBusLambda(this->on_QvMessageReceived(msg);))
|
QvMessageBusConnect(QvMessageBusObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QvMessageBusObject::on_QvMessageReceived(QvMessage msg)
|
void QvMessageBusObject::on_QvMessageReceived(QvMessage msg)
|
64
src/base/messaging/QvGlobalMessageBus.hpp
Normal file
64
src/base/messaging/QvGlobalMessageBus.hpp
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
#define QvMessageBusConnect(CLASSNAME) connect(&::Qv2ray::messageBus, &::Qv2ray::base::QvMessageBusObject::QvSendMessage, this, &CLASSNAME::on_QvMessageReceived)
|
||||||
|
|
||||||
|
#define QvMessageBusSlotHeader void on_QvMessageReceived(::Qv2ray::base::QvMessage msg);
|
||||||
|
#define QvMessageBusSlotImpl(CLASSNAME) void CLASSNAME::on_QvMessageReceived(::Qv2ray::base::QvMessage msg)
|
||||||
|
|
||||||
|
#define QvMessageBusShowDefault \
|
||||||
|
case SHOW_WINDOWS:\
|
||||||
|
this->setWindowOpacity(1);\
|
||||||
|
break;
|
||||||
|
|
||||||
|
#define QvMessageBusHideDefault \
|
||||||
|
case HIDE_WINDOWS:\
|
||||||
|
this->setWindowOpacity(0);\
|
||||||
|
break;
|
||||||
|
|
||||||
|
#define QvMessageBusRetranslateDefault \
|
||||||
|
case RETRANSLATE:\
|
||||||
|
this->retranslateUi(this);\
|
||||||
|
break;
|
||||||
|
|
||||||
|
#define QvMessageBusSlotImplDefault(CLASSNAME) \
|
||||||
|
QvMessageBusSlotImpl(CLASSNAME)\
|
||||||
|
{\
|
||||||
|
switch (msg) {\
|
||||||
|
QvMessageBusShowDefault\
|
||||||
|
QvMessageBusHideDefault\
|
||||||
|
QvMessageBusRetranslateDefault\
|
||||||
|
}\
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Qv2ray::base
|
||||||
|
{
|
||||||
|
Q_NAMESPACE
|
||||||
|
enum QvMessage {
|
||||||
|
/// Show all windows.
|
||||||
|
SHOW_WINDOWS,
|
||||||
|
/// Hide all windows.
|
||||||
|
HIDE_WINDOWS,
|
||||||
|
/// Retranslate User Interface.
|
||||||
|
RETRANSLATE,
|
||||||
|
/// Change Color Scheme
|
||||||
|
//CHANGE_COLORSCHEME
|
||||||
|
};
|
||||||
|
Q_ENUM_NS(QvMessage);
|
||||||
|
//
|
||||||
|
class QvMessageBusObject : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit QvMessageBusObject();
|
||||||
|
|
||||||
|
//
|
||||||
|
void EmitGlobalSignal(QvMessage msg);
|
||||||
|
signals:
|
||||||
|
void QvSendMessage(QvMessage msg);
|
||||||
|
private slots:
|
||||||
|
void on_QvMessageReceived(QvMessage msg);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
using namespace Qv2ray::base;
|
@ -6,7 +6,7 @@
|
|||||||
namespace Qv2ray::base
|
namespace Qv2ray::base
|
||||||
{
|
{
|
||||||
struct Qv2rayRuntimeConfig {
|
struct Qv2rayRuntimeConfig {
|
||||||
/// Whether to hide Qv2ray when taking a screenshot
|
//
|
||||||
bool screenShotHideQv2ray;
|
bool screenShotHideQv2ray;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ InboundEditor::InboundEditor(INBOUND root, QWidget *parent) :
|
|||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
original(root)
|
original(root)
|
||||||
{
|
{
|
||||||
QvMsgBusSlot(QvMsgBusImplDefault)
|
QvMessageBusConnect(InboundEditor);
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
this->root = root;
|
this->root = root;
|
||||||
auto inboundType = root["protocol"].toString();
|
auto inboundType = root["protocol"].toString();
|
||||||
@ -39,6 +39,8 @@ InboundEditor::InboundEditor(INBOUND root, QWidget *parent) :
|
|||||||
LoadUIData();
|
LoadUIData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QvMessageBusSlotImplDefault(InboundEditor)
|
||||||
|
|
||||||
INBOUND InboundEditor::OpenEditor()
|
INBOUND InboundEditor::OpenEditor()
|
||||||
{
|
{
|
||||||
int resultCode = this->exec();
|
int resultCode = this->exec();
|
||||||
|
@ -14,6 +14,8 @@ class InboundEditor : public QDialog, private Ui::InboundEditor
|
|||||||
explicit InboundEditor(INBOUND root, QWidget *parent = nullptr);
|
explicit InboundEditor(INBOUND root, QWidget *parent = nullptr);
|
||||||
~InboundEditor();
|
~InboundEditor();
|
||||||
INBOUND OpenEditor();
|
INBOUND OpenEditor();
|
||||||
|
public slots:
|
||||||
|
QvMessageBusSlotHeader
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_inboundProtocolCombo_currentIndexChanged(const QString &arg1);
|
void on_inboundProtocolCombo_currentIndexChanged(const QString &arg1);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
JsonEditor::JsonEditor(QJsonObject rootObject, QWidget *parent) :
|
JsonEditor::JsonEditor(QJsonObject rootObject, QWidget *parent) :
|
||||||
QDialog(parent)
|
QDialog(parent)
|
||||||
{
|
{
|
||||||
QvMsgBusSlot(QvMsgBusImplDefault)
|
QvMessageBusConnect(JsonEditor);
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
original = rootObject;
|
original = rootObject;
|
||||||
final = rootObject;
|
final = rootObject;
|
||||||
@ -24,6 +24,8 @@ JsonEditor::JsonEditor(QJsonObject rootObject, QWidget *parent) :
|
|||||||
jsonTree->resizeColumnToContents(0);
|
jsonTree->resizeColumnToContents(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QvMessageBusSlotImplDefault(JsonEditor)
|
||||||
|
|
||||||
QJsonObject JsonEditor::OpenEditor()
|
QJsonObject JsonEditor::OpenEditor()
|
||||||
{
|
{
|
||||||
int resultCode = this->exec();
|
int resultCode = this->exec();
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#include "base/Qv2rayBase.hpp"
|
#include "base/Qv2rayBase.hpp"
|
||||||
#include "ui_w_JsonEditor.h"
|
#include "ui_w_JsonEditor.h"
|
||||||
|
|
||||||
|
|
||||||
class JsonEditor : public QDialog, private Ui::JsonEditor
|
class JsonEditor : public QDialog, private Ui::JsonEditor
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -15,6 +14,8 @@ class JsonEditor : public QDialog, private Ui::JsonEditor
|
|||||||
explicit JsonEditor(QJsonObject rootObject, QWidget *parent = nullptr);
|
explicit JsonEditor(QJsonObject rootObject, QWidget *parent = nullptr);
|
||||||
~JsonEditor();
|
~JsonEditor();
|
||||||
QJsonObject OpenEditor();
|
QJsonObject OpenEditor();
|
||||||
|
public slots:
|
||||||
|
QvMessageBusSlotHeader
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_jsonEditor_textChanged();
|
void on_jsonEditor_textChanged();
|
||||||
|
@ -16,7 +16,7 @@ OutboundEditor::OutboundEditor(QWidget *parent)
|
|||||||
vmess(),
|
vmess(),
|
||||||
shadowsocks()
|
shadowsocks()
|
||||||
{
|
{
|
||||||
QvMsgBusSlot(QvMsgBusImplDefault)
|
QvMessageBusConnect(OutboundEditor);
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
//
|
//
|
||||||
ssWidget = new StreamSettingsWidget(this);
|
ssWidget = new StreamSettingsWidget(this);
|
||||||
@ -38,6 +38,8 @@ OutboundEditor::OutboundEditor(QWidget *parent)
|
|||||||
Result = GenerateConnectionJson();
|
Result = GenerateConnectionJson();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QvMessageBusSlotImplDefault(OutboundEditor)
|
||||||
|
|
||||||
OutboundEditor::OutboundEditor(OUTBOUND outboundEntry, QWidget *parent) : OutboundEditor(parent)
|
OutboundEditor::OutboundEditor(OUTBOUND outboundEntry, QWidget *parent) : OutboundEditor(parent)
|
||||||
{
|
{
|
||||||
Original = outboundEntry;
|
Original = outboundEntry;
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include "ui_w_OutboundEditor.h"
|
#include "ui_w_OutboundEditor.h"
|
||||||
#include "ui/widgets/StreamSettingsWidget.hpp"
|
#include "ui/widgets/StreamSettingsWidget.hpp"
|
||||||
|
|
||||||
|
|
||||||
class OutboundEditor : public QDialog, private Ui::OutboundEditor
|
class OutboundEditor : public QDialog, private Ui::OutboundEditor
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -15,6 +14,8 @@ class OutboundEditor : public QDialog, private Ui::OutboundEditor
|
|||||||
~OutboundEditor();
|
~OutboundEditor();
|
||||||
OUTBOUND OpenEditor();
|
OUTBOUND OpenEditor();
|
||||||
QString GetFriendlyName();
|
QString GetFriendlyName();
|
||||||
|
public slots:
|
||||||
|
QvMessageBusSlotHeader
|
||||||
signals:
|
signals:
|
||||||
void s_reload_config(bool need_restart);
|
void s_reload_config(bool need_restart);
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -71,7 +71,7 @@ void RouteEditor::SetupNodeWidget()
|
|||||||
|
|
||||||
RouteEditor::RouteEditor(QJsonObject connection, QWidget *parent) : QDialog(parent), root(connection), original(connection)
|
RouteEditor::RouteEditor(QJsonObject connection, QWidget *parent) : QDialog(parent), root(connection), original(connection)
|
||||||
{
|
{
|
||||||
QvMsgBusSlot(QvMsgBusImplDefault)
|
QvMessageBusConnect(RouteEditor);
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
setWindowFlags(windowFlags() | Qt::WindowMaximizeButtonHint);
|
setWindowFlags(windowFlags() | Qt::WindowMaximizeButtonHint);
|
||||||
@ -121,6 +121,8 @@ RouteEditor::RouteEditor(QJsonObject connection, QWidget *parent) : QDialog(pare
|
|||||||
isLoading = false;
|
isLoading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QvMessageBusSlotImplDefault(RouteEditor)
|
||||||
|
|
||||||
void RouteEditor::onNodeClicked(Node &n)
|
void RouteEditor::onNodeClicked(Node &n)
|
||||||
{
|
{
|
||||||
LOADINGCHECK
|
LOADINGCHECK
|
||||||
|
@ -32,6 +32,8 @@ class RouteEditor : public QDialog, private Ui::RouteEditor
|
|||||||
explicit RouteEditor(QJsonObject connection, QWidget *parent = nullptr);
|
explicit RouteEditor(QJsonObject connection, QWidget *parent = nullptr);
|
||||||
~RouteEditor();
|
~RouteEditor();
|
||||||
CONFIGROOT OpenEditor();
|
CONFIGROOT OpenEditor();
|
||||||
|
public slots:
|
||||||
|
QvMessageBusSlotHeader
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_buttonBox_accepted();
|
void on_buttonBox_accepted();
|
||||||
|
@ -1,62 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
#define QvMsgBusConnect(BODY) connect(&::Qv2ray::messageBus, &::Qv2ray::base::QvMessageBusObject::QvSendMessage, BODY);
|
|
||||||
#define QvMsgBusLambda(LAMBDABODY) [this](::Qv2ray::base::QvMessage msg) { LAMBDABODY }
|
|
||||||
#define QvMsgBusSwitch(SWITCHBODY) switch(msg) { SWITCHBODY }
|
|
||||||
|
|
||||||
#define QvMsgBusSlot(Impl) QvMsgBusConnect(QvMsgBusLambda(QvMsgBusSwitch(Impl)))
|
|
||||||
|
|
||||||
#define QvMsgBusShowDefault \
|
|
||||||
case MINIMIZE_WINDOWS:\
|
|
||||||
if(this) { this->setWindowOpacity(0); }\
|
|
||||||
break;
|
|
||||||
//if(this) { this->setWindowState((this->windowState() & ~Qt::WindowMinimized) | Qt::WindowActive); }
|
|
||||||
|
|
||||||
#define QvMsgBusHideDefault \
|
|
||||||
case RESTORE_WINDOWS:\
|
|
||||||
if(this) { this->setWindowOpacity(1); }\
|
|
||||||
break;
|
|
||||||
//if(this) { this->setWindowState(this->windowState() | Qt::WindowMinimized); }
|
|
||||||
|
|
||||||
#define QvMsgBusRetranslateDefault \
|
|
||||||
case RETRANSLATE:\
|
|
||||||
if(this) {this->retranslateUi(this);}\
|
|
||||||
break;
|
|
||||||
|
|
||||||
#define QvMsgBusImplDefault\
|
|
||||||
QvMsgBusShowDefault\
|
|
||||||
QvMsgBusHideDefault\
|
|
||||||
QvMsgBusRetranslateDefault
|
|
||||||
|
|
||||||
namespace Qv2ray::base
|
|
||||||
{
|
|
||||||
Q_NAMESPACE
|
|
||||||
enum QvMessage {
|
|
||||||
/// Hide all windows.
|
|
||||||
MINIMIZE_WINDOWS,
|
|
||||||
/// Show all windows.
|
|
||||||
RESTORE_WINDOWS,
|
|
||||||
/// Retranslate User Interface.
|
|
||||||
RETRANSLATE,
|
|
||||||
/// Change Color Scheme
|
|
||||||
//CHANGE_COLORSCHEME
|
|
||||||
};
|
|
||||||
Q_ENUM_NS(QvMessage);
|
|
||||||
|
|
||||||
class QvMessageBusObject : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit QvMessageBusObject();
|
|
||||||
|
|
||||||
//
|
|
||||||
void EmitGlobalSignal(QvMessage msg);
|
|
||||||
signals:
|
|
||||||
void QvSendMessage(QvMessage msg);
|
|
||||||
private slots:
|
|
||||||
void on_QvMessageReceived(QvMessage msg);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
using namespace Qv2ray::base;
|
|
@ -9,9 +9,10 @@ ConfigExporter::ConfigExporter(QWidget *parent) :
|
|||||||
qzxing(this)
|
qzxing(this)
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
QvMsgBusSlot(QvMsgBusImplDefault)
|
QvMessageBusConnect(ConfigExporter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QvMessageBusSlotImplDefault(ConfigExporter)
|
||||||
|
|
||||||
ConfigExporter::~ConfigExporter()
|
ConfigExporter::~ConfigExporter()
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#include "base/Qv2rayBase.hpp"
|
#include "base/Qv2rayBase.hpp"
|
||||||
#include "3rdparty/qzxing/src/QZXing.h"
|
#include "3rdparty/qzxing/src/QZXing.h"
|
||||||
|
|
||||||
|
|
||||||
class ConfigExporter : public QDialog, private Ui::ExportConfigWindow
|
class ConfigExporter : public QDialog, private Ui::ExportConfigWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -13,6 +12,8 @@ class ConfigExporter : public QDialog, private Ui::ExportConfigWindow
|
|||||||
explicit ConfigExporter(const CONFIGROOT &root, const ConnectionIdentifier &alias, QWidget *parent = nullptr);
|
explicit ConfigExporter(const CONFIGROOT &root, const ConnectionIdentifier &alias, QWidget *parent = nullptr);
|
||||||
~ConfigExporter();
|
~ConfigExporter();
|
||||||
void OpenExport();
|
void OpenExport();
|
||||||
|
public slots:
|
||||||
|
QvMessageBusSlotHeader
|
||||||
protected:
|
protected:
|
||||||
void changeEvent(QEvent *e);
|
void changeEvent(QEvent *e);
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -24,10 +24,12 @@ ImportConfigWindow::ImportConfigWindow(QWidget *parent)
|
|||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
nameTxt->setText(QDateTime::currentDateTime().toString("MMdd_hhmm"));
|
nameTxt->setText(QDateTime::currentDateTime().toString("MMdd_hhmm"));
|
||||||
QvMsgBusSlot(QvMsgBusImplDefault)
|
QvMessageBusConnect(ImportConfigWindow);
|
||||||
RESTORE_RUNTIME_CONFIG(screenShotHideQv2ray, hideQv2rayCB->setChecked)
|
RESTORE_RUNTIME_CONFIG(screenShotHideQv2ray, hideQv2rayCB->setChecked)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QvMessageBusSlotImplDefault(ImportConfigWindow)
|
||||||
|
|
||||||
ImportConfigWindow::~ImportConfigWindow()
|
ImportConfigWindow::~ImportConfigWindow()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -53,10 +55,9 @@ void ImportConfigWindow::on_qrFromScreenBtn_clicked()
|
|||||||
bool hideQv2ray = hideQv2rayCB->isChecked();
|
bool hideQv2ray = hideQv2rayCB->isChecked();
|
||||||
|
|
||||||
if (hideQv2ray) {
|
if (hideQv2ray) {
|
||||||
messageBus.EmitGlobalSignal(QvMessage::MINIMIZE_WINDOWS);
|
messageBus.EmitGlobalSignal(QvMessage::HIDE_WINDOWS);
|
||||||
}
|
}
|
||||||
|
|
||||||
QApplication::processEvents();
|
|
||||||
QThread::msleep(static_cast<ulong>(doubleSpinBox->value() * 1000));
|
QThread::msleep(static_cast<ulong>(doubleSpinBox->value() * 1000));
|
||||||
auto w = new ScreenShotWindow();
|
auto w = new ScreenShotWindow();
|
||||||
auto pix = w->DoScreenShot();
|
auto pix = w->DoScreenShot();
|
||||||
@ -65,7 +66,7 @@ void ImportConfigWindow::on_qrFromScreenBtn_clicked()
|
|||||||
delete w;
|
delete w;
|
||||||
|
|
||||||
if (hideQv2ray) {
|
if (hideQv2ray) {
|
||||||
messageBus.EmitGlobalSignal(QvMessage::RESTORE_WINDOWS);
|
messageBus.EmitGlobalSignal(QvMessage::SHOW_WINDOWS);
|
||||||
//ShowAllGlobalWindow();
|
//ShowAllGlobalWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#include "base/Qv2rayBase.hpp"
|
#include "base/Qv2rayBase.hpp"
|
||||||
#include "ui_w_ImportConfig.h"
|
#include "ui_w_ImportConfig.h"
|
||||||
|
|
||||||
|
|
||||||
class ImportConfigWindow : public QDialog, private Ui::ImportConfigWindow
|
class ImportConfigWindow : public QDialog, private Ui::ImportConfigWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -15,6 +14,8 @@ class ImportConfigWindow : public QDialog, private Ui::ImportConfigWindow
|
|||||||
explicit ImportConfigWindow(QWidget *parent = nullptr);
|
explicit ImportConfigWindow(QWidget *parent = nullptr);
|
||||||
~ImportConfigWindow();
|
~ImportConfigWindow();
|
||||||
QMap<QString, CONFIGROOT> OpenImport(bool outboundsOnly = false);
|
QMap<QString, CONFIGROOT> OpenImport(bool outboundsOnly = false);
|
||||||
|
public slots:
|
||||||
|
QvMessageBusSlotHeader
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void on_selectFileBtn_clicked();
|
void on_selectFileBtn_clicked();
|
||||||
|
@ -2,9 +2,6 @@
|
|||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>ImportConfigWindow</class>
|
<class>ImportConfigWindow</class>
|
||||||
<widget class="QDialog" name="ImportConfigWindow">
|
<widget class="QDialog" name="ImportConfigWindow">
|
||||||
<property name="windowModality">
|
|
||||||
<enum>Qt::ApplicationModal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
|
@ -79,6 +79,8 @@
|
|||||||
|
|
||||||
MainWindow *MainWindow::mwInstance = nullptr;
|
MainWindow *MainWindow::mwInstance = nullptr;
|
||||||
|
|
||||||
|
QvMessageBusSlotImplDefault(MainWindow)
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent):
|
MainWindow::MainWindow(QWidget *parent):
|
||||||
QMainWindow(parent), vinstance(),
|
QMainWindow(parent), vinstance(),
|
||||||
hTray(new QSystemTrayIcon(this)), vCoreLogHighlighter(), qvAppLogHighlighter()
|
hTray(new QSystemTrayIcon(this)), vCoreLogHighlighter(), qvAppLogHighlighter()
|
||||||
@ -94,7 +96,7 @@ MainWindow::MainWindow(QWidget *parent):
|
|||||||
});
|
});
|
||||||
//
|
//
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
QvMsgBusSlot(QvMsgBusImplDefault)
|
QvMessageBusConnect(MainWindow);
|
||||||
//
|
//
|
||||||
// Two browsers
|
// Two browsers
|
||||||
logTextBrowsers.append(new QTextBrowser());
|
logTextBrowsers.append(new QTextBrowser());
|
||||||
|
@ -40,6 +40,7 @@ class MainWindow : public QMainWindow, Ui::MainWindow
|
|||||||
void DisConnect() const;
|
void DisConnect() const;
|
||||||
void ReConnect() const;
|
void ReConnect() const;
|
||||||
public slots:
|
public slots:
|
||||||
|
QvMessageBusSlotHeader
|
||||||
void onPingFinished(QvTCPingData data);
|
void onPingFinished(QvTCPingData data);
|
||||||
void UpdateVCoreLog(const QString &log);
|
void UpdateVCoreLog(const QString &log);
|
||||||
void OnConfigListChanged(bool need_restart);
|
void OnConfigListChanged(bool need_restart);
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#include <ui_w_PreferencesWindow.h>
|
#include <ui_w_PreferencesWindow.h>
|
||||||
#include "base/Qv2rayBase.hpp"
|
#include "base/Qv2rayBase.hpp"
|
||||||
|
|
||||||
|
|
||||||
class PreferencesWindow : public QDialog, private Ui::PreferencesWindow
|
class PreferencesWindow : public QDialog, private Ui::PreferencesWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -3,9 +3,8 @@
|
|||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include "base/Qv2rayBase.hpp"
|
#include "base/Qv2rayBase.hpp"
|
||||||
#include "common/HTTPRequestHelper.hpp"
|
#include "common/HTTPRequestHelper.hpp"
|
||||||
|
|
||||||
#include "ui_w_SubscriptionManager.h"
|
#include "ui_w_SubscriptionManager.h"
|
||||||
|
|
||||||
|
|
||||||
class SubscribeEditor : public QDialog, private Ui::w_SubscribeEditor
|
class SubscribeEditor : public QDialog, private Ui::w_SubscribeEditor
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
Loading…
Reference in New Issue
Block a user