Skip to content

Commit

Permalink
cleanup: Minimise direct dependencies on core.h.
Browse files Browse the repository at this point in the history
And transitively on tox.h. This reduces the amount of rebuild that needs
to happen when we change tox.h.
  • Loading branch information
iphydf committed Nov 17, 2024
1 parent ac039b9 commit b699420
Show file tree
Hide file tree
Showing 20 changed files with 47 additions and 43 deletions.
1 change: 1 addition & 0 deletions src/chatlog/chatwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "content/filetransferwidget.h"
#include "content/text.h"
#include "src/chatlog/chatlinestorage.h"
#include "src/core/core.h"
#include "src/persistence/settings.h"
#include "src/widget/style.h"
#include "src/widget/translator.h"
Expand Down
4 changes: 2 additions & 2 deletions src/core/corefile.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@

#pragma once

#include <tox/tox.h>
#include <tox/tox.h> // Tox_File_Control

#include "toxfile.h"
#include "src/core/core.h"
#include "src/core/toxpk.h"
#include "src/model/status.h"

Expand All @@ -23,6 +22,7 @@
#include <memory>

struct Tox;
class Core;
class CoreFile;

using CoreFilePtr = std::unique_ptr<CoreFile>;
Expand Down
1 change: 1 addition & 0 deletions src/model/chatroom/friendchatroom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

#include "src/model/chatroom/friendchatroom.h"
#include "src/core/core.h"
#include "src/grouplist.h"
#include "src/model/dialogs/idialogsmanager.h"
#include "src/model/friend.h"
Expand Down
1 change: 0 additions & 1 deletion src/model/friend.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#include "chat.h"
#include "src/core/chatid.h"
#include "src/core/core.h"
#include "src/core/extension.h"
#include "src/core/toxpk.h"
#include "src/model/status.h"
Expand Down
1 change: 0 additions & 1 deletion src/model/ichatlog.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#pragma once

#include "message.h"
#include "src/core/core.h"
#include "src/core/toxfile.h"
#include "src/core/toxpk.h"
#include "src/friendlist.h"
Expand Down
1 change: 1 addition & 0 deletions src/model/imessagedispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "src/model/brokenmessagereason.h"
#include "src/model/friend.h"
#include "src/model/message.h"
#include "util/strongtype.h"

#include <QObject>
#include <QString>
Expand Down
3 changes: 2 additions & 1 deletion src/persistence/history.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#include <QDebug>
#include <cassert>

#include "history.h"
#include <tox/tox.h>

#include "profile.h"
#include "settings.h"
#include "db/rawdatabase.h"
Expand Down
3 changes: 1 addition & 2 deletions src/persistence/offlinemsgengine.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#pragma once

#include "src/chatlog/chatmessage.h"
#include "src/core/core.h"
#include "src/core/receiptnum.h"
#include "src/model/message.h"
#include "src/persistence/db/rawdatabase.h"

Expand All @@ -17,7 +17,6 @@
#include <QSet>
#include <chrono>


class OfflineMsgEngine : public QObject
{
Q_OBJECT
Expand Down
11 changes: 5 additions & 6 deletions src/persistence/profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@

#pragma once

#include "src/core/core.h"
#include "src/core/toxencrypt.h"

#include "src/net/avatarbroadcaster.h"

#include "src/net/bootstrapnodeupdater.h"
#include "src/persistence/history.h"

Expand All @@ -21,11 +18,13 @@
#include <QVector>
#include <memory>

class Settings;
class QCommandLineParser;
class ToxPk;
class CameraSource;
class Core;
class CoreAV;
class IMessageBoxManager;
class QCommandLineParser;
class Settings;
class ToxPk;

class Profile : public QObject
{
Expand Down
1 change: 0 additions & 1 deletion src/widget/categorywidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#pragma once

#include "genericchatitemwidget.h"
#include "src/core/core.h"
#include "src/model/status.h"

class FriendListLayout;
Expand Down
20 changes: 10 additions & 10 deletions src/widget/form/chatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <QTimer>

#include "genericchatform.h"
#include "src/core/core.h"
#include "src/model/ichatlog.h"
#include "src/model/imessagedispatcher.h"
#include "src/model/status.h"
Expand All @@ -20,23 +19,24 @@
#include "src/widget/tool/screenshotgrabber.h"

class CallConfirmWidget;
class ContentDialogManager;
class Core;
class DocumentCache;
class FileTransferInstance;
class Friend;
class FriendList;
class GroupList;
class History;
class ImagePreviewButton;
class IMessageBoxManager;
class OfflineMsgEngine;
class QPixmap;
class Profile;
class QHideEvent;
class QMoveEvent;
class ImagePreviewButton;
class DocumentCache;
class SmileyPack;
class QPixmap;
class Settings;
class SmileyPack;
class Style;
class Profile;
class IMessageBoxManager;
class ContentDialogManager;
class FriendList;
class GroupList;

class ChatForm : public GenericChatForm
{
Expand Down
1 change: 1 addition & 0 deletions src/widget/form/filesform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

#include "filesform.h"
#include "src/core/corefile.h"
#include "src/core/toxfile.h"
#include "src/friendlist.h"
#include "src/widget/contentlayout.h"
Expand Down
8 changes: 4 additions & 4 deletions src/widget/form/filesform.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#pragma once

#include "src/core/corefile.h"
#include "src/core/toxfile.h"

#include <QAbstractTableModel>
Expand All @@ -19,12 +18,13 @@
#include <QVBoxLayout>

class ContentLayout;
class CoreFile;
class FriendList;
class IMessageBoxManager;
class QFileInfo;
class QTableView;
class Settings;
class Style;
class QFileInfo;
class IMessageBoxManager;
class FriendList;

namespace FileTransferList {

Expand Down
1 change: 0 additions & 1 deletion src/widget/friendlistlayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#pragma once

#include "genericchatitemlayout.h"
#include "src/core/core.h"
#include "src/model/status.h"
#include <QBoxLayout>

Expand Down
1 change: 1 addition & 0 deletions src/widget/friendlistwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "friendwidget.h"
#include "groupwidget.h"
#include "widget.h"
#include "src/core/core.h"
#include "src/friendlist.h"
#include "src/model/friend.h"
#include "src/model/friendlist/friendlistmanager.h"
Expand Down
26 changes: 13 additions & 13 deletions src/widget/friendlistwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@
#pragma once

#include "genericchatitemlayout.h"
#include "src/core/core.h"
#include "src/model/status.h"
#include "src/persistence/settings.h"

#include <QWidget>

class QVBoxLayout;
class QGridLayout;
class QPixmap;
class Widget;
class FriendWidget;
class GroupWidget;
class CategoryWidget;
class CircleWidget;
class Core;
class Friend;
class FriendList;
class FriendListManager;
class FriendWidget;
class GenericChatroomWidget;
class CategoryWidget;
class Friend;
class GroupList;
class GroupWidget;
class IFriendListItem;
class Settings;
class Style;
class IMessageBoxManager;
class FriendList;
class GroupList;
class Profile;
class QGridLayout;
class QPixmap;
class QVBoxLayout;
class Settings;
class Style;
class Widget;

class FriendListWidget : public QWidget
{
Expand Down
1 change: 0 additions & 1 deletion src/widget/widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#include "audio/iaudiocontrol.h"
#include "audio/iaudiosink.h"
#include "src/core/core.h"
#include "src/core/groupid.h"
#include "src/core/toxfile.h"
#include "src/core/toxid.h"
Expand Down
2 changes: 2 additions & 0 deletions test/model/friendmessagedispatcher_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include <deque>
#include <set>

#include <tox/tox.h> // tox_max_message_length

namespace {
constexpr uint64_t testMaxExtendedMessageSize = 10 * 1024 * 1024;
}
Expand Down
1 change: 1 addition & 0 deletions test/model/groupmessagedispatcher_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <deque>
#include <set>

#include <tox/tox.h> // tox_max_message_length

class MockGroupMessageSender : public ICoreGroupMessageSender
{
Expand Down
2 changes: 2 additions & 0 deletions test/widget/filesform_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <QTest>
#include <limits>

#include <tox/tox.h> // TOX_FILE_KIND_*

class TestFileTransferList : public QObject
{
Q_OBJECT
Expand Down

0 comments on commit b699420

Please sign in to comment.