summaryrefslogtreecommitdiff
path: root/src/serverinfo.h
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2019-08-26 03:01:55 -0400
committerisanae <14251494+isanae@users.noreply.github.com>2019-08-26 03:01:55 -0400
commitc42e5fb2fec9b20fe6956d8798b85874b2eff73e (patch)
tree379ec7ae6407ce7d5adf98c5cb885ae17d7c53ec /src/serverinfo.h
parent896d80d02ccef746ba6598534ce444da2755ae04 (diff)
changed total speed and count to a list of the last 5 downloads
existing servers now merged when retrieving the download links download manager doesn't store the servers any more, queries the settings every time
Diffstat (limited to 'src/serverinfo.h')
-rw-r--r--src/serverinfo.h21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/serverinfo.h b/src/serverinfo.h
index c6e3b640..af8f77c8 100644
--- a/src/serverinfo.h
+++ b/src/serverinfo.h
@@ -8,27 +8,34 @@
class ServerInfo
{
public:
+ using SpeedList = std::vector<int>;
+
ServerInfo();
ServerInfo(
QString name, bool premium, QDate lastSeen, int preferred,
- int downloadCount, double downloadSpeed);
+ SpeedList lastDownloads);
const QString& name() const;
+
bool isPremium() const;
+ void setPremium(bool b);
+
const QDate& lastSeen() const;
- int preferred() const;
- int downloadCount() const;
- double downloadSpeed() const;
+ void updateLastSeen();
+ int preferred() const;
void setPreferred(int i);
+ const SpeedList& lastDownloads() const;
+ int averageSpeed() const;
+ void addDownload(int bytesPerSecond);
+
private:
QString m_name;
bool m_premium;
QDate m_lastSeen;
int m_preferred;
- int m_downloadCount;
- double m_downloadSpeed;
+ SpeedList m_lastDownloads;
};
Q_DECLARE_METATYPE(ServerInfo)
@@ -37,7 +44,7 @@ Q_DECLARE_METATYPE(ServerInfo)
class ServerList
{
public:
- using container = QList<ServerInfo>;
+ using container = std::vector<ServerInfo>;
using iterator = container::iterator;
using const_iterator = container::const_iterator;