Commit 5f4da8b5 authored by Ming Rui Zhang's avatar Ming Rui Zhang

settingswidget: add option for enabling or disabling running the application on startup

Change-Id: Ie8a9ed96b59c972c937037645c9972472fd32b16
parent efbfa72f
...@@ -234,6 +234,8 @@ SettingsWidget::SettingsWidget(QWidget* parent) ...@@ -234,6 +234,8 @@ SettingsWidget::SettingsWidget(QWidget* parent)
connect(ui->closeOrMinCheckBox, &QAbstractButton::clicked, this, &SettingsWidget::slotSetClosedOrMin); connect(ui->closeOrMinCheckBox, &QAbstractButton::clicked, this, &SettingsWidget::slotSetClosedOrMin);
connect(ui->applicationOnStartUpCheckBox, &QAbstractButton::clicked, this, &SettingsWidget::slotSetRunOnStartUp);
connect(ui->downloadButton, &QAbstractButton::clicked, this, &SettingsWidget::openDownloadFolderSlot); connect(ui->downloadButton, &QAbstractButton::clicked, this, &SettingsWidget::openDownloadFolderSlot);
connect(ui->checkUpdateButton, &QAbstractButton::clicked, this, &SettingsWidget::checkForUpdateSlot); connect(ui->checkUpdateButton, &QAbstractButton::clicked, this, &SettingsWidget::checkForUpdateSlot);
...@@ -909,6 +911,7 @@ SettingsWidget::populateGeneralSettings() ...@@ -909,6 +911,7 @@ SettingsWidget::populateGeneralSettings()
Utils::setElidedText(ui->downloadButton, downloadPath); Utils::setElidedText(ui->downloadButton, downloadPath);
ui->closeOrMinCheckBox->setChecked(settings.value(SettingsKey::closeOrMinimized).toBool()); ui->closeOrMinCheckBox->setChecked(settings.value(SettingsKey::closeOrMinimized).toBool());
ui->applicationOnStartUpCheckBox->setChecked(Utils::CheckStartupLink(L"Jami"));
auto notifs = settings.value(SettingsKey::enableNotifications).toBool(); auto notifs = settings.value(SettingsKey::enableNotifications).toBool();
ui->notificationCheckBox->setChecked(notifs); ui->notificationCheckBox->setChecked(notifs);
...@@ -952,6 +955,18 @@ SettingsWidget::slotSetClosedOrMin(bool state) ...@@ -952,6 +955,18 @@ SettingsWidget::slotSetClosedOrMin(bool state)
settings.setValue(SettingsKey::closeOrMinimized, state); settings.setValue(SettingsKey::closeOrMinimized, state);
} }
void
SettingsWidget::slotSetRunOnStartUp(bool state)
{
if (Utils::CheckStartupLink(L"Jami")) {
if (!state) {
Utils::DeleteStartupLink(L"Jami");
}
} else if (state) {
Utils::CreateStartupLink(L"Jami");
}
}
void void
SettingsWidget::checkForUpdateSlot() SettingsWidget::checkForUpdateSlot()
{ {
......
...@@ -132,6 +132,7 @@ private slots: ...@@ -132,6 +132,7 @@ private slots:
void slotSetNotifications(bool state); void slotSetNotifications(bool state);
void checkForUpdateSlot(); void checkForUpdateSlot();
void slotSetClosedOrMin(bool state); void slotSetClosedOrMin(bool state);
void slotSetRunOnStartUp(bool state);
void openDownloadFolderSlot(); void openDownloadFolderSlot();
void openRecordFolderSlot(); void openRecordFolderSlot();
void slotAlwaysRecordingClicked(bool state); void slotAlwaysRecordingClicked(bool state);
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>919</width> <width>890</width>
<height>690</height> <height>656</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
...@@ -39,8 +39,8 @@ ...@@ -39,8 +39,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>917</width> <width>888</width>
<height>688</height> <height>654</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
...@@ -668,6 +668,34 @@ ...@@ -668,6 +668,34 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<layout class="QHBoxLayout" name="applicationOnStartUpLayout">
<item>
<widget class="ToggleSwitch" name="applicationOnStartUpCheckBox" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="text" stdset="0">
<string>Run on Startup</string>
</property>
</widget>
</item>
</layout>
</item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_22"> <layout class="QHBoxLayout" name="horizontalLayout_22">
<property name="leftMargin"> <property name="leftMargin">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment