Example #1
0
void MetalinkSettings::accepted()
{
	int mode = 0;
	if (radioUseTorrent->isChecked())
		mode = 1;
	setSettingsValue("metalink/mode", mode);
}
Example #2
0
void Util::setDragMode(int mode)
{
    if (mode == dragMode()) {
        return;
    }

    QString modeString;
    switch(mode) {
    case DragGestures:
        modeString = "gestures";
        break;
    case DragScroll:
        modeString = "scroll";
        break;
    case DragSelect:
        modeString = "select";
        break;
    case DragOff:
    default:
        modeString = "off";
    }

    setSettingsValue("ui/dragMode", modeString);
    emit dragModeChanged();
}
Example #3
0
void JSettings::setValueString(JNIEnv*, jclass, jstring jname, jstring jvalue)
{
	JString name(jname);
	JString value(jvalue);

	setSettingsValue(name.str(), value.str());
}
Example #4
0
void Util::setShowWelcomeScreen(bool value)
{
    if (value != showWelcomeScreen()) {
        setSettingsValue("state/showWelcomeScreen", value);
        emit showWelcomeScreenChanged();
    }
}
Example #5
0
void Util::setFontSize(int size)
{
    if (size == fontSize()) {
        return;
    }

    setSettingsValue("ui/fontSize", size);
    emit fontSizeChanged();
}
Example #6
0
void Util::setKeyboardLayout(const QString &layout)
{
    if (layout == keyboardLayout()) {
        return;
    }

    setSettingsValue("ui/keyboardLayout", layout);
    emit keyboardLayoutChanged();
}
Example #7
0
void Util::setKeyboardFadeOutDelay(int delay)
{
    if (delay == keyboardFadeOutDelay()) {
        return;
    }

    setSettingsValue("ui/keyboardFadeOutDelay", delay);
    emit keyboardFadeOutDelayChanged();
}
Example #8
0
void SettingsJavaPluginForm::accepted()
{
	for (QMap<QWidget*,QString>::iterator it = m_extSettingsWidgets.begin(); it != m_extSettingsWidgets.end(); it++)
	{
		if (QLineEdit* edit = dynamic_cast<QLineEdit*>(it.key()))
		{
			setSettingsValue(it.value(), edit->text());
		}
		else if (QListWidget* list = dynamic_cast<QListWidget*>(it.key()))
		{
			if (list->dragDropMode() == QAbstractItemView::InternalMove) // order item
			{
				QList<QMap<QString, QVariant> > slist;

				for (int i = 0; i < list->count(); i++)
				{
					QListWidgetItem* item = list->item(i);
					QMap<QString, QVariant> map;

					map["item"] = item->data(Qt::UserRole).toString();
					slist << map;
				}

				setSettingsArray(it.value(), slist);
			}
		}
		else if (QComboBox* combo = dynamic_cast<QComboBox*>(it.key()))
		{
			int index = combo->currentIndex();
			setSettingsValue(it.value(), combo->itemData(index));
		}
	}

	for (int i = 0; i < g_configListeners.size(); i++)
		g_configListeners[i].call("configurationSaved");

	setSettingsValue("java/check_updates", checkAutoCheck->isChecked());
}
Example #9
0
void HttpFtpSettings::accepted()
{
	int index = comboDefaultProxy->currentIndex();
	if(!index)
		m_defaultProxy = QUuid();
	else
		m_defaultProxy = m_listProxy[index-1].uuid;
	setSettingsValue("httpftp/defaultproxy", m_defaultProxy.toString());
	
	Auth::saveAuths(m_listAuth);
	setSettingsValue("httpftp/forbidipv6", checkForbidIPv6->isChecked());

	bool ok;
	int timeout = lineConnectionTimeout->text().toInt(&ok);
	if (!ok || timeout <= 0)
		timeout = 20;

	setSettingsValue("httpftp/timeout", timeout);
	lineConnectionTimeout->setText(QString::number(timeout));

	setSettingsValue("httpftp/detect_torrents", checkDetectTorrents->isChecked());

	CurlPoller::setTransferTimeout(timeout);
}
Example #10
0
void Util::setOrientationMode(int mode)
{
    if (mode == orientationMode()) {
        return;
    }

    QString modeString;
    switch(mode) {
    case OrientationAuto:
        modeString = "auto";
        break;
    case OrientationLandscape:
        modeString = "landscape";
        break;
    case OrientationPortrait:
    default:
        modeString = "portrait";
    }

    setSettingsValue("ui/orientationLockMode", modeString);
    emit orientationModeChanged();
}
Example #11
0
void Util::setKeyboardMode(int mode)
{
    if (mode == keyboardMode()) {
        return;
    }

    QString modeString;
    switch(mode) {
    case KeyboardFade:
        modeString = "fade";
        break;
    case KeyboardMove:
        modeString = "move";
        break;
    case KeyboardOff:
    default:
        modeString = "off";
    }

    setSettingsValue("ui/vkbShowMethod", modeString);
    emit keyboardModeChanged();
}
void ToastySettings::save()
{
    setSettingsValue(QLatin1String("DeviceID"), m_lineEdit->text());
}
void PreferencesDialog::saveSettings()
{
    setSettingsValue("db", "defaultencoding", ui->encodingComboBox->currentText());
    setSettingsValue("db", "defaultlocation", ui->locationEdit->text());
    setSettingsValue("db", "savedefaultlocation", ui->comboDefaultLocation->currentIndex());
    setSettingsValue("db", "hideschemalinebreaks", ui->checkHideSchemaLinebreaks->isChecked());
    setSettingsValue("db", "foreignkeys", ui->foreignKeysCheckBox->isChecked());
    setSettingsValue("db", "prefetchsize", ui->spinPrefetchSize->value());

    setSettingsValue("checkversion", "enabled", ui->checkUpdates->isChecked());

    setSettingsValue("databrowser", "null_bg_colour",
                     ui->frameNullBgColour->palette().color(ui->frameNullBgColour->backgroundRole()));
    setSettingsValue("databrowser", "null_fg_colour",
                     ui->frameNullFgColour->palette().color(ui->frameNullFgColour->backgroundRole()));
    setSettingsValue("databrowser", "null_text", ui->txtNull->text());

    for(int i=0; i < ui->treeSyntaxHighlighting->topLevelItemCount(); ++i)
    {
        QString name = ui->treeSyntaxHighlighting->topLevelItem(i)->text(0);
        setSettingsValue("syntaxhighlighter", name + "_colour", ui->treeSyntaxHighlighting->topLevelItem(i)->text(2));
        setSettingsValue("syntaxhighlighter", name + "_bold", ui->treeSyntaxHighlighting->topLevelItem(i)->checkState(3) == Qt::Checked);
        setSettingsValue("syntaxhighlighter", name + "_italic", ui->treeSyntaxHighlighting->topLevelItem(i)->checkState(4) == Qt::Checked);
        setSettingsValue("syntaxhighlighter", name + "_underline", ui->treeSyntaxHighlighting->topLevelItem(i)->checkState(5) == Qt::Checked);
    }
    setSettingsValue("editor", "fontsize", ui->spinEditorFontSize->value());
    setSettingsValue("editor", "tabsize", ui->spinTabSize->value());
    setSettingsValue("log", "fontsize", ui->spinLogFontSize->value());

    QStringList extList;
    foreach(QListWidgetItem* item, ui->listExtensions->findItems(QString("*"), Qt::MatchWrap | Qt::MatchWildcard))
        extList.append(item->text());
    setSettingsValue("extensions", "list", extList);
    setSettingsValue("extensions", "disableregex", ui->checkRegexDisabled->isChecked());

    // Warn about restarting to change language
    QVariant newLanguage = ui->languageComboBox->itemData(ui->languageComboBox->currentIndex());
    if (newLanguage != getSettingsValue("General", "language"))
        QMessageBox::information(this, QApplication::applicationName(),
                                 tr("The language will change after you restart the application."));

    setSettingsValue("General", "language", newLanguage);

    accept();
}
Example #14
0
/*!
    Set current file path in the settings
    \param path/file Current index
    \param updateDock Update UI according with new path
*/
void FileBrowser::setFilePath( const QString& filePath, bool updateDock )
{
    setSettingsValue( "FilePath", filePath );
    if ( updateDock && mDock )
        mDock->setCurrentFilePath( filePath );
}
Example #15
0
/*!
    Set current path (root of the tree) in the settings
    \param path Current path
    \param updateDock Update UI according with new path
*/
void FileBrowser::setPath( const QString& path, bool updateDock )
{
    setSettingsValue( "Path", path );
    if ( updateDock && mDock )
        mDock->setCurrentPath( path );
}
Example #16
0
void FileBrowser::setBookmarks( const QStringList& bookmarks, bool updateDock )
{
    setSettingsValue( "Bookmarks", bookmarks );
    if ( updateDock && mDock )
        mDock->setBookmarks( bookmarks );
}
Example #17
0
/*!
    Set wildcards for filtering unneeded files from tree
    \param filters New set of filters
    \param updateDock If true - UI will be updated according with new filters
*/
void FileBrowser::setFilters( const QStringList& filters, bool updateDock )
{
    setSettingsValue( "Wildcards", filters );
    if ( updateDock && mDock )
        mDock->setFilters( filters );
}
Example #18
0
void JSettings::setValueDouble(JNIEnv*, jclass, jstring jname, jdouble value)
{
	JString name(jname);
	setSettingsValue(name.str(), value);
}
Example #19
0
void JSettings::setValueBoolean(JNIEnv*, jclass, jstring jname, jboolean value)
{
	JString name(jname);
	setSettingsValue(name.str(), value);
}
Example #20
0
void JSettings::setValueLong(JNIEnv*, jclass, jstring jname, jlong value)
{
	JString name(jname);
	setSettingsValue(name.str(), qlonglong(value));
}
Example #21
0
void SnoreSettings::save()
{
    setSettingsValue(SnoreBackendConstants::Position, m_comboBox->currentIndex());
}
Example #22
0
void SettingsGeneralForm::accepted()
{
	setSettingsValue("fileexec", comboFileExec->currentText());
	
	setSettingsValue("trayicon", checkTrayIcon->isChecked());
	setSettingsValue("hideminimize", checkHideMinimize->isChecked());
	setSettingsValue("hideclose", checkHideClose->isChecked());
	setSettingsValue("gui/hideunfocused", checkHideUnfocused->isChecked());
	
	setSettingsValue("graphminutes", spinGraphMinutes->value());
	setSettingsValue("graph_style", comboGraphStyle->currentIndex());
	setSettingsValue("transfer_dblclk", comboDoubleClick->currentIndex());
	setSettingsValue("tab_onclose", comboCloseCurrent->currentIndex());
	setSettingsValue("link_separator", comboLinkSeparator->currentIndex());
	
	setSettingsValue("gui_refresh", spinRefreshGUI->value()*1000);
	setSettingsValue("css", checkCSS->isChecked());
	setSettingsValue("gui/systemtheme", checkSystemTheme->isChecked());
	
	applySettings();
}
Example #23
0
void JVM::jvmStartup(QString libname)
{
	QLibrary lib (libname);
	cjvm_fn fn = (cjvm_fn) lib.resolve("JNI_CreateJavaVM");

	qDebug() << "libjvm found in" << libname;
	setSettingsValue("extensions/jvm_path", libname);

	if (!fn)
	{
		Logger::global()->enterLogMessage("JPlugin", QObject::tr("Failed to load the correct libjvm: %1").arg(lib.errorString()));
		return;
	}

	jint res;
	JavaVMInitArgs vm_args;
#ifdef DEBUG_BUILD
	JavaVMOption options[9];
#else
	JavaVMOption options[7];
#endif
	
	JNIEnv* env;
	QByteArray classpath = getClassPath().toUtf8();
	int mb = getSettingsValue("java/maxheap").toInt();

	if (!mb)
		mb = 16;

	classpath.prepend("-Djava.class.path=");
	qDebug() << "Java Classpath set to" << classpath;

	options[0].optionString = classpath.data();
	options[1].optionString = static_cast<char*>(alloca(24));

	snprintf(options[1].optionString, 24, "-Xmx%dm", mb);
	options[2].optionString = const_cast<char*>("-Djava.security.manager");
	options[3].optionString = const_cast<char*>("-Djava.security.policy=" DATA_LOCATION "/data/java/extension.policy");
	options[4].optionString = const_cast<char*>("-XX:+UseParNewGC");
	options[5].optionString = const_cast<char*>("-XX:MinHeapFreeRatio=5");
	options[6].optionString = const_cast<char*>("-XX:MaxHeapFreeRatio=10");
#ifdef DEBUG_BUILD
	options[7].optionString = const_cast<char*>("-Xdebug");
	options[8].optionString = const_cast<char*>("-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8222");
#endif

	vm_args.version = 0x00010006;
	vm_args.options = options;
	vm_args.nOptions = sizeof(options)/sizeof(options[0]);
	vm_args.ignoreUnrecognized = JNI_TRUE;

	res = fn(&m_jvm, (void**)&env, &vm_args);
	if (res < 0)
	{
		Logger::global()->enterLogMessage("JPlugin", QObject::tr("Failed to create a Java VM"));
		return;
	}
	JNIEnv** penv = new JNIEnv*;
	*penv = env;
	m_env.setLocalData(penv);

	if (!m_instance)
		m_instance = this;

	try
	{
		singleCObjectRegisterNatives();
		JSettings::registerNatives();
		JPlugin::registerNatives();
		JTransferPlugin::registerNatives();
		JDownloadPlugin::registerNatives();
		JBackgroundWorker::registerNatives();
		JAccountStatusPlugin::registerNatives();
	}
	catch (...)
	{
		qDebug() << "Failed to register JNI functions. This usually happens when there is an API discrepancy between the Java and the native code.\nPlease, remove ~/.local/share/fatrat/data/java/libs/fatrat-jplugins-core.jar, and try again";
		abort();
	}
}