1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-11 07:18:08 +00:00

Replace QMap with QHash when sensible

This commit is contained in:
Chocobo1 2019-04-26 02:50:40 +08:00
parent 44e4a5b13a
commit 375de4f8a6
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
4 changed files with 3 additions and 6 deletions

View File

@ -28,7 +28,6 @@
#include "torrentcategorydialog.h" #include "torrentcategorydialog.h"
#include <QMap>
#include <QMessageBox> #include <QMessageBox>
#include "base/bittorrent/session.h" #include "base/bittorrent/session.h"

View File

@ -34,7 +34,6 @@
#include <QFileIconProvider> #include <QFileIconProvider>
#include <QFileInfo> #include <QFileInfo>
#include <QIcon> #include <QIcon>
#include <QMap>
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
#include <Windows.h> #include <Windows.h>

View File

@ -537,7 +537,7 @@ void WebApplication::sessionStart()
// remove outdated sessions // remove outdated sessions
const qint64 now = QDateTime::currentMSecsSinceEpoch() / 1000; const qint64 now = QDateTime::currentMSecsSinceEpoch() / 1000;
const QMap<QString, WebSession *> sessionsCopy {m_sessions}; const QHash<QString, WebSession *> sessionsCopy {m_sessions};
for (const auto session : sessionsCopy) { for (const auto session : sessionsCopy) {
if ((now - session->timestamp()) > INACTIVE_TIME) if ((now - session->timestamp()) > INACTIVE_TIME)
delete m_sessions.take(session->id()); delete m_sessions.take(session->id());

View File

@ -30,7 +30,6 @@
#include <QDateTime> #include <QDateTime>
#include <QHash> #include <QHash>
#include <QMap>
#include <QObject> #include <QObject>
#include <QRegularExpression> #include <QRegularExpression>
#include <QSet> #include <QSet>
@ -120,7 +119,7 @@ private:
bool validateHostHeader(const QStringList &domains) const; bool validateHostHeader(const QStringList &domains) const;
// Persistent data // Persistent data
QMap<QString, WebSession *> m_sessions; QHash<QString, WebSession *> m_sessions;
// Current data // Current data
WebSession *m_currentSession = nullptr; WebSession *m_currentSession = nullptr;
@ -141,7 +140,7 @@ private:
QByteArray data; QByteArray data;
QDateTime lastModified; QDateTime lastModified;
}; };
QMap<QString, TranslatedFile> m_translatedFiles; QHash<QString, TranslatedFile> m_translatedFiles;
QString m_currentLocale; QString m_currentLocale;
QTranslator m_translator; QTranslator m_translator;
bool m_translationFileLoaded = false; bool m_translationFileLoaded = false;