Browse Source

Merge pull request #12545 from Chocobo1/padding

Reduce padding in class
adaptive-webui-19844
Mike Tzou 5 years ago committed by GitHub
parent
commit
0d849339da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      src/base/bittorrent/torrenthandleimpl.cpp
  2. 33
      src/base/bittorrent/torrenthandleimpl.h

13
src/base/bittorrent/torrenthandleimpl.cpp

@ -132,6 +132,8 @@ CreateTorrentParams::CreateTorrentParams(const AddTorrentParams &params)
, category(params.category) , category(params.category)
, tags(params.tags) , tags(params.tags)
, savePath(params.savePath) , savePath(params.savePath)
, uploadLimit(params.uploadLimit)
, downloadLimit(params.downloadLimit)
, disableTempPath(params.disableTempPath) , disableTempPath(params.disableTempPath)
, sequential(params.sequential) , sequential(params.sequential)
, firstLastPiecePriority(params.firstLastPiecePriority) , firstLastPiecePriority(params.firstLastPiecePriority)
@ -144,8 +146,6 @@ CreateTorrentParams::CreateTorrentParams(const AddTorrentParams &params)
, paused(params.addPaused == TriStateBool::Undefined , paused(params.addPaused == TriStateBool::Undefined
? Session::instance()->isAddTorrentPaused() ? Session::instance()->isAddTorrentPaused()
: params.addPaused == TriStateBool::True) : params.addPaused == TriStateBool::True)
, uploadLimit(params.uploadLimit)
, downloadLimit(params.downloadLimit)
, filePriorities(params.filePriorities) , filePriorities(params.filePriorities)
, ratioLimit(params.ignoreShareLimits ? TorrentHandleImpl::NO_RATIO_LIMIT : TorrentHandleImpl::USE_GLOBAL_RATIO) , ratioLimit(params.ignoreShareLimits ? TorrentHandleImpl::NO_RATIO_LIMIT : TorrentHandleImpl::USE_GLOBAL_RATIO)
, seedingTimeLimit(params.ignoreShareLimits ? TorrentHandleImpl::NO_SEEDING_TIME_LIMIT : TorrentHandleImpl::USE_GLOBAL_SEEDING_TIME) , seedingTimeLimit(params.ignoreShareLimits ? TorrentHandleImpl::NO_SEEDING_TIME_LIMIT : TorrentHandleImpl::USE_GLOBAL_SEEDING_TIME)
@ -166,21 +166,16 @@ TorrentHandleImpl::TorrentHandleImpl(Session *session, const lt::torrent_handle
: QObject(session) : QObject(session)
, m_session(session) , m_session(session)
, m_nativeHandle(nativeHandle) , m_nativeHandle(nativeHandle)
, m_state(TorrentState::Unknown)
, m_renameCount(0)
, m_useAutoTMM(params.savePath.isEmpty())
, m_name(params.name) , m_name(params.name)
, m_savePath(Utils::Fs::toNativePath(params.savePath)) , m_savePath(Utils::Fs::toNativePath(params.savePath))
, m_category(params.category) , m_category(params.category)
, m_tags(params.tags) , m_tags(params.tags)
, m_hasSeedStatus(params.hasSeedStatus)
, m_ratioLimit(params.ratioLimit) , m_ratioLimit(params.ratioLimit)
, m_seedingTimeLimit(params.seedingTimeLimit) , m_seedingTimeLimit(params.seedingTimeLimit)
, m_hasSeedStatus(params.hasSeedStatus)
, m_tempPathDisabled(params.disableTempPath) , m_tempPathDisabled(params.disableTempPath)
, m_fastresumeDataRejected(false)
, m_hasMissingFiles(false)
, m_hasRootFolder(params.hasRootFolder) , m_hasRootFolder(params.hasRootFolder)
, m_needsToSetFirstLastPiecePriority(false) , m_useAutoTMM(params.savePath.isEmpty())
{ {
if (m_useAutoTMM) if (m_useAutoTMM)
m_savePath = Utils::Fs::toNativePath(m_session->categorySavePath(m_category)); m_savePath = Utils::Fs::toNativePath(m_session->categorySavePath(m_category));

33
src/base/bittorrent/torrenthandleimpl.h

@ -55,12 +55,16 @@ namespace BitTorrent
struct CreateTorrentParams struct CreateTorrentParams
{ {
bool restored = false; // is existing torrent job? CreateTorrentParams() = default;
explicit CreateTorrentParams(const AddTorrentParams &params);
// for both new and restored torrents // for both new and restored torrents
QString name; QString name;
QString category; QString category;
QSet<QString> tags; QSet<QString> tags;
QString savePath; QString savePath;
int uploadLimit = -1;
int downloadLimit = -1;
bool disableTempPath = false; bool disableTempPath = false;
bool sequential = false; bool sequential = false;
bool firstLastPiecePriority = false; bool firstLastPiecePriority = false;
@ -69,17 +73,15 @@ namespace BitTorrent
bool hasRootFolder = true; bool hasRootFolder = true;
bool forced = false; bool forced = false;
bool paused = false; bool paused = false;
int uploadLimit = -1; bool restored = false; // is existing torrent job?
int downloadLimit = -1;
// for new torrents // for new torrents
QVector<DownloadPriority> filePriorities; QVector<DownloadPriority> filePriorities;
QDateTime addedTime; QDateTime addedTime;
// for restored torrents // for restored torrents
qreal ratioLimit = TorrentHandle::USE_GLOBAL_RATIO; qreal ratioLimit = TorrentHandle::USE_GLOBAL_RATIO;
int seedingTimeLimit = TorrentHandle::USE_GLOBAL_SEEDING_TIME; int seedingTimeLimit = TorrentHandle::USE_GLOBAL_SEEDING_TIME;
CreateTorrentParams() = default;
explicit CreateTorrentParams(const AddTorrentParams &params);
}; };
enum class MoveStorageMode enum class MoveStorageMode
@ -298,39 +300,38 @@ namespace BitTorrent
Session *const m_session; Session *const m_session;
lt::torrent_handle m_nativeHandle; lt::torrent_handle m_nativeHandle;
lt::torrent_status m_nativeStatus; lt::torrent_status m_nativeStatus;
TorrentState m_state; TorrentState m_state = TorrentState::Unknown;
TorrentInfo m_torrentInfo; TorrentInfo m_torrentInfo;
SpeedMonitor m_speedMonitor; SpeedMonitor m_speedMonitor;
InfoHash m_hash; InfoHash m_hash;
bool m_storageIsMoving = false;
// m_moveFinishedTriggers is activated only when the following conditions are met: // m_moveFinishedTriggers is activated only when the following conditions are met:
// all file rename jobs complete, all file move jobs complete // all file rename jobs complete, all file move jobs complete
QQueue<EventTrigger> m_moveFinishedTriggers; QQueue<EventTrigger> m_moveFinishedTriggers;
int m_renameCount; int m_renameCount = 0;
bool m_storageIsMoving = false;
// Until libtorrent provide an "old_name" field in `file_renamed_alert` // Until libtorrent provide an "old_name" field in `file_renamed_alert`
// we will rely on this workaround to remove empty leftover folders // we will rely on this workaround to remove empty leftover folders
QHash<LTFileIndex, QVector<QString>> m_oldPath; QHash<LTFileIndex, QVector<QString>> m_oldPath;
bool m_useAutoTMM; QHash<QString, TrackerInfo> m_trackerInfos;
// Persistent data // Persistent data
QString m_name; QString m_name;
QString m_savePath; QString m_savePath;
QString m_category; QString m_category;
QSet<QString> m_tags; QSet<QString> m_tags;
bool m_hasSeedStatus;
qreal m_ratioLimit; qreal m_ratioLimit;
int m_seedingTimeLimit; int m_seedingTimeLimit;
bool m_hasSeedStatus;
bool m_tempPathDisabled; bool m_tempPathDisabled;
bool m_fastresumeDataRejected; bool m_fastresumeDataRejected = false;
bool m_hasMissingFiles; bool m_hasMissingFiles = false;
bool m_hasRootFolder; bool m_hasRootFolder;
bool m_needsToSetFirstLastPiecePriority; bool m_needsToSetFirstLastPiecePriority = false;
bool m_useAutoTMM;
QHash<QString, TrackerInfo> m_trackerInfos;
bool m_unchecked = false; bool m_unchecked = false;
}; };

Loading…
Cancel
Save