static char *wallet_filename(void) { char *filename = setting("wallet"); if (!filename) filename = setting("w"); return filename; }
static void init_peers(struct net_child_info *nci) { /* * read network peers */ struct peer_manager *peers; peers = peerman_read(); if (!peers) { fprintf(plog, "net: initializing empty peer list\n"); peers = peerman_seed(setting("no_dns") == NULL ? true : false); if (!peerman_write(peers)) { fprintf(plog, "net: failed to write peer list\n"); exit(1); } } char *addnode = setting("addnode"); if (addnode) peerman_addstr(peers, addnode); peerman_sort(peers); if (debugging) fprintf(plog, "net: have %u/%zu peers\n", bp_hashtab_size(peers->map_addr), clist_length(peers->addrlist)); nci->peers = peers; }
void loadSamples(const char* sndDir, const char* musicFile) { loadSample( packGetFile(sndDir,"click.ogg"), SND_CLICK ); loadSample( packGetFile(sndDir,"brickmove.ogg"), SND_BRICKMOVE ); loadSample( packGetFile(sndDir,"brickgrab.ogg"), SND_BRICKGRAB ); loadSample( packGetFile(sndDir,"brickbreak.ogg"), SND_BRICKBREAK ); loadSample( packGetFile(sndDir,"scoretick.ogg"), SND_SCORECOUNT ); loadSample( packGetFile(sndDir,"countdown.ogg"), SND_COUNTDOWNTOSTART ); loadSample( packGetFile(sndDir,"start.ogg"), SND_START ); loadSample( packGetFile(sndDir,"timeout.ogg"), SND_TIMEOUT ); loadSample( packGetFile(sndDir,"victory.ogg"), SND_VICTORY ); loadSample( packGetFile(sndDir,"timeout.ogg"), SND_TIMEOUT ); loadSample( packGetFile(sndDir,"onewaymove.ogg"), SND_ONEWAY_MOVE ); loadSample( packGetFile(sndDir,"teleported.ogg"), SND_TELEPORTED ); loadSample( packGetFile(sndDir,"switchactivate.ogg"), SND_SWITCH_ACTIVATED ); loadSample( packGetFile(sndDir,"switchinactive.ogg"), SND_SWITCH_DEACTIVATED ); loadSample( packGetFile(sndDir,"brickswap.ogg"), SND_BRICKSWAP ); loadSample( packGetFile(sndDir,"brickcopy.ogg"), SND_BRICKCOPY ); loadSample( packGetFile(sndDir,"brickswapdenied.ogg"), SND_BRICKSWAP ); loadSample( packGetFile(sndDir,"brickcopydenied.ogg"), SND_BRICKCOPY ); loadSample( packGetFile(sndDir, "winner.ogg"), SND_WINNER); loadSample( packGetFile(sndDir, "loser.ogg"), SND_LOSER); //Music load code if(setting()->disableMusic) return; if( !musicFile ) return; //Load ingame song if not allready loaded. if(strcmp(lastLoadedSongFn, packGetFile("./",musicFile))!=0 && !setting()->userMusic) { //Free old song if loaded. if(mus[1]) { Mix_FreeMusic(mus[1]); } strcpy(lastLoadedSongFn, packGetFile("./",musicFile)); mus[1]=Mix_LoadMUS( lastLoadedSongFn ); if(!mus[1]) printf("Couldn't load music: '%s'\n",packGetFile("./",musicFile)); mPos[1] = 0.0f; if( !Mix_PlayingMusic() ) { Mix_FadeInMusicPos(mus[1], -1, MUSIC_FADETIME,mPos[1]); } } }
static void switch_keys() { rotated = TRUE; if (n_keyset < 1) { plugin_print("mcp game", "cannot switch CD key set (no key sets loaded)\n"); return; } i_keyset = (i_keyset + 1) % n_keyset; plugin_print("mcp game", "switching to CD key set %i\n", i_keyset + 1); strcpy(setting("ClassicKey")->s_var, keyset[i_keyset].classic); strcpy(setting("ExpansionKey")->s_var, keyset[i_keyset].expansion); }
//------------------------------------------------------------------------------------------------- void tNdp2kTableDataSources::OnMyRowChanged( int row ) { tDataType dataType; tSourceSelections selections; { tQMutexLocker locker( &m_Lock ); if (row >= m_Table.count()) return; dataType = m_Table[ row ].dataType; selections = m_Table[ row ].selections; } if (row < m_DefaultFormatRows && m_ShareChanges == true) { tDataType type = m_pDefaultFormatTypes[ row ]; Assert( type == dataType ); eDigitalDataSourceSettingId settingID = m_pSourceSettings->DataTypeToSettingId( type ); if (m_pSourceSettings->SettingIdToDataType( settingID ) == type) { tDigitalDataSourceSettings::tGlobalSetting setting(*m_pSourceSettings); setting.SetDataSourceList( selections ); setting.Save( settingID, eDDSFrom_Table ); } } Settings().SetValue( QString::number(row), ToVariant( dataType, selections ) ); }
//--------------------------------------------------------------------------------------- void tNdp2kTableDataSources::LoadFromGlobalSettings() { SetFormat( m_DefaultFormat ); int errors = 0; m_Table.resize( m_DefaultFormatRows ); for (int row = 0; row < m_DefaultFormatRows; ++row) { tDataType type = m_pDefaultFormatTypes[row]; eDigitalDataSourceSettingId settingID = m_pSourceSettings->DataTypeToSettingId( type ); tRow& info = m_Table[ row ]; info.dataType = type; info.dirty = false; bool ok = false; if (m_pSourceSettings->SettingIdToDataType( settingID ) == type) { tDigitalDataSourceSettings::tGlobalSetting setting(*m_pSourceSettings); if (setting.Load( settingID )) { info.selections = setting.DataSourceList(); ok = true; } } if (ok == false) { info.selections = tSourceSelections(); ++errors; } } }
void CopySenderServer::loadCompressPath(){ QSettings setting("settings.ini",QSettings::IniFormat); //grouping the settings setting.beginGroup("FileCopy"); //default settings values QVariant defaultfileCompressPath; QString theDefaultPathCompress = "buildCompressed"; defaultfileCompressPath.setValue(theDefaultPathCompress); //send in the default values in case it does not exist... QString loadedFileCompressPath = setting.value("fileCompressPath", defaultfileCompressPath).toString(); setting.endGroup(); if(!QDir(loadedFileCompressPath).exists()){ //firstly try and create that directory... bool successCreate = QDir().mkdir(loadedFileCompressPath); //...if it fails, revert to default if(!successCreate){ fileCompressPath = "buildCompressed"; QDir().mkdir(fileCompressPath); } } else{ fileCompressPath = loadedFileCompressPath; } }
void MainPage::init(){ this->man = NULL; ToolUtil::initStyle(this); IconHelper::Instance()->SetIcon(ui->btnMenu_Close, QChar(0xf00d), 10); IconHelper::Instance()->SetIcon(ui->btnMenu_Min, QChar(0xf068), 10); IconHelper::Instance()->SetIcon(ui->btnMenu, QChar(0xf0c9), 10); // IconHelper::Instance()->Set(ui->lab_Ico, QChar(0xf19c), 12); IconHelper::Instance()->SetBackground(ui->lab_Ico, "logo.png"); main_menu = new MainMenu(); icon_menu = new IconMenu(); //信号量注册 connect(ui->bt_quit,SIGNAL(clicked()),this,SLOT(userLogout())); /***********menu slot****************/ connect(main_menu,SIGNAL(setting()),this,SLOT(menuSetting())); connect(main_menu,SIGNAL(aboutus()),this,SLOT(menuAboutus())); connect(icon_menu,SIGNAL(login()),this,SLOT(menuLogin())); connect(icon_menu,SIGNAL(logout()),this,SLOT(userLogout())); connect(icon_menu,SIGNAL(min()),this,SLOT(on_btnMenu_Min_clicked())); connect(icon_menu,SIGNAL(useradd()),this,SLOT(userAdd())); connect(icon_menu,SIGNAL(clo()),this,SLOT(close())); connect(icon_menu,SIGNAL(pwdchange()),this,SLOT(menuPwdChange())); /*********login************/ this->showLoginDlg(); }
/** * Updates preferences */ void MainWindow::updatePreferences() { QSettings setting("rk", "scribo"); setting.beginGroup("writing"); QString style = "#textEdit_mainWindow_surface { margin: " + setting.value("marginTop", 35).toString() + " " + setting.value("marginRight", 35).toString() + " " + setting.value("marginBottom", 0).toString() + " " + setting.value("marginLeft", 35).toString() + "; " + "padding: " + setting.value("paddingTop", 20).toString() + " " + setting.value("paddingRight", 20).toString() + " " + setting.value("paddingBottom", 0).toString() + " " + setting.value("paddingLeft", 20).toString() + "; background: " + "rgb(" + setting.value("red", 255).toString() + "," + setting.value("green", 255).toString() + "," + setting.value("blue", 255).toString() + "); " + "}"; ui->textEdit_mainWindow_surface->setStyleSheet(style); passwordUsed = setting.value("passwordUsed", false).toBool(); setting.endGroup(); }
int main(int argc, char** argv) { Application app(argc, argv); if (!app.parseArgs()) { qDebug() << "Wrong usage!"; return 42; } #ifdef Q_OS_LINUX // int d = daemon(0, 0); // Q_UNUSED(d); #endif QString pathToConfig = app.config(); if (app.logFile().size()) { if (Logger::configure(app.logFile())) qInstallMessageHandler(Logger::logger); else qDebug() << "Log file not been set"; } Settings setting(pathToConfig); pSaver saver; pThreadPool pool(Settings::threads()); pServer server; app.exec(); }
void do_start_document(const Settings& settings) { seen_root_ = false; settings_ = settings; if(setting("indent") == "yes") indent_ = 0; } // do_start_document
bool Configuration::loadConfig(QString& path){ QSettings setting(path, QSettings::IniFormat); setting.sync(); this->threads_num_ = setting.value("settings/threads_num",0).toInt(); this->queue_size_ = setting.value("settings/queue_size",0).toInt(); this->servers_nb_ = setting.value("settings/servers_number",0).toInt(); this->DBServers_nb_ = setting.value("settings/servers_DB_number",0).toInt(); this->interval_ = setting.value("master_settings/interval",0).toInt(); for(int i = 1; i<=this->servers_nb_ + this->DBServers_nb_; ++i) { QString ip = setting.value("serwer"+QString::number(i)+"/ip","0.0.0.0").toString(); int portExt = setting.value("serwer"+QString::number(i)+"/portExt", 0).toInt(); int portDB = setting.value("serwer"+QString::number(i)+"/portDB", 0).toInt(); int portClient = setting.value("serwer"+QString::number(i)+"/portClient", 0).toInt(); QString stype = setting.value("serwer"+QString::number(i)+"/type","srv").toString(); SrvType type; if(stype == "srv"){ type = SrvType::SRV; } else{ if(stype == "db"){ type = SrvType::DB; } } QString pubKey = setting.value("serwer"+QString::number(i)+"/key","").toString(); SServer srv(i, ip, portExt, portDB, portClient, pubKey, type); addServer(srv); } }
void NetEin:: listWidget_show() { extern int dialog_auswertung; int row = 1; QString key_; QString key; QStringList comNet_; key = " "; row = listWidget_net->currentRow(); comNet = widget_net[row]; if (comNet.indexOf(" ") != -1){ comNet_ = comNet.split(" "); comNet = comNet_[0]; comNet_name = comNet_[1];} else comNet_name = ""; // Prüfen ob Daten in setting QSettings setting("qt5-fsarchiver", "qt5-fsarchiver"); setting.beginGroup(comNet_name); user = setting.value("Name").toString(); key_ = setting.value("key").toString(); setting.endGroup(); //Netzwerk-Daten in Textfeld eintragen //key entschlüsseln key = decrypt(key_); dummykey = key; txt_user ->setText(user); txt_key ->setText(key); }
Server::Server(Management *m,QObject *parent) : QTcpServer(parent), management(m) { QSettings setting("settings.ini",QSettings::IniFormat); //grouping the settings setting.beginGroup("Connection"); //default settings values QVariant defaultPort; defaultPort.setValue(4450); //send in the default values in case it does not exist... QString loadedPort = setting.value("port", defaultPort).toString(); setting.endGroup(); bool validPort; int aPort = loadedPort.toInt(&validPort); if(!validPort) { showMessage("The loaded port a valid number(1024-65000), reverting to default(4450)", "error"); port = 4450; } else { if(aPort >= 1024 && aPort <= 65000) port = aPort; else { showMessage("The loaded port was not within range(1024-65000), reverting to default(4450)", "error"); port = 4450; } } }
i_setting::id_type do_register_setting(const string& aSettingCategory, const string& aSettingName, simple_variant::type_e aSettingType, const simple_variant& aDefaultValue = simple_variant(), bool aHidden = false) { setting_by_name_list::iterator iterCheck = iSettingsByName.find(setting_by_name_list::key_type(aSettingCategory, aSettingName)); if (iterCheck != iSettingsByName.end()) throw setting_already_registered(); simple_variant currentValue = aDefaultValue; if (iStore.get() != 0) { xml::element::iterator xmlIterCategory = iStore->root().find(aSettingCategory.c_str()); if (xmlIterCategory != iStore->root().end()) { xml::element::iterator xmlIterSetting = xmlIterCategory->find(aSettingName.c_str()); if (xmlIterSetting != xmlIterCategory->end()) { if (aSettingType != i_simple_variant::CustomType) currentValue = from_string(xmlIterSetting->attribute_value("value"), aSettingType); else { string valueType = xmlIterSetting->attribute_value("type"); string valueData = xmlIterSetting->attribute_value("value"); currentValue = simple_variant(auto_ref<i_custom_type>(iCustomSettingTypeFactory->create(valueType, valueData))); } } } } setting_list::iterator iter = iSettings.insert(setting(*this, iNextSettingId++, aSettingCategory, aSettingName, aSettingType, currentValue, aHidden)); iSettingsByName[std::pair<string, string>(aSettingCategory, aSettingName)] = iter->id(); return iter->id(); }
QSimpleDownloader::QSimpleDownloader(QWidget *parent) : QWidget(parent) { labelUrl = new QLabel(tr("&URL:")); labelUrl->setFixedWidth(60); labelUrl->setAlignment(Qt::AlignRight); editUrl = new QLineEdit(); labelUrl->setBuddy(editUrl); QHBoxLayout *topLayout = new QHBoxLayout(); topLayout->addWidget(labelUrl); topLayout->addWidget(editUrl); labelSaveTo = new QLabel(tr("&Save To:")); labelSaveTo->setFixedWidth(60); labelSaveTo->setAlignment(Qt::AlignRight); editSaveTo = new QLineEdit(); labelSaveTo->setBuddy(editSaveTo); btnBrowse = new QPushButton(tr("&Browse...")); QHBoxLayout *midLayout = new QHBoxLayout(); midLayout->addWidget(labelSaveTo); midLayout->addWidget(editSaveTo); midLayout->addWidget(btnBrowse); btnSetting = new QPushButton(tr("Se&tting...")); btnAbout = new QPushButton(tr("&About...")); btnAboutQt = new QPushButton(tr("About &Qt...")); btnAboutQt->setStatusTip(tr("Show the Qt library's About box")); btnDownload = new QPushButton(tr("&Download")); btnExit = new QPushButton(tr("E&xit")); QHBoxLayout *midLayout2 = new QHBoxLayout(); midLayout2->addWidget(btnSetting); midLayout2->addWidget(btnAbout); midLayout2->addWidget(btnAboutQt); midLayout2->addStretch(); midLayout2->addWidget(btnDownload); midLayout2->addWidget(btnExit); outputList = new QListWidget(); QVBoxLayout *mainLayout = new QVBoxLayout(); mainLayout->addLayout(topLayout); mainLayout->addLayout(midLayout); mainLayout->addLayout(midLayout2); mainLayout->addWidget(outputList); setLayout(mainLayout); setWindowTitle(tr("Qt Simple Downloader")); this->resize(600, 480); optionDlg = new OptionDlg(this); optionDlg->setWindowTitle(tr("Option")); optionDlg->resize(480, 320); connect(btnBrowse, SIGNAL(clicked()), this, SLOT(browse())); connect(btnSetting, SIGNAL(clicked()), this, SLOT(setting())); connect(btnAbout, SIGNAL(clicked()), this, SLOT(about())); connect(btnAboutQt, SIGNAL(clicked()), qApp, SLOT(aboutQt())); connect(btnDownload, SIGNAL(clicked()), this, SLOT(download())); connect(btnExit, SIGNAL(clicked()), this, SLOT(close())); }
void QSimpleDownloader::download() { if(jobScheduler.isRunning()) { jobScheduler.stop(); btnDownload->setText(tr("&Download")); } else { if(editUrl->text().isEmpty()) { QMessageBox::warning(this, tr("Qt Simple Downloader"), tr("URL must be not empty")); editUrl->setFocus(); return; } std::vector<Target> targets, allTargets = optionDlg->getTargets(); foreach(Target target, allTargets) { if(target.selected) targets.push_back(target); } if(targets.size() == 0) { QMessageBox::warning(this, tr("Qt Simple Downloader"), tr("You must select one target at least to download")); setting(); return; } targets.push_back(Target("Hyperlink", "a", "href", QStringList())); jobScheduler.setMinFileSize(optionDlg->getMinFileSize()); jobScheduler.setSaveInSingleDir(optionDlg->getSaveInSingleDir()); jobScheduler.setFileExistsAction(optionDlg->getFileExistsAction()); jobScheduler.start(editUrl->text(), editSaveTo->text(), optionDlg->getRecursiveLayer(), targets); btnDownload->setText(tr("Sto&p")); outputList->addItem("start downloading..."); } }
void InputDialogue::okClicked(){ if(what == "port"){ bool parsed = false; //try parse port try{ parsed = testInput(1024,65000); }catch(ErrorClass ec){ showErrorMessage(ec.message, "error"); return; } if(!parsed){ QString message = "Incorrect input for port. Port must be between 1200 and 65000"; showErrorMessage(message, "error"); return; } QSettings setting("settings.ini",QSettings::IniFormat); //grouping the settings setting.beginGroup("Connection"); setting.setValue("port", ui->lineEdit->text().toInt()); setting.endGroup(); management->setPort(ui->lineEdit->text().toInt()); this->close(); } }
void COptions::SetXmlValue(unsigned int nID, wxString value) { if (!m_pXmlFile) return; // No checks are made about the validity of the value, that's done in SetOption char *utf8 = ConvUTF8(value); if (!utf8) return; TiXmlElement *settings = m_pXmlFile->GetElement()->FirstChildElement("Settings"); if (!settings) { TiXmlNode *node = m_pXmlFile->GetElement()->InsertEndChild(TiXmlElement("Settings")); if (!node) { delete [] utf8; return; } settings = node->ToElement(); if (!settings) { delete [] utf8; return; } } else { TiXmlNode *node = 0; while ((node = settings->IterateChildren("Setting", node))) { TiXmlElement *setting = node->ToElement(); if (!setting) continue; const char *attribute = setting->Attribute("name"); if (!attribute) continue; if (strcmp(attribute, options[nID].name)) continue; setting->RemoveAttribute("type"); setting->Clear(); setting->SetAttribute("type", (options[nID].type == string) ? "string" : "number"); setting->InsertEndChild(TiXmlText(utf8)); delete [] utf8; return; } } wxASSERT(options[nID].name[0]); TiXmlElement setting("Setting"); setting.SetAttribute("name", options[nID].name); setting.SetAttribute("type", (options[nID].type == string) ? "string" : "number"); setting.InsertEndChild(TiXmlText(utf8)); settings->InsertEndChild(setting); delete [] utf8; }
bool soem_SGDV::configureHook() { minimumConfigure(); PDOmapping(); setting(); if(useDC) { //To change the error tolerance before starting SDOwrite(0x1F01,2,false,4,PDOerrorsTolerance); //To set the desired shift of the outputs in the slave SDOwrite(0x1C33,0x03,false,4,SHIFT); //To let know the master that this slave will use DC configmyDC = this->getPeer("Master")->getOperation("configDC"); configmyDC(internalNumber,true,SYNC0TIME,SHIFTMASTER); } Logger::log(Logger::Info) << soem_SGDV::getName()<<" configured !" <<endlog(); return true; }
static size_t mcp_send_packet(mcp_packet_t packet) { if (invoke_packet_handlers(MCP_SENT, &packet) == BLOCK_PACKET) { return packet.len; // pretend we sent it } if (setting("Verbose")->b_var) { ui_console_lock(); print("[MCP] sent:\n\n"); mcp_dump_packet(packet); print("\n"); ui_console_unlock(); } byte buf[packet.len]; net_set_data(buf, packet.len, 0, word); net_set_data(buf, packet.id, sizeof(word), byte); memcpy(buf + sizeof(word) + sizeof(byte), packet.data, packet.len - MCP_HEADER_SIZE); size_t sent = net_send(mcp_socket, buf, packet.len); /*if (sent == packet.len) { invoke_packet_handlers(MCP_SENT, &packet); }*/ return sent; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); ui->menuButton->hide(); ui->mapList->hide(); ui->menuBar->hide(); ui->offset_box->hide(); ui->label->hide(); ui->delay->hide(); ui->label_2->hide(); QDir setting(QDir::currentPath()); setting.mkdir("songs"); QPixmap bkgd(":/images/images/title.png"); bkgd=bkgd.scaled(this->size(),Qt::IgnoreAspectRatio); QPalette palette; palette.setBrush(QPalette::Background,bkgd); this->setPalette(palette); QDir dir_map; QString map_path=dir_map.currentPath()+"/songs"; dir_map.setPath(map_path); ui->mapList->addItems(dir_map.entryList(QDir::Dirs|QDir::NoDotAndDotDot)); if(ui->mapList->count()>0) ui->mapList->setCurrentItem(ui->mapList->item(0)); }
int solve(int idx, int n, int end, int ps_x[], int ps_y[])// idx번째 좌표를 선택/미선택으로 백트래킹 { if (idx == end) return n; int t1 = 0; int t2=0; if (chess[ps_y[idx]][ps_x[idx]] == 0) // 이동가능 하면 { setting(ps_y[idx], ps_x[idx], 1); // x자로 +1 t1 = solve(idx + 1, n + 1, end, ps_x, ps_y); setting(ps_y[idx], ps_x[idx], -1); //x자로 -1 (0이라면 다시 이동가능해짐) } t2 = solve(idx + 1, n, end, ps_x, ps_y); return (t1 > t2 ? t1 : t2); }
_export void module_cleanup() { struct iterator it = list_iterator(&items); item_t *i; while ((i = iterator_next(&it))) { if (!is_blocked(i)) { logitem("failed to pick "); if (i->amount > 1) logitem("%i ", i->amount); if (i->ethereal) logitem("ethereal "); if (i->quality != 0x00) logitem("%s ", qualities[i->quality]); logitem("%s", lookup_item(i)); if (i->quality != 0x00) logitem(" (%i)", i->level); if (i->sockets > 0) logitem(" [%i]", i->sockets); if (setting("Debug")->b_var) logitem(" distance: %i", i->distance); // test pickit logitem("\n"); } } list_clear(&items); gold = 0; routine_scheduled = FALSE; }
Settings::Settings(QWidget *parent) : Dialog(parent), _passcodeSwitch(""), _passCodePage(parent), _changePassCodePage(parent), _langPage(parent) { _mainLayout.setContentsMargins(24, 24, 24, 24); setLayout(&_mainLayout); initGeneral(); initSecurity(); initDataBase(); _mainLayout.insertSpacing(2, 24); _mainLayout.insertSpacing(5, 24); _mainLayout.insertSpacing(8, 24); setMinimumWidth(400); _passCodePage.hide(); _changePassCodePage.hide(); _langPage.hide(); QSettings setting("MyOrg", "MyApp"); _passcodeSwitch.setChecked(setting.value("authentication/hasPasscode").toBool()); _langLabel.setText(Tr(setting.value("Language").toString())); QObject::connect(&_passcodeSwitch, SIGNAL(toggled(bool)), this, SLOT(onSwitch(bool))); QObject::connect(&_passCodePage, SIGNAL(cancel()), this, SLOT(onPassCodeCancel())); QObject::connect(&_changePassCodePage, SIGNAL(cancel()), this, SLOT(onPassCodeCancel())); QObject::connect(&_passCodePage, SIGNAL(save(QByteArray)), this, SLOT(onPassCodeSave(QByteArray))); QObject::connect(&_changePassCodePage, SIGNAL(save(QByteArray)), this, SLOT(onPassCodeSave(QByteArray))); QObject::connect(&_langItem, SIGNAL(clicked()), this, SLOT(onLanguage())); QObject::connect(&_langPage, SIGNAL(ok()), this, SLOT(onLanguageOk())); QObject::connect(&_langPage, SIGNAL(restart(QString)), this, SLOT(onLanguageRestart(QString))); QObject::connect(&_passCodeItem, SIGNAL(clicked()), this, SLOT(onChangePassCode())); }
void ApplicationSettings::on_PushButtonDone_pressed(){ //-currentlySelected //setting upconvertToBytesloadRate int uploadRateToSet = convertToBytes(ui->spinBoxUploadRate->value(), currentlySelected); CopyRateController &rc = CopyRateController::instance(); /*----get it into legible form(i.e. every 50ms a part will be sent across network)*/ int convertedRate = uploadRateToSet/20; rc.setUploadRate(convertedRate); //set it in the settings QSettings setting("settings.ini",QSettings::IniFormat); //grouping the settings setting.beginGroup("Network"); QVariant theValue = convertedRate; setting.setValue("uploadRate(Bytes)", theValue); setting.endGroup(); /*----endSetting uploadRate*/ this->close(); }
void DifficultyEditor::saveSetting() { // Get the ID of the currently selected item (might be -1 if no selection) int id = getSelectedSettingId(); // Instantiate a new setting and fill the data in difficulty::SettingPtr setting(new difficulty::Setting); // Load the widget contents setting->className = _classCombo->get_active_text(); setting->spawnArg = _spawnArgEntry->get_text(); setting->argument = _argumentEntry->get_text(); // Get the apptype from the dropdown list setting->appType = difficulty::Setting::EAssign; Gtk::TreeModel::iterator iter = _appTypeCombo->get_active(); if (iter) { setting->appType = static_cast<difficulty::Setting::EApplicationType>( static_cast<int>((*iter)[difficulty::Setting::getTreeModelColumns().type]) ); } // Pass the data to the DifficultySettings class to handle it id = _settings->save(id, setting); // Update the treemodel _settings->updateTreeModel(); // Highlight the setting, it might have been newly created selectSettingById(id); }
void ApplicationSettings::loadUploadSpeed(){ QSettings setting("settings.ini",QSettings::IniFormat); //grouping the settings setting.beginGroup("Network"); //default settings values QVariant defaultUploadRate; defaultUploadRate.setValue(25600); //send in the default values in case it does not exist... QString loadedUploadRate = setting.value("uploadRate(Bytes)", defaultUploadRate).toString(); setting.endGroup(); bool validUprate; int uploadRateBeforeConvert = loadedUploadRate.toInt(&validUprate); if(!validUprate){ uploadRateBeforeConvert = defaultUploadRate.toInt(); }else if(uploadRateBeforeConvert <= 0){ uploadRateBeforeConvert = defaultUploadRate.toInt(); } //convert to seconds(20 times per second it will upload) int uploadRateAfter = uploadRateBeforeConvert*20; ui->spinBoxUploadRate->setValue(uploadRateAfter); currentlySelected = BYTES; }
CDTMapToolSelectTrainingSamples::CDTMapToolSelectTrainingSamples(QgsMapCanvas *canvas) : QgsMapTool(canvas), mapCanvas(canvas), toolBar(new CDTCategoryToolBar(tr("Select training samples"),MainWindow::getMainWindow())), model(new QSqlQueryModel(this)) { toolBar->setFloatable(true); toolBar->setMovable(true); toolBar->show(); toolBar->raise(); QSettings setting("WHU","CDTStudio"); setting.beginGroup("CDTCategoryToolBar"); QByteArray geometry = setting.value("Geometry").toByteArray(); setting.endGroup(); if (geometry.isEmpty()) { QPoint ptGlobal = MainWindow::getCurrentMapCanvas()->mapToGlobal(MainWindow::getCurrentMapCanvas()->rect().center()); toolBar->move(MainWindow::getMainWindow()->mapFromGlobal(ptGlobal)); } else toolBar->restoreGeometry(geometry); comboBoxCategory = new QComboBox(toolBar); comboBoxCategory->setModel(model); QWidgetAction *actionLabel = new QWidgetAction(this); QWidgetAction *actionCombo = new QWidgetAction(this); actionLabel->setDefaultWidget(new QLabel(tr("Category"),toolBar)); actionCombo->setDefaultWidget(comboBoxCategory); toolBar->addAction(actionLabel); toolBar->addAction(actionCombo); MainWindow::getMainWindow()->addToolBar(toolBar); }
bool RuleListModel::realDeserializeData() { QSettings setting("Ray Fung", "Excel JSON"); QByteArray json = setting.value("rule_list", QByteArray("[]")).toByteArray(); QJsonDocument doc = QJsonDocument::fromJson(json); ruleList.clear(); if(doc.isArray() == false) return false; QJsonArray array = doc.array(); int count = array.size(); for(int i = 0; i < count; ++i) { QJsonValue val = array.at(i); if(val.isObject() == false) return false; QJsonObject data = val.toObject(); RuleData rule; RuleItem item; rule.isEnabled = data.value("enable").toBool(true); rule.excelPath = data.value("excel_path").toString(); rule.jsonPath = data.value("json_path").toString(); item.setRule(rule); ruleList.append(item); } return true; }