mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor(widget): remove Widget singleton in ContentDialog
This commit is contained in:
parent
e7e6bff318
commit
6d0ae67c9d
|
@ -37,10 +37,10 @@
|
|||
#include "src/model/status.h"
|
||||
#include "src/persistence/settings.h"
|
||||
#include "src/widget/contentlayout.h"
|
||||
#include "src/widget/friendwidget.h"
|
||||
#include "src/widget/groupwidget.h"
|
||||
#include "src/widget/form/chatform.h"
|
||||
#include "src/widget/friendlistlayout.h"
|
||||
#include "src/widget/friendwidget.h"
|
||||
#include "src/widget/groupwidget.h"
|
||||
#include "src/widget/style.h"
|
||||
#include "src/widget/tool/adjustingscrollarea.h"
|
||||
#include "src/widget/translator.h"
|
||||
|
@ -141,7 +141,7 @@ ContentDialog::~ContentDialog()
|
|||
Translator::unregister(this);
|
||||
}
|
||||
|
||||
void ContentDialog::closeEvent(QCloseEvent *event)
|
||||
void ContentDialog::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
emit willClose();
|
||||
event->accept();
|
||||
|
@ -499,7 +499,7 @@ void ContentDialog::dropEvent(QDropEvent* event)
|
|||
return;
|
||||
}
|
||||
|
||||
Widget::getInstance()->addFriendDialog(contact, this);
|
||||
emit addFriendDialog(contact, this);
|
||||
ensureSplitterVisible();
|
||||
} else if (group) {
|
||||
assert(event->mimeData()->hasFormat("groupId"));
|
||||
|
@ -509,7 +509,7 @@ void ContentDialog::dropEvent(QDropEvent* event)
|
|||
return;
|
||||
}
|
||||
|
||||
Widget::getInstance()->addGroupDialog(contact, this);
|
||||
emit addGroupDialog(contact, this);
|
||||
ensureSplitterVisible();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,12 +20,12 @@
|
|||
#ifndef CONTENTDIALOG_H
|
||||
#define CONTENTDIALOG_H
|
||||
|
||||
#include "src/model/dialogs/idialogs.h"
|
||||
#include "src/widget/genericchatitemlayout.h"
|
||||
#include "src/widget/tool/activatedialog.h"
|
||||
#include "src/model/status.h"
|
||||
#include "src/core/groupid.h"
|
||||
#include "src/core/toxpk.h"
|
||||
#include "src/model/dialogs/idialogs.h"
|
||||
#include "src/model/status.h"
|
||||
#include "src/widget/genericchatitemlayout.h"
|
||||
#include "src/widget/tool/activatedialog.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
@ -79,6 +79,8 @@ public:
|
|||
signals:
|
||||
void friendDialogShown(const Friend* f);
|
||||
void groupDialogShown(Group* g);
|
||||
void addFriendDialog(Friend* frnd, ContentDialog* contentDialog);
|
||||
void addGroupDialog(Group* group, ContentDialog* contentDialog);
|
||||
void activated();
|
||||
void willClose();
|
||||
|
||||
|
@ -116,7 +118,6 @@ private:
|
|||
void focusCommon(const ContactId& id, QHash<const ContactId&, GenericChatroomWidget*> list);
|
||||
|
||||
private:
|
||||
|
||||
QList<QLayout*> layouts;
|
||||
QSplitter* splitter;
|
||||
FriendListLayout* friendLayout;
|
||||
|
|
|
@ -1820,6 +1820,8 @@ ContentDialog* Widget::createContentDialog() const
|
|||
connect(core, &Core::usernameSet, contentDialog, &ContentDialog::setUsername);
|
||||
connect(&settings, &Settings::groupchatPositionChanged, contentDialog,
|
||||
&ContentDialog::reorderLayouts);
|
||||
connect(contentDialog, &ContentDialog::addFriendDialog, this, &Widget::addFriendDialog);
|
||||
connect(contentDialog, &ContentDialog::addGroupDialog, this, &Widget::addGroupDialog);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
Nexus& n = Nexus::getInstance();
|
||||
|
|
Loading…
Reference in New Issue
Block a user