mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge branch 'pr691'
This commit is contained in:
commit
f9cb19a157
|
@ -120,6 +120,7 @@ void Settings::load()
|
||||||
currentProfile = s.value("currentProfile", "").toString();
|
currentProfile = s.value("currentProfile", "").toString();
|
||||||
autoAwayTime = s.value("autoAwayTime", 10).toInt();
|
autoAwayTime = s.value("autoAwayTime", 10).toInt();
|
||||||
checkUpdates = s.value("checkUpdates", false).toBool();
|
checkUpdates = s.value("checkUpdates", false).toBool();
|
||||||
|
showInFront = s.value("showInFront", false).toBool();
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("Widgets");
|
s.beginGroup("Widgets");
|
||||||
|
@ -257,6 +258,7 @@ void Settings::save(QString path)
|
||||||
s.setValue("currentProfile", currentProfile);
|
s.setValue("currentProfile", currentProfile);
|
||||||
s.setValue("autoAwayTime", autoAwayTime);
|
s.setValue("autoAwayTime", autoAwayTime);
|
||||||
s.setValue("checkUpdates", checkUpdates);
|
s.setValue("checkUpdates", checkUpdates);
|
||||||
|
s.setValue("showInFront", showInFront);
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("Widgets");
|
s.beginGroup("Widgets");
|
||||||
|
@ -480,6 +482,16 @@ void Settings::setStatusChangeNotificationEnabled(bool newValue)
|
||||||
statusChangeNotificationEnabled = newValue;
|
statusChangeNotificationEnabled = newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Settings::getShowInFront() const
|
||||||
|
{
|
||||||
|
return showInFront;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::setShowInFront(bool newValue)
|
||||||
|
{
|
||||||
|
showInFront = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
QString Settings::getTranslation() const
|
QString Settings::getTranslation() const
|
||||||
{
|
{
|
||||||
return translation;
|
return translation;
|
||||||
|
|
|
@ -102,6 +102,9 @@ public:
|
||||||
bool getCheckUpdates() const;
|
bool getCheckUpdates() const;
|
||||||
void setCheckUpdates(bool newValue);
|
void setCheckUpdates(bool newValue);
|
||||||
|
|
||||||
|
bool getShowInFront() const;
|
||||||
|
void setShowInFront(bool newValue);
|
||||||
|
|
||||||
QPixmap getSavedAvatar(const QString& ownerId);
|
QPixmap getSavedAvatar(const QString& ownerId);
|
||||||
void saveAvatar(QPixmap& pic, const QString& ownerId);
|
void saveAvatar(QPixmap& pic, const QString& ownerId);
|
||||||
|
|
||||||
|
@ -223,6 +226,7 @@ private:
|
||||||
bool minimizeToTray;
|
bool minimizeToTray;
|
||||||
bool useEmoticons;
|
bool useEmoticons;
|
||||||
bool checkUpdates;
|
bool checkUpdates;
|
||||||
|
bool showInFront;
|
||||||
|
|
||||||
bool forceTCP;
|
bool forceTCP;
|
||||||
|
|
||||||
|
|
|
@ -188,7 +188,7 @@ void ChatForm::onFileRecvRequest(ToxFile file)
|
||||||
Widget* w = Widget::getInstance();
|
Widget* w = Widget::getInstance();
|
||||||
if (!w->isFriendWidgetCurActiveWidget(f)|| w->isMinimized() || !w->isActiveWindow())
|
if (!w->isFriendWidgetCurActiveWidget(f)|| w->isMinimized() || !w->isActiveWindow())
|
||||||
{
|
{
|
||||||
w->newMessageAlert();
|
w->newMessageAlert(f->getFriendWidget());
|
||||||
f->setEventFlag(true);
|
f->setEventFlag(true);
|
||||||
f->getFriendWidget()->updateStatusLight();
|
f->getFriendWidget()->updateStatusLight();
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ void ChatForm::onAvInvite(int FriendId, int CallId, bool video)
|
||||||
Widget* w = Widget::getInstance();
|
Widget* w = Widget::getInstance();
|
||||||
if (!w->isFriendWidgetCurActiveWidget(f)|| w->isMinimized() || !w->isActiveWindow())
|
if (!w->isFriendWidgetCurActiveWidget(f)|| w->isMinimized() || !w->isActiveWindow())
|
||||||
{
|
{
|
||||||
w->newMessageAlert();
|
w->newMessageAlert(f->getFriendWidget());
|
||||||
f->setEventFlag(true);
|
f->setEventFlag(true);
|
||||||
f->getFriendWidget()->updateStatusLight();
|
f->getFriendWidget()->updateStatusLight();
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
|
||||||
|
|
||||||
bodyUI->checkUpdates->setVisible(AUTOUPDATE_ENABLED);
|
bodyUI->checkUpdates->setVisible(AUTOUPDATE_ENABLED);
|
||||||
bodyUI->checkUpdates->setChecked(Settings::getInstance().getCheckUpdates());
|
bodyUI->checkUpdates->setChecked(Settings::getInstance().getCheckUpdates());
|
||||||
|
bodyUI->trayLayout->addStretch();
|
||||||
|
|
||||||
bodyUI->cbEnableIPv6->setChecked(Settings::getInstance().getEnableIPv6());
|
bodyUI->cbEnableIPv6->setChecked(Settings::getInstance().getEnableIPv6());
|
||||||
for (int i = 0; i < langs.size(); i++)
|
for (int i = 0; i < langs.size(); i++)
|
||||||
|
@ -57,6 +58,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
|
||||||
bodyUI->useEmoticons->setChecked(Settings::getInstance().getUseEmoticons());
|
bodyUI->useEmoticons->setChecked(Settings::getInstance().getUseEmoticons());
|
||||||
bodyUI->autoacceptFiles->setChecked(Settings::getInstance().getAutoSaveEnabled());
|
bodyUI->autoacceptFiles->setChecked(Settings::getInstance().getAutoSaveEnabled());
|
||||||
bodyUI->autoSaveFilesDir->setText(Settings::getInstance().getGlobalAutoAcceptDir());
|
bodyUI->autoSaveFilesDir->setText(Settings::getInstance().getGlobalAutoAcceptDir());
|
||||||
|
bodyUI->showInFront->setChecked(Settings::getInstance().getShowInFront());
|
||||||
|
|
||||||
for (auto entry : SmileyPack::listSmileyPacks())
|
for (auto entry : SmileyPack::listSmileyPacks())
|
||||||
{
|
{
|
||||||
|
@ -106,6 +108,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
|
||||||
connect(bodyUI->minimizeToTray, &QCheckBox::stateChanged, this, &GeneralForm::onSetMinimizeToTray);
|
connect(bodyUI->minimizeToTray, &QCheckBox::stateChanged, this, &GeneralForm::onSetMinimizeToTray);
|
||||||
connect(bodyUI->statusChanges, &QCheckBox::stateChanged, this, &GeneralForm::onSetStatusChange);
|
connect(bodyUI->statusChanges, &QCheckBox::stateChanged, this, &GeneralForm::onSetStatusChange);
|
||||||
connect(bodyUI->autoAwaySpinBox, SIGNAL(editingFinished()), this, SLOT(onAutoAwayChanged()));
|
connect(bodyUI->autoAwaySpinBox, SIGNAL(editingFinished()), this, SLOT(onAutoAwayChanged()));
|
||||||
|
connect(bodyUI->showInFront, &QCheckBox::stateChanged, this, &GeneralForm::onSetShowInFront);
|
||||||
connect(bodyUI->autoacceptFiles, &QCheckBox::stateChanged, this, &GeneralForm::onAutoAcceptFileChange);
|
connect(bodyUI->autoacceptFiles, &QCheckBox::stateChanged, this, &GeneralForm::onAutoAcceptFileChange);
|
||||||
if(bodyUI->autoacceptFiles->isChecked())
|
if(bodyUI->autoacceptFiles->isChecked())
|
||||||
connect(bodyUI->autoSaveFilesDir, SIGNAL(clicked()), this, SLOT(onAutoSaveDirChange()));
|
connect(bodyUI->autoSaveFilesDir, SIGNAL(clicked()), this, SLOT(onAutoSaveDirChange()));
|
||||||
|
@ -291,3 +294,9 @@ void GeneralForm::onCheckUpdateChanged()
|
||||||
{
|
{
|
||||||
Settings::getInstance().setCheckUpdates(bodyUI->checkUpdates->isChecked());
|
Settings::getInstance().setCheckUpdates(bodyUI->checkUpdates->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GeneralForm::onSetShowInFront()
|
||||||
|
{
|
||||||
|
Settings::getInstance().setShowInFront(bodyUI->showInFront->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,7 @@ private slots:
|
||||||
void onAutoAcceptFileChange();
|
void onAutoAcceptFileChange();
|
||||||
void onAutoSaveDirChange();
|
void onAutoSaveDirChange();
|
||||||
void onCheckUpdateChanged();
|
void onCheckUpdateChanged();
|
||||||
|
void onSetShowInFront();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::GeneralSettings *bodyUI;
|
Ui::GeneralSettings *bodyUI;
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>511</width>
|
<width>511</width>
|
||||||
<height>720</height>
|
<height>796</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="0,0,1">
|
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="0,0,1">
|
||||||
|
@ -94,25 +94,47 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="startInTray">
|
<layout class="QHBoxLayout" name="trayLayout">
|
||||||
<property name="text">
|
<item>
|
||||||
<string>Start in tray</string>
|
<widget class="QCheckBox" name="startInTray">
|
||||||
</property>
|
<property name="text">
|
||||||
</widget>
|
<string>Start in tray</string>
|
||||||
</item>
|
</property>
|
||||||
<item>
|
<property name="sizePolicy">
|
||||||
<widget class="QCheckBox" name="closeToTray">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
<property name="text">
|
<horstretch>0</horstretch>
|
||||||
<string>Close to tray</string>
|
<verstretch>0</verstretch>
|
||||||
</property>
|
</sizepolicy>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
</widget>
|
||||||
<item>
|
</item>
|
||||||
<widget class="QCheckBox" name="minimizeToTray">
|
<item>
|
||||||
<property name="text">
|
<widget class="QCheckBox" name="closeToTray">
|
||||||
<string>Minimize to tray</string>
|
<property name="text">
|
||||||
</property>
|
<string>Close to tray</string>
|
||||||
</widget>
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="minimizeToTray">
|
||||||
|
<property name="text">
|
||||||
|
<string>Minimize to tray</string>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="statusChanges">
|
<widget class="QCheckBox" name="statusChanges">
|
||||||
|
@ -128,6 +150,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="showInFront">
|
||||||
|
<property name="text">
|
||||||
|
<string>Focus qTox when a message is received</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item alignment="Qt::AlignLeft">
|
<item alignment="Qt::AlignLeft">
|
||||||
|
@ -171,33 +200,37 @@
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="autoacceptFiles">
|
<layout class="QHBoxLayout" name="fileLayout">
|
||||||
<property name="text">
|
|
||||||
<string>Autoaccept files</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="saveFilesHLayout">
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="autoSaveFilesDirLabel">
|
<widget class="QCheckBox" name="autoacceptFiles">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Save files in</string>
|
<string>Autoaccept files</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="autoSaveFilesDir">
|
<layout class="QHBoxLayout" name="saveFilesHLayout">
|
||||||
<property name="sizePolicy">
|
<item>
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<widget class="QLabel" name="autoSaveFilesDirLabel">
|
||||||
<horstretch>0</horstretch>
|
<property name="text">
|
||||||
<verstretch>0</verstretch>
|
<string>Save files in</string>
|
||||||
</sizepolicy>
|
</property>
|
||||||
</property>
|
</widget>
|
||||||
<property name="text">
|
</item>
|
||||||
<string>PushButton</string>
|
<item>
|
||||||
</property>
|
<widget class="QPushButton" name="autoSaveFilesDir">
|
||||||
</widget>
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>PushButton</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
@ -398,7 +431,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="cbEnableUDP">
|
<widget class="QCheckBox" name="cbEnableUDP">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string extracomment="force tcp checkbox tooltip">This allows, e.g., toxing over Tor. It adds load to the Tox network however, so use only when necessary.</string>
|
<string extracomment="force tcp checkbox tooltip">Disabling this allows, e.g., toxing over Tor. It adds load to the Tox network however, so uncheck only when necessary.</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string extracomment="Text on checkbox to disable UDP">Enable UDP (recommended)</string>
|
<string extracomment="Text on checkbox to disable UDP">Enable UDP (recommended)</string>
|
||||||
|
|
|
@ -329,8 +329,7 @@ void Widget::changeEvent(QEvent *event)
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::WindowStateChange)
|
if (event->type() == QEvent::WindowStateChange)
|
||||||
{
|
{
|
||||||
if(isMinimized() == true
|
if(isMinimized() && Settings::getInstance().getMinimizeToTray())
|
||||||
&& Settings::getInstance().getMinimizeToTray() == true)
|
|
||||||
{
|
{
|
||||||
this->hide();
|
this->hide();
|
||||||
}
|
}
|
||||||
|
@ -675,7 +674,7 @@ void Widget::onFriendStatusChanged(int friendId, Status status)
|
||||||
|
|
||||||
//won't print the message if there were no messages before
|
//won't print the message if there were no messages before
|
||||||
if(!f->getChatForm()->isEmpty()
|
if(!f->getChatForm()->isEmpty()
|
||||||
&& Settings::getInstance().getStatusChangeNotificationEnabled() == true)
|
&& Settings::getInstance().getStatusChangeNotificationEnabled())
|
||||||
{
|
{
|
||||||
QString fStatus = "";
|
QString fStatus = "";
|
||||||
switch(f->getStatus()){
|
switch(f->getStatus()){
|
||||||
|
@ -750,23 +749,30 @@ void Widget::onFriendMessageReceived(int friendId, const QString& message, bool
|
||||||
if ((static_cast<GenericChatroomWidget*>(f->getFriendWidget()) != activeChatroomWidget) || isMinimized() || !isActiveWindow())
|
if ((static_cast<GenericChatroomWidget*>(f->getFriendWidget()) != activeChatroomWidget) || isMinimized() || !isActiveWindow())
|
||||||
{
|
{
|
||||||
f->setEventFlag(true);
|
f->setEventFlag(true);
|
||||||
newMessageAlert();
|
newMessageAlert(f->getFriendWidget());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
f->setEventFlag(true);
|
f->setEventFlag(true);
|
||||||
newMessageAlert();
|
newMessageAlert(f->getFriendWidget());
|
||||||
}
|
}
|
||||||
|
|
||||||
f->getFriendWidget()->updateStatusLight();
|
f->getFriendWidget()->updateStatusLight();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::newMessageAlert()
|
void Widget::newMessageAlert(GenericChatroomWidget* chat)
|
||||||
{
|
{
|
||||||
QApplication::alert(this);
|
QApplication::alert(this);
|
||||||
|
|
||||||
static QFile sndFile(":audio/notification.pcm");
|
static QFile sndFile(":audio/notification.pcm");
|
||||||
|
if ((isMinimized() || !isActiveWindow()) && Settings::getInstance().getShowInFront())
|
||||||
|
{
|
||||||
|
this->show();
|
||||||
|
showNormal();
|
||||||
|
activateWindow();
|
||||||
|
emit chat->chatroomWidgetClicked(chat);
|
||||||
|
}
|
||||||
static QByteArray sndData;
|
static QByteArray sndData;
|
||||||
if (sndData.isEmpty())
|
if (sndData.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -878,7 +884,7 @@ void Widget::onGroupMessageReceived(int groupnumber, const QString& message, con
|
||||||
g->hasNewMessages = 1;
|
g->hasNewMessages = 1;
|
||||||
if (targeted)
|
if (targeted)
|
||||||
{
|
{
|
||||||
newMessageAlert();
|
newMessageAlert(g->widget);
|
||||||
g->userWasMentioned = 1; // useful for highlighting line or desktop notifications
|
g->userWasMentioned = 1; // useful for highlighting line or desktop notifications
|
||||||
}
|
}
|
||||||
g->widget->updateStatusLight();
|
g->widget->updateStatusLight();
|
||||||
|
|
|
@ -57,7 +57,7 @@ public:
|
||||||
QThread* getCoreThread();
|
QThread* getCoreThread();
|
||||||
Camera* getCamera();
|
Camera* getCamera();
|
||||||
static Widget* getInstance();
|
static Widget* getInstance();
|
||||||
void newMessageAlert();
|
void newMessageAlert(GenericChatroomWidget* chat);
|
||||||
bool isFriendWidgetCurActiveWidget(Friend* f);
|
bool isFriendWidgetCurActiveWidget(Friend* f);
|
||||||
bool getIsWindowMinimized();
|
bool getIsWindowMinimized();
|
||||||
static QList<QString> searchProfiles();
|
static QList<QString> searchProfiles();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user