mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-21 11:20:49 +08:00
refactor: refactors, fixed rename crash, fixed plugin port check, fixed empty jumplist entry
This commit is contained in:
parent
0abf4fc9da
commit
f2c7b5170f
@ -1 +1 @@
|
|||||||
5676
|
5677
|
||||||
|
@ -166,7 +166,7 @@ namespace Qv2ray::core::handler
|
|||||||
}
|
}
|
||||||
void QvConfigHandler::ClearConnectionUsage(const ConnectionGroupPair &id)
|
void QvConfigHandler::ClearConnectionUsage(const ConnectionGroupPair &id)
|
||||||
{
|
{
|
||||||
CheckConnectionExistanceEx(id.connectionId, nothing);
|
CheckValidId(id.connectionId, nothing);
|
||||||
connections[id.connectionId].upLinkData = 0;
|
connections[id.connectionId].upLinkData = 0;
|
||||||
connections[id.connectionId].downLinkData = 0;
|
connections[id.connectionId].downLinkData = 0;
|
||||||
emit OnStatsAvailable(id, 0, 0, 0, 0);
|
emit OnStatsAvailable(id, 0, 0, 0, 0);
|
||||||
@ -176,7 +176,7 @@ namespace Qv2ray::core::handler
|
|||||||
|
|
||||||
const QList<GroupId> QvConfigHandler::GetGroupId(const ConnectionId &connId) const
|
const QList<GroupId> QvConfigHandler::GetGroupId(const ConnectionId &connId) const
|
||||||
{
|
{
|
||||||
CheckConnectionExistanceEx(connId, {});
|
CheckValidId(connId, {});
|
||||||
QList<GroupId> grps;
|
QList<GroupId> grps;
|
||||||
for (const auto &groupId : groups.keys())
|
for (const auto &groupId : groups.keys())
|
||||||
{
|
{
|
||||||
@ -191,7 +191,7 @@ namespace Qv2ray::core::handler
|
|||||||
|
|
||||||
const std::optional<QString> QvConfigHandler::RenameConnection(const ConnectionId &id, const QString &newName)
|
const std::optional<QString> QvConfigHandler::RenameConnection(const ConnectionId &id, const QString &newName)
|
||||||
{
|
{
|
||||||
CheckConnectionExistance(id);
|
CheckValidId(id, {});
|
||||||
OnConnectionRenamed(id, connections[id].displayName, newName);
|
OnConnectionRenamed(id, connections[id].displayName, newName);
|
||||||
PluginHost->Send_ConnectionEvent({ Events::ConnectionEntry::Renamed, newName, connections[id].displayName });
|
PluginHost->Send_ConnectionEvent({ Events::ConnectionEntry::Renamed, newName, connections[id].displayName });
|
||||||
connections[id].displayName = newName;
|
connections[id].displayName = newName;
|
||||||
@ -201,7 +201,7 @@ namespace Qv2ray::core::handler
|
|||||||
|
|
||||||
bool QvConfigHandler::RemoveConnectionFromGroup(const ConnectionId &id, const GroupId &gid)
|
bool QvConfigHandler::RemoveConnectionFromGroup(const ConnectionId &id, const GroupId &gid)
|
||||||
{
|
{
|
||||||
CheckConnectionExistanceEx(id, false);
|
CheckValidId(id, false);
|
||||||
LOG(MODULE_CONNECTION, "Removing connection : " + id.toString())
|
LOG(MODULE_CONNECTION, "Removing connection : " + id.toString())
|
||||||
if (groups[gid].connections.contains(id))
|
if (groups[gid].connections.contains(id))
|
||||||
{
|
{
|
||||||
@ -243,7 +243,7 @@ namespace Qv2ray::core::handler
|
|||||||
|
|
||||||
bool QvConfigHandler::LinkConnectionWithGroup(const ConnectionId &id, const GroupId &newGroupId)
|
bool QvConfigHandler::LinkConnectionWithGroup(const ConnectionId &id, const GroupId &newGroupId)
|
||||||
{
|
{
|
||||||
CheckConnectionExistanceEx(id, false);
|
CheckValidId(id, false);
|
||||||
if (groups[newGroupId].connections.contains(id))
|
if (groups[newGroupId].connections.contains(id))
|
||||||
{
|
{
|
||||||
LOG(MODULE_CONNECTION, "Connection not linked since " + id.toString() + " is already in the group " + newGroupId.toString())
|
LOG(MODULE_CONNECTION, "Connection not linked since " + id.toString() + " is already in the group " + newGroupId.toString())
|
||||||
@ -258,9 +258,9 @@ namespace Qv2ray::core::handler
|
|||||||
|
|
||||||
bool QvConfigHandler::MoveConnectionFromToGroup(const ConnectionId &id, const GroupId &sourceGid, const GroupId &targetGid)
|
bool QvConfigHandler::MoveConnectionFromToGroup(const ConnectionId &id, const GroupId &sourceGid, const GroupId &targetGid)
|
||||||
{
|
{
|
||||||
CheckConnectionExistanceEx(id, false);
|
CheckValidId(id, false);
|
||||||
CheckGroupExistanceEx(targetGid, false);
|
CheckValidId(targetGid, false);
|
||||||
CheckGroupExistanceEx(sourceGid, false);
|
CheckValidId(sourceGid, false);
|
||||||
//
|
//
|
||||||
if (!groups[sourceGid].connections.contains(id))
|
if (!groups[sourceGid].connections.contains(id))
|
||||||
{
|
{
|
||||||
@ -291,7 +291,7 @@ namespace Qv2ray::core::handler
|
|||||||
|
|
||||||
const std::optional<QString> QvConfigHandler::DeleteGroup(const GroupId &id)
|
const std::optional<QString> QvConfigHandler::DeleteGroup(const GroupId &id)
|
||||||
{
|
{
|
||||||
CheckGroupExistance(id);
|
CheckValidId(id, {});
|
||||||
if (!groups.contains(id) || id == NullGroupId)
|
if (!groups.contains(id) || id == NullGroupId)
|
||||||
{
|
{
|
||||||
return tr("Group does not exist");
|
return tr("Group does not exist");
|
||||||
@ -318,7 +318,7 @@ namespace Qv2ray::core::handler
|
|||||||
|
|
||||||
bool QvConfigHandler::StartConnection(const ConnectionGroupPair &identifier)
|
bool QvConfigHandler::StartConnection(const ConnectionGroupPair &identifier)
|
||||||
{
|
{
|
||||||
CheckConnectionExistanceEx(identifier.connectionId, false);
|
CheckValidId(identifier, false);
|
||||||
connections[identifier.connectionId].lastConnected = system_clock::to_time_t(system_clock::now());
|
connections[identifier.connectionId].lastConnected = system_clock::to_time_t(system_clock::now());
|
||||||
//
|
//
|
||||||
CONFIGROOT root = GetConnectionRoot(identifier.connectionId);
|
CONFIGROOT root = GetConnectionRoot(identifier.connectionId);
|
||||||
@ -364,20 +364,20 @@ namespace Qv2ray::core::handler
|
|||||||
|
|
||||||
const CONFIGROOT QvConfigHandler::GetConnectionRoot(const ConnectionId &id) const
|
const CONFIGROOT QvConfigHandler::GetConnectionRoot(const ConnectionId &id) const
|
||||||
{
|
{
|
||||||
CheckConnectionExistanceEx(id, CONFIGROOT());
|
CheckValidId(id, CONFIGROOT());
|
||||||
return connectionRootCache.value(id);
|
return connectionRootCache.value(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QvConfigHandler::OnLatencyDataArrived_p(const ConnectionId &id, const LatencyTestResult &result)
|
void QvConfigHandler::OnLatencyDataArrived_p(const ConnectionId &id, const LatencyTestResult &result)
|
||||||
{
|
{
|
||||||
CheckConnectionExistanceEx(id, nothing);
|
CheckValidId(id, nothing);
|
||||||
connections[id].latency = result.avg;
|
connections[id].latency = result.avg;
|
||||||
emit OnLatencyTestFinished(id, result.avg);
|
emit OnLatencyTestFinished(id, result.avg);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QvConfigHandler::UpdateConnection(const ConnectionId &id, const CONFIGROOT &root, bool skipRestart)
|
bool QvConfigHandler::UpdateConnection(const ConnectionId &id, const CONFIGROOT &root, bool skipRestart)
|
||||||
{
|
{
|
||||||
CheckConnectionExistanceEx(id, false);
|
CheckValidId(id, false);
|
||||||
//
|
//
|
||||||
auto path = QV2RAY_CONNECTIONS_DIR + "/" + id.toString() + QV2RAY_CONFIG_FILE_EXTENSION;
|
auto path = QV2RAY_CONNECTIONS_DIR + "/" + id.toString() + QV2RAY_CONFIG_FILE_EXTENSION;
|
||||||
auto content = JsonToString(root);
|
auto content = JsonToString(root);
|
||||||
@ -417,7 +417,7 @@ namespace Qv2ray::core::handler
|
|||||||
|
|
||||||
const std::optional<QString> QvConfigHandler::RenameGroup(const GroupId &id, const QString &newName)
|
const std::optional<QString> QvConfigHandler::RenameGroup(const GroupId &id, const QString &newName)
|
||||||
{
|
{
|
||||||
CheckGroupExistance(id);
|
CheckValidId(id, {});
|
||||||
if (!groups.contains(id))
|
if (!groups.contains(id))
|
||||||
{
|
{
|
||||||
return tr("Group does not exist");
|
return tr("Group does not exist");
|
||||||
@ -431,7 +431,7 @@ namespace Qv2ray::core::handler
|
|||||||
bool QvConfigHandler::SetSubscriptionData(const GroupId &id, std::optional<bool> isSubscription, const std::optional<QString> &address,
|
bool QvConfigHandler::SetSubscriptionData(const GroupId &id, std::optional<bool> isSubscription, const std::optional<QString> &address,
|
||||||
std::optional<float> updateInterval)
|
std::optional<float> updateInterval)
|
||||||
{
|
{
|
||||||
CheckGroupExistanceEx(id, false);
|
CheckValidId(id, false);
|
||||||
|
|
||||||
if (isSubscription.has_value())
|
if (isSubscription.has_value())
|
||||||
groups[id].isSubscription = ACCESS_OPTIONAL_VALUE(isSubscription);
|
groups[id].isSubscription = ACCESS_OPTIONAL_VALUE(isSubscription);
|
||||||
@ -447,7 +447,7 @@ namespace Qv2ray::core::handler
|
|||||||
|
|
||||||
bool QvConfigHandler::SetSubscriptionIncludeKeywords(const GroupId &id, const QStringList &Keywords)
|
bool QvConfigHandler::SetSubscriptionIncludeKeywords(const GroupId &id, const QStringList &Keywords)
|
||||||
{
|
{
|
||||||
CheckGroupExistanceEx(id, false);
|
CheckValidId(id, false);
|
||||||
groups[id].subscriptionOption.IncludeKeywords.clear();
|
groups[id].subscriptionOption.IncludeKeywords.clear();
|
||||||
|
|
||||||
for (const auto &keyword : Keywords)
|
for (const auto &keyword : Keywords)
|
||||||
@ -462,7 +462,7 @@ namespace Qv2ray::core::handler
|
|||||||
|
|
||||||
bool QvConfigHandler::SetSubscriptionIncludeRelation(const GroupId &id, SubscriptionFilterRelation relation)
|
bool QvConfigHandler::SetSubscriptionIncludeRelation(const GroupId &id, SubscriptionFilterRelation relation)
|
||||||
{
|
{
|
||||||
CheckGroupExistanceEx(id, false);
|
CheckValidId(id, false);
|
||||||
if (!groups.contains(id))
|
if (!groups.contains(id))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -473,7 +473,7 @@ namespace Qv2ray::core::handler
|
|||||||
|
|
||||||
bool QvConfigHandler::SetSubscriptionExcludeKeywords(const GroupId &id, const QStringList &Keywords)
|
bool QvConfigHandler::SetSubscriptionExcludeKeywords(const GroupId &id, const QStringList &Keywords)
|
||||||
{
|
{
|
||||||
CheckGroupExistanceEx(id, false);
|
CheckValidId(id, false);
|
||||||
groups[id].subscriptionOption.ExcludeKeywords.clear();
|
groups[id].subscriptionOption.ExcludeKeywords.clear();
|
||||||
for (const auto &keyword : Keywords)
|
for (const auto &keyword : Keywords)
|
||||||
{
|
{
|
||||||
@ -487,14 +487,14 @@ namespace Qv2ray::core::handler
|
|||||||
|
|
||||||
bool QvConfigHandler::SetSubscriptionExcludeRelation(const GroupId &id, SubscriptionFilterRelation relation)
|
bool QvConfigHandler::SetSubscriptionExcludeRelation(const GroupId &id, SubscriptionFilterRelation relation)
|
||||||
{
|
{
|
||||||
CheckGroupExistanceEx(id, false);
|
CheckValidId(id, false);
|
||||||
groups[id].subscriptionOption.ExcludeRelation = relation;
|
groups[id].subscriptionOption.ExcludeRelation = relation;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QvConfigHandler::UpdateSubscriptionAsync(const GroupId &id)
|
void QvConfigHandler::UpdateSubscriptionAsync(const GroupId &id)
|
||||||
{
|
{
|
||||||
CheckGroupExistanceEx(id, nothing);
|
CheckValidId(id, nothing);
|
||||||
if (!groups[id].isSubscription)
|
if (!groups[id].isSubscription)
|
||||||
return;
|
return;
|
||||||
asyncRequestHelper->AsyncHttpGet(groups[id].subscriptionOption.address, [=](const QByteArray &d) {
|
asyncRequestHelper->AsyncHttpGet(groups[id].subscriptionOption.address, [=](const QByteArray &d) {
|
||||||
@ -513,7 +513,7 @@ namespace Qv2ray::core::handler
|
|||||||
|
|
||||||
bool QvConfigHandler::CHUpdateSubscription_p(const GroupId &id, const QByteArray &data)
|
bool QvConfigHandler::CHUpdateSubscription_p(const GroupId &id, const QByteArray &data)
|
||||||
{
|
{
|
||||||
CheckGroupExistanceEx(id, false);
|
CheckValidId(id, false);
|
||||||
if (!groups.contains(id))
|
if (!groups.contains(id))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -11,18 +11,12 @@ namespace Qv2ray::common::network
|
|||||||
class NetworkRequestHelper;
|
class NetworkRequestHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CheckIdExistance(type, id, val) \
|
#define CheckValidId(id, returnValue) \
|
||||||
if (!type.contains(id)) \
|
|
||||||
{ \
|
{ \
|
||||||
return val; \
|
if (!IsValidId(id)) \
|
||||||
|
return returnValue; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CheckGroupExistanceEx(id, val) CheckIdExistance(groups, id, val)
|
|
||||||
#define CheckGroupExistance(id) CheckGroupExistanceEx(id, tr("Group does not exist"))
|
|
||||||
|
|
||||||
#define CheckConnectionExistanceEx(id, val) CheckIdExistance(connections, id, val)
|
|
||||||
#define CheckConnectionExistance(id) CheckConnectionExistanceEx(id, tr("Connection does not exist"))
|
|
||||||
|
|
||||||
namespace Qv2ray::core::handler
|
namespace Qv2ray::core::handler
|
||||||
{
|
{
|
||||||
class QvConfigHandler : public QObject
|
class QvConfigHandler : public QObject
|
||||||
@ -39,7 +33,7 @@ namespace Qv2ray::core::handler
|
|||||||
}
|
}
|
||||||
inline const QList<ConnectionId> Connections(const GroupId &groupId) const
|
inline const QList<ConnectionId> Connections(const GroupId &groupId) const
|
||||||
{
|
{
|
||||||
CheckGroupExistanceEx(groupId, {});
|
CheckValidId(groupId, {});
|
||||||
return groups[groupId].connections;
|
return groups[groupId].connections;
|
||||||
}
|
}
|
||||||
inline QList<GroupId> AllGroups() const
|
inline QList<GroupId> AllGroups() const
|
||||||
@ -48,14 +42,26 @@ namespace Qv2ray::core::handler
|
|||||||
std::sort(k.begin(), k.end(), [&](const auto &idA, const auto &idB) { return groups[idA].displayName < groups[idB].displayName; });
|
std::sort(k.begin(), k.end(), [&](const auto &idA, const auto &idB) { return groups[idA].displayName < groups[idB].displayName; });
|
||||||
return k;
|
return k;
|
||||||
}
|
}
|
||||||
|
inline bool IsValidId(const ConnectionId &id) const
|
||||||
|
{
|
||||||
|
return connections.contains(id);
|
||||||
|
}
|
||||||
|
inline bool IsValidId(const GroupId &id) const
|
||||||
|
{
|
||||||
|
return groups.contains(id);
|
||||||
|
}
|
||||||
|
inline bool IsValidId(const ConnectionGroupPair &id) const
|
||||||
|
{
|
||||||
|
return IsValidId(id.connectionId) && IsValidId(id.groupId);
|
||||||
|
}
|
||||||
inline const ConnectionObject GetConnectionMetaObject(const ConnectionId &id) const
|
inline const ConnectionObject GetConnectionMetaObject(const ConnectionId &id) const
|
||||||
{
|
{
|
||||||
CheckConnectionExistanceEx(id, {});
|
CheckValidId(id, {});
|
||||||
return connections[id];
|
return connections[id];
|
||||||
}
|
}
|
||||||
inline GroupObject GetGroupMetaObject(const GroupId &id) const
|
inline GroupObject GetGroupMetaObject(const GroupId &id) const
|
||||||
{
|
{
|
||||||
CheckGroupExistanceEx(id, {});
|
CheckValidId(id, {});
|
||||||
return groups[id];
|
return groups[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,6 +70,7 @@ namespace Qv2ray::core::handler
|
|||||||
return kernelHandler->CurrentConnection() == id;
|
return kernelHandler->CurrentConnection() == id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Q_DECL_DEPRECATED_X("ConnectionId-Only has been deprecated since GroudId is also required.")
|
||||||
bool IsConnected(const ConnectionId &id) const
|
bool IsConnected(const ConnectionId &id) const
|
||||||
{
|
{
|
||||||
return kernelHandler->CurrentConnection().connectionId == id;
|
return kernelHandler->CurrentConnection().connectionId == id;
|
||||||
@ -71,6 +78,7 @@ namespace Qv2ray::core::handler
|
|||||||
|
|
||||||
inline void IgnoreSubscriptionUpdate(const GroupId &group)
|
inline void IgnoreSubscriptionUpdate(const GroupId &group)
|
||||||
{
|
{
|
||||||
|
CheckValidId(group, nothing);
|
||||||
if (groups[group].isSubscription)
|
if (groups[group].isSubscription)
|
||||||
{
|
{
|
||||||
groups[group].lastUpdatedDate = system_clock::to_time_t(system_clock::now());
|
groups[group].lastUpdatedDate = system_clock::to_time_t(system_clock::now());
|
||||||
|
@ -55,7 +55,7 @@ namespace Qv2ray::core::handler
|
|||||||
}
|
}
|
||||||
if (GlobalConfig.pluginConfig.v2rayIntegration)
|
if (GlobalConfig.pluginConfig.v2rayIntegration)
|
||||||
{
|
{
|
||||||
for (int i = 0; i <= plugins; i++)
|
for (int i = 0; i < plugins; i++)
|
||||||
{
|
{
|
||||||
auto result = components::port::CheckTCPPortStatus("127.0.0.1", GlobalConfig.pluginConfig.portAllocationStart + i);
|
auto result = components::port::CheckTCPPortStatus("127.0.0.1", GlobalConfig.pluginConfig.portAllocationStart + i);
|
||||||
if (!result)
|
if (!result)
|
||||||
|
@ -106,41 +106,30 @@ void MainWindow::SortConnectionList(MW_ITEM_COL byCol, bool asending)
|
|||||||
void MainWindow::ReloadRecentConnectionList()
|
void MainWindow::ReloadRecentConnectionList()
|
||||||
{
|
{
|
||||||
QList<ConnectionGroupPair> newRecentConnections;
|
QList<ConnectionGroupPair> newRecentConnections;
|
||||||
//
|
|
||||||
for (const auto &_action : recentConnectionsActionList)
|
|
||||||
{
|
|
||||||
tray_RecentConnectionsMenu->removeAction(_action);
|
|
||||||
delete _action;
|
|
||||||
}
|
|
||||||
recentConnectionsActionList.clear();
|
|
||||||
//
|
|
||||||
const auto iterateRange = std::min(GlobalConfig.uiConfig.maxJumpListCount, GlobalConfig.uiConfig.recentConnections.count());
|
const auto iterateRange = std::min(GlobalConfig.uiConfig.maxJumpListCount, GlobalConfig.uiConfig.recentConnections.count());
|
||||||
for (auto i = 0; i < iterateRange; i++)
|
for (auto i = 0; i < iterateRange; i++)
|
||||||
{
|
{
|
||||||
const auto &item = GlobalConfig.uiConfig.recentConnections.at(i);
|
const auto &item = GlobalConfig.uiConfig.recentConnections.at(i);
|
||||||
if (newRecentConnections.contains(item) || item.isEmpty())
|
if (newRecentConnections.contains(item) || item.isEmpty())
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
newRecentConnections << item;
|
newRecentConnections << item;
|
||||||
auto action = tray_RecentConnectionsMenu->addAction( //
|
|
||||||
GetDisplayName(item.connectionId) + " (" + GetDisplayName(item.groupId) + ")", //
|
|
||||||
[=]() { //
|
|
||||||
emit ConnectionManager->StartConnection(item);
|
|
||||||
}); //
|
|
||||||
|
|
||||||
connect(ConnectionManager, &QvConfigHandler::OnConnectionRenamed, //
|
|
||||||
[=](const ConnectionId &_t1, const QString &, const QString &_t3) { //
|
|
||||||
if (_t1 == item.connectionId) //
|
|
||||||
action->setText(_t3); //
|
|
||||||
}); //
|
|
||||||
|
|
||||||
recentConnectionsActionList << action;
|
|
||||||
}
|
}
|
||||||
GlobalConfig.uiConfig.recentConnections = newRecentConnections;
|
GlobalConfig.uiConfig.recentConnections = newRecentConnections;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::OnRecentConnectionsMenuReadyToShow()
|
||||||
|
{
|
||||||
|
tray_RecentConnectionsMenu->clear();
|
||||||
|
tray_RecentConnectionsMenu->addAction(tray_ClearRecentConnectionsAction);
|
||||||
|
tray_RecentConnectionsMenu->addSeparator();
|
||||||
|
for (const auto &conn : GlobalConfig.uiConfig.recentConnections)
|
||||||
|
{
|
||||||
|
if (ConnectionManager->IsValidId(conn))
|
||||||
|
tray_RecentConnectionsMenu->addAction(GetDisplayName(conn.connectionId) + " (" + GetDisplayName(conn.groupId) + ")",
|
||||||
|
[=]() { emit ConnectionManager->StartConnection(conn); });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
|
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
@ -223,8 +212,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
|
|||||||
//
|
//
|
||||||
tray_RootMenu->addSeparator();
|
tray_RootMenu->addSeparator();
|
||||||
tray_RootMenu->addMenu(tray_RecentConnectionsMenu);
|
tray_RootMenu->addMenu(tray_RecentConnectionsMenu);
|
||||||
tray_RecentConnectionsMenu->addAction(tray_ClearRecentConnectionsAction);
|
connect(tray_RecentConnectionsMenu, &QMenu::aboutToShow, this, &MainWindow::OnRecentConnectionsMenuReadyToShow);
|
||||||
tray_RecentConnectionsMenu->addSeparator();
|
|
||||||
//
|
//
|
||||||
tray_RootMenu->addSeparator();
|
tray_RootMenu->addSeparator();
|
||||||
tray_RootMenu->addAction(tray_action_Start);
|
tray_RootMenu->addAction(tray_action_Start);
|
||||||
@ -532,7 +520,9 @@ void MainWindow::on_actionExit_triggered()
|
|||||||
|
|
||||||
void MainWindow::on_preferencesBtn_clicked()
|
void MainWindow::on_preferencesBtn_clicked()
|
||||||
{
|
{
|
||||||
ProcessCommand("open", { "preference", "general" }, {});
|
PreferencesWindow w;
|
||||||
|
w.exec();
|
||||||
|
// ProcessCommand("open", { "preference", "general" }, {});
|
||||||
}
|
}
|
||||||
void MainWindow::on_clearlogButton_clicked()
|
void MainWindow::on_clearlogButton_clicked()
|
||||||
{
|
{
|
||||||
|
@ -98,6 +98,7 @@ class MainWindow
|
|||||||
void SortConnectionList(MW_ITEM_COL byCol, bool asending);
|
void SortConnectionList(MW_ITEM_COL byCol, bool asending);
|
||||||
//
|
//
|
||||||
void ReloadRecentConnectionList();
|
void ReloadRecentConnectionList();
|
||||||
|
void OnRecentConnectionsMenuReadyToShow();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void timerEvent(QTimerEvent *event) override;
|
void timerEvent(QTimerEvent *event) override;
|
||||||
@ -119,8 +120,6 @@ class MainWindow
|
|||||||
QMenu *tray_RecentConnectionsMenu = new QMenu(tr("Recent Connections"), this);
|
QMenu *tray_RecentConnectionsMenu = new QMenu(tr("Recent Connections"), this);
|
||||||
QAction *tray_ClearRecentConnectionsAction = new QAction(tr("Clear Recent Connections"), this);
|
QAction *tray_ClearRecentConnectionsAction = new QAction(tr("Clear Recent Connections"), this);
|
||||||
//
|
//
|
||||||
QList<QAction *> recentConnectionsActionList;
|
|
||||||
//
|
|
||||||
QAction *tray_action_ShowHide = new QAction(tr("Hide"), this);
|
QAction *tray_action_ShowHide = new QAction(tr("Hide"), this);
|
||||||
QAction *tray_action_ShowPreferencesWindow = new QAction(tr("Preferences"), this);
|
QAction *tray_action_ShowPreferencesWindow = new QAction(tr("Preferences"), this);
|
||||||
QAction *tray_action_Quit = new QAction(tr("Quit"), this);
|
QAction *tray_action_Quit = new QAction(tr("Quit"), this);
|
||||||
|
Loading…
Reference in New Issue
Block a user