mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-10 01:22:31 -06:00
Make BitTorrent::TorrentState strongly-typed enum
This is needed to forward declare this type and pass it by value. Conversion from/to QVariant are hanled via Q_DECLARE_METATYPE, while TorrentState::toString() function was used in webui only and as such is moved there.
This commit is contained in:
committed by
sledgehammer999
parent
a6c99844de
commit
d3a0ac3b6e
@@ -120,48 +120,35 @@ namespace BitTorrent
|
||||
quint32 numPeers = 0;
|
||||
};
|
||||
|
||||
class TorrentState
|
||||
enum class TorrentState
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
Unknown = -1,
|
||||
Unknown = -1,
|
||||
|
||||
ForcedDownloading,
|
||||
Downloading,
|
||||
DownloadingMetadata,
|
||||
Allocating,
|
||||
StalledDownloading,
|
||||
ForcedDownloading,
|
||||
Downloading,
|
||||
DownloadingMetadata,
|
||||
Allocating,
|
||||
StalledDownloading,
|
||||
|
||||
ForcedUploading,
|
||||
Uploading,
|
||||
StalledUploading,
|
||||
|
||||
QueuedDownloading,
|
||||
QueuedUploading,
|
||||
|
||||
CheckingUploading,
|
||||
CheckingDownloading,
|
||||
ForcedUploading,
|
||||
Uploading,
|
||||
StalledUploading,
|
||||
|
||||
#if LIBTORRENT_VERSION_NUM < 10100
|
||||
QueuedForChecking,
|
||||
QueuedForChecking,
|
||||
#endif
|
||||
CheckingResumeData,
|
||||
CheckingResumeData,
|
||||
QueuedDownloading,
|
||||
QueuedUploading,
|
||||
|
||||
PausedDownloading,
|
||||
PausedUploading,
|
||||
CheckingUploading,
|
||||
CheckingDownloading,
|
||||
|
||||
MissingFiles,
|
||||
Error
|
||||
};
|
||||
PausedDownloading,
|
||||
PausedUploading,
|
||||
|
||||
TorrentState(int value);
|
||||
|
||||
operator int() const;
|
||||
QString toString() const;
|
||||
|
||||
private:
|
||||
int m_value;
|
||||
MissingFiles,
|
||||
Error
|
||||
};
|
||||
|
||||
class TorrentHandle : public QObject
|
||||
@@ -474,4 +461,6 @@ namespace BitTorrent
|
||||
};
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(BitTorrent::TorrentState)
|
||||
|
||||
#endif // BITTORRENT_TORRENTHANDLE_H
|
||||
|
||||
Reference in New Issue
Block a user