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:
@@ -176,3 +176,5 @@ void AccountEmoticonModel::addEmoticon(const QUrl &source, const QString &shortc
|
||||
{
|
||||
doAddEmoticon(source, shortcode, description, type);
|
||||
}
|
||||
|
||||
#include "moc_accountemoticonmodel.cpp"
|
||||
|
||||
@@ -174,3 +174,5 @@ QString CollapseStateProxyModel::excessAuthors(int row) const
|
||||
return QStringLiteral("+ %1").arg(excessAuthors);
|
||||
}
|
||||
}
|
||||
|
||||
#include "moc_collapsestateproxymodel.cpp"
|
||||
|
||||
@@ -193,3 +193,5 @@ void CompletionModel::setRoomListModel(RoomListModel *roomListModel)
|
||||
m_roomListModel = roomListModel;
|
||||
Q_EMIT roomListModelChanged();
|
||||
}
|
||||
|
||||
#include "moc_completionmodel.cpp"
|
||||
|
||||
@@ -59,3 +59,5 @@ void CompletionProxyModel::setFullText(const QString &fullText)
|
||||
{
|
||||
m_fullText = fullText;
|
||||
}
|
||||
|
||||
#include "moc_completionproxymodel.cpp"
|
||||
|
||||
@@ -208,3 +208,5 @@ QVariantList CustomEmojiModel::filterModel(const QString &filter)
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
#include "moc_customemojimodel.cpp"
|
||||
|
||||
@@ -109,3 +109,5 @@ Connection *DevicesModel::connection() const
|
||||
{
|
||||
return Controller::instance().activeConnection();
|
||||
}
|
||||
|
||||
#include "moc_devicesmodel.cpp"
|
||||
|
||||
@@ -216,3 +216,5 @@ QVariantList EmojiModel::categoriesWithCustom() const
|
||||
;
|
||||
return cats;
|
||||
}
|
||||
|
||||
#include "moc_emojimodel.cpp"
|
||||
|
||||
@@ -53,3 +53,5 @@ void EmoticonFilterModel::setShowEmojis(bool showEmojis)
|
||||
endResetModel();
|
||||
Q_EMIT showEmojisChanged();
|
||||
}
|
||||
|
||||
#include "moc_emoticonfiltermodel.cpp"
|
||||
|
||||
@@ -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>
|
||||
|
||||
/**
|
||||
|
||||
@@ -165,3 +165,5 @@ QVector<Quotient::ImagePackEventContent::ImagePackImage> ImagePacksModel::images
|
||||
}
|
||||
return m_events[index].images;
|
||||
}
|
||||
|
||||
#include "moc_imagepacksmodel.cpp"
|
||||
|
||||
@@ -169,3 +169,5 @@ void LiveLocationsModel::updateLocationData(LiveLocationData &&data)
|
||||
|
||||
Q_EMIT dataChanged(idx, idx);
|
||||
}
|
||||
|
||||
#include "moc_livelocationsmodel.cpp"
|
||||
|
||||
@@ -127,3 +127,5 @@ QRectF LocationsModel::boundingBox() const
|
||||
}
|
||||
return bbox;
|
||||
}
|
||||
|
||||
#include "moc_locationsmodel.cpp"
|
||||
|
||||
@@ -77,3 +77,5 @@ int MediaMessageFilterModel::getRowForSourceItem(int sourceRow) const
|
||||
{
|
||||
return mapFromSource(sourceModel()->index(sourceRow, 0)).row();
|
||||
}
|
||||
|
||||
#include "moc_mediamessagefiltermodel.cpp"
|
||||
|
||||
@@ -1163,3 +1163,5 @@ void MessageEventModel::createReactionModelForEvent(const Quotient::RoomMessageE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "moc_messageeventmodel.cpp"
|
||||
|
||||
@@ -49,3 +49,5 @@ bool MessageFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sour
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#include "moc_messagefiltermodel.cpp"
|
||||
|
||||
@@ -260,3 +260,5 @@ bool PublicRoomListModel::hasMore() const
|
||||
{
|
||||
return !(attempted && nextBatch.isEmpty());
|
||||
}
|
||||
|
||||
#include "moc_publicroomlistmodel.cpp"
|
||||
|
||||
@@ -443,3 +443,5 @@ QVector<QVariant> PushRuleModel::actionToVariant(PushNotificationAction::Action
|
||||
|
||||
return actions;
|
||||
}
|
||||
|
||||
#include "moc_pushrulemodel.cpp"
|
||||
|
||||
@@ -108,3 +108,5 @@ QHash<int, QByteArray> ReactionModel::roleNames() const
|
||||
{HasLocalUser, "hasLocalUser"},
|
||||
};
|
||||
}
|
||||
|
||||
#include "moc_reactionmodel.cpp"
|
||||
|
||||
@@ -525,3 +525,5 @@ int RoomListModel::rowForRoom(NeoChatRoom *room) const
|
||||
{
|
||||
return m_rooms.indexOf(room);
|
||||
}
|
||||
|
||||
#include "moc_roomlistmodel.cpp"
|
||||
|
||||
@@ -283,3 +283,5 @@ void SearchModel::setSearching(bool searching)
|
||||
m_searching = searching;
|
||||
Q_EMIT searchingChanged();
|
||||
}
|
||||
|
||||
#include "moc_searchmodel.cpp"
|
||||
|
||||
@@ -151,3 +151,5 @@ QHash<int, QByteArray> ServerListModel::roleNames() const
|
||||
{IsDeletableRole, QByteArrayLiteral("isDeletable")},
|
||||
};
|
||||
}
|
||||
|
||||
#include "moc_serverlistmodel.cpp"
|
||||
|
||||
@@ -103,3 +103,5 @@ void SortFilterRoomListModel::setActiveSpaceId(const QString &spaceId)
|
||||
Q_EMIT activeSpaceIdChanged();
|
||||
invalidate();
|
||||
}
|
||||
|
||||
#include "moc_sortfilterroomlistmodel.cpp"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -30,3 +30,5 @@ void StateFilterModel::removeStateEventTypeFiltered(const QString &stateEventTyp
|
||||
invalidateFilter();
|
||||
}
|
||||
}
|
||||
|
||||
#include "moc_statefiltermodel.cpp"
|
||||
|
||||
@@ -70,3 +70,5 @@ QByteArray StateModel::stateEventJson(const QModelIndex &index)
|
||||
return {};
|
||||
#endif
|
||||
}
|
||||
|
||||
#include "moc_statemodel.cpp"
|
||||
|
||||
@@ -127,3 +127,5 @@ void StickerModel::postSticker(int index)
|
||||
};
|
||||
m_room->postJson("m.sticker", content);
|
||||
}
|
||||
|
||||
#include "moc_stickermodel.cpp"
|
||||
|
||||
@@ -194,3 +194,5 @@ int UserDirectoryListModel::rowCount(const QModelIndex &parent) const
|
||||
|
||||
return users.count();
|
||||
}
|
||||
|
||||
#include "moc_userdirectorylistmodel.cpp"
|
||||
|
||||
@@ -26,3 +26,5 @@ void UserFilterModel::setFilterText(const QString &filterText)
|
||||
Q_EMIT filterTextChanged();
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
#include "moc_userfiltermodel.cpp"
|
||||
|
||||
@@ -213,3 +213,5 @@ QHash<int, QByteArray> UserListModel::roleNames() const
|
||||
|
||||
return roles;
|
||||
}
|
||||
|
||||
#include "moc_userlistmodel.cpp"
|
||||
|
||||
@@ -129,3 +129,5 @@ void KWebShortcutModel::configureWebShortcuts()
|
||||
job->exec();
|
||||
#endif
|
||||
}
|
||||
|
||||
#include "moc_webshortcutmodel.cpp"
|
||||
|
||||
Reference in New Issue
Block a user