1
0
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:
Diadlo 2017-09-28 00:36:52 +03:00
parent 7f2bd726ef
commit 68813a37c3
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
2 changed files with 5 additions and 7 deletions

View File

@ -26,7 +26,6 @@
#include "src/model/groupinvite.h"
#include "src/nexus.h"
#include "src/persistence/profile.h"
#include "src/persistence/settings.h"
#include "src/widget/gui.h"
#include <QCoreApplication>
@ -607,8 +606,6 @@ void Core::requestFriendship(const ToxId& friendId, const QString& message)
emit failedToAddFriend(friendPk);
} else {
qDebug() << "Requested friendship of " << friendNumber;
Settings::getInstance().updateFriendAddress(friendId.toString());
emit friendAdded(friendNumber, friendPk);
emit requestSent(friendPk, message);
}

View File

@ -967,8 +967,11 @@ void Widget::onCallEnd(uint32_t friendId)
void Widget::addFriend(int friendId, const ToxPk& friendPk)
{
Settings& s = Settings::getInstance();
s.updateFriendAddress(friendPk.toString());
Friend* newfriend = FriendList::addFriend(friendId, friendPk);
bool compact = Settings::getInstance().getCompactLayout();
bool compact = s.getCompactLayout();
FriendWidget* widget = new FriendWidget(newfriend, compact);
ChatForm* friendForm = new ChatForm(newfriend);
newfriend->setChatForm(friendForm);
@ -977,12 +980,10 @@ void Widget::addFriend(int friendId, const ToxPk& friendPk)
chatForms[friendId] = friendForm;
newfriend->loadHistory();
const Settings& s = Settings::getInstance();
QDate activityDate = s.getFriendActivity(friendPk);
QDate chatDate = friendForm->getLatestDate();
if (chatDate > activityDate && chatDate.isValid()) {
Settings::getInstance().setFriendActivity(friendPk, chatDate);
s.setFriendActivity(friendPk, chatDate);
}
contactListWidget->addFriendWidget(widget, Status::Offline, s.getFriendCircleID(friendPk));