diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2020-01-31 06:12:02 +0100 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2020-01-31 15:11:21 +0100 |
commit | 4cd260bfcfcbf88a6efb8bf5a1abf3d37fb06463 (patch) | |
tree | 2d39fbdb1acdf678fa9d28f054ac08d44c91a4cf /src/Utils.h | |
parent | Add next/prev room shortcuts (diff) | |
download | nheko-4cd260bfcfcbf88a6efb8bf5a1abf3d37fb06463.tar.xz |
Optimize includes a bit
Diffstat (limited to 'src/Utils.h')
-rw-r--r-- | src/Utils.h | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/src/Utils.h b/src/Utils.h index ea0df21f..a3854dd8 100644 --- a/src/Utils.h +++ b/src/Utils.h @@ -2,8 +2,6 @@ #include <variant> -#include "RoomInfoListItem.h" - #include <QCoreApplication> #include <QDateTime> #include <QPixmap> @@ -12,6 +10,8 @@ #include <qmath.h> +struct DescInfo; + namespace cache { // Forward declarations to prevent dependency on Cache.h, since this header is included often! QString @@ -166,25 +166,6 @@ messageDescription(const QString &username = "", } } -template<class T, class Event> -DescInfo -createDescriptionInfo(const Event &event, const QString &localUser, const QString &room_id) -{ - const auto msg = std::get<T>(event); - const auto sender = QString::fromStdString(msg.sender); - - const auto username = cache::displayName(room_id, sender); - const auto ts = QDateTime::fromMSecsSinceEpoch(msg.origin_server_ts); - - return DescInfo{QString::fromStdString(msg.event_id), - sender, - messageDescription<T>(username, - QString::fromStdString(msg.content.body).trimmed(), - sender == localUser), - utils::descriptiveTime(ts), - ts}; -} - //! Scale down an image to fit to the given width & height limitations. QPixmap scaleDown(uint64_t maxWidth, uint64_t maxHeight, const QPixmap &source); @@ -326,14 +307,4 @@ centerWidget(QWidget *widget, QWidget *parent); void restoreCombobox(QComboBox *combo, const QString &value); -struct SideBarSizes -{ - int small; - int normal; - int groups; - int collapsePoint; -}; - -SideBarSizes -calculateSidebarSizes(const QFont &f); } |