mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge branch 'pr422'
This commit is contained in:
commit
a0600d1ce4
|
@ -138,6 +138,7 @@ void Settings::load()
|
||||||
minimizeOnClose = s.value("minimizeOnClose", false).toBool();
|
minimizeOnClose = s.value("minimizeOnClose", false).toBool();
|
||||||
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();
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("State");
|
s.beginGroup("State");
|
||||||
|
@ -245,6 +246,7 @@ void Settings::save(QString path)
|
||||||
s.setValue("minimizeOnClose", minimizeOnClose);
|
s.setValue("minimizeOnClose", minimizeOnClose);
|
||||||
s.setValue("nativeStyle", useNativeStyle);
|
s.setValue("nativeStyle", useNativeStyle);
|
||||||
s.setValue("style",style);
|
s.setValue("style",style);
|
||||||
|
s.setValue("statusChangeNotificationEnabled", statusChangeNotificationEnabled);
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("State");
|
s.beginGroup("State");
|
||||||
|
@ -377,6 +379,16 @@ void Settings::setAutostartInTray(bool newValue)
|
||||||
autostartInTray = newValue;
|
autostartInTray = newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Settings::getStatusChangeNotificationEnabled() const
|
||||||
|
{
|
||||||
|
return statusChangeNotificationEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::setStatusChangeNotificationEnabled(bool newValue)
|
||||||
|
{
|
||||||
|
statusChangeNotificationEnabled = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
bool Settings::getUseTranslations() const
|
bool Settings::getUseTranslations() const
|
||||||
{
|
{
|
||||||
return useTranslations;
|
return useTranslations;
|
||||||
|
|
|
@ -138,10 +138,14 @@ public:
|
||||||
bool isMinimizeOnCloseEnabled() const;
|
bool isMinimizeOnCloseEnabled() const;
|
||||||
void setMinimizeOnClose(bool newValue);
|
void setMinimizeOnClose(bool newValue);
|
||||||
|
|
||||||
|
bool getStatusChangeNotificationEnabled() const;
|
||||||
|
void setStatusChangeNotificationEnabled(bool newValue);
|
||||||
|
|
||||||
// Privacy
|
// Privacy
|
||||||
bool isTypingNotificationEnabled() const;
|
bool isTypingNotificationEnabled() const;
|
||||||
void setTypingNotification(bool enabled);
|
void setTypingNotification(bool enabled);
|
||||||
|
|
||||||
|
// State
|
||||||
bool getUseNativeStyle() const;
|
bool getUseNativeStyle() const;
|
||||||
void setUseNativeStyle(bool value);
|
void setUseNativeStyle(bool value);
|
||||||
|
|
||||||
|
@ -211,6 +215,7 @@ private:
|
||||||
int firstColumnHandlePos;
|
int firstColumnHandlePos;
|
||||||
int secondColumnHandlePosFromRight;
|
int secondColumnHandlePosFromRight;
|
||||||
QString timestampFormat;
|
QString timestampFormat;
|
||||||
|
bool statusChangeNotificationEnabled;
|
||||||
|
|
||||||
// Privacy
|
// Privacy
|
||||||
bool typingNotification;
|
bool typingNotification;
|
||||||
|
|
|
@ -118,6 +118,11 @@ void ChatAreaWidget::insertMessage(ChatAction *msgAction)
|
||||||
messages.append(msgAction);
|
messages.append(msgAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ChatAreaWidget::getNumberOfMessages()
|
||||||
|
{
|
||||||
|
return messages.size();
|
||||||
|
}
|
||||||
|
|
||||||
void ChatAreaWidget::onSliderRangeChanged()
|
void ChatAreaWidget::onSliderRangeChanged()
|
||||||
{
|
{
|
||||||
QScrollBar* scroll = verticalScrollBar();
|
QScrollBar* scroll = verticalScrollBar();
|
||||||
|
|
|
@ -33,6 +33,7 @@ public:
|
||||||
|
|
||||||
int nameColWidth() {return nameWidth;}
|
int nameColWidth() {return nameWidth;}
|
||||||
void setNameColWidth(int w);
|
void setNameColWidth(int w);
|
||||||
|
int getNumberOfMessages();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void onFileTranfertInterract(QString widgetName, QString buttonName);
|
void onFileTranfertInterract(QString widgetName, QString buttonName);
|
||||||
|
|
|
@ -127,6 +127,11 @@ GenericChatForm::GenericChatForm(QWidget *parent) :
|
||||||
connect(chatWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onChatContextMenuRequested(QPoint)));
|
connect(chatWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onChatContextMenuRequested(QPoint)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GenericChatForm::getNumberOfMessages()
|
||||||
|
{
|
||||||
|
return chatWidget->getNumberOfMessages();
|
||||||
|
}
|
||||||
|
|
||||||
void GenericChatForm::setName(const QString &newName)
|
void GenericChatForm::setName(const QString &newName)
|
||||||
{
|
{
|
||||||
nameLabel->setText(newName);
|
nameLabel->setText(newName);
|
||||||
|
|
|
@ -46,6 +46,7 @@ public:
|
||||||
virtual void show(Ui::MainWindow &ui);
|
virtual void show(Ui::MainWindow &ui);
|
||||||
void addMessage(QString author, QString message, bool isAction = false, QDateTime datetime=QDateTime::currentDateTime());
|
void addMessage(QString author, QString message, bool isAction = false, QDateTime datetime=QDateTime::currentDateTime());
|
||||||
void addSystemInfoMessage(const QString &message, const QString &type, const QDateTime &datetime=QDateTime::currentDateTime());
|
void addSystemInfoMessage(const QString &message, const QString &type, const QDateTime &datetime=QDateTime::currentDateTime());
|
||||||
|
int getNumberOfMessages();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sendMessage(int, QString);
|
void sendMessage(int, QString);
|
||||||
|
|
|
@ -33,6 +33,7 @@ GeneralForm::GeneralForm() :
|
||||||
bodyUI->cbUseTranslations->setChecked(Settings::getInstance().getUseTranslations());
|
bodyUI->cbUseTranslations->setChecked(Settings::getInstance().getUseTranslations());
|
||||||
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());
|
||||||
|
|
||||||
for (auto entry : SmileyPack::listSmileyPacks())
|
for (auto entry : SmileyPack::listSmileyPacks())
|
||||||
{
|
{
|
||||||
|
@ -61,6 +62,7 @@ GeneralForm::GeneralForm() :
|
||||||
connect(bodyUI->cbUseTranslations, &QCheckBox::stateChanged, this, &GeneralForm::onUseTranslationUpdated);
|
connect(bodyUI->cbUseTranslations, &QCheckBox::stateChanged, this, &GeneralForm::onUseTranslationUpdated);
|
||||||
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->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);
|
||||||
|
@ -101,6 +103,11 @@ void GeneralForm::onStyleSelected(QString style)
|
||||||
this->setStyle(QStyleFactory::create(style));
|
this->setStyle(QStyleFactory::create(style));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GeneralForm::onSetStatusChange()
|
||||||
|
{
|
||||||
|
Settings::getInstance().setStatusChangeNotificationEnabled(bodyUI->statusChangesCheckbox->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();
|
||||||
|
|
|
@ -43,6 +43,7 @@ private slots:
|
||||||
void onProxyPortEdited(int port);
|
void onProxyPortEdited(int port);
|
||||||
void onUseProxyUpdated();
|
void onUseProxyUpdated();
|
||||||
void onStyleSelected(QString style);
|
void onStyleSelected(QString style);
|
||||||
|
void onSetStatusChange();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::GeneralSettings *bodyUI;
|
Ui::GeneralSettings *bodyUI;
|
||||||
|
|
|
@ -53,6 +53,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="statusChangesCheckbox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Show contacts' status changes</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -151,7 +151,6 @@ Widget::Widget(QWidget *parent)
|
||||||
connect(core, SIGNAL(fileUploadFinished(const QString&)), &filesForm, SLOT(onFileUploadComplete(const QString&)));
|
connect(core, SIGNAL(fileUploadFinished(const QString&)), &filesForm, SLOT(onFileUploadComplete(const QString&)));
|
||||||
connect(core, &Core::friendAdded, this, &Widget::addFriend);
|
connect(core, &Core::friendAdded, this, &Widget::addFriend);
|
||||||
connect(core, &Core::failedToAddFriend, this, &Widget::addFriendFailed);
|
connect(core, &Core::failedToAddFriend, this, &Widget::addFriendFailed);
|
||||||
connect(core, &Core::friendStatusChanged, this, &Widget::onFriendStatusChanged);
|
|
||||||
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::friendStatusMessageChanged, this, &Widget::onFriendStatusMessageChanged);
|
connect(core, &Core::friendStatusMessageChanged, this, &Widget::onFriendStatusMessageChanged);
|
||||||
|
@ -538,6 +537,23 @@ void Widget::onFriendStatusChanged(int friendId, Status status)
|
||||||
|
|
||||||
f->friendStatus = status;
|
f->friendStatus = status;
|
||||||
f->widget->updateStatusLight();
|
f->widget->updateStatusLight();
|
||||||
|
|
||||||
|
QString fStatus = "";
|
||||||
|
switch(f->friendStatus){
|
||||||
|
case Status::Away:
|
||||||
|
fStatus = tr("away", "contact status"); break;
|
||||||
|
case Status::Busy:
|
||||||
|
fStatus = tr("busy", "contact status"); break;
|
||||||
|
case Status::Offline:
|
||||||
|
fStatus = tr("offline", "contact status"); break;
|
||||||
|
default:
|
||||||
|
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(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)
|
void Widget::onFriendStatusMessageChanged(int friendId, const QString& message)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user