Browse Source

Revise SessionSettingsEnums wrapper

This simplify the wrapper to become a namespace.
adaptive-webui-19844
Chocobo1 5 years ago
parent
commit
7f453a80d3
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 24
      src/base/bittorrent/session.h

24
src/base/bittorrent/session.h

@ -95,18 +95,19 @@ namespace BitTorrent @@ -95,18 +95,19 @@ namespace BitTorrent
class TrackerEntry;
struct CreateTorrentParams;
class SessionSettingsEnums
// Using `Q_ENUM_NS()` without a wrapper namespace in our case is not advised
// since `Q_NAMESPACE` cannot be used when the same namespace resides at different files.
// https://www.kdab.com/new-qt-5-8-meta-object-support-namespaces/#comment-143779
namespace SessionSettingsEnums
{
Q_GADGET
Q_NAMESPACE
public:
// TODO: remove `SessionSettingsEnums` wrapper when we can use `Q_ENUM_NS` directly (QT >= 5.8 only)
enum class ChokingAlgorithm : int
{
FixedSlots = 0,
RateBased = 1
};
Q_ENUM(ChokingAlgorithm)
Q_ENUM_NS(ChokingAlgorithm)
enum class SeedChokingAlgorithm : int
{
@ -114,14 +115,14 @@ namespace BitTorrent @@ -114,14 +115,14 @@ namespace BitTorrent
FastestUpload = 1,
AntiLeech = 2
};
Q_ENUM(SeedChokingAlgorithm)
Q_ENUM_NS(SeedChokingAlgorithm)
enum class MixedModeAlgorithm : int
{
TCP = 0,
Proportional = 1
};
Q_ENUM(MixedModeAlgorithm)
Q_ENUM_NS(MixedModeAlgorithm)
enum class BTProtocol : int
{
@ -129,12 +130,9 @@ namespace BitTorrent @@ -129,12 +130,9 @@ namespace BitTorrent
TCP = 1,
UTP = 2
};
Q_ENUM(BTProtocol)
};
using ChokingAlgorithm = SessionSettingsEnums::ChokingAlgorithm;
using SeedChokingAlgorithm = SessionSettingsEnums::SeedChokingAlgorithm;
using MixedModeAlgorithm = SessionSettingsEnums::MixedModeAlgorithm;
using BTProtocol = SessionSettingsEnums::BTProtocol;
Q_ENUM_NS(BTProtocol)
}
using namespace SessionSettingsEnums;
struct SessionMetricIndices
{

Loading…
Cancel
Save