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)
{
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) {
static_cast<Core*>(core)->checkLastOnline(friendId);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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