1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

cleanup "sign in change", since it's unnecessary

This commit is contained in:
dubslow 2014-10-16 09:07:35 -05:00 committed by Tux3 / Mlkj / !Lev.uXFMLA
parent 8788931f36
commit 8be4725acd
9 changed files with 9 additions and 56 deletions

View File

@ -410,7 +410,7 @@ void Core::onUserStatusChanged(Tox*/* tox*/, int friendId, uint8_t userstatus, v
void Core::onConnectionStatusChanged(Tox*/* tox*/, int friendId, uint8_t status, void* core) void Core::onConnectionStatusChanged(Tox*/* tox*/, int friendId, uint8_t status, void* core)
{ {
Status friendStatus = status ? Status::Online : Status::Offline; Status friendStatus = status ? Status::Online : Status::Offline;
emit static_cast<Core*>(core)->friendSignedIn(friendId, friendStatus); emit static_cast<Core*>(core)->friendStatusChanged(friendId, friendStatus);
if (friendStatus == Status::Offline) { if (friendStatus == Status::Offline) {
static_cast<Core*>(core)->checkLastOnline(friendId); static_cast<Core*>(core)->checkLastOnline(friendId);

View File

@ -115,7 +115,6 @@ signals:
void friendAdded(int friendId, const QString& userId); void friendAdded(int friendId, const QString& userId);
void friendStatusChanged(int friendId, Status status); void friendStatusChanged(int friendId, Status status);
void friendSignedIn(int friendId, Status friendStatus);
void friendStatusMessageChanged(int friendId, const QString& message); void friendStatusMessageChanged(int friendId, const QString& message);
void friendUsernameChanged(int friendId, const QString& username); void friendUsernameChanged(int friendId, const QString& username);
void friendTypingChanged(int friendId, bool isTyping); void friendTypingChanged(int friendId, bool isTyping);

View File

@ -139,7 +139,6 @@ void Settings::load()
useNativeStyle = s.value("nativeStyle", false).toBool(); useNativeStyle = s.value("nativeStyle", false).toBool();
style = s.value("style", "None").toString(); style = s.value("style", "None").toString();
statusChangeNotificationEnabled = s.value("statusChangeNotificationEnabled", false).toBool(); statusChangeNotificationEnabled = s.value("statusChangeNotificationEnabled", false).toBool();
signInNotificationEnabled = s.value("signInNotificationEnabled", false).toBool();
s.endGroup(); s.endGroup();
s.beginGroup("State"); s.beginGroup("State");
@ -248,7 +247,6 @@ void Settings::save(QString path)
s.setValue("nativeStyle", useNativeStyle); s.setValue("nativeStyle", useNativeStyle);
s.setValue("style",style); s.setValue("style",style);
s.setValue("statusChangeNotificationEnabled", statusChangeNotificationEnabled); s.setValue("statusChangeNotificationEnabled", statusChangeNotificationEnabled);
s.setValue("signInNotificationEnabled", signInNotificationEnabled);
s.endGroup(); s.endGroup();
s.beginGroup("State"); s.beginGroup("State");
@ -381,16 +379,6 @@ void Settings::setAutostartInTray(bool newValue)
autostartInTray = newValue; autostartInTray = newValue;
} }
bool Settings::getSignInNotificationEnabled() const
{
return signInNotificationEnabled;
}
void Settings::setSignInNotificationEnabled(bool newValue)
{
signInNotificationEnabled = newValue;
}
bool Settings::getStatusChangeNotificationEnabled() const bool Settings::getStatusChangeNotificationEnabled() const
{ {
return statusChangeNotificationEnabled; return statusChangeNotificationEnabled;

View File

@ -137,10 +137,7 @@ public:
bool isMinimizeOnCloseEnabled() const; bool isMinimizeOnCloseEnabled() const;
void setMinimizeOnClose(bool newValue); void setMinimizeOnClose(bool newValue);
bool getSignInNotificationEnabled() const;
void setSignInNotificationEnabled(bool newValue);
bool getStatusChangeNotificationEnabled() const; bool getStatusChangeNotificationEnabled() const;
void setStatusChangeNotificationEnabled(bool newValue); void setStatusChangeNotificationEnabled(bool newValue);
@ -218,7 +215,6 @@ private:
int firstColumnHandlePos; int firstColumnHandlePos;
int secondColumnHandlePosFromRight; int secondColumnHandlePosFromRight;
QString timestampFormat; QString timestampFormat;
bool signInNotificationEnabled;
bool statusChangeNotificationEnabled; bool statusChangeNotificationEnabled;
// Privacy // Privacy

View File

@ -34,7 +34,6 @@ GeneralForm::GeneralForm() :
bodyUI->cbMakeToxPortable->setChecked(Settings::getInstance().getMakeToxPortable()); bodyUI->cbMakeToxPortable->setChecked(Settings::getInstance().getMakeToxPortable());
bodyUI->startInTray->setChecked(Settings::getInstance().getAutostartInTray()); bodyUI->startInTray->setChecked(Settings::getInstance().getAutostartInTray());
bodyUI->statusChangesCheckbox->setChecked(Settings::getInstance().getStatusChangeNotificationEnabled()); bodyUI->statusChangesCheckbox->setChecked(Settings::getInstance().getStatusChangeNotificationEnabled());
bodyUI->signInNotificationsCheckbox->setChecked(Settings::getInstance().getSignInNotificationEnabled());
for (auto entry : SmileyPack::listSmileyPacks()) for (auto entry : SmileyPack::listSmileyPacks())
{ {
@ -64,7 +63,6 @@ GeneralForm::GeneralForm() :
connect(bodyUI->cbMakeToxPortable, &QCheckBox::stateChanged, this, &GeneralForm::onMakeToxPortableUpdated); connect(bodyUI->cbMakeToxPortable, &QCheckBox::stateChanged, this, &GeneralForm::onMakeToxPortableUpdated);
connect(bodyUI->startInTray, &QCheckBox::stateChanged, this, &GeneralForm::onSetAutostartInTray); connect(bodyUI->startInTray, &QCheckBox::stateChanged, this, &GeneralForm::onSetAutostartInTray);
connect(bodyUI->statusChangesCheckbox, &QCheckBox::stateChanged, this, &GeneralForm::onSetStatusChange); connect(bodyUI->statusChangesCheckbox, &QCheckBox::stateChanged, this, &GeneralForm::onSetStatusChange);
connect(bodyUI->signInNotificationsCheckbox, &QCheckBox::stateChanged, this, &GeneralForm::onSetSignInNotifications);
connect(bodyUI->smileyPackBrowser, SIGNAL(currentIndexChanged(int)), this, SLOT(onSmileyBrowserIndexChanged(int))); connect(bodyUI->smileyPackBrowser, SIGNAL(currentIndexChanged(int)), this, SLOT(onSmileyBrowserIndexChanged(int)));
// new syntax can't handle overloaded signals... (at least not in a pretty way) // new syntax can't handle overloaded signals... (at least not in a pretty way)
connect(bodyUI->cbUDPDisabled, &QCheckBox::stateChanged, this, &GeneralForm::onUDPUpdated); connect(bodyUI->cbUDPDisabled, &QCheckBox::stateChanged, this, &GeneralForm::onUDPUpdated);
@ -110,11 +108,6 @@ void GeneralForm::onSetStatusChange()
Settings::getInstance().setStatusChangeNotificationEnabled(bodyUI->statusChangesCheckbox->isChecked()); Settings::getInstance().setStatusChangeNotificationEnabled(bodyUI->statusChangesCheckbox->isChecked());
} }
void GeneralForm::onSetSignInNotifications()
{
Settings::getInstance().setSignInNotificationEnabled(bodyUI->signInNotificationsCheckbox->isChecked());
}
void GeneralForm::onSmileyBrowserIndexChanged(int index) void GeneralForm::onSmileyBrowserIndexChanged(int index)
{ {
QString filename = bodyUI->smileyPackBrowser->itemData(index).toString(); QString filename = bodyUI->smileyPackBrowser->itemData(index).toString();

View File

@ -44,7 +44,6 @@ private slots:
void onUseProxyUpdated(); void onUseProxyUpdated();
void onStyleSelected(QString style); void onStyleSelected(QString style);
void onSetStatusChange(); void onSetStatusChange();
void onSetSignInNotifications();
private: private:
Ui::GeneralSettings *bodyUI; Ui::GeneralSettings *bodyUI;

View File

@ -56,14 +56,7 @@
<item> <item>
<widget class="QCheckBox" name="statusChangesCheckbox"> <widget class="QCheckBox" name="statusChangesCheckbox">
<property name="text"> <property name="text">
<string>Show status changes</string> <string>Show contacts' status changes</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="signInNotificationsCheckbox">
<property name="text">
<string>Notify me when contacts sign in</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -153,7 +153,6 @@ Widget::Widget(QWidget *parent)
connect(core, &Core::failedToAddFriend, this, &Widget::addFriendFailed); connect(core, &Core::failedToAddFriend, this, &Widget::addFriendFailed);
connect(core, &Core::friendUsernameChanged, this, &Widget::onFriendUsernameChanged); connect(core, &Core::friendUsernameChanged, this, &Widget::onFriendUsernameChanged);
connect(core, &Core::friendStatusChanged, this, &Widget::onFriendStatusChanged); connect(core, &Core::friendStatusChanged, this, &Widget::onFriendStatusChanged);
connect(core, &Core::friendSignedIn, this, &Widget::onFriendSignIn);
connect(core, &Core::friendStatusMessageChanged, this, &Widget::onFriendStatusMessageChanged); connect(core, &Core::friendStatusMessageChanged, this, &Widget::onFriendStatusMessageChanged);
connect(core, &Core::friendRequestReceived, this, &Widget::onFriendRequestReceived); connect(core, &Core::friendRequestReceived, this, &Widget::onFriendRequestReceived);
connect(core, &Core::friendMessageReceived, this, &Widget::onFriendMessageReceived); connect(core, &Core::friendMessageReceived, this, &Widget::onFriendMessageReceived);
@ -542,32 +541,19 @@ void Widget::onFriendStatusChanged(int friendId, Status status)
QString fStatus = ""; QString fStatus = "";
switch(f->friendStatus){ switch(f->friendStatus){
case Status::Away: case Status::Away:
fStatus = "away"; break; fStatus = tr("away", "contact status"); break;
case Status::Busy: case Status::Busy:
fStatus = "busy"; break; fStatus = tr("busy", "contact status"); break;
case Status::Offline: case Status::Offline:
fStatus = "offline"; break; fStatus = tr("offline", "contact status"); break;
default: default:
fStatus = "online"; break; fStatus = tr("online", "contact status"); break;
} }
//won't print the message if there were no messages before //won't print the message if there were no messages before
if(f->chatForm->getNumberOfMessages() != 0 if(f->chatForm->getNumberOfMessages() != 0
&& Settings::getInstance().getStatusChangeNotificationEnabled() == true) && Settings::getInstance().getStatusChangeNotificationEnabled() == true)
f->chatForm->addSystemInfoMessage(f->getName() + " has changed status to " + fStatus, "white"); f->chatForm->addSystemInfoMessage(tr("%1 is now %2", "e.g. \"Dubslow is now online\"").arg(f->getName()).arg(fStatus), "white");
}
void Widget::onFriendSignIn(int friendId, Status status)
{
Friend* f = FriendList::findFriend(friendId);
if (!f)
return;
contactListWidget->moveWidget(f->widget, status);
f->friendStatus = status;
f->widget->updateStatusLight();
} }
void Widget::onFriendStatusMessageChanged(int friendId, const QString& message) void Widget::onFriendStatusMessageChanged(int friendId, const QString& message)

View File

@ -90,8 +90,7 @@ private slots:
void setStatusMessage(const QString &statusMessage); void setStatusMessage(const QString &statusMessage);
void addFriend(int friendId, const QString& userId); void addFriend(int friendId, const QString& userId);
void addFriendFailed(const QString& userId); void addFriendFailed(const QString& userId);
void onFriendStatusChanged(int friendId, Status status); void onFriendStatusChanged(int friendId, Status status);
void onFriendSignIn(int friendId, Status status);
void onFriendStatusMessageChanged(int friendId, const QString& message); void onFriendStatusMessageChanged(int friendId, const QString& message);
void onFriendUsernameChanged(int friendId, const QString& username); void onFriendUsernameChanged(int friendId, const QString& username);
void onChatroomWidgetClicked(GenericChatroomWidget *); void onChatroomWidgetClicked(GenericChatroomWidget *);