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:
@@ -183,3 +183,5 @@ void ActionsHandler::checkEffects(const QString &text)
|
||||
Q_EMIT showEffect(*effect);
|
||||
}
|
||||
}
|
||||
|
||||
#include "moc_actionshandler.cpp"
|
||||
|
||||
@@ -355,3 +355,5 @@ void ChatDocumentHandler::setErrorColor(const QColor &color)
|
||||
m_highlighter->rehighlight();
|
||||
Q_EMIT errorColorChanged();
|
||||
}
|
||||
|
||||
#include "moc_chatdocumenthandler.cpp"
|
||||
|
||||
@@ -79,3 +79,5 @@ void Clipboard::setImage(const QUrl &url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "moc_clipboard.cpp"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -746,3 +746,5 @@ QVariantList Controller::getSupportedRoomVersions(Quotient::Connection *connecti
|
||||
|
||||
return supportedRoomVersions;
|
||||
}
|
||||
|
||||
#include "moc_controller.cpp"
|
||||
|
||||
@@ -151,3 +151,5 @@ qreal DelegateSizeHelper::currentWidth() const
|
||||
return std::ceil(std::min(absoluteWidth, m_maxWidth));
|
||||
}
|
||||
}
|
||||
|
||||
#include "moc_delegatesizehelper.cpp"
|
||||
|
||||
@@ -112,3 +112,5 @@ QStringList FileTypeSingleton::supportedAnimatedImageFormats() const
|
||||
Q_D(const FileTypeSingleton);
|
||||
return d->supportedAnimatedImageFormats;
|
||||
}
|
||||
|
||||
#include "moc_filetypesingleton.cpp"
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QMimeDatabase>
|
||||
#include <QObject>
|
||||
#include <qqml.h>
|
||||
|
||||
@@ -89,3 +89,5 @@ void LinkPreviewer::loadUrlPreview()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
#include "moc_linkpreviewer.cpp"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -207,3 +207,5 @@ bool Login::isLoggedIn() const
|
||||
{
|
||||
return m_isLoggedIn;
|
||||
}
|
||||
|
||||
#include "moc_login.cpp"
|
||||
|
||||
@@ -114,3 +114,5 @@ QQuickImageResponse *MatrixImageProvider::requestImageResponse(const QString &id
|
||||
{
|
||||
return new ThumbnailResponse(id, requestedSize);
|
||||
}
|
||||
|
||||
#include "moc_matriximageprovider.cpp"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -103,3 +103,5 @@ Connection *AccountRegistry::get(const QString &userId)
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#include "moc_neochataccountregistry.cpp"
|
||||
|
||||
@@ -2104,3 +2104,5 @@ void NeoChatRoom::loadReply(const QString &eventId, const QString &replyId)
|
||||
Q_EMIT replyLoaded(eventId, replyId);
|
||||
});
|
||||
}
|
||||
|
||||
#include "moc_neochatroom.cpp"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -294,3 +294,5 @@ void NotificationsManager::clearInvitationNotification(const QString &roomId)
|
||||
m_invitations[roomId]->close();
|
||||
}
|
||||
}
|
||||
|
||||
#include "moc_notificationsmanager.cpp"
|
||||
|
||||
@@ -163,3 +163,5 @@ int PollHandler::answerCount() const
|
||||
{
|
||||
return m_answers.size();
|
||||
}
|
||||
|
||||
#include "moc_pollhandler.cpp"
|
||||
|
||||
@@ -291,3 +291,5 @@ void RoomManager::setChatDocumentHandler(ChatDocumentHandler *handler)
|
||||
m_chatDocumentHandler->setRoom(m_currentRoom);
|
||||
Q_EMIT chatDocumentHandlerChanged();
|
||||
}
|
||||
|
||||
#include "moc_roommanager.cpp"
|
||||
|
||||
@@ -94,3 +94,5 @@ void Runner::Run(const QString &id, const QString &actionId)
|
||||
|
||||
WindowController::instance().showAndRaiseWindow(QString());
|
||||
}
|
||||
|
||||
#include "moc_runner.cpp"
|
||||
|
||||
@@ -107,3 +107,5 @@ bool SpaceHierarchyCache::isChildSpace(const QString &spaceId) const
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#include "moc_spacehierarchycache.cpp"
|
||||
|
||||
@@ -448,3 +448,5 @@ QList<QUrl> TextHandler::getLinkPreviews()
|
||||
}
|
||||
return links;
|
||||
}
|
||||
|
||||
#include "moc_texthandler.cpp"
|
||||
|
||||
@@ -35,3 +35,5 @@ TrayIcon::TrayIcon(QObject *parent)
|
||||
|
||||
setContextMenu(menu);
|
||||
}
|
||||
|
||||
#include "moc_trayicon.cpp"
|
||||
|
||||
@@ -32,3 +32,5 @@ void TrayIcon::hide()
|
||||
{
|
||||
setStatus(Passive);
|
||||
}
|
||||
|
||||
#include "moc_trayicon_sni.cpp"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -69,3 +69,5 @@ void WindowController::showAndRaiseWindow(const QString &startupId)
|
||||
KWindowSystem::activateWindow(m_window);
|
||||
#endif
|
||||
}
|
||||
|
||||
#include "moc_windowcontroller.cpp"
|
||||
|
||||
Reference in New Issue
Block a user