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()) {
|
if (userName.isEmpty()) {
|
||||||
userName = friendPk.toString();
|
userName = friendPk.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
chatForm = new ChatForm(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Friend::~Friend()
|
Friend::~Friend()
|
||||||
|
@ -142,3 +140,8 @@ ChatForm* Friend::getChatForm() const
|
||||||
{
|
{
|
||||||
return chatForm;
|
return chatForm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Friend::setChatForm(ChatForm* form)
|
||||||
|
{
|
||||||
|
chatForm = form;
|
||||||
|
}
|
||||||
|
|
|
@ -57,9 +57,9 @@ public:
|
||||||
Status getStatus() const;
|
Status getStatus() const;
|
||||||
|
|
||||||
ChatForm* getChatForm() const;
|
ChatForm* getChatForm() const;
|
||||||
|
void setChatForm(ChatForm* form);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
// TODO: move signals to DB object
|
|
||||||
void nameChanged(uint32_t friendId, const QString& name);
|
void nameChanged(uint32_t friendId, const QString& name);
|
||||||
void aliasChanged(uint32_t friendId, QString alias);
|
void aliasChanged(uint32_t friendId, QString alias);
|
||||||
void statusChanged(uint32_t friendId, Status status);
|
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);
|
Friend* newfriend = FriendList::addFriend(friendId, friendPk);
|
||||||
bool compact = Settings::getInstance().getCompactLayout();
|
bool compact = Settings::getInstance().getCompactLayout();
|
||||||
FriendWidget* widget = new FriendWidget(newfriend, compact);
|
FriendWidget* widget = new FriendWidget(newfriend, compact);
|
||||||
|
ChatForm* friendForm = new ChatForm(newfriend);
|
||||||
ChatForm* friendForm = newfriend->getChatForm();
|
newfriend->setChatForm(friendForm);
|
||||||
|
|
||||||
friendWidgets[friendId] = widget;
|
friendWidgets[friendId] = widget;
|
||||||
|
chatForms[friendId] = friendForm;
|
||||||
newfriend->loadHistory();
|
newfriend->loadHistory();
|
||||||
|
|
||||||
const Settings& s = Settings::getInstance();
|
const Settings& s = Settings::getInstance();
|
||||||
|
|
|
@ -38,6 +38,7 @@ namespace Ui {
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ChatForm;
|
||||||
class GenericChatroomWidget;
|
class GenericChatroomWidget;
|
||||||
class FriendWidget;
|
class FriendWidget;
|
||||||
class Group;
|
class Group;
|
||||||
|
@ -293,6 +294,7 @@ private:
|
||||||
int icon_size;
|
int icon_size;
|
||||||
|
|
||||||
QMap<int, FriendWidget*> friendWidgets;
|
QMap<int, FriendWidget*> friendWidgets;
|
||||||
|
QMap<int, ChatForm*> chatForms;
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
QAction* fileMenu;
|
QAction* fileMenu;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user