mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor: Remove Settings from Core
This commit is contained in:
parent
7f2bd726ef
commit
68813a37c3
|
@ -26,7 +26,6 @@
|
||||||
#include "src/model/groupinvite.h"
|
#include "src/model/groupinvite.h"
|
||||||
#include "src/nexus.h"
|
#include "src/nexus.h"
|
||||||
#include "src/persistence/profile.h"
|
#include "src/persistence/profile.h"
|
||||||
#include "src/persistence/settings.h"
|
|
||||||
#include "src/widget/gui.h"
|
#include "src/widget/gui.h"
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
@ -607,8 +606,6 @@ void Core::requestFriendship(const ToxId& friendId, const QString& message)
|
||||||
emit failedToAddFriend(friendPk);
|
emit failedToAddFriend(friendPk);
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "Requested friendship of " << friendNumber;
|
qDebug() << "Requested friendship of " << friendNumber;
|
||||||
Settings::getInstance().updateFriendAddress(friendId.toString());
|
|
||||||
|
|
||||||
emit friendAdded(friendNumber, friendPk);
|
emit friendAdded(friendNumber, friendPk);
|
||||||
emit requestSent(friendPk, message);
|
emit requestSent(friendPk, message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -967,8 +967,11 @@ void Widget::onCallEnd(uint32_t friendId)
|
||||||
|
|
||||||
void Widget::addFriend(int friendId, const ToxPk& friendPk)
|
void Widget::addFriend(int friendId, const ToxPk& friendPk)
|
||||||
{
|
{
|
||||||
|
Settings& s = Settings::getInstance();
|
||||||
|
s.updateFriendAddress(friendPk.toString());
|
||||||
|
|
||||||
Friend* newfriend = FriendList::addFriend(friendId, friendPk);
|
Friend* newfriend = FriendList::addFriend(friendId, friendPk);
|
||||||
bool compact = Settings::getInstance().getCompactLayout();
|
bool compact = s.getCompactLayout();
|
||||||
FriendWidget* widget = new FriendWidget(newfriend, compact);
|
FriendWidget* widget = new FriendWidget(newfriend, compact);
|
||||||
ChatForm* friendForm = new ChatForm(newfriend);
|
ChatForm* friendForm = new ChatForm(newfriend);
|
||||||
newfriend->setChatForm(friendForm);
|
newfriend->setChatForm(friendForm);
|
||||||
|
@ -977,12 +980,10 @@ void Widget::addFriend(int friendId, const ToxPk& friendPk)
|
||||||
chatForms[friendId] = friendForm;
|
chatForms[friendId] = friendForm;
|
||||||
newfriend->loadHistory();
|
newfriend->loadHistory();
|
||||||
|
|
||||||
const Settings& s = Settings::getInstance();
|
|
||||||
|
|
||||||
QDate activityDate = s.getFriendActivity(friendPk);
|
QDate activityDate = s.getFriendActivity(friendPk);
|
||||||
QDate chatDate = friendForm->getLatestDate();
|
QDate chatDate = friendForm->getLatestDate();
|
||||||
if (chatDate > activityDate && chatDate.isValid()) {
|
if (chatDate > activityDate && chatDate.isValid()) {
|
||||||
Settings::getInstance().setFriendActivity(friendPk, chatDate);
|
s.setFriendActivity(friendPk, chatDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
contactListWidget->addFriendWidget(widget, Status::Offline, s.getFriendCircleID(friendPk));
|
contactListWidget->addFriendWidget(widget, Status::Offline, s.getFriendCircleID(friendPk));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user