mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor: Remove ChatForm creation from Friend
This commit is contained in:
parent
ad58c1767b
commit
3473090ec1
|
@ -37,8 +37,6 @@ Friend::Friend(uint32_t friendId, const ToxPk& friendPk, const QString& userAlia
|
|||
if (userName.isEmpty()) {
|
||||
userName = friendPk.toString();
|
||||
}
|
||||
|
||||
chatForm = new ChatForm(this);
|
||||
}
|
||||
|
||||
Friend::~Friend()
|
||||
|
@ -142,3 +140,8 @@ ChatForm* Friend::getChatForm() const
|
|||
{
|
||||
return chatForm;
|
||||
}
|
||||
|
||||
void Friend::setChatForm(ChatForm* form)
|
||||
{
|
||||
chatForm = form;
|
||||
}
|
||||
|
|
|
@ -57,9 +57,9 @@ public:
|
|||
Status getStatus() const;
|
||||
|
||||
ChatForm* getChatForm() const;
|
||||
void setChatForm(ChatForm* form);
|
||||
|
||||
signals:
|
||||
// TODO: move signals to DB object
|
||||
void nameChanged(uint32_t friendId, const QString& name);
|
||||
void aliasChanged(uint32_t friendId, QString alias);
|
||||
void statusChanged(uint32_t friendId, Status status);
|
||||
|
|
|
@ -963,10 +963,11 @@ void Widget::addFriend(int friendId, const ToxPk& friendPk)
|
|||
Friend* newfriend = FriendList::addFriend(friendId, friendPk);
|
||||
bool compact = Settings::getInstance().getCompactLayout();
|
||||
FriendWidget* widget = new FriendWidget(newfriend, compact);
|
||||
|
||||
ChatForm* friendForm = newfriend->getChatForm();
|
||||
ChatForm* friendForm = new ChatForm(newfriend);
|
||||
newfriend->setChatForm(friendForm);
|
||||
|
||||
friendWidgets[friendId] = widget;
|
||||
chatForms[friendId] = friendForm;
|
||||
newfriend->loadHistory();
|
||||
|
||||
const Settings& s = Settings::getInstance();
|
||||
|
|
|
@ -38,6 +38,7 @@ namespace Ui {
|
|||
class MainWindow;
|
||||
}
|
||||
|
||||
class ChatForm;
|
||||
class GenericChatroomWidget;
|
||||
class FriendWidget;
|
||||
class Group;
|
||||
|
@ -293,6 +294,7 @@ private:
|
|||
int icon_size;
|
||||
|
||||
QMap<int, FriendWidget*> friendWidgets;
|
||||
QMap<int, ChatForm*> chatForms;
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
QAction* fileMenu;
|
||||
|
|
Loading…
Reference in New Issue
Block a user