Advertisement
nick43ui

Untitled

Jun 17th, 2020
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1.  
  2. #ifndef SESSION_H
  3. #define SESSION_H
  4.  
  5. #include <QPointer>
  6. #include <QFile>
  7.  
  8. #include "addtorrentparams.h"
  9. #include "torrentinfo.h"
  10. #include "sessionstatus.h"
  11.  
  12.  
  13. namespace BitTorrent
  14. {
  15.  
  16. class AddTorrentParams;
  17. class SessionStatus;
  18.  
  19. class Session : public QObject
  20. {
  21. Q_OBJECT
  22. Q_DISABLE_COPY(Session)
  23.  
  24. public:
  25. static void initInstance();
  26. static void freeInstance();
  27. static Session *instance();
  28.  
  29. QString defaultSavePath() const;
  30. void setDefaultSavePath(QString path);
  31.  
  32. bool addTorrent(const QString &source, const AddTorrentParams &params = AddTorrentParams());
  33. bool addTorrent(const TorrentInfo &torrentInfo, const AddTorrentParams &params = AddTorrentParams());
  34. bool deleteTorrent(const QString &hash, bool deleteLocalFiles = false);
  35.  
  36. int downloadSpeedLimit() const;
  37. void setDownloadSpeedLimit(int limit);
  38. int uploadSpeedLimit() const;
  39. void setUploadSpeedLimit(int limit);
  40.  
  41. bool hasActiveTorrents() const;
  42. bool hasUnfinishedTorrents() const;
  43. bool hasRunningSeed() const;
  44.  
  45. //signals:
  46.  
  47. private:
  48. explicit Session(QObject* parent = nullptr);
  49. ~Session();
  50.  
  51. void initResumeFolder();
  52.  
  53. // BitTorrent
  54. libtorrent::session *native_session_;
  55.  
  56. QString resume_folder_path_;
  57.  
  58. SessionStatus status_;
  59.  
  60. static Session *instance_;
  61. };
  62.  
  63. } // BitTorrent
  64. #endif // SESSION_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement