Add option to start qbt with Windows startup.

This commit is contained in:
sledgehammer999
2012-10-07 23:05:33 +03:00
parent 89d3678adc
commit 3dd7ac0549
4 changed files with 40 additions and 0 deletions

View File

@@ -181,6 +181,24 @@ public:
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
QString getSavePath() const {
QString save_path = value(QString::fromUtf8("Preferences/Downloads/SavePath")).toString();