mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
closing to tray, gui and settings
This commit is contained in:
parent
9ba1d4cf41
commit
d268360c51
|
@ -112,6 +112,7 @@ void Settings::load()
|
||||||
translation = s.value("translation", "").toString();
|
translation = s.value("translation", "").toString();
|
||||||
makeToxPortable = s.value("makeToxPortable", false).toBool();
|
makeToxPortable = s.value("makeToxPortable", false).toBool();
|
||||||
autostartInTray = s.value("autostartInTray", false).toBool();
|
autostartInTray = s.value("autostartInTray", false).toBool();
|
||||||
|
closeToTray = s.value("closeToTray", false).toBool();
|
||||||
forceTCP = s.value("forceTCP", false).toBool();
|
forceTCP = s.value("forceTCP", false).toBool();
|
||||||
useProxy = s.value("useProxy", false).toBool();
|
useProxy = s.value("useProxy", false).toBool();
|
||||||
proxyAddr = s.value("proxyAddr", "").toString();
|
proxyAddr = s.value("proxyAddr", "").toString();
|
||||||
|
@ -225,6 +226,7 @@ void Settings::save(QString path)
|
||||||
s.setValue("translation",translation);
|
s.setValue("translation",translation);
|
||||||
s.setValue("makeToxPortable",makeToxPortable);
|
s.setValue("makeToxPortable",makeToxPortable);
|
||||||
s.setValue("autostartInTray",autostartInTray);
|
s.setValue("autostartInTray",autostartInTray);
|
||||||
|
s.setValue("closeToTray", closeToTray);
|
||||||
s.setValue("useProxy", useProxy);
|
s.setValue("useProxy", useProxy);
|
||||||
s.setValue("forceTCP", forceTCP);
|
s.setValue("forceTCP", forceTCP);
|
||||||
s.setValue("proxyAddr", proxyAddr);
|
s.setValue("proxyAddr", proxyAddr);
|
||||||
|
@ -390,6 +392,16 @@ void Settings::setAutostartInTray(bool newValue)
|
||||||
autostartInTray = newValue;
|
autostartInTray = newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Settings::getCloseToTray() const
|
||||||
|
{
|
||||||
|
return closeToTray;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::setCloseToTray(bool newValue)
|
||||||
|
{
|
||||||
|
closeToTray = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
bool Settings::getStatusChangeNotificationEnabled() const
|
bool Settings::getStatusChangeNotificationEnabled() const
|
||||||
{
|
{
|
||||||
return statusChangeNotificationEnabled;
|
return statusChangeNotificationEnabled;
|
||||||
|
|
|
@ -52,6 +52,9 @@ public:
|
||||||
bool getAutostartInTray() const;
|
bool getAutostartInTray() const;
|
||||||
void setAutostartInTray(bool newValue);
|
void setAutostartInTray(bool newValue);
|
||||||
|
|
||||||
|
bool getCloseToTray() const;
|
||||||
|
void setCloseToTray(bool newValue);
|
||||||
|
|
||||||
QString getStyle() const;
|
QString getStyle() const;
|
||||||
void setStyle(const QString& newValue);
|
void setStyle(const QString& newValue);
|
||||||
|
|
||||||
|
@ -185,6 +188,7 @@ private:
|
||||||
QString translation;
|
QString translation;
|
||||||
static bool makeToxPortable;
|
static bool makeToxPortable;
|
||||||
bool autostartInTray;
|
bool autostartInTray;
|
||||||
|
bool closeToTray;
|
||||||
|
|
||||||
bool forceTCP;
|
bool forceTCP;
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
|
||||||
bodyUI->transComboBox->setCurrentIndex(locales.indexOf(Settings::getInstance().getTranslation()));
|
bodyUI->transComboBox->setCurrentIndex(locales.indexOf(Settings::getInstance().getTranslation()));
|
||||||
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->closeToTrayCheckbox->setChecked(Settings::getInstance().getCloseToTray());
|
||||||
bodyUI->statusChangesCheckbox->setChecked(Settings::getInstance().getStatusChangeNotificationEnabled());
|
bodyUI->statusChangesCheckbox->setChecked(Settings::getInstance().getStatusChangeNotificationEnabled());
|
||||||
|
|
||||||
for (auto entry : SmileyPack::listSmileyPacks())
|
for (auto entry : SmileyPack::listSmileyPacks())
|
||||||
|
@ -72,6 +73,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
|
||||||
connect(bodyUI->transComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onTranslationUpdated()));
|
connect(bodyUI->transComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onTranslationUpdated()));
|
||||||
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->closeToTrayCheckbox, &QCheckBox::stateChanged, this, &GeneralForm::onSetCloseToTray);
|
||||||
connect(bodyUI->statusChangesCheckbox, &QCheckBox::stateChanged, this, &GeneralForm::onSetStatusChange);
|
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)
|
||||||
|
@ -109,6 +111,11 @@ void GeneralForm::onSetAutostartInTray()
|
||||||
Settings::getInstance().setAutostartInTray(bodyUI->startInTray->isChecked());
|
Settings::getInstance().setAutostartInTray(bodyUI->startInTray->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GeneralForm::onSetCloseToTray()
|
||||||
|
{
|
||||||
|
Settings::getInstance().setCloseToTray(bodyUI->closeToTrayCheckbox->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
void GeneralForm::onStyleSelected(QString style)
|
void GeneralForm::onStyleSelected(QString style)
|
||||||
{
|
{
|
||||||
Settings::getInstance().setStyle(style);
|
Settings::getInstance().setStyle(style);
|
||||||
|
|
|
@ -35,6 +35,7 @@ private slots:
|
||||||
void onTranslationUpdated();
|
void onTranslationUpdated();
|
||||||
void onMakeToxPortableUpdated();
|
void onMakeToxPortableUpdated();
|
||||||
void onSetAutostartInTray();
|
void onSetAutostartInTray();
|
||||||
|
void onSetCloseToTray();
|
||||||
void onSmileyBrowserIndexChanged(int index);
|
void onSmileyBrowserIndexChanged(int index);
|
||||||
void onUDPUpdated();
|
void onUDPUpdated();
|
||||||
void onProxyAddrEdited();
|
void onProxyAddrEdited();
|
||||||
|
|
|
@ -73,6 +73,13 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="closeToTrayCheckbox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Close to tray</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="statusChangesCheckbox">
|
<widget class="QCheckBox" name="statusChangesCheckbox">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
|
@ -253,12 +253,20 @@ QThread* Widget::getCoreThread()
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::closeEvent(QCloseEvent *event)
|
void Widget::closeEvent(QCloseEvent *event)
|
||||||
|
{
|
||||||
|
if(Settings::getInstance().getCloseToTray() == true)
|
||||||
|
{
|
||||||
|
event->ignore();
|
||||||
|
this->hide();
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
Settings::getInstance().setWindowGeometry(saveGeometry());
|
Settings::getInstance().setWindowGeometry(saveGeometry());
|
||||||
Settings::getInstance().setWindowState(saveState());
|
Settings::getInstance().setWindowState(saveState());
|
||||||
Settings::getInstance().setSplitterState(ui->mainSplitter->saveState());
|
Settings::getInstance().setSplitterState(ui->mainSplitter->saveState());
|
||||||
QWidget::closeEvent(event);
|
QWidget::closeEvent(event);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString Widget::detectProfile()
|
QString Widget::detectProfile()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user