本文整理汇总了C++中saveConfig函数的典型用法代码示例。如果您正苦于以下问题:C++ saveConfig函数的具体用法?C++ saveConfig怎么用?C++ saveConfig使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了saveConfig函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ram
//.........这里部分代码省略.........
numentries++;
};
visible_lines = ((RESY/getFontHeight())-1)/2;
while (1) {
// Display current menu page
lcdClear();
lcdPrint("Config");
lcdSetCrsrX(60);
lcdPrint("[");
lcdPrint(IntToStr((current_offset/visible_lines)+1,1,0));
lcdPrint("/");
lcdPrint(IntToStr(((numentries-1)/visible_lines)+1,1,0));
lcdPrint("]");
lcdNl();
lcdNl();
uint8_t j=0;
for (uint8_t i=0;i<current_offset;i++)
while (the_config[++j].disabled);
uint8_t t=0;
for (uint8_t i=0;i<menuselection;i++)
while (the_config[++t].disabled);
for (uint8_t i = current_offset; i < (visible_lines + current_offset) && i < numentries; i++,j++) {
while(the_config[j].disabled)j++;
if(i==0){
lcdPrintln("Save changes:");
if (i == t)
lcdPrint("*");
lcdSetCrsrX(14);
if (i == t)
lcdPrintln("YES");
else
lcdPrintln("no");
}else{
lcdPrintln(the_config[j].name);
if (j == t)
lcdPrint("*");
lcdSetCrsrX(14);
lcdPrint("<");
lcdPrint(IntToStr(the_config[j].value,3,F_LONG));
lcdPrintln(">");
};
lcdRefresh();
}
switch (getInputWaitRepeat()) {
case BTN_UP:
menuselection--;
if (menuselection < current_offset) {
if (menuselection < 0) {
menuselection = numentries-1;
current_offset = ((numentries-1)/visible_lines) * visible_lines;
} else {
current_offset -= visible_lines;
}
}
break;
case BTN_DOWN:
menuselection++;
if (menuselection > (current_offset + visible_lines-1) || menuselection >= numentries) {
if (menuselection >= numentries) {
menuselection = 0;
current_offset = 0;
} else {
current_offset += visible_lines;
}
}
break;
case BTN_LEFT:
if(the_config[t].value >
the_config[t].min)
the_config[t].value--;
if(the_config[t].value > the_config[t].max)
the_config[t].value=
the_config[t].max;
applyConfig();
break;
case BTN_RIGHT:
if(the_config[t].value <
the_config[t].max)
the_config[t].value++;
if(the_config[t].value < the_config[t].min)
the_config[t].value=
the_config[t].min;
applyConfig();
break;
case BTN_ENTER:
if(menuselection==0)
saveConfig();
return;
}
}
/* NOTREACHED */
}
示例2: saveConfig
PluginLoader::~PluginLoader() {
saveConfig();
unloadPlugins();
}
示例3: saveConfig
void CalibrationMain::on_SaveConfigButton_clicked()
{
saveConfig(currentFile);
}
示例4: loadConfig
//.........这里部分代码省略.........
//frame_duration = 1.0 / 25.0;
frame_duration = 1.0f / 10.0f;
}
BGS->SetFrameRate(frame_duration);
if (status == MLBGS_LEARN)
{
if (loadDefaultParams)
{
mode_learn_rate_per_second = 0.5;
weight_learn_rate_per_second = 0.5;
init_mode_weight = 0.05f;
}
else
{
mode_learn_rate_per_second = learn_mode_learn_rate_per_second;
weight_learn_rate_per_second = learn_weight_learn_rate_per_second;
init_mode_weight = learn_init_mode_weight;
}
}
if (status == MLBGS_DETECT)
{
if (loadDefaultParams)
{
mode_learn_rate_per_second = 0.01f;
weight_learn_rate_per_second = 0.01f;
init_mode_weight = 0.001f;
}
else
{
mode_learn_rate_per_second = detect_mode_learn_rate_per_second;
weight_learn_rate_per_second = detect_weight_learn_rate_per_second;
init_mode_weight = detect_init_mode_weight;
}
}
BGS->SetParameters(max_mode_num, mode_learn_rate_per_second, weight_learn_rate_per_second, init_mode_weight);
saveConfig();
delete org_img;
}
//IplImage* inputImage = new IplImage(img_input);
//IplImage* img = cvCreateImage(img_size, IPL_DEPTH_8U, 3);
//cvCopy(inputImage, img);
//delete inputImage;
if (detectAfter > 0 && detectAfter == frameNumber)
{
std::cout << "MultiLayerBGS in DETECT mode" << std::endl;
status = MLBGS_DETECT;
mode_learn_rate_per_second = 0.01f;
weight_learn_rate_per_second = 0.01f;
init_mode_weight = 0.001f;
BGS->SetParameters(max_mode_num, mode_learn_rate_per_second, weight_learn_rate_per_second, init_mode_weight);
BGS->m_disableLearning = disableLearning;
if (disableLearning)
std::cout << "MultiLayerBGS disabled learning in DETECT mode" << std::endl;
else
std::cout << "MultiLayerBGS enabled learning in DETECT mode" << std::endl;
}
IplImage* img = new IplImage(img_input);
BGS->SetRGBInputImage(img);
BGS->Process();
BGS->GetBackgroundImage(bg_img);
BGS->GetForegroundImage(fg_img);
BGS->GetForegroundProbabilityImage(fg_prob_img3);
BGS->GetForegroundMaskImage(fg_mask_img);
BGS->MergeImages(4, img, bg_img, fg_prob_img3, fg_img, merged_img);
img_merged = cv::Mat(merged_img);
img_foreground = cv::Mat(fg_mask_img);
img_background = cv::Mat(bg_img);
if (showOutput)
{
//cv::imshow("MLBGS Layers", img_merged);
// cv::imshow("MLBGS FG Mask", img_foreground);
}
img_foreground.copyTo(img_output);
img_background.copyTo(img_bgmodel);
delete img;
//cvReleaseImage(&img);
firstTime = false;
frameNumber++;
}
示例5: getConfigFileName
void Config::save() const
{
char filename[MAX_STRING_SIZE];
getConfigFileName(filename, MAX_STRING_SIZE);
saveConfig(filename);
}
示例6: saveConfig
bool MICCD::SetFilterNames()
{
// Cannot save it in hardware, so let's just save it in the config file to be loaded later
saveConfig();
return true;
}
示例7: loadConfig
void T2FMRF_UM::process(const cv::Mat &img_input, cv::Mat &img_output, cv::Mat &img_bgmodel)
{
if(img_input.empty())
return;
loadConfig();
if(firstTime)
saveConfig();
frame = new IplImage(img_input);
if(firstTime)
frame_data.ReleaseMemory(false);
frame_data = frame;
if(firstTime)
{
int width = img_input.size().width;
int height = img_input.size().height;
lowThresholdMask = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 1);
lowThresholdMask.Ptr()->origin = IPL_ORIGIN_BL;
highThresholdMask = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 1);
highThresholdMask.Ptr()->origin = IPL_ORIGIN_BL;
params.SetFrameSize(width, height);
params.LowThreshold() = threshold;
params.HighThreshold() = 2*params.LowThreshold();
params.Alpha() = alpha;
params.MaxModes() = gaussians;
params.Type() = TYPE_T2FMRF_UM;
params.KM() = km; // Factor control for the T2FMRF-UM [0,3] default: 2
params.KV() = kv; // Factor control for the T2FMRF-UV [0.3,1] default: 0.9
bgs.Initalize(params);
bgs.InitModel(frame_data);
old_labeling = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 1);
old = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 1);
mrf.height = height;
mrf.width = width;
mrf.Build_Classes_OldLabeling_InImage_LocalEnergy();
firstTime = false;
}
bgs.Subtract(frameNumber, frame_data, lowThresholdMask, highThresholdMask);
cvCopy(lowThresholdMask.Ptr(), old);
/************************************************************************/
/* the code for MRF, it can be noted when using other methods */
/************************************************************************/
//the optimization process is done when the foreground detection is stable,
if(frameNumber >= 10)
{
gmm = bgs.gmm();
hmm = bgs.hmm();
mrf.background2 = frame_data.Ptr();
mrf.in_image = lowThresholdMask.Ptr();
mrf.out_image = lowThresholdMask.Ptr();
mrf.InitEvidence2(gmm,hmm,old_labeling);
mrf.ICM2();
cvCopy(mrf.out_image, lowThresholdMask.Ptr());
}
cvCopy(old, old_labeling);
lowThresholdMask.Clear();
bgs.Update(frameNumber, frame_data, lowThresholdMask);
cv::Mat foreground(highThresholdMask.Ptr());
if(showOutput)
cv::imshow("T2FMRF-UM", foreground);
foreground.copyTo(img_output);
delete frame;
frameNumber++;
}
示例8: loadConfig
//.........这里部分代码省略.........
cv::circle(img_input, cv::Point((*it3).x,(*it3).y), 3, cv::Scalar(255,255,255), -1);
}
points.erase(it2);
points.insert(std::pair<cvb::CvID, std::vector<CvPoint2D64f>>(id,centroids2));
}
else
{
points.erase(it2);
}
}
else
{
if(track->inactive == 0)
{
std::vector<CvPoint2D64f> centroids;
centroids.push_back(centroid);
// time(&start);
points.insert(std::pair<cvb::CvID, std::vector<CvPoint2D64f>>(id,centroids));
}
//
std::map<cvb::CvID, CarSpeed>::iterator speedit =carspeeds.find(id);
CarSpeed carspeed2 =speedit->second;
time(&end);
carspeed2.lasttime = end;
carspeed2.lastcentroid = centroid;
carspeeds.insert(std::pair<cvb::CvID, CarSpeed>(id,carspeed2));
// std::cout << "latest center point...id:" << id <<" cost time: "<<difftime(carspeed2.lasttime,carspeed2.starttime) << " (" << carspeed2.startcentroid.x << "," << carspeed2.startcentroid.y << ")" << " (" << carspeed2.lastcentroid.x << "," << carspeed2.lastcentroid.y << ")" << std::endl;
//
if(difftime(carspeed2.lasttime,carspeed2.starttime)>0){
double costtime =difftime(carspeed2.lasttime,carspeed2.starttime);
double distance =sqrt((carspeed2.startcentroid.y - carspeed2.lastcentroid.y) *(carspeed2.startcentroid.y - carspeed2.lastcentroid.y)+(carspeed2.startcentroid.x - carspeed2.lastcentroid.x)*(carspeed2.startcentroid.x - carspeed2.lastcentroid.x));
// std::cout<<"ID:"<<id<<" Distance: "<<distance<<" Time: "<<costtime<<" speed: "<<distance/costtime<<std::endl;
IdSpeed is;
is.id=id;
is.speed=distance/costtime;
idspeeds.push_back(is);
}
}
// time(&end);
// double sec=difftime(end,start);
endpoint = centroid;
// double distance =sqrt((endpoint.y-startpoint.y) *(endpoint.y-startpoint.y)+(endpoint.x-startpoint.x)*(endpoint.x-startpoint.x));
// std::cout <<"track->id:"<<track->id << " track->lifetime: " << track->lifetime ;
// printf("distance : %f ",distance);
// printf("time cost: %lf \n ",sec);
//cv::waitKey(0);
}
//--------------------------------------------------------------------------
// std::cout<<"endtime"<<std::endl;
time(&endtime);
//if 30 second has passed ,please recount the car num.
if(difftime(endtime,origintime)>30){
std::cout<<"30 seconds has passed"<<std::endl;
countAB=0;
countBA=0;
std::cout<<"restarttime"<<std::endl;
time(&origintime);
}
if(showAB == 0)
{
cv::putText(img_input, "A->B: " + boost::lexical_cast<std::string>(countAB), cv::Point(10,img_h-20), cv::FONT_HERSHEY_PLAIN, 1, cv::Scalar(255,255,255));
cv::putText(img_input, "B->A: " + boost::lexical_cast<std::string>(countBA), cv::Point(10,img_h-8), cv::FONT_HERSHEY_PLAIN, 1, cv::Scalar(255,255,255));
}
if(showAB == 1){
cv::putText(img_input, "A->B: " + boost::lexical_cast<std::string>(countAB), cv::Point(10,img_h-8), cv::FONT_HERSHEY_PLAIN, 1, cv::Scalar(255,255,255));
}
if(showAB == 2)
{
cv::putText(img_input, "B->A: " + boost::lexical_cast<std::string>(countBA), cv::Point(10,img_h-8), cv::FONT_HERSHEY_PLAIN, 1, cv::Scalar(255,255,255));
}
if(showOutput)
cv::imshow("VehicleCouting", img_input);
if(firstTime)
saveConfig();
firstTime = false;
}
示例9: saveConfig
PRL_RESULT CDspDispConfigGuard::saveConfig( bool bNoSaveNetwork )
{
QString path = ParallelsDirs::getDispatcherConfigFilePath();
return saveConfig( path, bNoSaveNetwork );
}
示例10: saveConfig
ApokalypseApp::~ApokalypseApp(){
if (screen) delete screen;
if (!configfile.isEmpty())
saveConfig();
}
示例11: realmain
//.........这里部分代码省略.........
// FIXME: Change this to LOG_WZ on next release
debug(LOG_INFO, "Using %s debug file", buf);
}
// NOTE: it is now safe to use debug() calls to make sure output gets captured.
check_Physfs();
debug(LOG_WZ, "Warzone 2100 - %s", version_getFormattedVersionString());
debug(LOG_WZ, "Using language: %s", getLanguage());
debug(LOG_WZ, "Backend: %s", BACKEND);
debug(LOG_MEMORY, "sizeof: SIMPLE_OBJECT=%ld, BASE_OBJECT=%ld, DROID=%ld, STRUCTURE=%ld, FEATURE=%ld, PROJECTILE=%ld",
(long)sizeof(SIMPLE_OBJECT), (long)sizeof(BASE_OBJECT), (long)sizeof(DROID), (long)sizeof(STRUCTURE), (long)sizeof(FEATURE), (long)sizeof(PROJECTILE));
/* Put in the writedir root */
sstrcpy(KeyMapPath, "keymap.map");
// initialise all the command line states
war_SetDefaultStates();
debug(LOG_MAIN, "initializing");
PhysicsEngineHandler engine; // register abstract physfs filesystem
loadConfig();
// parse the command line
if (!ParseCommandLine(utfargc, utfargv))
{
return EXIT_FAILURE;
}
// Save new (commandline) settings
saveConfig();
// Find out where to find the data
scanDataDirs();
// Now we check the mods to see if they exist or not (specified on the command line)
// They are all capped at 100 mods max(see clparse.c)
// FIX ME: I know this is a bit hackish, but better than nothing for now?
{
char *modname;
char modtocheck[256];
int i = 0;
int result = 0;
// check global mods
for(i=0; i < 100; i++)
{
modname = global_mods[i];
if (modname == NULL)
{
break;
}
ssprintf(modtocheck, "mods/global/%s", modname);
result = PHYSFS_exists(modtocheck);
result |= PHYSFS_isDirectory(modtocheck);
if (!result)
{
debug(LOG_ERROR, "The (global) mod (%s) you have specified doesn't exist!", modname);
}
else
{
info("(global) mod (%s) is enabled", modname);
}
示例12: saveConfig
KChatBaseModel::~KChatBaseModel()
{
// kDebug(11000) << "KChatBaseModelPrivate: DESTRUCT (" << this << ")";
saveConfig();
}
示例13: IUUpdateNumber
bool QHYCCD::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
{
// first check if it's for our device
//IDLog("INDI::CCD::ISNewNumber %s\n",name);
if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
{
if (strcmp(name, FilterSlotNP.name) == 0)
{
INDI::FilterInterface::processNumber(dev, name, values, names, n);
return true;
}
if (strcmp(name, GainNP.name) == 0)
{
IUUpdateNumber(&GainNP, values, names, n);
GainRequest = GainN[0].value;
if (LastGainRequest != GainRequest)
{
SetQHYCCDParam(camhandle, CONTROL_GAIN, GainN[0].value);
LastGainRequest = GainRequest;
}
DEBUGF(INDI::Logger::DBG_SESSION, "Current %s value %f", GainNP.name, GainN[0].value);
GainNP.s = IPS_OK;
IDSetNumber(&GainNP, NULL);
return true;
}
if (strcmp(name, OffsetNP.name) == 0)
{
IUUpdateNumber(&OffsetNP, values, names, n);
SetQHYCCDParam(camhandle, CONTROL_OFFSET, OffsetN[0].value);
DEBUGF(INDI::Logger::DBG_SESSION, "Current %s value %f", OffsetNP.name, OffsetN[0].value);
OffsetNP.s = IPS_OK;
IDSetNumber(&OffsetNP, NULL);
saveConfig(true, OffsetNP.name);
return true;
}
if (strcmp(name, SpeedNP.name) == 0)
{
IUUpdateNumber(&SpeedNP, values, names, n);
SetQHYCCDParam(camhandle, CONTROL_SPEED, SpeedN[0].value);
DEBUGF(INDI::Logger::DBG_SESSION, "Current %s value %f", SpeedNP.name, SpeedN[0].value);
SpeedNP.s = IPS_OK;
IDSetNumber(&SpeedNP, NULL);
saveConfig(true, SpeedNP.name);
return true;
}
if (strcmp(name, USBTrafficNP.name) == 0)
{
IUUpdateNumber(&USBTrafficNP, values, names, n);
SetQHYCCDParam(camhandle, CONTROL_USBTRAFFIC, USBTrafficN[0].value);
DEBUGF(INDI::Logger::DBG_SESSION, "Current %s value %f", USBTrafficNP.name, USBTrafficN[0].value);
USBTrafficNP.s = IPS_OK;
IDSetNumber(&USBTrafficNP, NULL);
saveConfig(true, USBTrafficNP.name);
return true;
}
}
// if we didn't process it, continue up the chain, let somebody else
// give it a shot
return INDI::CCD::ISNewNumber(dev, name, values, names, n);
}
示例14: qDebug
/*! \brief Load new configuration.
* \param cfgfile
* \returns True if config is OK, False if not (e.g. no input device specified).
*
* If cfgfile is an absolute path it will be used as is, otherwise it is assumed to be the
* name of a file under m_cfg_dir.
*
* If cfgfile does not exist it will be created.
*
* If no input device is specified, we return false to signal that the I/O configuration
* dialog should be run.
*
* FIXME: Refactor.
*/
bool MainWindow::loadConfig(const QString cfgfile, bool check_crash)
{
bool conf_ok = false;
bool skipLoadingSettings = false;
qDebug() << "Loading configuration from:" << cfgfile;
if (m_settings)
delete m_settings;
if (QDir::isAbsolutePath(cfgfile))
m_settings = new QSettings(cfgfile, QSettings::IniFormat);
else
m_settings = new QSettings(QString("%1/%2").arg(m_cfg_dir).arg(cfgfile), QSettings::IniFormat);
qDebug() << "Configuration file:" << m_settings->fileName();
if (check_crash)
{
if (m_settings->value("crashed", false).toBool())
{
qDebug() << "Crash guard triggered!" << endl;
QMessageBox* askUserAboutConfig =
new QMessageBox(QMessageBox::Warning, tr("Crash Detected!"),
tr("<p>Gqrx has detected problems with the current configuration. "
"Loading the configuration again could cause the application to crash.</p>"
"<p>Do you want to edit the settings?</p>"),
QMessageBox::Yes | QMessageBox::No);
askUserAboutConfig->setDefaultButton(QMessageBox::Yes);
askUserAboutConfig->setTextFormat(Qt::RichText);
askUserAboutConfig->exec();
if (askUserAboutConfig->result() == QMessageBox::Yes)
skipLoadingSettings = true;
delete askUserAboutConfig;
}
else
{
m_settings->setValue("crashed", true); // clean exit will set this to FALSE
saveConfig(cfgfile);
}
}
if (skipLoadingSettings)
return false;
emit configChanged(m_settings);
// manual reconf (FIXME: check status)
bool conv_ok = false;
QString indev = m_settings->value("input/device", "").toString();
if (!indev.isEmpty())
{
conf_ok = true;
rx->set_input_device(indev.toStdString());
// Update window title
QRegExp regexp("'([a-zA-Z0-9 \\-\\_\\/\\.\\,\\(\\)]+)'");
QString devlabel;
if (regexp.indexIn(indev, 0) != -1)
devlabel = regexp.cap(1);
else
devlabel = indev; //"Unknown";
setWindowTitle(QString("Gqrx %1 - %2").arg(VERSION).arg(devlabel));
// Add available antenna connectors to the UI
std::vector<std::string> antennas = rx->get_antennas();
uiDockInputCtl->setAntennas(antennas);
}
QString outdev = m_settings->value("output/device", "").toString();
rx->set_output_device(outdev.toStdString());
int sr = m_settings->value("input/sample_rate", 0).toInt(&conv_ok);
if (conv_ok && (sr > 0))
{
double actual_rate = rx->set_input_rate(sr);
qDebug() << "Requested sample rate:" << sr;
qDebug() << "Actual sample rate :" << QString("%1").arg(actual_rate, 0, 'f', 6);
uiDockRxOpt->setFilterOffsetRange((qint64)(0.9*actual_rate));
ui->plotter->setSampleRate(actual_rate);
ui->plotter->setSpanFreq((quint32)actual_rate);
}
//.........这里部分代码省略.........
示例15: saveConfig
bool CConfigFile::saveConfig(const std::string & filename)
{
return saveConfig(filename.c_str());
}