Browse Source

Replace QMap with QHash when sensible

adaptive-webui-19844
Chocobo1 6 years ago
parent
commit
375de4f8a6
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 1
      src/gui/torrentcategorydialog.cpp
  2. 1
      src/gui/torrentcontentmodel.cpp
  3. 2
      src/webui/webapplication.cpp
  4. 5
      src/webui/webapplication.h

1
src/gui/torrentcategorydialog.cpp

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

1
src/gui/torrentcontentmodel.cpp

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

2
src/webui/webapplication.cpp

@ -537,7 +537,7 @@ void WebApplication::sessionStart() @@ -537,7 +537,7 @@ void WebApplication::sessionStart()
// remove outdated sessions
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) {
if ((now - session->timestamp()) > INACTIVE_TIME)
delete m_sessions.take(session->id());

5
src/webui/webapplication.h

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

Loading…
Cancel
Save