void InBandStreams::loadMethodSettings(IDataStreamSocket *ASocket, const OptionsNode &ANode) { IInBandStream *stream = qobject_cast<IInBandStream *>(ASocket->instance()); if (stream) { stream->setMaximumBlockSize(ANode.value("max-block-size").toInt()); stream->setBlockSize(ANode.value("block-size").toInt()); stream->setDataStanzaType(ANode.value("stanza-type").toInt()); } else { REPORT_ERROR("Failed to load inband stream settings: Invalid socket"); } }
void SocksStreams::loadMethodSettings(IDataStreamSocket *ASocket, const OptionsNode &ANode) { ISocksStream *stream = qobject_cast<ISocksStream *>(ASocket->instance()); if (stream) { QStringList proxyItems = ANode.value("stream-proxy-list").toStringList(); if (ANode.value("use-account-stream-proxy").toBool()) { QString streamProxy = accountStreamProxy(stream->streamJid()); if (!streamProxy.isEmpty() && !proxyItems.contains(streamProxy)) proxyItems.prepend(streamProxy); } stream->setProxyList(proxyItems); stream->setConnectTimeout(ANode.value("connect-timeout").toInt()); stream->setDirectConnectionsDisabled(ANode.value("disable-direct-connections").toBool()); stream->setForwardAddress(ANode.value("forward-host").toString(), ANode.value("forward-port").toInt()); if (ANode.value("use-account-network-proxy").toBool()) stream->setNetworkProxy(accountNetworkProxy(stream->streamJid())); else if (FConnectionManager) stream->setNetworkProxy(FConnectionManager->proxyById(ANode.value("network-proxy").toString()).proxy); } else { REPORT_ERROR("Failed to load socks stream settings: Invalid socket"); } }
void UserTuneHandler::onOptionsChanged(const OptionsNode &ANode) { if (ANode.path() == OPV_USERTUNE_SHOW_ROSTER_LABEL) { FTuneLabelVisible = ANode.value().toBool(); if (FTuneLabelVisible) { foreach (const Jid streamJid, FRostersModel->streams()) { updateDataHolder(streamJid, Jid::null); } } } else if (ANode.path() == OPV_USERTUNE_TAG_FORMAT) {
IConnectionProxy ConnectionManager::proxyById(const QUuid &AProxyId) const { static const IConnectionProxy noProxy = {" "+tr("<No Proxy>"), QNetworkProxy(QNetworkProxy::NoProxy) }; if (!AProxyId.isNull()) { OptionsNode pnode; QList<QUuid> plist = proxyList(); if (plist.contains(AProxyId)) pnode = Options::node(OPV_PROXY_ITEM,AProxyId.toString()); else if (plist.contains(defaultProxy())) pnode = Options::node(OPV_PROXY_ITEM,defaultProxy().toString()); if (!pnode.isNull()) { IConnectionProxy proxy; proxy.name = pnode.value("name").toString(); proxy.proxy.setType((QNetworkProxy::ProxyType)pnode.value("type").toInt()); proxy.proxy.setHostName(pnode.value("host").toString()); proxy.proxy.setPort(pnode.value("port").toInt()); proxy.proxy.setUser(pnode.value("user").toString()); proxy.proxy.setPassword(Options::decrypt(pnode.value("pass").toByteArray()).toString()); return proxy; } } return noProxy; }
void EditWidget::onOptionsChanged(const OptionsNode &ANode) { if (ANode.path() == OPV_MESSAGES_EDITORAUTORESIZE) { setAutoResize(ANode.value().toBool()); } else if (ANode.path() == OPV_MESSAGES_EDITORMINIMUMLINES) { setMinimumLines(ANode.value().toInt()); } else if (ANode.path() == OPV_MESSAGES_EDITORMAXIMUMLINES) { setMaximumLines(ANode.value().toInt()); } else if (ANode.path() == OPV_MESSAGES_EDITORSENDKEY) { QKeySequence key = ANode.value().value<QKeySequence>(); if (key.isEmpty()) key = Options::defaultValue(OPV_MESSAGES_EDITORSENDKEY).value<QKeySequence>(); setSendKey(key); ; } }
void ConsoleWidget::loadContext(const QUuid &AContextId) { OptionsNode node = Options::node(OPV_CONSOLE_CONTEXT_ITEM, AContextId.toString()); QString streamJid = node.value("streamjid").toString(); if (streamJid.isEmpty()) ui.cmbStreamJid->setCurrentIndex(0); else ui.cmbStreamJid->setCurrentIndex(ui.cmbStreamJid->findData(streamJid)); ui.ltwConditions->clear(); ui.ltwConditions->addItems(node.value("conditions").toStringList()); ui.chbWordWrap->setChecked(node.value("word-wrap").toBool()); ui.chbHilightXML->setCheckState((Qt::CheckState)node.value("highlight-xml").toInt()); onWordWrapButtonToggled(ui.chbWordWrap->isChecked()); if (!restoreGeometry(Options::fileValue("console.context.window-geometry",AContextId.toString()).toByteArray())) setGeometry(WidgetManager::alignGeometry(QSize(640,640),this)); ui.sptHSplitter->restoreState(Options::fileValue("console.context.hsplitter-state",AContextId.toString()).toByteArray()); ui.sptVSplitter->restoreState(Options::fileValue("console.context.vsplitter-state",AContextId.toString()).toByteArray()); setWindowTitle(tr("XML Console - %1").arg(node.value("name").toString())); }
IMessageStyleOptions SimpleMessageStyleEngine::styleOptions(const OptionsNode &AEngineNode, const QString &AStyleId) const { IMessageStyleOptions options; if (AStyleId.isEmpty() || FStylePaths.contains(AStyleId)) { QString styleId = AStyleId.isEmpty() ? AEngineNode.value("style-id").toString() : AStyleId; // Select default style if (!FStylePaths.isEmpty() && !FStylePaths.contains(styleId)) { int mtype = AEngineNode.parentNSpaces().value(1).toInt(); switch (mtype) { case Message::Normal: case Message::Headline: case Message::Error: styleId = "Message Style"; AEngineNode.node("style",styleId).setValue(QString("Default"),"variant"); break; default: styleId = "Chat Style"; AEngineNode.node("style",styleId).setValue(QString("Default"),"variant"); } styleId = !FStylePaths.contains(styleId) ? FStylePaths.keys().first() : styleId; } if (FStylePaths.contains(styleId)) { options.engineId = engineId(); options.styleId = styleId; OptionsNode styleNode = AEngineNode.node("style",styleId); options.extended.insert(MSO_VARIANT,styleNode.value("variant")); options.extended.insert(MSO_FONT_FAMILY,styleNode.value("font-family")); options.extended.insert(MSO_FONT_SIZE,styleNode.value("font-size")); options.extended.insert(MSO_SELF_COLOR,styleNode.value("self-color")); options.extended.insert(MSO_CONTACT_COLOR,styleNode.value("contact-color")); options.extended.insert(MSO_BG_COLOR,styleNode.value("bg-color")); options.extended.insert(MSO_BG_IMAGE_FILE,styleNode.value("bg-image-file")); QList<QString> variants = styleVariants(styleId); QMap<QString,QVariant> info = styleInfo(styleId); if (!variants.contains(options.extended.value(MSO_VARIANT).toString())) options.extended.insert(MSO_VARIANT,info.value(MSIV_DEFAULT_VARIANT, variants.value(0))); if (info.value(MSIV_DISABLE_CUSTOM_BACKGROUND,false).toBool()) { options.extended.remove(MSO_BG_IMAGE_FILE); options.extended.insert(MSO_BG_COLOR,info.value(MSIV_DEFAULT_BACKGROUND_COLOR)); } else if (options.extended.value(MSO_BG_COLOR).toString().isEmpty()) { options.extended.insert(MSO_BG_COLOR,info.value(MSIV_DEFAULT_BACKGROUND_COLOR)); } if (options.extended.value(MSO_FONT_FAMILY).toString().isEmpty()) options.extended.insert(MSO_FONT_FAMILY,info.value(MSIV_DEFAULT_FONT_FAMILY)); if (options.extended.value(MSO_FONT_SIZE).toInt() == 0) options.extended.insert(MSO_FONT_SIZE,info.value(MSIV_DEFAULT_FONT_SIZE)); if (options.extended.value(MSO_SELF_COLOR).toString().isEmpty()) options.extended.insert(MSO_SELF_COLOR,info.value(MSIV_DEFAULT_SELF_COLOR,QColor(Qt::red).name())); if (options.extended.value(MSO_CONTACT_COLOR).toString().isEmpty()) options.extended.insert(MSO_CONTACT_COLOR,info.value(MSIV_DEFAULT_CONTACT_COLOR,QColor(Qt::blue).name())); } else { REPORT_ERROR("Failed to find any suitable simple message style"); } } else { REPORT_ERROR(QString("Failed to get adium style options for style=%1: Style not found").arg(AStyleId)); } return options; }
QUuid ConnectionManager::loadProxySettings(const OptionsNode &ANode) const { return ANode.value().toString(); }