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

@@ -183,3 +183,5 @@ void ActionsHandler::checkEffects(const QString &text)
Q_EMIT showEffect(*effect);
}
}
#include "moc_actionshandler.cpp"

View File

@@ -355,3 +355,5 @@ void ChatDocumentHandler::setErrorColor(const QColor &color)
m_highlighter->rehighlight();
Q_EMIT errorColorChanged();
}
#include "moc_chatdocumenthandler.cpp"

View File

@@ -79,3 +79,5 @@ void Clipboard::setImage(const QUrl &url)
}
}
}
#include "moc_clipboard.cpp"

View File

@@ -44,3 +44,5 @@ QString ColorSchemer::nameForIndex(int index) const
{
return c->model()->data(c->model()->index(index, 0), Qt::DisplayRole).toString();
}
#include "moc_colorschemer.cpp"

View File

@@ -746,3 +746,5 @@ QVariantList Controller::getSupportedRoomVersions(Quotient::Connection *connecti
return supportedRoomVersions;
}
#include "moc_controller.cpp"

View File

@@ -151,3 +151,5 @@ qreal DelegateSizeHelper::currentWidth() const
return std::ceil(std::min(absoluteWidth, m_maxWidth));
}
}
#include "moc_delegatesizehelper.cpp"

View File

@@ -112,3 +112,5 @@ QStringList FileTypeSingleton::supportedAnimatedImageFormats() const
Q_D(const FileTypeSingleton);
return d->supportedAnimatedImageFormats;
}
#include "moc_filetypesingleton.cpp"

View File

@@ -5,6 +5,7 @@
#pragma once
#include <QFileInfo>
#include <QMimeDatabase>
#include <QObject>
#include <qqml.h>

View File

@@ -89,3 +89,5 @@ void LinkPreviewer::loadUrlPreview()
});
}
}
#include "moc_linkpreviewer.cpp"

View File

@@ -42,3 +42,5 @@ float LocationHelper::zoomToFit(const QRectF &r, float mapWidth, float mapHeight
return std::clamp(z, 5.0, 18.0);
}
#include "moc_locationhelper.cpp"

View File

@@ -1,5 +1,6 @@
// SPDX-FileCopyrightText: 2023 Volker Krause <vkrause@kde.org>
// SPDX-License-Identifier: LGPL-2.0-or-later
#pragma once
#include "linkpreviewer.h"
#include <QMetaType>

View File

@@ -207,3 +207,5 @@ bool Login::isLoggedIn() const
{
return m_isLoggedIn;
}
#include "moc_login.cpp"

View File

@@ -114,3 +114,5 @@ QQuickImageResponse *MatrixImageProvider::requestImageResponse(const QString &id
{
return new ThumbnailResponse(id, requestedSize);
}
#include "moc_matriximageprovider.cpp"

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"

View File

@@ -103,3 +103,5 @@ Connection *AccountRegistry::get(const QString &userId)
}
return nullptr;
}
#include "moc_neochataccountregistry.cpp"

View File

@@ -2104,3 +2104,5 @@ void NeoChatRoom::loadReply(const QString &eventId, const QString &replyId)
Q_EMIT replyLoaded(eventId, replyId);
});
}
#include "moc_neochatroom.cpp"

View File

@@ -39,3 +39,5 @@ void NeoChatUser::polishColor()
// https://github.com/quotient-im/libQuotient/wiki/User-color-coding-standard-draft-proposal
setColor(QColor::fromHslF(hueF(), 1, -0.7 * lightness + 0.9, 1));
}
#include "moc_neochatuser.cpp"

View File

@@ -294,3 +294,5 @@ void NotificationsManager::clearInvitationNotification(const QString &roomId)
m_invitations[roomId]->close();
}
}
#include "moc_notificationsmanager.cpp"

View File

@@ -163,3 +163,5 @@ int PollHandler::answerCount() const
{
return m_answers.size();
}
#include "moc_pollhandler.cpp"

View File

@@ -291,3 +291,5 @@ void RoomManager::setChatDocumentHandler(ChatDocumentHandler *handler)
m_chatDocumentHandler->setRoom(m_currentRoom);
Q_EMIT chatDocumentHandlerChanged();
}
#include "moc_roommanager.cpp"

View File

@@ -94,3 +94,5 @@ void Runner::Run(const QString &id, const QString &actionId)
WindowController::instance().showAndRaiseWindow(QString());
}
#include "moc_runner.cpp"

View File

@@ -107,3 +107,5 @@ bool SpaceHierarchyCache::isChildSpace(const QString &spaceId) const
}
return false;
}
#include "moc_spacehierarchycache.cpp"

View File

@@ -448,3 +448,5 @@ QList<QUrl> TextHandler::getLinkPreviews()
}
return links;
}
#include "moc_texthandler.cpp"

View File

@@ -35,3 +35,5 @@ TrayIcon::TrayIcon(QObject *parent)
setContextMenu(menu);
}
#include "moc_trayicon.cpp"

View File

@@ -32,3 +32,5 @@ void TrayIcon::hide()
{
setStatus(Passive);
}
#include "moc_trayicon_sni.cpp"

View File

@@ -29,3 +29,5 @@ void UrlHelper::copyTo(const QUrl &origin, const QUrl &destination)
QFile originFile(origin.toLocalFile());
originFile.copy(destination.toLocalFile());
}
#include "moc_urlhelper.cpp"

View File

@@ -69,3 +69,5 @@ void WindowController::showAndRaiseWindow(const QString &startupId)
KWindowSystem::activateWindow(m_window);
#endif
}
#include "moc_windowcontroller.cpp"