mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor: remove getInstance() from groupchatroom.cpp
This commit is contained in:
parent
040a833d56
commit
c5e21be0f8
|
@ -28,9 +28,10 @@
|
|||
#include "src/model/status.h"
|
||||
#include "src/persistence/settings.h"
|
||||
|
||||
GroupChatroom::GroupChatroom(Group* group, IDialogsManager* dialogsManager)
|
||||
GroupChatroom::GroupChatroom(Group* group, IDialogsManager* dialogsManager, Core& _core)
|
||||
: group{group}
|
||||
, dialogsManager{dialogsManager}
|
||||
, core{_core}
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -68,7 +69,7 @@ void GroupChatroom::inviteFriend(const ToxPk& pk)
|
|||
const auto canInvite = Status::isOnline(frnd->getStatus());
|
||||
|
||||
if (canInvite) {
|
||||
Core::getInstance()->groupInviteFriend(friendId, groupId);
|
||||
core.groupInviteFriend(friendId, groupId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <QObject>
|
||||
|
||||
class Core;
|
||||
class IDialogsManager;
|
||||
class Group;
|
||||
class ToxPk;
|
||||
|
@ -31,7 +32,7 @@ class GroupChatroom : public QObject, public Chatroom
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GroupChatroom(Group* group, IDialogsManager* dialogsManager);
|
||||
GroupChatroom(Group* group, IDialogsManager* dialogsManager, Core& _core);
|
||||
|
||||
Contact* getContact() override;
|
||||
|
||||
|
@ -50,4 +51,5 @@ public:
|
|||
private:
|
||||
Group* group{nullptr};
|
||||
IDialogsManager* dialogsManager{nullptr};
|
||||
Core& core;
|
||||
};
|
||||
|
|
|
@ -2068,7 +2068,7 @@ Group* Widget::createGroup(uint32_t groupnumber, const GroupId& groupId)
|
|||
});
|
||||
}
|
||||
auto dialogManager = ContentDialogManager::getInstance();
|
||||
auto rawChatroom = new GroupChatroom(newgroup, dialogManager);
|
||||
auto rawChatroom = new GroupChatroom(newgroup, dialogManager, *core);
|
||||
std::shared_ptr<GroupChatroom> chatroom(rawChatroom);
|
||||
|
||||
const auto compact = settings.getCompactLayout();
|
||||
|
|
Loading…
Reference in New Issue
Block a user