Browse Source

refactor: Remove Settings from Core

pull/4696/head
Diadlo 8 years ago
parent
commit
68813a37c3
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
  1. 3
      src/core/core.cpp
  2. 9
      src/widget/widget.cpp

3
src/core/core.cpp

@ -26,7 +26,6 @@ @@ -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) @@ -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);
}

9
src/widget/widget.cpp

@ -967,8 +967,11 @@ void Widget::onCallEnd(uint32_t friendId) @@ -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) @@ -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));

Loading…
Cancel
Save