mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Fix #1409: Don't save core if nothing really changed
This commit is contained in:
parent
94f3e6d6e4
commit
8253e1e395
|
@ -740,6 +740,9 @@ QString Core::getUsername() const
|
||||||
|
|
||||||
void Core::setUsername(const QString& username)
|
void Core::setUsername(const QString& username)
|
||||||
{
|
{
|
||||||
|
if (username == getUsername())
|
||||||
|
return;
|
||||||
|
|
||||||
CString cUsername(username);
|
CString cUsername(username);
|
||||||
|
|
||||||
if (tox_self_set_name(tox, cUsername.data(), cUsername.size(), nullptr) == false)
|
if (tox_self_set_name(tox, cUsername.data(), cUsername.size(), nullptr) == false)
|
||||||
|
@ -813,6 +816,9 @@ Status Core::getStatus() const
|
||||||
|
|
||||||
void Core::setStatusMessage(const QString& message)
|
void Core::setStatusMessage(const QString& message)
|
||||||
{
|
{
|
||||||
|
if (message == getStatusMessage())
|
||||||
|
return;
|
||||||
|
|
||||||
CString cMessage(message);
|
CString cMessage(message);
|
||||||
|
|
||||||
if (tox_self_set_status_message(tox, cMessage.data(), cMessage.size(), nullptr) == false)
|
if (tox_self_set_status_message(tox, cMessage.data(), cMessage.size(), nullptr) == false)
|
||||||
|
|
|
@ -81,12 +81,6 @@ void AndroidGUI::onDisconnected()
|
||||||
emit statusSet(Status::Offline);
|
emit statusSet(Status::Offline);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidGUI::onUsernameChanged(const QString& newUsername, const QString& oldUsername)
|
|
||||||
{
|
|
||||||
setUsername(oldUsername); // restore old username until Core tells us to set it
|
|
||||||
Nexus::getCore()->setUsername(newUsername);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AndroidGUI::setUsername(const QString& username)
|
void AndroidGUI::setUsername(const QString& username)
|
||||||
{
|
{
|
||||||
QString sanename = username;
|
QString sanename = username;
|
||||||
|
@ -95,11 +89,6 @@ void AndroidGUI::setUsername(const QString& username)
|
||||||
sanitizedNameMention = QRegExp("\\b" + QRegExp::escape(sanename) + "\\b", Qt::CaseInsensitive);
|
sanitizedNameMention = QRegExp("\\b" + QRegExp::escape(sanename) + "\\b", Qt::CaseInsensitive);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidGUI::onStatusMessageChanged(const QString& newStatusMessage, const QString& oldStatusMessage)
|
|
||||||
{
|
|
||||||
Nexus::getCore()->setStatusMessage(newStatusMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AndroidGUI::setStatusMessage(const QString &statusMessage)
|
void AndroidGUI::setStatusMessage(const QString &statusMessage)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -59,10 +59,6 @@ private:
|
||||||
void reloadTheme();
|
void reloadTheme();
|
||||||
virtual void keyPressEvent(QKeyEvent* event) final override;
|
virtual void keyPressEvent(QKeyEvent* event) final override;
|
||||||
|
|
||||||
private slots:
|
|
||||||
void onUsernameChanged(const QString& newUsername, const QString& oldUsername);
|
|
||||||
void onStatusMessageChanged(const QString& newStatusMessage, const QString& oldStatusMessage);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::Android* ui;
|
Ui::Android* ui;
|
||||||
MaskablePixmapWidget* profilePicture;
|
MaskablePixmapWidget* profilePicture;
|
||||||
|
|
|
@ -828,12 +828,6 @@ void Widget::hideMainForms(GenericChatroomWidget* chatroomWidget)
|
||||||
activeChatroomWidget = chatroomWidget;
|
activeChatroomWidget = chatroomWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::onUsernameChanged(const QString& newUsername, const QString& oldUsername)
|
|
||||||
{
|
|
||||||
setUsername(oldUsername); // restore old username until Core tells us to set it
|
|
||||||
Nexus::getCore()->setUsername(newUsername);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Widget::setUsername(const QString& username)
|
void Widget::setUsername(const QString& username)
|
||||||
{
|
{
|
||||||
if (username.isEmpty())
|
if (username.isEmpty())
|
||||||
|
|
|
@ -164,7 +164,6 @@ private slots:
|
||||||
void onGroupClicked();
|
void onGroupClicked();
|
||||||
void onTransferClicked();
|
void onTransferClicked();
|
||||||
void showProfile();
|
void showProfile();
|
||||||
void onUsernameChanged(const QString& newUsername, const QString& oldUsername);
|
|
||||||
void onChatroomWidgetClicked(GenericChatroomWidget *, bool group);
|
void onChatroomWidgetClicked(GenericChatroomWidget *, bool group);
|
||||||
void onStatusMessageChanged(const QString& newStatusMessage);
|
void onStatusMessageChanged(const QString& newStatusMessage);
|
||||||
void removeFriend(int friendId);
|
void removeFriend(int friendId);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user