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 @@
#include "torrentcategorydialog.h" #include "torrentcategorydialog.h"
#include <QMap>
#include <QMessageBox> #include <QMessageBox>
#include "base/bittorrent/session.h" #include "base/bittorrent/session.h"

1
src/gui/torrentcontentmodel.cpp

@ -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>

2
src/webui/webapplication.cpp

@ -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());

5
src/webui/webapplication.h

@ -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;

Loading…
Cancel
Save