Add explicit moc includes to sources for moc-covered headers

Add missing #pragma once + missing include

* speeds up incremental builds as changes to a header will not always
  need the full mocs_compilation.cpp for all the target's headers rebuild,
  while having a moc file sourced into a source file only adds minor
  extra costs, due to small own code and the used headers usually
  already covered by the source file, being for the same class/struct
* seems to not slow down clean builds, due to empty mocs_compilation.cpp
  resulting in those quickly processed, while the minor extra cost of the
  sourced moc files does not outweigh that in summary.
  Measured times actually improved by some percent points.
  (ideally CMake would just skip empty mocs_compilation.cpp & its object
  file one day)
* enables compiler to see all methods of a class in same compilation unit
  to do some sanity checks
* potentially more inlining in general, due to more in the compilation unit
* allows to keep using more forward declarations in the header, as with the
  moc code being sourced into the cpp file there definitions can be ensured
  and often are already for the needs of the normal class methods
This commit is contained in:
Laurent Montel
2023-07-12 13:47:51 +02:00
parent 732b43cbd6
commit 6d45d126f8
56 changed files with 110 additions and 0 deletions

View File

@@ -176,3 +176,5 @@ void AccountEmoticonModel::addEmoticon(const QUrl &source, const QString &shortc
{
doAddEmoticon(source, shortcode, description, type);
}
#include "moc_accountemoticonmodel.cpp"

View File

@@ -174,3 +174,5 @@ QString CollapseStateProxyModel::excessAuthors(int row) const
return QStringLiteral("+ %1").arg(excessAuthors);
}
}
#include "moc_collapsestateproxymodel.cpp"

View File

@@ -193,3 +193,5 @@ void CompletionModel::setRoomListModel(RoomListModel *roomListModel)
m_roomListModel = roomListModel;
Q_EMIT roomListModelChanged();
}
#include "moc_completionmodel.cpp"

View File

@@ -59,3 +59,5 @@ void CompletionProxyModel::setFullText(const QString &fullText)
{
m_fullText = fullText;
}
#include "moc_completionproxymodel.cpp"

View File

@@ -208,3 +208,5 @@ QVariantList CustomEmojiModel::filterModel(const QString &filter)
}
return results;
}
#include "moc_customemojimodel.cpp"

View File

@@ -109,3 +109,5 @@ Connection *DevicesModel::connection() const
{
return Controller::instance().activeConnection();
}
#include "moc_devicesmodel.cpp"

View File

@@ -216,3 +216,5 @@ QVariantList EmojiModel::categoriesWithCustom() const
;
return cats;
}
#include "moc_emojimodel.cpp"

View File

@@ -53,3 +53,5 @@ void EmoticonFilterModel::setShowEmojis(bool showEmojis)
endResetModel();
Q_EMIT showEmojisChanged();
}
#include "moc_emoticonfiltermodel.cpp"

View File

@@ -1,6 +1,8 @@
// SPDX-FileCopyrightText: 2023 Tobias Fella <tobias.fella@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <QSortFilterProxyModel>
/**

View File

@@ -165,3 +165,5 @@ QVector<Quotient::ImagePackEventContent::ImagePackImage> ImagePacksModel::images
}
return m_events[index].images;
}
#include "moc_imagepacksmodel.cpp"

View File

@@ -169,3 +169,5 @@ void LiveLocationsModel::updateLocationData(LiveLocationData &&data)
Q_EMIT dataChanged(idx, idx);
}
#include "moc_livelocationsmodel.cpp"

View File

@@ -127,3 +127,5 @@ QRectF LocationsModel::boundingBox() const
}
return bbox;
}
#include "moc_locationsmodel.cpp"

View File

@@ -77,3 +77,5 @@ int MediaMessageFilterModel::getRowForSourceItem(int sourceRow) const
{
return mapFromSource(sourceModel()->index(sourceRow, 0)).row();
}
#include "moc_mediamessagefiltermodel.cpp"

View File

@@ -1163,3 +1163,5 @@ void MessageEventModel::createReactionModelForEvent(const Quotient::RoomMessageE
}
}
}
#include "moc_messageeventmodel.cpp"

View File

@@ -49,3 +49,5 @@ bool MessageFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sour
return true;
}
#include "moc_messagefiltermodel.cpp"

View File

@@ -260,3 +260,5 @@ bool PublicRoomListModel::hasMore() const
{
return !(attempted && nextBatch.isEmpty());
}
#include "moc_publicroomlistmodel.cpp"

View File

@@ -443,3 +443,5 @@ QVector<QVariant> PushRuleModel::actionToVariant(PushNotificationAction::Action
return actions;
}
#include "moc_pushrulemodel.cpp"

View File

@@ -108,3 +108,5 @@ QHash<int, QByteArray> ReactionModel::roleNames() const
{HasLocalUser, "hasLocalUser"},
};
}
#include "moc_reactionmodel.cpp"

View File

@@ -525,3 +525,5 @@ int RoomListModel::rowForRoom(NeoChatRoom *room) const
{
return m_rooms.indexOf(room);
}
#include "moc_roomlistmodel.cpp"

View File

@@ -283,3 +283,5 @@ void SearchModel::setSearching(bool searching)
m_searching = searching;
Q_EMIT searchingChanged();
}
#include "moc_searchmodel.cpp"

View File

@@ -151,3 +151,5 @@ QHash<int, QByteArray> ServerListModel::roleNames() const
{IsDeletableRole, QByteArrayLiteral("isDeletable")},
};
}
#include "moc_serverlistmodel.cpp"

View File

@@ -103,3 +103,5 @@ void SortFilterRoomListModel::setActiveSpaceId(const QString &spaceId)
Q_EMIT activeSpaceIdChanged();
invalidate();
}
#include "moc_sortfilterroomlistmodel.cpp"

View File

@@ -37,3 +37,5 @@ bool SortFilterSpaceListModel::lessThan(const QModelIndex &source_left, const QM
const auto idRight = sourceModel()->data(source_right, RoomListModel::IdRole).toString();
return idLeft < idRight;
}
#include "moc_sortfilterspacelistmodel.cpp"

View File

@@ -30,3 +30,5 @@ void StateFilterModel::removeStateEventTypeFiltered(const QString &stateEventTyp
invalidateFilter();
}
}
#include "moc_statefiltermodel.cpp"

View File

@@ -70,3 +70,5 @@ QByteArray StateModel::stateEventJson(const QModelIndex &index)
return {};
#endif
}
#include "moc_statemodel.cpp"

View File

@@ -127,3 +127,5 @@ void StickerModel::postSticker(int index)
};
m_room->postJson("m.sticker", content);
}
#include "moc_stickermodel.cpp"

View File

@@ -194,3 +194,5 @@ int UserDirectoryListModel::rowCount(const QModelIndex &parent) const
return users.count();
}
#include "moc_userdirectorylistmodel.cpp"

View File

@@ -26,3 +26,5 @@ void UserFilterModel::setFilterText(const QString &filterText)
Q_EMIT filterTextChanged();
invalidateFilter();
}
#include "moc_userfiltermodel.cpp"

View File

@@ -213,3 +213,5 @@ QHash<int, QByteArray> UserListModel::roleNames() const
return roles;
}
#include "moc_userlistmodel.cpp"

View File

@@ -129,3 +129,5 @@ void KWebShortcutModel::configureWebShortcuts()
job->exec();
#endif
}
#include "moc_webshortcutmodel.cpp"