mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-19 02:10:28 +08:00
Revert "fix: some fixes when updating the subscription with exactly the same protocol/host/port pair but different name"
This reverts commit 1cabc14835
.
This commit is contained in:
parent
e5755ec107
commit
7273bf9fb8
@ -1 +1 @@
|
||||
4688
|
||||
4687
|
@ -50,9 +50,9 @@ namespace Qv2ray::core
|
||||
inline const static auto NullGroupId = GroupId("null");
|
||||
|
||||
template<typename IDType>
|
||||
QSet<IDType> StringsToIdSet(const QList<QString> &strings)
|
||||
QList<IDType> StringsToIdList(const QList<QString> &strings)
|
||||
{
|
||||
QSet<IDType> list;
|
||||
QList<IDType> list;
|
||||
|
||||
for (auto str : strings)
|
||||
{
|
||||
@ -63,7 +63,7 @@ namespace Qv2ray::core
|
||||
}
|
||||
|
||||
template<typename IDType>
|
||||
QList<QString> IdListToStrings(const QSet<IDType> &ids)
|
||||
QList<QString> IdListToStrings(const QList<IDType> &ids)
|
||||
{
|
||||
QList<QString> list;
|
||||
|
||||
@ -104,7 +104,7 @@ namespace Qv2ray::core
|
||||
{
|
||||
// Implicit base of two types, since group object is actually the group base object.
|
||||
bool isSubscription = false;
|
||||
QSet<ConnectionId> connections;
|
||||
QList<ConnectionId> connections;
|
||||
// Suger for down casting.
|
||||
GroupMetaObject() : connections()
|
||||
{
|
||||
@ -114,7 +114,7 @@ namespace Qv2ray::core
|
||||
this->isSubscription = false;
|
||||
this->displayName = base.displayName;
|
||||
this->importDate = base.importDate;
|
||||
this->connections = StringsToIdSet<ConnectionId>(base.connections);
|
||||
this->connections = StringsToIdList<ConnectionId>(base.connections);
|
||||
}
|
||||
// Suger for down casting.
|
||||
GroupMetaObject(const SubscriptionObject_Config &base) : GroupMetaObject((GroupObject_Config) base)
|
||||
|
@ -223,7 +223,7 @@ namespace Qv2ray::core::handlers
|
||||
id.toString() + QV2RAY_CONFIG_FILE_EXTENSION);
|
||||
//
|
||||
connections.remove(id);
|
||||
groups[groupId].connections.remove(id);
|
||||
groups[groupId].connections.removeAll(id);
|
||||
emit OnConnectionDeleted(id, groupId);
|
||||
//
|
||||
bool exists = connectionFile.exists();
|
||||
@ -259,8 +259,8 @@ namespace Qv2ray::core::handlers
|
||||
{
|
||||
LOG(MODULE_FILEIO, "Cannot rename")
|
||||
}
|
||||
groups[oldgid].connections.remove(id);
|
||||
groups[newGroupId].connections << id;
|
||||
groups[oldgid].connections.removeAll(id);
|
||||
groups[newGroupId].connections.append(id);
|
||||
connections[id].groupId = newGroupId;
|
||||
//
|
||||
emit OnConnectionGroupChanged(id, oldgid, newGroupId);
|
||||
@ -521,8 +521,7 @@ namespace Qv2ray::core::handlers
|
||||
groups[id].connections << _conn;
|
||||
UpdateConnection(_conn, config);
|
||||
// Remove Connection Id from the list.
|
||||
connectionsOrig.remove(_conn);
|
||||
typeMap.remove(typeMap.key(_conn));
|
||||
connectionsOrig.removeAll(_conn);
|
||||
}
|
||||
else if (canGetOutboundData && typeMap.contains(outboundData))
|
||||
{
|
||||
@ -533,8 +532,7 @@ namespace Qv2ray::core::handlers
|
||||
UpdateConnection(_conn, config);
|
||||
RenameConnection(_conn, _alias);
|
||||
// Remove Connection Id from the list.
|
||||
connectionsOrig.remove(_conn);
|
||||
nameMap.remove(nameMap.key(_conn));
|
||||
connectionsOrig.removeAll(_conn);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -552,6 +550,7 @@ namespace Qv2ray::core::handlers
|
||||
LOG(MODULE_CORE_HANDLER, "Removing: " + conn.toString())
|
||||
DeleteConnection(conn);
|
||||
}
|
||||
|
||||
// Update the time
|
||||
groups[id].lastUpdated = system_clock::to_time_t(system_clock::now());
|
||||
|
||||
|
@ -40,7 +40,7 @@ namespace Qv2ray::core::handlers
|
||||
{
|
||||
return connections.keys();
|
||||
}
|
||||
inline const QSet<ConnectionId> Connections(const GroupId &groupId) const
|
||||
inline const QList<ConnectionId> Connections(const GroupId &groupId) const
|
||||
{
|
||||
CheckGroupExistance(groupId);
|
||||
return groups[groupId].connections;
|
||||
@ -124,7 +124,7 @@ namespace Qv2ray::core::handlers
|
||||
//
|
||||
void OnGroupCreated(const GroupId &id, const QString &displayName);
|
||||
void OnGroupRenamed(const GroupId &id, const QString &oldName, const QString &newName);
|
||||
void OnGroupDeleted(const GroupId &id, const QSet<ConnectionId> &connections);
|
||||
void OnGroupDeleted(const GroupId &id, const QList<ConnectionId> &connections);
|
||||
//
|
||||
void OnSubscriptionUpdateFinished(const GroupId &id);
|
||||
|
||||
|
@ -854,7 +854,7 @@ void MainWindow::OnGroupCreated(const GroupId &id, const QString &displayName)
|
||||
Q_UNUSED(displayName)
|
||||
MWAddGroupItem_p(id);
|
||||
}
|
||||
void MainWindow::OnGroupDeleted(const GroupId &id, const QSet<ConnectionId> &connections)
|
||||
void MainWindow::OnGroupDeleted(const GroupId &id, const QList<ConnectionId> &connections)
|
||||
{
|
||||
for (auto conn : connections)
|
||||
{
|
||||
|
@ -81,7 +81,7 @@ class MainWindow
|
||||
void OnConnectionGroupChanged(const ConnectionId &id, const GroupId &originalGroup, const GroupId &newGroup);
|
||||
//
|
||||
void OnGroupCreated(const GroupId &id, const QString &displayName);
|
||||
void OnGroupDeleted(const GroupId &id, const QSet<ConnectionId> &connections);
|
||||
void OnGroupDeleted(const GroupId &id, const QList<ConnectionId> &connections);
|
||||
//
|
||||
void on_action_StartThis_triggered();
|
||||
void on_action_RCM_SetAutoConnection_triggered();
|
||||
|
Loading…
Reference in New Issue
Block a user