예제 #1
0
void ValueSetters::RunOnBootMinimizedValueSetter(QString group, QString name, QVariant value)
{
	bool runOnBoot = value.toBool();

	QSettings bootUpSettings(QString("HKEY_LOCAL_MACHINE\\SOFTWARE\\") + (StaticHelpers::IsWow64() ? "Wow6432Node\\" : "") + "Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);
	QString applicationFilePath = QDir::toNativeSeparators(QFileInfo(QApplication::applicationFilePath()).absoluteFilePath());
	if (runOnBoot)
	{
		bootUpSettings.setValue("CuteTorrent", "\"" + applicationFilePath + "\"" + " -m");
	}
	else
	{
		bootUpSettings.setValue("CuteTorrent", "\"" + applicationFilePath + "\"");
	}
}
예제 #2
0
void FSettingsDialog::on_buttonBox_accepted()
{
   db->updateBoolPref("ScanLibsOnStartup", (bool)ui->cb_ScanLibOnStartup->checkState());

   //Artwortk-Page
   db->updateBoolPref("useArtworkCache", (bool)ui->cb_Artwork_UseCache->checkState());


   //##########################
   //WatchedFolders
    db->updateWatchedFolders(watchedFolders.values());

   //##########################
    //Launchers
    db->updateLaunchers(launchers.values());


    //##########################
    //Savegame-Sync
    db->updateTextPref("sync_target", ui->le_sync_path->text());
    db->updateIntPref("sync_No_of_Backups", ui->sb_sync_backups->value());


    db->updateBoolPref("autoScanUpdates", (bool)ui->cb_gen_ScanForUpdates->checkState());

    db->updateBoolPref("StartWithSystem", (bool)ui->cb_gen_StartWithSystem->checkState());
    db->updateBoolPref("useTrayIcon", (bool)ui->cb_gen_useTrayIcon->checkState());

#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
    db->updateTextPref("currentLanguage", ui->cb_int_language->currentData().toString());
#endif

    #ifdef _WIN32
        QSettings bootUpSettings("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);
        QString app_path = QCoreApplication::applicationFilePath().replace("/", "\\");

        if(db->getBoolPref("StartWithSystem", true)) {
            bootUpSettings.setValue("FusionLauncher", app_path);
        }else {
            bootUpSettings.remove("FusionLauncher");
        }
    #elif __linux

    #endif

}
예제 #3
0
void ValueSetters::RunOnBootValueSetter(QString group, QString name, QVariant value)
{
	bool runOnBoot = value.toBool();
#ifdef Q_WS_WIN
	QSettings bootUpSettings(QString("HKEY_LOCAL_MACHINE\\SOFTWARE\\") + (StaticHelpers::IsWow64() ? "Wow6432Node\\" : "") + "Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);
	QString applicationFilePath = QDir::toNativeSeparators(QFileInfo(QApplication::applicationFilePath()).absoluteFilePath());
	if (runOnBoot)
	{
		bootUpSettings.setValue("CuteTorrent", "\"" + applicationFilePath + "\"");
	}
	else
	{
		bootUpSettings.remove("CuteTorrent");
	}
#elif Q_WS_X11
	if (runOnBoot)
	{
		if (!QFile::exists(StaticHelpers::CombinePathes(QDir::homePath(), ".config/autostart/CuteTorrent.desktop")))
		{
			QFile shortcut("/usr/share/applications/CuteTorrent.desktop");

			if (!shortcut.copy(StaticHelpers::CombinePathes(QDir::homePath(), ".config/autostart/CuteTorrent.desktop")))
			{
				qCritical() << "Unable to copy /usr/share/applications/CuteTorrent.desktop to ~/.config/autostart/CuteTorrent.desktop" << shortcut.errorString();
			}
		}
	}
	else
	{
		QFile shortcut(StaticHelpers::CombinePathes(QDir::homePath(), ".config/autostart/CuteTorrent.desktop"));

		if (shortcut.exists())
		{
			if (!shortcut.remove())
			{
				qCritical() << "failed to remove ~/.config/autostart/CuteTorrent.desktop" << shortcut.errorString();
			}
		}
	}
#endif
}