From 79f967da8c8c077a6fdbbd46ae9ee59a19a891a3 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sun, 15 Dec 2019 03:34:17 +0100 Subject: [PATCH] Reduce Cache.h includes further via one forward declaration --- src/Cache.cpp | 2 -- src/ChatPage.h | 1 + src/MainWindow.cpp | 1 + src/MxcImageProvider.cpp | 2 +- src/QuickSwitcher.cpp | 1 + src/UserSettingsPage.cpp | 1 + src/Utils.cpp | 1 + src/Utils.h | 7 ++++++- src/dialogs/RoomSettings.cpp | 1 + 9 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Cache.cpp b/src/Cache.cpp index 79425fa..0bfc284 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp @@ -104,7 +104,6 @@ numeric_key_comparison(const MDB_val *a, const MDB_val *b) return -1; } - Cache::Cache(const QString &userId, QObject *parent) : QObject{parent} , env_{nullptr} @@ -2901,4 +2900,3 @@ restoreSessions() return instance_->restoreSessions(); } } // namespace cache - diff --git a/src/ChatPage.h b/src/ChatPage.h index a7fb31a..9e88dcc 100644 --- a/src/ChatPage.h +++ b/src/ChatPage.h @@ -22,6 +22,7 @@ #include #include +#include #include #include diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index b13f1b8..a24266f 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -23,6 +23,7 @@ #include +#include "Cache.h" #include "ChatPage.h" #include "Config.h" #include "Logging.h" diff --git a/src/MxcImageProvider.cpp b/src/MxcImageProvider.cpp index 02ca280..d04eab2 100644 --- a/src/MxcImageProvider.cpp +++ b/src/MxcImageProvider.cpp @@ -1,8 +1,8 @@ #include "MxcImageProvider.h" #include "Cache.h" -#include "MatrixClient.h" #include "Logging.h" +#include "MatrixClient.h" void MxcImageResponse::run() diff --git a/src/QuickSwitcher.cpp b/src/QuickSwitcher.cpp index 29683bb..53dd21e 100644 --- a/src/QuickSwitcher.cpp +++ b/src/QuickSwitcher.cpp @@ -22,6 +22,7 @@ #include #include +#include "Cache.h" #include "QuickSwitcher.h" #include "popups/SuggestionsPopup.h" diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp index 772a8d1..6809d60 100644 --- a/src/UserSettingsPage.cpp +++ b/src/UserSettingsPage.cpp @@ -29,6 +29,7 @@ #include #include +#include "Cache.h" #include "Config.h" #include "MatrixClient.h" #include "Olm.h" diff --git a/src/Utils.cpp b/src/Utils.cpp index 918e199..1c94761 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -15,6 +15,7 @@ #include +#include "Cache.h" #include "Config.h" using TimelineEvent = mtx::events::collections::TimelineEvents; diff --git a/src/Utils.h b/src/Utils.h index aa62b8e..6b809d6 100644 --- a/src/Utils.h +++ b/src/Utils.h @@ -2,7 +2,6 @@ #include -#include "Cache.h" #include "RoomInfoListItem.h" #include @@ -13,6 +12,12 @@ #include +namespace cache { +// Forward declarations to prevent dependency on Cache.h, since this header is included often! +QString +displayName(const QString &room_id, const QString &user_id); +} + class QComboBox; // Contains information about related events for diff --git a/src/dialogs/RoomSettings.cpp b/src/dialogs/RoomSettings.cpp index fcaa4fd..b214b35 100644 --- a/src/dialogs/RoomSettings.cpp +++ b/src/dialogs/RoomSettings.cpp @@ -16,6 +16,7 @@ #include "dialogs/RoomSettings.h" +#include "Cache.h" #include "ChatPage.h" #include "Config.h" #include "Logging.h"