mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 13:04:23 +00:00
Use the same internal data type for conversion function
This commit is contained in:
parent
ed62854af7
commit
72faf89e26
@ -64,7 +64,7 @@ namespace
|
||||
|
||||
QJsonValue triStateBoolToJsonValue(const TriStateBool &triStateBool)
|
||||
{
|
||||
switch (static_cast<int>(triStateBool)) {
|
||||
switch (static_cast<signed char>(triStateBool)) {
|
||||
case 0: return false;
|
||||
case 1: return true;
|
||||
default: return {};
|
||||
@ -82,7 +82,7 @@ namespace
|
||||
|
||||
int triStateBoolToAddPausedLegacy(const TriStateBool &triStateBool)
|
||||
{
|
||||
switch (static_cast<int>(triStateBool)) {
|
||||
switch (static_cast<signed char>(triStateBool)) {
|
||||
case 0: return 2; // never
|
||||
case 1: return 1; // always
|
||||
default: return 0; // default
|
||||
|
@ -43,13 +43,13 @@ public:
|
||||
*this = boolean ? True : False;
|
||||
}
|
||||
|
||||
explicit constexpr operator int() const
|
||||
TriStateBool &operator=(const TriStateBool &other) = default; // TODO: add constexpr when using C++17
|
||||
|
||||
explicit constexpr operator signed char() const
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
|
||||
TriStateBool &operator=(const TriStateBool &other) = default; // add constexpr when using C++17
|
||||
|
||||
constexpr friend bool operator==(const TriStateBool &left, const TriStateBool &right)
|
||||
{
|
||||
return (left.m_value == right.m_value);
|
||||
|
Loading…
x
Reference in New Issue
Block a user