mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-28 07:24:28 +00:00
Add option to start qbt with Windows startup.
This commit is contained in:
parent
89d3678adc
commit
3dd7ac0549
@ -350,6 +350,13 @@
|
|||||||
<string>Desktop</string>
|
<string>Desktop</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_12">
|
<layout class="QVBoxLayout" name="verticalLayout_12">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkStartup">
|
||||||
|
<property name="text">
|
||||||
|
<string>Start qBittorrent on Windows start up</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkShowSplash">
|
<widget class="QCheckBox" name="checkShowSplash">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -122,6 +122,7 @@ options_imp::options_imp(QWidget *parent):
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef Q_WS_WIN
|
#ifndef Q_WS_WIN
|
||||||
|
checkStartup->setVisible(false);
|
||||||
groupFileAssociation->setVisible(false);
|
groupFileAssociation->setVisible(false);
|
||||||
#endif
|
#endif
|
||||||
#if LIBTORRENT_VERSION_MINOR < 16
|
#if LIBTORRENT_VERSION_MINOR < 16
|
||||||
@ -141,6 +142,9 @@ options_imp::options_imp(QWidget *parent):
|
|||||||
connect(checkCloseToSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
connect(checkCloseToSystray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||||
connect(checkMinimizeToSysTray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
connect(checkMinimizeToSysTray, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||||
connect(checkStartMinimized, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
connect(checkStartMinimized, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||||
|
#ifdef Q_WS_WIN
|
||||||
|
connect(checkStartup, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||||
|
#endif
|
||||||
connect(checkShowSplash, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
connect(checkShowSplash, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||||
connect(checkProgramExitConfirm, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
connect(checkProgramExitConfirm, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||||
connect(checkPreventFromSuspend, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
connect(checkPreventFromSuspend, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||||
@ -372,6 +376,7 @@ void options_imp::saveOptions() {
|
|||||||
pref.setConfirmOnExit(checkProgramExitConfirm->isChecked());
|
pref.setConfirmOnExit(checkProgramExitConfirm->isChecked());
|
||||||
pref.setPreventFromSuspend(preventFromSuspend());
|
pref.setPreventFromSuspend(preventFromSuspend());
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
|
pref.setStartup(Startup());
|
||||||
// Windows: file association settings
|
// Windows: file association settings
|
||||||
Preferences::setTorrentFileAssoc(checkAssociateTorrents->isChecked());
|
Preferences::setTorrentFileAssoc(checkAssociateTorrents->isChecked());
|
||||||
Preferences::setMagnetLinkAssoc(checkAssociateMagnetLinks->isChecked());
|
Preferences::setMagnetLinkAssoc(checkAssociateMagnetLinks->isChecked());
|
||||||
@ -546,6 +551,7 @@ void options_imp::loadOptions() {
|
|||||||
checkProgramExitConfirm->setChecked(pref.confirmOnExit());
|
checkProgramExitConfirm->setChecked(pref.confirmOnExit());
|
||||||
checkPreventFromSuspend->setChecked(pref.preventFromSuspend());
|
checkPreventFromSuspend->setChecked(pref.preventFromSuspend());
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
|
checkStartup->setChecked(pref.Startup());
|
||||||
// Windows: file association settings
|
// Windows: file association settings
|
||||||
checkAssociateTorrents->setChecked(Preferences::isTorrentFileAssocSet());
|
checkAssociateTorrents->setChecked(Preferences::isTorrentFileAssocSet());
|
||||||
checkAssociateMagnetLinks->setChecked(Preferences::isMagnetLinkAssocSet());
|
checkAssociateMagnetLinks->setChecked(Preferences::isMagnetLinkAssocSet());
|
||||||
@ -974,6 +980,12 @@ bool options_imp::isSlashScreenDisabled() const {
|
|||||||
return !checkShowSplash->isChecked();
|
return !checkShowSplash->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef Q_WS_WIN
|
||||||
|
bool options_imp::Startup() const {
|
||||||
|
return checkStartup->isChecked();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool options_imp::preventFromSuspend() const {
|
bool options_imp::preventFromSuspend() const {
|
||||||
return checkPreventFromSuspend->isChecked();
|
return checkPreventFromSuspend->isChecked();
|
||||||
}
|
}
|
||||||
|
@ -101,6 +101,9 @@ private:
|
|||||||
bool startMinimized() const;
|
bool startMinimized() const;
|
||||||
bool isSlashScreenDisabled() const;
|
bool isSlashScreenDisabled() const;
|
||||||
bool preventFromSuspend() const;
|
bool preventFromSuspend() const;
|
||||||
|
#ifdef Q_WS_WIN
|
||||||
|
bool Startup() const;
|
||||||
|
#endif
|
||||||
// Downloads
|
// Downloads
|
||||||
QString getSavePath() const;
|
QString getSavePath() const;
|
||||||
bool isTempPathEnabled() const;
|
bool isTempPathEnabled() const;
|
||||||
|
@ -181,6 +181,24 @@ public:
|
|||||||
setValue("Preferences/General/PreventFromSuspend", b);
|
setValue("Preferences/General/PreventFromSuspend", b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef Q_WS_WIN
|
||||||
|
bool Startup() const {
|
||||||
|
QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);
|
||||||
|
return settings.contains("qBittorrent");
|
||||||
|
}
|
||||||
|
|
||||||
|
void setStartup(bool b) {
|
||||||
|
QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);
|
||||||
|
if (b) {
|
||||||
|
const QString bin_path = "\""+qApp->applicationFilePath().replace("/", "\\")+"\"";
|
||||||
|
settings.setValue("qBittorrent", bin_path);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
settings.remove("qBittorrent");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Downloads
|
// Downloads
|
||||||
QString getSavePath() const {
|
QString getSavePath() const {
|
||||||
QString save_path = value(QString::fromUtf8("Preferences/Downloads/SavePath")).toString();
|
QString save_path = value(QString::fromUtf8("Preferences/Downloads/SavePath")).toString();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user