本文整理汇总了C++中setting函数的典型用法代码示例。如果您正苦于以下问题:C++ setting函数的具体用法?C++ setting怎么用?C++ setting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setting函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setting
static char *wallet_filename(void)
{
char *filename = setting("wallet");
if (!filename)
filename = setting("w");
return filename;
}
示例2: init_peers
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;
}
示例3: loadSamples
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]);
}
}
}
示例4: switch_keys
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);
}
示例5: locker
//-------------------------------------------------------------------------------------------------
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 ) );
}
示例6: SetFormat
//---------------------------------------------------------------------------------------
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;
}
}
}
示例7: setting
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;
}
}
示例8: QChar
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();
}
示例9: setting
/**
* 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();
}
示例10: main
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();
}
示例11: do_start_document
void do_start_document(const Settings& settings)
{
seen_root_ = false;
settings_ = settings;
if(setting("indent") == "yes")
indent_ = 0;
} // do_start_document
示例12: setting
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);
}
}
示例13: listWidget_show
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);
}
示例14: QTcpServer
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;
}
}
}
示例15: do_register_setting
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();
}