File indexing completed on 2024-10-13 07:27:34
0001 /* This file is part of the KDE project 0002 0003 Copyright (C) 2008 Lukas Appelhans <l.appelhans@gmx.de> 0004 0005 This program is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU General Public 0007 License as published by the Free Software Foundation; either 0008 version 2 of the License, or (at your option) any later version. 0009 */ 0010 0011 #ifndef TRANSFERGROUPSCHEDULER_H 0012 #define TRANSFERGROUPSCHEDULER_H 0013 0014 #include "core/scheduler.h" 0015 0016 /** 0017 * @brief TransferGroupScheduler class: what handle all the transfers in kget. 0018 * 0019 * This class handles all transfers of KGet, it is a modified Scheduler 0020 * 0021 */ 0022 0023 class TransferGroupScheduler : public Scheduler 0024 { 0025 Q_OBJECT 0026 public: 0027 explicit TransferGroupScheduler(QObject *parent = nullptr); 0028 ~TransferGroupScheduler() override; 0029 0030 /** 0031 * Calculates the whole SpeedLimits 0032 */ 0033 void calculateSpeedLimits(); 0034 0035 /** 0036 * Calculates the DownloadLimits 0037 */ 0038 void calculateDownloadLimit(); 0039 0040 /** 0041 * Calculates the DownloadLimits 0042 */ 0043 void calculateUploadLimit(); 0044 0045 /** 0046 * Sets a download limit to the scheduler 0047 * @param limit the download limit 0048 */ 0049 void setDownloadLimit(int limit); 0050 0051 /** 0052 * @return the transfergroupschedulers download limit 0053 */ 0054 int downloadLimit() const 0055 { 0056 return m_downloadLimit; 0057 } 0058 0059 /** 0060 * Sets a upload limit to the scheduler 0061 * @param limit the upload limit 0062 */ 0063 void setUploadLimit(int limit); 0064 0065 /** 0066 * @return the transfergroupschedulers upload limit 0067 */ 0068 int uploadLimit() const 0069 { 0070 return m_uploadLimit; 0071 } 0072 0073 private: 0074 int m_downloadLimit; 0075 int m_uploadLimit; 0076 }; 0077 0078 #endif