CoinControlDialog::CoinControlDialog(const PlatformStyle *platformStyle, QWidget *parent) : QDialog(parent), ui(new Ui::CoinControlDialog), model(0), platformStyle(platformStyle) { ui->setupUi(this); // context menu actions QAction *copyAddressAction = new QAction(tr("Copy address"), this); QAction *copyLabelAction = new QAction(tr("Copy label"), this); QAction *copyAmountAction = new QAction(tr("Copy amount"), this); copyTransactionHashAction = new QAction(tr("Copy transaction ID"), this); // we need to enable/disable this lockAction = new QAction(tr("Lock unspent"), this); // we need to enable/disable this unlockAction = new QAction(tr("Unlock unspent"), this); // we need to enable/disable this // context menu contextMenu = new QMenu(); contextMenu->addAction(copyAddressAction); contextMenu->addAction(copyLabelAction); contextMenu->addAction(copyAmountAction); contextMenu->addAction(copyTransactionHashAction); contextMenu->addSeparator(); contextMenu->addAction(lockAction); contextMenu->addAction(unlockAction); // context menu signals connect(ui->treeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showMenu(QPoint))); connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress())); connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel())); connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount())); connect(copyTransactionHashAction, SIGNAL(triggered()), this, SLOT(copyTransactionHash())); connect(lockAction, SIGNAL(triggered()), this, SLOT(lockCoin())); connect(unlockAction, SIGNAL(triggered()), this, SLOT(unlockCoin())); // clipboard actions QAction *clipboardQuantityAction = new QAction(tr("Copy quantity"), this); QAction *clipboardAmountAction = new QAction(tr("Copy amount"), this); QAction *clipboardFeeAction = new QAction(tr("Copy fee"), this); QAction *clipboardAfterFeeAction = new QAction(tr("Copy after fee"), this); QAction *clipboardBytesAction = new QAction(tr("Copy bytes"), this); QAction *clipboardPriorityAction = new QAction(tr("Copy priority"), this); QAction *clipboardLowOutputAction = new QAction(tr("Copy dust"), this); QAction *clipboardChangeAction = new QAction(tr("Copy change"), this); connect(clipboardQuantityAction, SIGNAL(triggered()), this, SLOT(clipboardQuantity())); connect(clipboardAmountAction, SIGNAL(triggered()), this, SLOT(clipboardAmount())); connect(clipboardFeeAction, SIGNAL(triggered()), this, SLOT(clipboardFee())); connect(clipboardAfterFeeAction, SIGNAL(triggered()), this, SLOT(clipboardAfterFee())); connect(clipboardBytesAction, SIGNAL(triggered()), this, SLOT(clipboardBytes())); connect(clipboardPriorityAction, SIGNAL(triggered()), this, SLOT(clipboardPriority())); connect(clipboardLowOutputAction, SIGNAL(triggered()), this, SLOT(clipboardLowOutput())); connect(clipboardChangeAction, SIGNAL(triggered()), this, SLOT(clipboardChange())); ui->labelCoinControlQuantity->addAction(clipboardQuantityAction); ui->labelCoinControlAmount->addAction(clipboardAmountAction); ui->labelCoinControlFee->addAction(clipboardFeeAction); ui->labelCoinControlAfterFee->addAction(clipboardAfterFeeAction); ui->labelCoinControlBytes->addAction(clipboardBytesAction); ui->labelCoinControlPriority->addAction(clipboardPriorityAction); ui->labelCoinControlLowOutput->addAction(clipboardLowOutputAction); ui->labelCoinControlChange->addAction(clipboardChangeAction); // toggle tree/list mode connect(ui->radioTreeMode, SIGNAL(toggled(bool)), this, SLOT(radioTreeMode(bool))); connect(ui->radioListMode, SIGNAL(toggled(bool)), this, SLOT(radioListMode(bool))); // click on checkbox connect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(viewItemChanged(QTreeWidgetItem*, int))); // click on header #if QT_VERSION < 0x050000 ui->treeWidget->header()->setClickable(true); #else ui->treeWidget->header()->setSectionsClickable(true); #endif connect(ui->treeWidget->header(), SIGNAL(sectionClicked(int)), this, SLOT(headerSectionClicked(int))); // ok button connect(ui->buttonBox, SIGNAL(clicked( QAbstractButton*)), this, SLOT(buttonBoxClicked(QAbstractButton*))); // (un)select all connect(ui->pushButtonSelectAll, SIGNAL(clicked()), this, SLOT(buttonSelectAllClicked())); // change coin control first column label due Qt4 bug. // see https://github.com/bitcoin/bitcoin/issues/5716 ui->treeWidget->headerItem()->setText(COLUMN_CHECKBOX, QString()); ui->treeWidget->setColumnWidth(COLUMN_CHECKBOX, 84); ui->treeWidget->setColumnWidth(COLUMN_AMOUNT, 100); ui->treeWidget->setColumnWidth(COLUMN_LABEL, 170); ui->treeWidget->setColumnWidth(COLUMN_ADDRESS, 290); ui->treeWidget->setColumnWidth(COLUMN_DATE, 110); ui->treeWidget->setColumnWidth(COLUMN_CONFIRMATIONS, 100); ui->treeWidget->setColumnWidth(COLUMN_PRIORITY, 100); ui->treeWidget->setColumnHidden(COLUMN_TXHASH, true); // store transaction hash in this column, but don't show it ui->treeWidget->setColumnHidden(COLUMN_VOUT_INDEX, true); // store vout index in this column, but don't show it ui->treeWidget->setColumnHidden(COLUMN_AMOUNT_INT64, true); // store amount int64 in this column, but don't show it ui->treeWidget->setColumnHidden(COLUMN_PRIORITY_INT64, true); // store priority int64 in this column, but don't show it ui->treeWidget->setColumnHidden(COLUMN_DATE_INT64, true); // store date int64 in this column, but don't show it // default view is sorted by amount desc sortView(COLUMN_AMOUNT_INT64, Qt::DescendingOrder); // restore list mode and sortorder as a convenience feature QSettings settings; if (settings.contains("nCoinControlMode") && !settings.value("nCoinControlMode").toBool()) ui->radioTreeMode->click(); if (settings.contains("nCoinControlSortColumn") && settings.contains("nCoinControlSortOrder")) sortView(settings.value("nCoinControlSortColumn").toInt(), ((Qt::SortOrder)settings.value("nCoinControlSortOrder").toInt())); }
bool SettingsDialog::loadSettings() { QSettings settings; p->ui.monitorOutputDevice->clear(); p->ui.monitorOutputDevice->addItems(settings.value("MonitorOutputDevices").toStringList()); int index = p->ui.monitorOutputDevice->findText(settings.value("MonitorOutputDevice").toString()); p->ui.monitorOutputDevice->setCurrentIndex(index); //Common p->ui.comboLanguage->setCurrentIndex( settings.value("language",0 ).toInt()); //fade slider p->ui.faderTimeSlider->setValue(settings.value("faderTimeSlider","12").toInt()); p->ui.faderTimeLabel->setText(settings.value("faderTimeSlider","12").toString() + "s"); p->ui.faderEndSlider->setValue(settings.value("faderEndSlider","12").toInt()); p->ui.faderEndLabel->setText(settings.value("faderEndSlider","12").toString() + "s"); //Playlist setting p->ui.checkAutoRemove->setChecked(settings.value("checkAutoRemove",true).toBool()); //Silent setting p->ui.checkSkipSilentEnd->setChecked(settings.value("checkSkipSilentEnd",true).toBool()); p->ui.checkAutoCue->setChecked(settings.value("checkAutoCue",true).toBool()); //AutoDJ p->ui.minTracks->setValue(settings.value("minTracks","6").toInt()); p->ui.countDJ->setValue(settings.value("countDJ","3").toInt()); p->ui.checkAutoDjCountPlayed->setChecked(settings.value("isEnabledAutoDJCount",false).toBool()); //CollectionFolders p->model->setDirsChecked(settings.value("Dirs").toStringList()); p->ui.chkMonitor->setChecked(settings.value("Monitor").toBool()); //File Browser p->ui.txtBrowserRoot->setText(settings.value("editBrowerRoot","").toString()); //Load Dj list loadDjList(p->ui.countDJ->value()); return true; }
SyntroDB::SyntroDB() : QMainWindow() { m_startingUp = true; ui.setupUi(this); m_storeStreamDlg = NULL; connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(close())); connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT(onAbout())); connect(ui.actionBasicSetup, SIGNAL(triggered()), this, SLOT(onBasicSetup())); connect(ui.actionConfiguration, SIGNAL(triggered()), this, SLOT(onConfiguration())); initStatusBar(); initDisplayStats(); restoreWindowState(); SyntroUtils::syntroAppInit(); startControlServer(); setWindowTitle(QString("%1 - %2") .arg(SyntroUtils::getAppType()) .arg(SyntroUtils::getAppName())); m_storeClient = new StoreClient(this); connect(this, SIGNAL(refreshStreamSource(int)), m_storeClient, SLOT(refreshStreamSource(int)), Qt::QueuedConnection); connect(m_storeClient, SIGNAL(running()), this, SLOT(storeRunning()), Qt::QueuedConnection); m_storeClient->resumeThread(); m_CFSClient = new CFSClient(this); m_CFSClient->resumeThread(); QSettings *settings = SyntroUtils::getSettings(); settings->beginReadArray(SYNTRODB_PARAMS_STREAM_SOURCES); for (int index = 0; index < SYNTRODB_MAX_STREAMS; index++) { settings->setArrayIndex(index); QString source = settings->value(SYNTRODB_PARAMS_STREAM_SOURCE).toString(); m_rxStreamTable->item(index, SYNTRODB_COL_STREAM)->setText(source); if (source.length() > 0) { if (settings->value(SYNTRODB_PARAMS_INUSE, SYNTRO_PARAMS_FALSE).toString() == SYNTRO_PARAMS_TRUE) m_useBox[index]->setCheckState(Qt::Checked); else m_useBox[index]->setCheckState(Qt::Unchecked); } else { m_useBox[index]->setCheckState(Qt::Unchecked); } } settings->endArray(); m_startingUp = false; delete settings; m_timerId = startTimer(2000); }
void GameStorage::setRounds(int uniqueId, int rounds) { QSettings settings; settings.setValue(QString("%1.rounds").arg(uniqueId), rounds); }
void GameStorage::setWins(int uniqueId, int wins) { QSettings settings; settings.setValue(QString("%1.wins").arg(uniqueId), wins); }
void QgsComposerView::wheelZoom( QWheelEvent * event ) { //get mouse wheel zoom behaviour settings QSettings mySettings; int wheelAction = mySettings.value( "/qgis/wheel_action", 2 ).toInt(); double zoomFactor = mySettings.value( "/qgis/zoom_factor", 2 ).toDouble(); if (( QgsMapCanvas::WheelAction )wheelAction == QgsMapCanvas::WheelNothing ) { return; } if ( event->modifiers() & Qt::ControlModifier ) { //holding ctrl while wheel zooming results in a finer zoom zoomFactor = 1.0 + ( zoomFactor - 1.0 ) / 10.0; } //caculate zoom scale factor bool zoomIn = event->delta() > 0; double scaleFactor = ( zoomIn ? 1 / zoomFactor : zoomFactor ); //get current visible part of scene QRect viewportRect( 0, 0, viewport()->width(), viewport()->height() ); QgsRectangle visibleRect = QgsRectangle( mapToScene( viewportRect ).boundingRect() ); //transform the mouse pos to scene coordinates QPointF scenePoint = mapToScene( event->pos() ); //adjust view center according to wheel action setting switch (( QgsMapCanvas::WheelAction )wheelAction ) { case QgsMapCanvas::WheelZoomAndRecenter: { centerOn( scenePoint.x(), scenePoint.y() ); break; } case QgsMapCanvas::WheelZoomToMouseCursor: { QgsPoint oldCenter( visibleRect.center() ); QgsPoint newCenter( scenePoint.x() + (( oldCenter.x() - scenePoint.x() ) * scaleFactor ), scenePoint.y() + (( oldCenter.y() - scenePoint.y() ) * scaleFactor ) ); centerOn( newCenter.x(), newCenter.y() ); break; } default: break; } //zoom composition if ( zoomIn ) { scale( zoomFactor, zoomFactor ); } else { scale( 1 / zoomFactor, 1 / zoomFactor ); } //update composition for new zoom emit zoomLevelChanged(); updateRulers(); update(); //redraw cached map items QList<QGraphicsItem *> itemList = composition()->items(); QList<QGraphicsItem *>::iterator itemIt = itemList.begin(); for ( ; itemIt != itemList.end(); ++itemIt ) { QgsComposerMap* mypItem = dynamic_cast<QgsComposerMap *>( *itemIt ); if (( mypItem ) && ( mypItem->previewMode() == QgsComposerMap::Render ) ) { mypItem->updateCachedImage(); } } }
/** Ask user which datum transform to use*/ void QgsMapCanvas::getDatumTransformInfo( const QgsMapLayer* ml, const QString& srcAuthId, const QString& destAuthId ) { if ( !ml ) { return; } //check if default datum transformation available QSettings s; QString settingsString = "/Projections/" + srcAuthId + "//" + destAuthId; QVariant defaultSrcTransform = s.value( settingsString + "_srcTransform" ); QVariant defaultDestTransform = s.value( settingsString + "_destTransform" ); if ( defaultSrcTransform.isValid() && defaultDestTransform.isValid() ) { mSettings.datumTransformStore().addEntry( ml->id(), srcAuthId, destAuthId, defaultSrcTransform.toInt(), defaultDestTransform.toInt() ); mMapRenderer->addLayerCoordinateTransform( ml->id(), srcAuthId, destAuthId, defaultSrcTransform.toInt(), defaultDestTransform.toInt() ); return; } const QgsCoordinateReferenceSystem& srcCRS = QgsCRSCache::instance()->crsByAuthId( srcAuthId ); const QgsCoordinateReferenceSystem& destCRS = QgsCRSCache::instance()->crsByAuthId( destAuthId ); if ( !s.value( "/Projections/showDatumTransformDialog", false ).toBool() ) { // just use the default transform mSettings.datumTransformStore().addEntry( ml->id(), srcAuthId, destAuthId, -1, -1 ); mMapRenderer->addLayerCoordinateTransform( ml->id(), srcAuthId, destAuthId, -1, -1 ); return; } //get list of datum transforms QList< QList< int > > dt = QgsCoordinateTransform::datumTransformations( srcCRS, destCRS ); if ( dt.size() < 2 ) { return; } //if several possibilities: present dialog QgsDatumTransformDialog d( ml->name(), dt ); d.setDatumTransformInfo( srcCRS.authid(), destCRS.authid() ); if ( d.exec() == QDialog::Accepted ) { int srcTransform = -1; int destTransform = -1; QList<int> t = d.selectedDatumTransform(); if ( !t.isEmpty() ) { srcTransform = t.at( 0 ); } if ( t.size() > 1 ) { destTransform = t.at( 1 ); } mSettings.datumTransformStore().addEntry( ml->id(), srcAuthId, destAuthId, srcTransform, destTransform ); mMapRenderer->addLayerCoordinateTransform( ml->id(), srcAuthId, destAuthId, srcTransform, destTransform ); if ( d.rememberSelection() ) { s.setValue( settingsString + "_srcTransform", srcTransform ); s.setValue( settingsString + "_destTransform", destTransform ); } } else { mSettings.datumTransformStore().addEntry( ml->id(), srcAuthId, destAuthId, -1, -1 ); mMapRenderer->addLayerCoordinateTransform( ml->id(), srcAuthId, destAuthId, -1, -1 ); } }
void ccColorScalesManager::fromPersistentSettings() { QSettings settings; settings.beginGroup(c_csm_groupName); QStringList scales = settings.childGroups(); ccLog::Print(QString("[ccColorScalesManager] Found %1 custom scale(s) in persistent settings").arg(scales.size())); //read each scale for (int j=0; j<scales.size(); ++j) { settings.beginGroup(scales[j]); QString name = settings.value(c_csm_scaleName,"unknown").toString(); bool relative = settings.value(c_csm_relative,true).toBool(); ccColorScale::Shared scale(new ccColorScale(name,scales[j])); if (!relative) { double minVal = settings.value(c_csm_minVal,0.0).toDouble(); double maxVal = settings.value(c_csm_maxVal,1.0).toDouble(); scale->setAbsolute(minVal,maxVal); } try { //steps { int size = settings.beginReadArray(c_csm_stepsList); for (int i=0; i<size;++i) { settings.setArrayIndex(i); double relativePos = settings.value(c_csm_stepRelativePos, 0.0).toDouble(); QRgb rgb = static_cast<QRgb>(settings.value(c_csm_stepColor, 0).toInt()); QColor color = QColor::fromRgb(rgb); scale->insert(ccColorScaleElement(relativePos,color),false); } settings.endArray(); } //custom labels { int size = settings.beginReadArray(c_csm_customLabels); for (int i=0; i<size;++i) { settings.setArrayIndex(i); double label = settings.value(c_csm_customLabelValue, 0.0).toDouble(); scale->customLabels().insert(label); } settings.endArray(); } } catch (const std::bad_alloc&) { ccLog::Warning(QString("[ccColorScalesManager] Failed to load scale '%1' (not enough memory)").arg(scale->getName())); scale.clear(); } settings.endGroup(); if (scale) { scale->update(); addScale(scale); } } settings.endGroup(); }
bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, int role) { bool successful = true; /* set to false on parse error */ if(role == Qt::EditRole) { QSettings settings; switch(index.row()) { case StartAtStartup: successful = GUIUtil::SetStartOnSystemStartup(value.toBool()); break; case MinimizeToTray: fMinimizeToTray = value.toBool(); settings.setValue("fMinimizeToTray", fMinimizeToTray); break; case MapPortUPnP: fUseUPnP = value.toBool(); settings.setValue("fUseUPnP", value.toBool()); MapPort(value.toBool()); break; case MinimizeOnClose: fMinimizeOnClose = value.toBool(); settings.setValue("fMinimizeOnClose", fMinimizeOnClose); break; case ProxyUse: settings.setValue("fUseProxy", value.toBool()); ApplyProxySettings(); break; case ProxyIP: { proxyType proxy; proxy = CService("127.0.0.1", 9050); GetProxy(NET_IPV4, proxy); CNetAddr addr(value.toString().toStdString()); proxy.SetIP(addr); settings.setValue("addrProxy", proxy.ToStringIPPort().c_str()); successful = ApplyProxySettings(); } break; case ProxyPort: { proxyType proxy; proxy = CService("127.0.0.1", 9050); GetProxy(NET_IPV4, proxy); proxy.SetPort(value.toInt()); settings.setValue("addrProxy", proxy.ToStringIPPort().c_str()); successful = ApplyProxySettings(); } break; case Fee: nTransactionFee = value.toLongLong(); settings.setValue("nTransactionFee", (qint64) nTransactionFee); emit transactionFeeChanged(nTransactionFee); break; case ReserveBalance: nReserveBalance = value.toLongLong(); settings.setValue("nReserveBalance", (qint64) nReserveBalance); emit reserveBalanceChanged(nReserveBalance); break; case DisplayUnit: nDisplayUnit = value.toInt(); settings.setValue("nDisplayUnit", nDisplayUnit); emit displayUnitChanged(nDisplayUnit); break; case DisplayAddresses: bDisplayAddresses = value.toBool(); settings.setValue("bDisplayAddresses", bDisplayAddresses); emit displayUnitChanged(settings.value("nDisplayUnit", BitcoinUnits::LEO).toInt()); break; case DetachDatabases: { bool fDetachDB = value.toBool(); bitdb.SetDetach(fDetachDB); settings.setValue("detachDB", fDetachDB); } break; case Language: settings.setValue("language", value); break; case RowsPerPage: { nRowsPerPage = value.toInt(); settings.setValue("nRowsPerPage", nRowsPerPage); emit rowsPerPageChanged(nRowsPerPage); } break; case Notifications: { notifications = value.toStringList(); settings.setValue("notifications", notifications); } break; case VisibleTransactions: { visibleTransactions = value.toStringList(); settings.setValue("visibleTransactions", visibleTransactions); emit visibleTransactionsChanged(visibleTransactions); } break; case AutoRingSize: { fAutoRingSize = value.toBool(); settings.setValue("fAutoRingSize", fAutoRingSize); } break; case AutoRedeemLEOcoin: { fAutoRedeemLEOcoin = value.toBool(); settings.setValue("fAutoRedeemLEOcoin", fAutoRedeemLEOcoin); } break; case MinRingSize: { nMinRingSize = value.toInt(); settings.setValue("nMinRingSize", nMinRingSize); } break; case MaxRingSize: { nMaxRingSize = value.toInt(); settings.setValue("nMaxRingSize", nMaxRingSize); } break; case Staking: settings.setValue("fStaking", value.toBool()); break; case MinStakeInterval: nMinStakeInterval = value.toInt(); settings.setValue("nMinStakeInterval", nMinStakeInterval); break; case ThinMode: settings.setValue("fThinMode", value.toBool()); break; case ThinFullIndex: settings.setValue("fThinFullIndex", value.toBool()); break; case ThinIndexWindow: settings.setValue("fThinIndexWindow", value.toInt()); break; case SecureMessaging: { if(value.toBool()) { if(!fSecMsgEnabled) SecureMsgEnable(); } else SecureMsgDisable(); settings.setValue("fSecMsgEnabled", fSecMsgEnabled); } break; default: break; } } emit dataChanged(index, index); return successful; }
QgsDecorationCopyrightDialog::~QgsDecorationCopyrightDialog() { QSettings settings; settings.setValue( "/Windows/DecorationCopyright/geometry", saveGeometry() ); }
void ccColorScalesManager::toPersistentSettings() const { QSettings settings; //remove all existing info settings.remove(c_csm_groupName); //create new set settings.beginGroup(c_csm_groupName); //add each scale for (ScalesMap::const_iterator it = m_scales.begin(); it != m_scales.end(); ++it) { if (!(*it)->isLocked()) //locked scales are pre-defined ones! { settings.beginGroup((*it)->getUuid()); settings.setValue(c_csm_scaleName,(*it)->getName()); settings.setValue(c_csm_relative,(*it)->isRelative()); if (!(*it)->isRelative()) { double minVal,maxVal; (*it)->getAbsoluteBoundaries(minVal,maxVal); settings.setValue(c_csm_minVal,minVal); settings.setValue(c_csm_maxVal,maxVal); } settings.beginWriteArray(c_csm_stepsList); { for (int i=0; i<(*it)->stepCount();++i) { settings.setArrayIndex(i); settings.setValue(c_csm_stepRelativePos, (*it)->step(i).getRelativePos()); int rgb = static_cast<int>((*it)->step(i).getColor().rgb()); settings.setValue(c_csm_stepColor, rgb); } } settings.endArray(); settings.beginWriteArray(c_csm_customLabels); { int i=0; for (ccColorScale::LabelSet::const_iterator itL=(*it)->customLabels().begin(); itL!=(*it)->customLabels().end(); ++itL, ++i) { settings.setArrayIndex(i); settings.setValue(c_csm_customLabelValue, *itL); } } settings.endArray(); settings.endGroup(); } } settings.endGroup(); }
Preferences::~Preferences() { if (!isChanged()) { return; } QSettings settings; settings.setValue("Goal/Type", m_goal_type); settings.setValue("Goal/Minutes", m_goal_minutes); settings.setValue("Goal/Words", m_goal_words); settings.setValue("Stats/ShowCharacters", m_show_characters); settings.setValue("Stats/ShowPages", m_show_pages); settings.setValue("Stats/ShowParagraphs", m_show_paragraphs); settings.setValue("Stats/ShowWords", m_show_words); settings.setValue("Stats/PageSizeType", m_page_type); settings.setValue("Stats/CharactersPerPage", m_page_characters); settings.setValue("Stats/ParagraphsPerPage", m_page_paragraphs); settings.setValue("Stats/WordsPerPage", m_page_words); settings.setValue("Stats/AccurateWordcount", m_accurate_wordcount); settings.setValue("Edit/AlwaysCenter", m_always_center); settings.setValue("Edit/BlockCursor", m_block_cursor); settings.setValue("Edit/RichText", m_rich_text); settings.setValue("Edit/SmoothFonts", m_smooth_fonts); settings.setValue("Edit/SmartQuotes", m_smart_quotes); settings.setValue("Edit/SmartDoubleQuotes", m_double_quotes); settings.setValue("Edit/SmartSingleQuotes", m_single_quotes); settings.setValue("Edit/TypewriterSounds", m_typewriter_sounds); settings.setValue("Save/Auto", m_auto_save); settings.setValue("Save/RememberPositions", m_save_positions); settings.setValue("Toolbar/Style", m_toolbar_style); settings.setValue("Toolbar/Actions", m_toolbar_actions); settings.setValue("Spelling/HighlightMisspelled", m_highlight_misspelled); settings.setValue("Spelling/IgnoreNumbers", m_ignore_numbers); settings.setValue("Spelling/IgnoreUppercase", m_ignore_uppercase); settings.setValue("Spelling/Language", m_language); }
Preferences::Preferences() { QSettings settings; m_goal_type = settings.value("Goal/Type", 1).toInt(); m_goal_minutes = settings.value("Goal/Minutes", 30).toInt(); m_goal_words = settings.value("Goal/Words", 1000).toInt(); m_show_characters = settings.value("Stats/ShowCharacters", true).toBool(); m_show_pages = settings.value("Stats/ShowPages", true).toBool(); m_show_paragraphs = settings.value("Stats/ShowParagraphs", true).toBool(); m_show_words = settings.value("Stats/ShowWords", true).toBool(); m_page_type = settings.value("Stats/PageSizeType", 0).toInt(); m_page_characters = settings.value("Stats/CharactersPerPage", 1500).toInt(); m_page_paragraphs = settings.value("Stats/ParagraphsPerPage", 5).toInt(); m_page_words = settings.value("Stats/WordsPerPage", 250).toInt(); m_accurate_wordcount = settings.value("Stats/AccurateWordcount", true).toBool(); m_always_center = settings.value("Edit/AlwaysCenter", false).toBool(); m_block_cursor = settings.value("Edit/BlockCursor", false).toBool(); m_rich_text = settings.value("Edit/RichText", false).toBool(); m_smooth_fonts = settings.value("Edit/SmoothFonts", true).toBool(); m_smart_quotes = settings.value("Edit/SmartQuotes", true).toBool(); m_double_quotes = settings.value("Edit/SmartDoubleQuotes", -1).toInt(); m_single_quotes = settings.value("Edit/SmartSingleQuotes", -1).toInt(); m_typewriter_sounds = settings.value("Edit/TypewriterSounds", true).toBool(); m_auto_save = settings.value("Save/Auto", false).toBool(); m_save_positions = settings.value("Save/RememberPositions", true).toBool(); m_toolbar_style = settings.value("Toolbar/Style", Qt::ToolButtonTextUnderIcon).toInt(); m_toolbar_actions = QStringList() << "New" << "Open" << "Save" << "|" << "Undo" << "Redo" << "|" << "Cut" << "Copy" << "Paste" << "|" << "Find" << "Replace"; m_toolbar_actions = settings.value("Toolbar/Actions", m_toolbar_actions).toStringList(); m_highlight_misspelled = settings.value("Spelling/HighlightMisspelled", true).toBool(); m_ignore_numbers = settings.value("Spelling/IgnoreNumbers", true).toBool(); m_ignore_uppercase = settings.value("Spelling/IgnoreUppercase", true).toBool(); m_language = settings.value("Spelling/Language", QLocale().name()).toString(); QStringList languages = Dictionary::availableLanguages(); if (!languages.isEmpty() && !languages.contains(m_language)) { int close = languages.indexOf(QRegExp(m_language.left(2) + ".*")); m_language = (close != -1) ? languages.at(close) : (languages.contains("en_US") ? "en_US" : languages.first()); } Dictionary::setDefaultLanguage(m_language); Dictionary::setIgnoreNumbers(m_ignore_numbers); Dictionary::setIgnoreUppercase(m_ignore_uppercase); }
bool DatabaseService::setupTables() { QSqlDatabase dbDisk = QSqlDatabase::database("disk"); QSqlQuery queryDisk(dbDisk); queryDisk.exec("CREATE TABLE IF NOT EXISTS appData (" "name VARCHAR(255) PRIMARY KEY, " "value VARCHAR(255));"); int version = getAppData("database_version").toInt(); int oldVersion = version; qDebug() << __func__ << " - 'database_version': " << version; QSqlDatabase dbMemory = QSqlDatabase::database("memory"); QSqlQuery queryMemory(dbMemory); queryMemory.exec("CREATE TABLE IF NOT EXISTS note (" "id INTEGER PRIMARY KEY," "name VARCHAR(255)," "file_name VARCHAR(255)," "note_text TEXT," "decrypted_note_text TEXT," "has_dirty_data INTEGER DEFAULT 0," "file_last_modified DATETIME," "file_created DATETIME," "crypto_key INT64 DEFAULT 0," "crypto_password VARCHAR(255)," "created DATETIME default current_timestamp," "modified DATETIME default current_timestamp)"); if (version < 1) { queryDisk.exec("CREATE TABLE IF NOT EXISTS calendarItem (" "id INTEGER PRIMARY KEY," "summary VARCHAR(255)," "url VARCHAR(255)," "description TEXT," "has_dirty_data INTEGER DEFAULT 0," "completed INTEGER DEFAULT 0," "priority INTEGER," "calendar VARCHAR(255)," "uid VARCHAR(255)," "ics_data TEXT," "alarm_date DATETIME," "etag VARCHAR(255)," "last_modified_string VARCHAR(255)," "created DATETIME DEFAULT current_timestamp," "modified DATETIME DEFAULT current_timestamp)"); queryDisk.exec("CREATE UNIQUE INDEX IF NOT EXISTS idxUrl " "ON calendarItem( url );"); queryDisk.exec("ALTER TABLE calendarItem ADD completed_date DATETIME;"); queryDisk.exec("ALTER TABLE calendarItem " "ADD sort_priority INTEGER DEFAULT 0;"); version = 1; } if (version < 2) { CalendarItem::updateAllSortPriorities(); version = 2; } if (version < 3) { queryDisk.exec("CREATE TABLE IF NOT EXISTS noteFolder (" "id INTEGER PRIMARY KEY," "name VARCHAR(255)," "local_path VARCHAR(255)," "remote_path VARCHAR(255)," "owncloud_server_id INTEGER DEFAULT 0," "priority INTEGER DEFAULT 0 )"); version = 3; } // we need to remove the main splitter sizes for version 4 and 5 if (version < 5) { QSettings settings; // remove the main splitter sizes for the tags pane settings.remove("mainSplitterSizes"); version = 5; } if (version < 6) { QSettings settings; // remove the obsolete activeTagId setting settings.remove("activeTagId"); version = 6; } if (version < 7) { queryDisk.exec("ALTER TABLE noteFolder ADD active_tag_id INTEGER;"); version = 7; } if (version < 8) { queryDisk.exec("CREATE TABLE IF NOT EXISTS script (" "id INTEGER PRIMARY KEY," "name VARCHAR(255)," "script_path TEXT," "enabled BOOLEAN DEFAULT 1," "priority INTEGER DEFAULT 0 )"); version = 8; } if (version != oldVersion) { setAppData("database_version", QString::number(version)); } return true; }
QgsComposerManager::~QgsComposerManager() { QSettings settings; settings.setValue( "/Windows/ComposerManager/geometry", saveGeometry() ); }
void OptionsModel::Init() { QSettings settings; // These are Qt-only settings: nDisplayUnit = settings.value("nDisplayUnit", BitcoinUnits::LEO).toInt(); bDisplayAddresses = settings.value("bDisplayAddresses", false).toBool(); fMinimizeToTray = settings.value("fMinimizeToTray", false).toBool(); fMinimizeOnClose = settings.value("fMinimizeOnClose", false).toBool(); nTransactionFee = settings.value("nTransactionFee").toLongLong(); nReserveBalance = settings.value("nReserveBalance").toLongLong(); language = settings.value("language", "").toString(); nRowsPerPage = settings.value("nRowsPerPage", 20).toInt(); notifications = settings.value("notifications", "*").toStringList(); visibleTransactions = settings.value("visibleTransactions", "*").toStringList(); fAutoRingSize = settings.value("fAutoRingSize", false).toBool(); fAutoRedeemLEOcoin = settings.value("fAutoRedeemLEOcoin", false).toBool(); nMinRingSize = settings.value("nMinRingSize", MIN_RING_SIZE).toInt(); nMaxRingSize = settings.value("nMaxRingSize", MAX_RING_SIZE).toInt(); // These are shared with core Bitcoin; we want // command-line options to override the GUI settings: if (settings.contains("fUseUPnP")) SoftSetBoolArg("-upnp", settings.value("fUseUPnP").toBool()); if (settings.contains("addrProxy") && settings.value("fUseProxy").toBool()) SoftSetArg("-proxy", settings.value("addrProxy").toString().toStdString()); if (settings.contains("nSocksVersion") && settings.value("fUseProxy").toBool()) SoftSetArg("-socks", settings.value("nSocksVersion").toString().toStdString()); if (settings.contains("detachDB")) SoftSetBoolArg("-detachdb", settings.value("detachDB").toBool()); if (!language.isEmpty()) SoftSetArg("-lang", language.toStdString()); if (settings.contains("fStaking")) SoftSetBoolArg("-staking", settings.value("fStaking").toBool()); if (settings.contains("nMinStakeInterval")) SoftSetArg("-minstakeinterval", settings.value("nMinStakeInterval").toString().toStdString()); if (settings.contains("fSecMsgEnabled")) SoftSetBoolArg("-nosmsg", !settings.value("fSecMsgEnabled").toBool()); if (settings.contains("fThinMode")) SoftSetBoolArg("-thinmode", settings.value("fThinMode").toBool()); if (settings.contains("fThinFullIndex")) SoftSetBoolArg("-thinfullindex", settings.value("fThinFullIndex").toBool()); if (settings.contains("nThinIndexWindow")) SoftSetArg("-thinindexmax", settings.value("nThinIndexWindow").toString().toStdString()); }
QgsComposerManager::QgsComposerManager( QWidget * parent, Qt::WindowFlags f ): QDialog( parent, f ) { QPushButton *pb; setupUi( this ); QSettings settings; restoreGeometry( settings.value( "/Windows/ComposerManager/geometry" ).toByteArray() ); connect( mButtonBox, SIGNAL( rejected() ), this, SLOT( close() ) ); connect( QgisApp::instance(), SIGNAL( composerAdded( QgsComposerView* ) ), this, SLOT( refreshComposers() ) ); connect( QgisApp::instance(), SIGNAL( composerRemoved( QgsComposerView* ) ), this, SLOT( refreshComposers() ) ); pb = new QPushButton( tr( "&Show" ) ); mButtonBox->addButton( pb, QDialogButtonBox::ActionRole ); connect( pb, SIGNAL( clicked() ), this, SLOT( show_clicked() ) ); pb = new QPushButton( tr( "&Duplicate" ) ); mButtonBox->addButton( pb, QDialogButtonBox::ActionRole ); connect( pb, SIGNAL( clicked() ), this, SLOT( duplicate_clicked() ) ); pb = new QPushButton( tr( "&Remove" ) ); mButtonBox->addButton( pb, QDialogButtonBox::ActionRole ); connect( pb, SIGNAL( clicked() ), this, SLOT( remove_clicked() ) ); pb = new QPushButton( tr( "Re&name" ) ); mButtonBox->addButton( pb, QDialogButtonBox::ActionRole ); connect( pb, SIGNAL( clicked() ), this, SLOT( rename_clicked() ) ); #ifdef Q_WS_MAC // Create action to select this window mWindowAction = new QAction( windowTitle(), this ); connect( mWindowAction, SIGNAL( triggered() ), this, SLOT( activate() ) ); #endif mTemplate->addItem( tr( "Empty composer" ) ); mTemplate->addItem( tr( "Specific" ) ); mUserTemplatesDir = QgsApplication::qgisSettingsDirPath() + "/composer_templates"; QMap<QString, QString> userTemplateMap = defaultTemplates( true ); if ( userTemplateMap.size() > 0 ) { mTemplate->insertSeparator( mTemplate->count() ); QMap<QString, QString>::const_iterator templateIt = userTemplateMap.constBegin(); for ( ; templateIt != userTemplateMap.constEnd(); ++templateIt ) { mTemplate->addItem( templateIt.key(), templateIt.value() ); } } mDefaultTemplatesDir = QgsApplication::pkgDataPath() + "/composer_templates"; QMap<QString, QString> defaultTemplateMap = defaultTemplates( false ); if ( defaultTemplateMap.size() > 0 ) { mTemplate->insertSeparator( mTemplate->count() ); QMap<QString, QString>::const_iterator templateIt = defaultTemplateMap.constBegin(); for ( ; templateIt != defaultTemplateMap.constEnd(); ++templateIt ) { mTemplate->addItem( templateIt.key(), templateIt.value() ); } } mTemplatePathLineEdit->setText( settings.value( "/UI/ComposerManager/templatePath", QString( "" ) ).toString() ); refreshComposers(); }
QVariant OptionsModel::data(const QModelIndex & index, int role) const { if(role == Qt::EditRole) { QSettings settings; switch(index.row()) { case StartAtStartup: return GUIUtil::GetStartOnSystemStartup(); case MinimizeToTray: return fMinimizeToTray; case MapPortUPnP: return settings.value("fUseUPnP", GetBoolArg("-upnp", true)); case MinimizeOnClose: return fMinimizeOnClose; case ProxyUse: return settings.value("fUseProxy", false); case ProxyIP: { proxyType proxy; if (GetProxy(NET_IPV4, proxy)) return QString::fromStdString(proxy.ToStringIP()); else return ""; } case ProxyPort: { proxyType proxy; if (GetProxy(NET_IPV4, proxy)) return QVariant(proxy.GetPort()); } break; case ProxySocksVersion: return settings.value("nSocksVersion", 5); case Fee: return (qint64) nTransactionFee; case ReserveBalance: return (qint64) nReserveBalance; case DisplayUnit: return nDisplayUnit; case DisplayAddresses: return bDisplayAddresses; case DetachDatabases: return bitdb.GetDetach(); case Language: return settings.value("language", ""); case RowsPerPage: return nRowsPerPage; case AutoRingSize: return fAutoRingSize; case AutoRedeemLEOcoin: return fAutoRedeemLEOcoin; case MinRingSize: return nMinRingSize; case MaxRingSize: return nMaxRingSize; case Staking: return settings.value("fStaking", GetBoolArg("-staking", true)).toBool(); case MinStakeInterval: return nMinStakeInterval; case SecureMessaging: return fSecMsgEnabled; case ThinMode: return settings.value("fThinMode", GetBoolArg("-thinmode", false)).toBool(); case ThinFullIndex: return settings.value("fThinFullIndex", GetBoolArg("-thinfullindex", false)).toBool(); case ThinIndexWindow: return settings.value("ThinIndexWindow", (qint64) GetArg("-thinindexwindow", 4096)).toInt(); case Notifications: return notifications; case VisibleTransactions: return visibleTransactions; } } return QVariant(); }
// ######################################################################### // Saves the settings in the settings file. bool saveApplSettings() { QSettings settings ("qucs","qucs"); settings.setValue("x", QucsSettings.x); settings.setValue("y", QucsSettings.y); settings.setValue("dx", QucsSettings.dx); settings.setValue("dy", QucsSettings.dy); settings.setValue("font", QucsSettings.font.toString()); // store LargeFontSize as a string, so it will be also human-readable in the settings file (will be a @Variant() otherwise) settings.setValue("LargeFontSize", QString::number(QucsSettings.largeFontSize)); settings.setValue("maxUndo", QucsSettings.maxUndo); settings.setValue("NodeWiring", QucsSettings.NodeWiring); settings.setValue("BGColor", QucsSettings.BGColor.name()); settings.setValue("Editor", QucsSettings.Editor); settings.setValue("FileTypes", QucsSettings.FileTypes); settings.setValue("Language", QucsSettings.Language); settings.setValue("Comment", QucsSettings.Comment.name()); settings.setValue("String", QucsSettings.String.name()); settings.setValue("Integer", QucsSettings.Integer.name()); settings.setValue("Real", QucsSettings.Real.name()); settings.setValue("Character", QucsSettings.Character.name()); settings.setValue("Type", QucsSettings.Type.name()); settings.setValue("Attribute", QucsSettings.Attribute.name()); settings.setValue("Directive", QucsSettings.Directive.name()); settings.setValue("Task", QucsSettings.Comment.name()); //settings.setValue("Qucsator", QucsSettings.Qucsator); //settings.setValue("BinDir", QucsSettings.BinDir); //settings.setValue("LangDir", QucsSettings.LangDir); //settings.setValue("LibDir", QucsSettings.LibDir); settings.setValue("AdmsXmlBinDir", QucsSettings.AdmsXmlBinDir.canonicalPath()); settings.setValue("AscoBinDir", QucsSettings.AscoBinDir.canonicalPath()); //settings.setValue("OctaveDir", QucsSettings.OctaveDir); //settings.setValue("ExamplesDir", QucsSettings.ExamplesDir); //settings.setValue("DocDir", QucsSettings.DocDir); settings.setValue("OctaveBinDir", QucsSettings.OctaveBinDir.canonicalPath()); settings.setValue("QucsHomeDir", QucsSettings.QucsHomeDir.canonicalPath()); settings.setValue("IgnoreVersion", QucsSettings.IgnoreFutureVersion); settings.setValue("GraphAntiAliasing", QucsSettings.GraphAntiAliasing); settings.setValue("TextAntiAliasing", QucsSettings.TextAntiAliasing); // Copy the list of directory paths in which Qucs should // search for subcircuit schematics from qucsPathList settings.remove("Paths"); settings.beginWriteArray("Paths"); int i = 0; foreach(QString path, qucsPathList) { settings.setArrayIndex(i); settings.setValue("path", path); i++; }
void CCardSearchParameters::fetchFromSettings(QSettings &settings) { settings.beginGroup("searchOptions"); mName = settings.value("name", mName).toString(); mLwCsName = mName.toLower(); mSkill = settings.value("skill", mSkill).toStringList(); mLwCsSkill.clear(); for (QStringList::const_iterator i = mSkill.begin(); i != mSkill.end(); ++i) { mLwCsSkill.push_back(i->toLower()); } mRarityMask = settings.value("rarityMask", mRarityMask).toInt(); mTypeMask = settings.value("typeMask", mTypeMask).toInt(); mFactionMask = settings.value("factionMask", mFactionMask).toInt(); mTimerMask = settings.value("timerMask", mTimerMask).toInt(); mAttackCompare = static_cast<EComparisonMethod>(settings.value("attackCompare").toInt()); mHpCompare = static_cast<EComparisonMethod>(settings.value("hpCompare").toInt()); mAttackValue = settings.value("attackValue", mAttackValue).toInt(); mHpValue = settings.value("hpValue", mHpValue).toInt(); mUpgradeLevel = settings.value("upgradeLevel", mUpgradeLevel).toInt(); mCheckUpgradeLevel = settings.value("checkUpgradeLevel", mCheckUpgradeLevel).toBool(); mIsUnique = settings.value("checkUnique", mIsUnique).toBool(); settings.endGroup(); }
QgsCptCityColorRampV2Dialog::QgsCptCityColorRampV2Dialog( QgsCptCityColorRampV2* ramp, QWidget* parent ) : QDialog( parent ) , mRamp( 0 ) , mArchiveViewType( QgsCptCityBrowserModel::Selections ) { setupUi( this ); buttonBox->button( QDialogButtonBox::Ok )->setEnabled( false ); QSettings settings; restoreGeometry( settings.value( "/Windows/CptCityColorRampV2Dialog/geometry" ).toByteArray() ); mSplitter->setSizes( QList<int>() << 250 << 550 ); mSplitter->restoreState( settings.value( "/Windows/CptCityColorRampV2Dialog/splitter" ).toByteArray() ); mModel = mAuthorsModel = mSelectionsModel = 0; //mListModel = 0; mTreeFilter = 0; QgsCptCityArchive::initDefaultArchive(); mArchive = QgsCptCityArchive::defaultArchive(); // show information on how to install cpt-city files if none are found if ( ! mArchive || mArchive->isEmpty() ) { // QgsDialog dlg( this ); // dlg.setWindowTitle( tr( "cpt-city gradient files not found" ) ); QTextEdit *edit = new QTextEdit( 0 ); edit->setReadOnly( true ); // not sure if we want this long string to be translated QString helpText = tr( "Error - cpt-city gradient files not found.\n\n" "You have two means of installing them:\n\n" "1) Install the \"Color Ramp Manager\" python plugin " "(you must enable Experimental plugins in the plugin manager) " "and use it to download latest cpt-city package.\n" "You can install the entire cpt-city archive or a selection for QGIS.\n\n" "2) Download the complete archive (in svg format) " "and unzip it to your QGIS settings directory [%1] .\n\n" "This file can be found at [%2]\nand current file is [%3]" ).arg( QgsApplication::qgisSettingsDirPath() ).arg( "http://soliton.vm.bytemark.co.uk/pub/cpt-city/pkg/" ).arg( "http://soliton.vm.bytemark.co.uk/pub/cpt-city/pkg/cpt-city-svg-2.07.zip" ); edit->setText( helpText ); mStackedWidget->addWidget( edit ); mStackedWidget->setCurrentIndex( 1 ); tabBar->setVisible( false ); // dlg.layout()->addWidget( edit ); // dlg.resize(500,400); // dlg.exec(); return; } if ( ! mArchive ) return; QgsDebugMsg( "archive: " + mArchive->archiveName() ); if ( ramp ) { mRamp = ramp; } else { mRamp = new QgsCptCityColorRampV2( "", "", false ); ramp = mRamp; } QgsDebugMsg( QString( "ramp name= %1 variant= %2 - %3 variants" ).arg( ramp->schemeName() ).arg( ramp->variantName() ).arg( ramp->variantList().count() ) ); // model / view QgsDebugMsg( "loading model/view objects" ); if ( mAuthorsModel ) delete mAuthorsModel; mAuthorsModel = new QgsCptCityBrowserModel( this, mArchive, QgsCptCityBrowserModel::Authors ); if ( mSelectionsModel ) delete mSelectionsModel; mSelectionsModel = new QgsCptCityBrowserModel( this, mArchive, QgsCptCityBrowserModel::Selections ); setTreeModel( mSelectionsModel ); mTreeView->setSelectionMode( QAbstractItemView::SingleSelection ); mTreeView->setColumnHidden( 1, true ); QgsDebugMsg( "done loading model/view objects" ); // setup ui tabBar->blockSignals( true ); tabBar->addTab( tr( "Selections by theme" ) ); tabBar->addTab( tr( "All by author" ) ); cboVariantName->setIconSize( QSize( 100, 15 ) ); lblPreview->installEventFilter( this ); // mouse click on preview label shows svg render // look for item, if not found in selections archive, look for in authors QgsDebugMsg( "looking for ramp " + mRamp->schemeName() ); if ( mRamp->schemeName() != "" ) { bool found = updateRamp(); if ( ! found ) { tabBar->setCurrentIndex( 1 ); setTreeModel( mAuthorsModel ); found = updateRamp(); // if not found, go back to selections model if ( ! found ) { tabBar->setCurrentIndex( 0 ); setTreeModel( mSelectionsModel ); } } if ( found ) buttonBox->button( QDialogButtonBox::Ok )->setEnabled( true ); } else { updateRamp(); } tabBar->blockSignals( false ); connect( this, SIGNAL( finished( int ) ), this, SLOT( onFinished() ) ); }
void CCardSearchParameters::updateSettings(QSettings &settings) const { settings.beginGroup("searchOptions"); settings.setValue("name", mName); settings.setValue("skill", mSkill); settings.setValue("rarityMask", mRarityMask); settings.setValue("typeMask", mTypeMask); settings.setValue("factionMask", mFactionMask); settings.setValue("timerMask", mTimerMask); settings.setValue("attackCompare", static_cast<int>(mAttackCompare)); settings.setValue("hpCompare", static_cast<int>(mHpCompare)); settings.setValue("attackValue", mAttackValue); settings.setValue("hpValue", mHpValue); settings.setValue("upgradeLevel", mUpgradeLevel); settings.setValue("checkUpgradeLevel", mCheckUpgradeLevel); settings.setValue("checkUnique", mIsUnique); settings.endGroup(); }
int GameStorage::wins(int uniqueId) { QSettings settings; return settings.value(QString("%1.wins").arg(uniqueId), 0).toInt(); }
void QgsNewHttpConnection::accept() { QSettings settings; QString key = mBaseKey + txtName->text(); QString credentialsKey = "/Qgis/" + mCredentialsBaseKey + '/' + txtName->text(); // warn if entry was renamed to an existing connection if (( mOriginalConnName.isNull() || mOriginalConnName.compare( txtName->text(), Qt::CaseInsensitive ) != 0 ) && settings.contains( key + "/url" ) && QMessageBox::question( this, tr( "Save connection" ), tr( "Should the existing connection %1 be overwritten?" ).arg( txtName->text() ), QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Cancel ) { return; } if ( !txtPassword->text().isEmpty() && QMessageBox::question( this, tr( "Saving passwords" ), tr( "WARNING: You have entered a password. It will be stored in plain text in your project files and in your home directory on Unix-like systems, or in your user profile on Windows. If you do not want this to happen, please press the Cancel button.\nNote: giving the password is optional. It will be requested interactivly, when needed." ), QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Cancel ) { return; } // on rename delete original entry first if ( !mOriginalConnName.isNull() && mOriginalConnName != key ) { settings.remove( mBaseKey + mOriginalConnName ); settings.remove( "/Qgis/" + mCredentialsBaseKey + '/' + mOriginalConnName ); settings.sync(); } QUrl url( txtUrl->text().trimmed() ); const QList< QPair<QByteArray, QByteArray> > &items = url.encodedQueryItems(); QHash< QString, QPair<QByteArray, QByteArray> > params; for ( QList< QPair<QByteArray, QByteArray> >::const_iterator it = items.constBegin(); it != items.constEnd(); ++it ) { params.insert( QString( it->first ).toUpper(), *it ); } if ( params["SERVICE"].second.toUpper() == "WMS" || params["SERVICE"].second.toUpper() == "WFS" || params["SERVICE"].second.toUpper() == "WCS" ) { url.removeEncodedQueryItem( params["SERVICE"].first ); url.removeEncodedQueryItem( params["REQUEST"].first ); url.removeEncodedQueryItem( params["FORMAT"].first ); } if ( url.encodedPath().isEmpty() ) { url.setEncodedPath( "/" ); } settings.setValue( key + "/url", url.toString() ); if ( mBaseKey == "/Qgis/connections-wms/" || mBaseKey == "/Qgis/connections-wcs/" ) { settings.setValue( key + "/ignoreGetMapURI", cbxIgnoreGetMapURI->isChecked() ); settings.setValue( key + "/ignoreAxisOrientation", cbxIgnoreAxisOrientation->isChecked() ); settings.setValue( key + "/invertAxisOrientation", cbxInvertAxisOrientation->isChecked() ); settings.setValue( key + "/smoothPixmapTransform", cbxSmoothPixmapTransform->isChecked() ); int dpiMode = 0; switch ( cmbDpiMode->currentIndex() ) { case 0: // all => QGIS|UMN|GeoServer dpiMode = 7; break; case 1: // off dpiMode = 0; break; case 2: // QGIS dpiMode = 1; break; case 3: // UMN dpiMode = 2; break; case 4: // GeoServer dpiMode = 4; break; } settings.setValue( key + "/dpiMode", dpiMode ); } if ( mBaseKey == "/Qgis/connections-wms/" ) { settings.setValue( key + "/ignoreGetFeatureInfoURI", cbxIgnoreGetFeatureInfoURI->isChecked() ); } settings.setValue( key + "/referer", txtReferer->text() ); settings.setValue( credentialsKey + "/username", txtUserName->text() ); settings.setValue( credentialsKey + "/password", txtPassword->text() ); settings.setValue( credentialsKey + "/authcfg", mAuthConfigSelect->configId() ); settings.setValue( mBaseKey + "/selected", txtName->text() ); QDialog::accept(); }
void SettingsDialog::accept() { QSettings settings; settings.setValue("MonitorOutputDevice",p->ui.monitorOutputDevice->currentText()); //Common settings.setValue("language",p->ui.comboLanguage->currentIndex()); //save fade slider settings.setValue("faderTimeSlider",p->ui.faderTimeSlider->value()); settings.setValue("faderEndSlider",p->ui.faderEndSlider->value()); //Playlist settings settings.setValue("checkAutoRemove",p->ui.checkAutoRemove->isChecked()); //Silent settings settings.setValue("checkAutoCue",p->ui.checkAutoCue->isChecked()); settings.setValue("checkSkipSilentEnd",p->ui.checkSkipSilentEnd->isChecked()); //AutoDJ settings.setValue("minTracks",p->ui.minTracks->value()); settings.setValue("countDJ",p->ui.countDJ->value()); settings.setValue("isEnabledAutoDJCount",p->ui.checkAutoDjCountPlayed->isChecked()); settings.beginGroup("AutoDJ"); int maxDj=p->ui.countDJ->value(); for (int d=0;d<maxDj;d++) { settings.beginGroup(QString::number(d)); QListWidgetItem *item = p->ui.listDjNames->item(d); if (DjSettings *djs = dynamic_cast<DjSettings*>(p->ui.listDjNames->itemWidget(item))) { settings.setValue("Name", djs->name() ); settings.setValue("FilterCount", djs->filterCount() ); } settings.endGroup(); } settings.endGroup(); //CollectionFolders settings.setValue("Dirs",p->model->dirsChecked()); settings.setValue("Monitor", p->ui.chkMonitor->isChecked() ); //File Browser settings.setValue("editBrowerRoot",p->ui.txtBrowserRoot->text()); QDialog::accept(); }
QgsNewHttpConnection::QgsNewHttpConnection( QWidget *parent, const QString& baseKey, const QString& connName, const Qt::WindowFlags& fl ) : QDialog( parent, fl ) , mBaseKey( baseKey ) , mOriginalConnName( connName ) , mAuthConfigSelect( 0 ) { setupUi( this ); QString service = baseKey.mid( 18, 3 ).toUpper(); setWindowTitle( tr( "Create a new %1 connection" ).arg( service ) ); // It would be obviously much better to use mBaseKey also for credentials, // but for some strange reason a different hardcoded key was used instead. // WFS and WMS credentials were mixed with the same key WMS. // Only WMS and WFS providers are using QgsNewHttpConnection at this moment // using connection-wms and connection-wfs -> parse credential key fro it. mCredentialsBaseKey = mBaseKey.split( '-' ).last().toUpper(); txtName->setValidator( new QRegExpValidator( QRegExp( "[^\\/]+" ), txtName ) ); cmbDpiMode->clear(); cmbDpiMode->addItem( tr( "all" ) ); cmbDpiMode->addItem( tr( "off" ) ); cmbDpiMode->addItem( tr( "QGIS" ) ); cmbDpiMode->addItem( tr( "UMN" ) ); cmbDpiMode->addItem( tr( "GeoServer" ) ); mAuthConfigSelect = new QgsAuthConfigSelect( this ); tabAuth->insertTab( 1, mAuthConfigSelect, tr( "Configurations" ) ); if ( !connName.isEmpty() ) { // populate the dialog with the information stored for the connection // populate the fields with the stored setting parameters QSettings settings; QString key = mBaseKey + connName; QString credentialsKey = "/Qgis/" + mCredentialsBaseKey + '/' + connName; txtName->setText( connName ); txtUrl->setText( settings.value( key + "/url" ).toString() ); cbxIgnoreGetMapURI->setChecked( settings.value( key + "/ignoreGetMapURI", false ).toBool() ); cbxIgnoreAxisOrientation->setChecked( settings.value( key + "/ignoreAxisOrientation", false ).toBool() ); cbxInvertAxisOrientation->setChecked( settings.value( key + "/invertAxisOrientation", false ).toBool() ); cbxIgnoreGetFeatureInfoURI->setChecked( settings.value( key + "/ignoreGetFeatureInfoURI", false ).toBool() ); cbxSmoothPixmapTransform->setChecked( settings.value( key + "/smoothPixmapTransform", false ).toBool() ); int dpiIdx; switch ( settings.value( key + "/dpiMode", 7 ).toInt() ) { case 0: // off dpiIdx = 1; break; case 1: // QGIS dpiIdx = 2; break; case 2: // UMN dpiIdx = 3; break; case 4: // GeoServer dpiIdx = 4; break; default: // other => all dpiIdx = 0; break; } cmbDpiMode->setCurrentIndex( dpiIdx ); txtReferer->setText( settings.value( key + "/referer" ).toString() ); txtUserName->setText( settings.value( credentialsKey + "/username" ).toString() ); txtPassword->setText( settings.value( credentialsKey + "/password" ).toString() ); QString authcfg = settings.value( credentialsKey + "/authcfg" ).toString(); mAuthConfigSelect->setConfigId( authcfg ); if ( !authcfg.isEmpty() ) { tabAuth->setCurrentIndex( tabAuth->indexOf( mAuthConfigSelect ) ); } } if ( mBaseKey != "/Qgis/connections-wms/" ) { if ( mBaseKey == "/Qgis/connections-wcs/" ) { cbxIgnoreGetMapURI->setText( tr( "Ignore GetCoverage URI reported in capabilities" ) ); cbxIgnoreAxisOrientation->setText( tr( "Ignore axis orientation" ) ); } else { cbxIgnoreGetMapURI->setVisible( false ); cbxIgnoreAxisOrientation->setVisible( false ); cbxInvertAxisOrientation->setVisible( false ); cbxSmoothPixmapTransform->setVisible( false ); mGroupBox->layout()->removeWidget( cbxIgnoreGetMapURI ); mGroupBox->layout()->removeWidget( cbxIgnoreAxisOrientation ); mGroupBox->layout()->removeWidget( cbxInvertAxisOrientation ); mGroupBox->layout()->removeWidget( cbxSmoothPixmapTransform ); } cbxIgnoreGetFeatureInfoURI->setVisible( false ); mGroupBox->layout()->removeWidget( cbxIgnoreGetFeatureInfoURI ); cmbDpiMode->setVisible( false ); mGroupBox->layout()->removeWidget( cmbDpiMode ); lblDpiMode->setVisible( false ); mGroupBox->layout()->removeWidget( lblDpiMode ); txtReferer->setVisible( false ); mGroupBox->layout()->removeWidget( txtReferer ); lblReferer->setVisible( false ); mGroupBox->layout()->removeWidget( lblReferer ); // Adjust height int w = width(); adjustSize(); resize( w, height() ); } on_txtName_textChanged( connName ); }
void SettingsDialog::onScanNow() { QSettings settings; settings.setValue("Dirs",p->model->dirsChecked()); Q_EMIT scanNowPressed(); }
void RunnerPlugin::init() { QSettings* set = *settings; cmds.clear(); if ( set->value("runner/version", 0.0).toDouble() == 0.0 ) { set->beginWriteArray("runner/cmds"); set->setArrayIndex(0); #ifdef Q_WS_WIN set->setValue("name", "cmd"); set->setValue("file", "C:\\Windows\\System32\\cmd.exe"); set->setValue("args", "/K $$"); #endif #ifdef Q_WS_X11 set->setValue("name", "cmd"); set->setValue("file", "/usr/bin/xterm"); set->setValue("args", "-hold -e $$"); #endif /* #ifdef Q_WS_MAC set->setValue("name", "cmd"); set->setValue("file", "") #endif */ set->endArray(); } set->setValue("runner/version", 2.0); // Read in the array of websites int count = set->beginReadArray("runner/cmds"); for(int i = 0; i < count; ++i) { set->setArrayIndex(i); runnerCmd cmd; cmd.file = set->value("file").toString(); cmd.name = set->value("name").toString(); cmd.args = set->value("args").toString(); cmds.push_back(cmd); } set->endArray(); }
void saveInSettings(QSettings &settingsObj, const QString &name, const QBrush &value) { settingsObj.setValue(name, value); }
/** Autoconnected SLOTS **/ void QgsOracleNewConnection::accept() { QSettings settings; QString baseKey = "/Oracle/connections/"; settings.setValue( baseKey + "selected", txtName->text() ); if ( chkStorePassword->isChecked() && QMessageBox::question( this, tr( "Saving passwords" ), tr( "WARNING: You have opted to save your password. It will be stored in plain text in your project files and in your home directory on Unix-like systems, or in your user profile on Windows. If you do not want this to happen, please press the Cancel button.\n" ), QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Cancel ) { return; } // warn if entry was renamed to an existing connection if (( mOriginalConnName.isNull() || mOriginalConnName.compare( txtName->text(), Qt::CaseInsensitive ) != 0 ) && ( settings.contains( baseKey + txtName->text() + "/service" ) || settings.contains( baseKey + txtName->text() + "/host" ) ) && QMessageBox::question( this, tr( "Save connection" ), tr( "Should the existing connection %1 be overwritten?" ).arg( txtName->text() ), QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Cancel ) { return; } // on rename delete the original entry first if ( !mOriginalConnName.isNull() && mOriginalConnName != txtName->text() ) { settings.remove( baseKey + mOriginalConnName ); settings.sync(); } baseKey += txtName->text(); settings.setValue( baseKey + "/database", txtDatabase->text() ); settings.setValue( baseKey + "/host", txtHost->text() ); settings.setValue( baseKey + "/port", txtPort->text() ); settings.setValue( baseKey + "/username", chkStoreUsername->isChecked() ? txtUsername->text() : "" ); settings.setValue( baseKey + "/password", chkStorePassword->isChecked() ? txtPassword->text() : "" ); settings.setValue( baseKey + "/userTablesOnly", cb_userTablesOnly->isChecked() ); settings.setValue( baseKey + "/geometryColumnsOnly", cb_geometryColumnsOnly->isChecked() ); settings.setValue( baseKey + "/allowGeometrylessTables", cb_allowGeometrylessTables->isChecked() ); settings.setValue( baseKey + "/estimatedMetadata", cb_useEstimatedMetadata->isChecked() ? "true" : "false" ); settings.setValue( baseKey + "/onlyExistingTypes", cb_onlyExistingTypes->isChecked() ? "true" : "false" ); settings.setValue( baseKey + "/saveUsername", chkStoreUsername->isChecked() ? "true" : "false" ); settings.setValue( baseKey + "/savePassword", chkStorePassword->isChecked() ? "true" : "false" ); settings.setValue( baseKey + "/dboptions", txtOptions->text() ); QDialog::accept(); }