void CDDBModule::save() { KCModule::save(); checkSettings(); }
/*! Main function */ int main (int argc, char *argv[]) { INFO *info; bool result = false; info = initialize (); #if HAVE_MPI MPI_Init (&argc, &argv); MPI_Comm_rank (MPI_COMM_WORLD, &(info -> world_id)); MPI_Comm_size (MPI_COMM_WORLD, &(info -> world_size)); #endif #if HAVE_OPENMP info -> threads = omp_get_num_procs (); omp_set_num_threads (info -> threads); #endif /* Process the command line parameters and then check them; ** if either fail then print usage information */ if ((!processOptions (argc, argv, info)) || (!checkSettings (info))) { usage (argv[0]); } else { result = run (info); } #if HAVE_MPI MPI_Finalize (); #endif uninitialize (info); return (EXIT_SUCCESS); }
void MainWindow::change() { //qDebug()<<"timer fired:"<<index; if (index >= urls.size()) { index = 0; //stop the timer timer->stop(); //go get all the records again, just in case something changed checkSettings(); //restart the timer timer->start(timerDelay); } if (urls.size() != 0) { //build a fancy string to put in here QString s = pages + location + urls.at(index) + ".html"; //view->setHtml(s); view->load(QUrl(s)); } else { //load the default page since there's nothing in the array view->load(QUrl(defaultpage)); } index++; }
void ConfigDialog::customChanged(){ if(ui->listWidget->currentItem() == 0){ ui->tool_remRepo->setEnabled(false); }else{ ui->tool_remRepo->setEnabled(true); } checkSettings(); //also update the apply button }
void initConfiguration(int argc, const char *argv[]) { /* load some more defaults from config file */ runScript(PATH_SCRIPTS, "config.lua"); runScript(PATH_SCRIPTS, "artpack.lua"); /* go for .gltronrc (or whatever is defined in RC_NAME) */ { char *path; path = getPossiblePath(PATH_PREFERENCES, RC_NAME); if (path != NULL) { if (fileExists(path)) { printf("[status] loading settings from %s\n", path); scripting_RunFile(path); } else { printf("[error] cannot load %s from %s\n", RC_NAME, path); } free(path); } else { printf("[fatal] can't get valid pref path for %s\n", RC_NAME); exit(1); // something is seriously wrong } } if(!isSetting("version") || getSettingf("version") < 0.70f) { /* load some more defaults from config file */ runScript(PATH_SCRIPTS, "config.lua"); runScript(PATH_SCRIPTS, "artpack.lua"); printf("[warning] old config file found, overriding using defaults\n"); } // check if config is valid scripting_GetGlobal("save_completed", NULL); if(scripting_IsNilResult()) { runScript(PATH_SCRIPTS, "config.lua"); runScript(PATH_SCRIPTS, "artpack.lua"); printf("[warning] defunct config file found, overriding using defaults\n"); } setSettingf("version", 0.70f); /* parse any comandline switches overrinding the loaded settings */ parse_args(argc, argv); /* sanity check some settings */ checkSettings(); /* intialize the settings cache, remember to do that everytime you change something */ updateSettingsCache(); }
WifiSettingsDialog::WifiSettingsDialog(const QString &preferredInterface, QWidget *parent) : QDialog(parent), ui(new Ui::WifiSettingsDialog), _qpd(NULL), _connecting(false) { setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint); ui->setupUi(this); ui->list->setItemDelegate(new TwoIconsDelegate(this)); ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); connect(ui->passwordEdit, SIGNAL(textChanged(QString)), this, SLOT(checkSettings())); FiW1Wpa_supplicant1Interface *wpa = WpaFactory::createWpaSupplicantProxy(this); _ifpath = wpa->GetInterface(preferredInterface).value(); if (_ifpath.path().isEmpty()) { /* Preferred wlan interface not available, take first one out of list instead */ QList<QDBusObjectPath> ifaces = wpa->interfaces(); if (ifaces.count()) { _ifpath = ifaces.first(); } else { QMessageBox::critical(parent, tr("No wifi interfaces"), tr("No wifi interfaces available"), QMessageBox::Close); close(); } } _interface = WpaFactory::createInterfaceProxy(_ifpath, this); _ifname = _interface->ifname(); qDebug() << "Using wifi interface" << _ifname; _currentBSS = _interface->currentBSS(); connect(_interface, SIGNAL(BSSAdded(QDBusObjectPath,QVariantMap)), this, SLOT(onBSSAdded(QDBusObjectPath))); connect(_interface, SIGNAL(PropertiesChanged(QVariantMap)), this, SLOT(onPropertiesChanged(QVariantMap))); /* Call onBSSAdded() for BSSes already scanned prior to opening the dialog */ QList<QDBusObjectPath> bSSs = _interface->bSSs(); foreach (QDBusObjectPath bsspath, bSSs) { onBSSAdded(bsspath); }
void MainWidget::prepareApplication(bool showSystray) { //TODO: delete database before exit if(QSettings().value("useMemoryStorage", true).toBool()) { db = new QListDB(); } else { db = new SQLiteDB(); } configForm = new ConfigWidget(); backupForm = new BackupManagerForm(db, this); managerForm = new ClientManager(db, this); connectSignals(); if(showSystray) { createTrayIcon(); } checkSettings(); }
MainWindow::MainWindow(QMainWindow *parent) :QMainWindow(parent) { mw.setupUi(this); view = new QWebView(this); setCentralWidget(view); //set up a new timer timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(change())); connect(view,SIGNAL(loadFinished(bool)),this, SLOT(checkPage())); //set up the basic info for qsettings QCoreApplication::setOrganizationName("sign"); QCoreApplication::setApplicationName("sign"); timerDelay = 5000; //in milliseconds, 1000ms = 1s QSettings settings; timerDelay = settings.value("timer").toInt(); //set the index number index = 0; //set up the initial stuff for where the pages live pages = settings.value("pages").toString(); location = settings.value("location").toString(); //set up the default page defaultpage = pages + location + "default.html"; dbase = new Database(); //pull all the stuff from the database checkSettings(); //put this back later //showFullScreen(); }
NodeEditorWindows::NodeEditorWindows(QWidget *parent, GPNodeProject *nodeProject) : QMainWindow(parent) { setWindowIcon(QIcon(":/img/img/gpstudio_node.ico")); if(nodeProject) _project = nodeProject; else _project = new GPNodeProject(); setupWidgets(); createDocks(); createToolBarAndMenu(); checkSettings(); attachProject(nodeProject); if(!_project->node()) _project->newProject(); _blockEditor = NULL; showCamExplorer(); }
LibjoynrSettings::LibjoynrSettings(Settings& settings) : settings(settings) { checkSettings(); }
int main (int argc, char *argv[]) { /* HWND hwndGrab; */ HAB hab; HMQ hmq; QMSG qmsg; SWCNTRL swctl={0}; PID pid; HWND hwndFrame; short a; FILE *file; char logText[CCHMAXPATH]; char text[CCHMAXPATH+10]; char title[CCHMAXPATH]; /* Create a copy of the args */ /* argv[0]: progname * argv[1]: installdir of Audio-CD-Creator * argv[2]: foldername * argv[3]: filelist file * argv[4]: Parameter file */ numArgs=argc; for(a=0;a<argc;a++) { params[a]=argv[a]; } removeLog(); hab=WinInitialize(0); if(hab) { hmq=WinCreateMsgQueue(hab,0); if(hmq) { writeLog("\""); writeLog(argv[0]); writeLog("\" started with the following parameters:\n\n"); for(a=0;a<argc;a++) { snprintf(logText,sizeof(logText),"%d: %s\n",a,argv[a]); writeLog(logText); } writeLog("\n\n"); /* Check if user started prog by hand */ if(argc<5) pmUsage(); else { /* Get our ressource dll */ RESSOURCEHANDLE=queryResModuleHandle(); /* Graphics are bound to the class DLL */ CLASSDLLHANDLE=queryClassDLLModuleHandle(argv[1]); /* Load options from cdrecord.ini */ readIni(); /* load background bitmap */ _loadBmps(CLASSDLLHANDLE); if(readWindowPosFromIni(chrInstallDir, "pmthefly")) bHaveWindowPos=TRUE; if(checkSettings()) { if((ptrLocalMem=malloc(SHAREDMEM_SIZE))!=NULLHANDLE) { if((file=fopen(argv[4],"rb"))!=NULL){ /* Copy command line to local memory */ fread(ptrLocalMem, sizeof(char), SHAREDMEM_SIZE, file); fclose(file); /* Register the percent bar window class */ percentRegisterBarClass(); if( WinDlgBox( HWND_DESKTOP, NULLHANDLE, onTheFlyStatusDialogProc, RESSOURCEHANDLE, IDDLG_CHECKSTATUS, 0 ) == DID_ERROR ) { if(ptrLocalMem) free(ptrLocalMem); DosBeep(100,600); errorResource2("Problem with Audio/Data-CD-Creator installation"); WinDestroyMsgQueue( hmq ); WinTerminate( hab ); return( 1 ); } writeWindowPosToIni(chrInstallDir, "pmthefly"); } } else { /* Text: "Can't alloc shared memory! Aborting..." Title: "On the fly writing" */ messageBox( text, IDSTRPM_ALLOCSHAREDMEMERROR , sizeof(text), title, IDSTRD_ONTHEFLYTITLE, sizeof(title), RESSOURCEHANDLE, HWND_DESKTOP, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE); } }/* if(checkSettings) */ freeClassDLLHandle(); freeResHandle(); } WinDestroyMsgQueue(hmq); } WinTerminate(hab); } if(ptrLocalMem) free(ptrLocalMem); if(argc>=5) { remove(params[3]); remove(params[4]); } return 0; }
void KMSpecialPrinterDlg::slotOk() { if (!checkSettings()) return; KDialogBase::slotOk(); }
void fitter( const string workDirName="Test", // Working directory // Select the type of datasets to fit bool fitData = true, // Fits Data if true, otherwise fits MC bool fitPbPb = true, // Fits PbPb datasets bool fitPP = true, // Fits PP datasets // Select the type of object to fit bool incJpsi = true, // Includes Jpsi model bool incPsi2S = true, // Includes Psi(2S) model bool incBkg = true, // Includes Background model // Select the fitting options bool cutCtau = false, // Apply prompt ctau cuts bool doSimulFit = false, // Do simultaneous fit bool wantPureSMC = false, // Flag to indicate if we want to fit pure signal MC int numCores = 2, // Number of cores used for fitting // Select the drawing options bool setLogScale = true, // Draw plot with log scale bool incSS = false, // Include Same Sign data bool zoomPsi = false, // Zoom Psi(2S) peak on extra pad int nBins = 54 // Number of bins used for plotting ) { // ------------------------------------------------------------------------------- // STEP 0: INITIALIZE THE FITTER WORK ENVIROMENT // The work enviroment is divided as follows: /* main |-> Macros: Contain all the macros |-> Input |-> <WorkDir> : Contain Input File, Bin and Parameter List for a given work directory (e.g. 20160201) |-> Output |-> <WorkDir> : Contain Output Plots and Results for a given work directory (e.g. 20160201) |-> DataSet : Contain all the datasets (MC and Data) */ if (!checkSettings(fitData, fitPbPb, fitPP, incJpsi, incPsi2S, incBkg, cutCtau, doSimulFit, wantPureSMC, setLogScale, zoomPsi, incSS, numCores, nBins)) { return; } map<string,string> DIR; if(!iniWorkEnv(DIR, workDirName)){ return; } // ------------------------------------------------------------------------------- // STEP 1: CREATE/LOAD THE ROODATASETS /* Input : List of TTrees with format: TAG <tab> FILE_NAME Output: Collection of RooDataSets splitted by tag name, including OS and SS dimuons. */ const string InputTrees = DIR["input"] + "InputTrees.txt"; map<string, vector<string> > InputFileCollection; if(!getInputFileNames(InputTrees, InputFileCollection)){ return; } TObjArray* aDSTAG = new TObjArray(); // Array to store the different tags in the list of trees aDSTAG->SetOwner(true); map<string, RooWorkspace> Workspace; for(map<string, vector<string> >::iterator FileCollection=InputFileCollection.begin(); FileCollection!=InputFileCollection.end(); ++FileCollection) { // Get the file tag which has the following format: DSTAG_COLL , i.e. DATA_PP string FILETAG = FileCollection->first; string DSTAG = FILETAG; if (FILETAG.size()) { DSTAG.erase(DSTAG.find("_")); } else { cout << "[ERROR] FILETAG is empty!" << endl; } // Extract the filenames vector<string> InputFileNames = FileCollection->second; string OutputFileName; // If we have data, check if the user wants to fit data if ( (FILETAG.find("DATA")!=std::string::npos) && fitData==true ) { if ( (FILETAG.find("PP")!=std::string::npos) && !fitPP ) continue; // If we find PP, check if the user wants PP if ( (FILETAG.find("PbPb")!=std::string::npos) && !fitPbPb ) continue; // If we find PbPb, check if the user wants PbPb OutputFileName = DIR["dataset"] + "DATASET_" + FILETAG + ".root"; if(!tree2DataSet(Workspace[DSTAG], InputFileNames, FILETAG, OutputFileName)){ return; } if (!aDSTAG->FindObject(DSTAG.c_str())) aDSTAG->Add(new TObjString(DSTAG.c_str())); } // If we find MC, check if the user wants to fit MC if ( (FILETAG.find("MC")!=std::string::npos) && fitData==false ) { if ( (FILETAG.find("PP")!=std::string::npos) && !fitPP ) continue; // If we find PP, check if the user wants PP if ( (FILETAG.find("PbPb")!=std::string::npos) && !fitPbPb ) continue; // If we find PbPb, check if the user wants PbPb if ( (FILETAG.find("JPSI")!=std::string::npos) && !incJpsi ) continue; // If we find Jpsi MC, check if the user wants to include Jpsi if ( (FILETAG.find("PSI2S")!=std::string::npos) && !incPsi2S ) continue; // If we find Psi2S MC, check if the user wants to include Psi2S OutputFileName = DIR["dataset"] + "DATASET_" + FILETAG + ".root"; if(!tree2DataSet(Workspace[DSTAG], InputFileNames, FILETAG, OutputFileName)){ return; } if (!aDSTAG->FindObject(DSTAG.c_str())) aDSTAG->Add(new TObjString(DSTAG.c_str())); if (wantPureSMC) { OutputFileName = DIR["dataset"] + "DATASET_" + FILETAG + "_PureS" + ".root"; if(!tree2DataSet(Workspace[Form("%s_PureS",DSTAG.c_str())], InputFileNames, FILETAG, OutputFileName)){ return; } } } } if (Workspace.size()==0) { cout << "[ERROR] No onia tree files were found matching the user's input settings!" << endl; return; } // ------------------------------------------------------------------------------- // STEP 2: LOAD THE INITIAL PARAMETERS /* Input : List of initial parameters with format PT <tab> RAP <tab> CEN <tab> iniPar ... Output: two vectors with one entry per kinematic bin filled with the cuts and initial parameters */ string InputFile; vector< struct KinCuts > cutVector; vector< map<string, string> > parIniVector; if (fitPbPb && incBkg) { // Add initial parameters for PbPb background models InputFile = (DIR["input"] + "InitialParam_MASS_BKG_PbPb.csv"); if (!addParameters(InputFile, cutVector, parIniVector, true)) { return; } } if (fitPbPb && incJpsi) { // Add initial parameters for PbPb jpsi models InputFile = (DIR["input"] + "InitialParam_MASS_JPSI_PbPb.csv"); if (!addParameters(InputFile, cutVector, parIniVector, true)) { return; } } if (fitPbPb && incPsi2S) { // Add initial parameters for PbPb psi(2S) models InputFile = (DIR["input"] + "InitialParam_MASS_PSI2S_PbPb.csv"); if (!addParameters(InputFile, cutVector, parIniVector, true)) { return; } } if (fitPP && incBkg) { // Add initial parameters for PP background models InputFile = (DIR["input"] + "InitialParam_MASS_BKG_PP.csv"); if (!addParameters(InputFile, cutVector, parIniVector, false)) { return; } } if (fitPP && incJpsi) { // Add initial parameters for PP jpsi models InputFile = (DIR["input"] + "InitialParam_MASS_JPSI_PP.csv"); if (!addParameters(InputFile, cutVector, parIniVector, false)) { return; } } if (fitPP && incPsi2S) { // Add initial parameters for PP psi(2S) models InputFile = (DIR["input"] + "InitialParam_MASS_PSI2S_PP.csv"); if (!addParameters(InputFile, cutVector, parIniVector, false)) { return; } } // ------------------------------------------------------------------------------- // STEP 3: FIT THE DATASETS /* Input : -> The cuts and initial parameters per kinematic bin -> The workspace with the full datasets included. Output: -> Plots (png, pdf and root format) of each fit. -> The local workspace used for each fit. */ TIter nextDSTAG(aDSTAG); string outputDir = DIR["output"]; for (unsigned int i=0; i<cutVector.size(); i++) { nextDSTAG.Reset(); TObjString* soDSTAG(0x0); while ( (soDSTAG = static_cast<TObjString*>(nextDSTAG.Next())) ) { TString DSTAG = static_cast<TString>(soDSTAG->GetString()); if (Workspace.count(DSTAG.Data())>0) { // DATA/MC datasets were loaded if (doSimulFit) { // If do simultaneous fits, then just fits once if (!fitCharmonia( Workspace[DSTAG.Data()], cutVector.at(i), parIniVector.at(i), outputDir, // Select the type of datasets to fit DSTAG.Data(), false, // dummy flag when fitting simultaneously since both PP and PbPb are used // Select the type of object to fit incJpsi, // Includes Jpsi model incPsi2S, // Includes Psi(2S) model incBkg, // Includes Background model // Select the fitting options cutCtau, // Apply prompt ctau cuts true, // Do simultaneous fit wantPureSMC, // Flag to indicate if we want to fit pure signal MC numCores, // Number of cores used for fitting // Select the drawing options setLogScale, // Draw plot with log scale incSS, // Include Same Sign data zoomPsi, // Zoom Psi(2S) peak on extra pad nBins, // Number of bins used for plotting false // Compute the mean PT (NEED TO FIX) ) ) { return; } } else { // If don't want simultaneous fits, then fit PbPb or PP separately if ( DSTAG.Contains("MCJPSI") ) { incJpsi = true; incPsi2S = false; } if ( DSTAG.Contains("MCPSI2S") ) { incJpsi = false; incPsi2S = true; } if (fitPbPb) { if (!fitCharmonia( Workspace[DSTAG.Data()], cutVector.at(i), parIniVector.at(i), outputDir, // Select the type of datasets to fit DSTAG.Data(), true, // In this case we are fitting PbPb // Select the type of object to fit incJpsi, // Includes Jpsi model incPsi2S, // Includes Psi(2S) model incBkg, // Includes Background model // Select the fitting options cutCtau, // Apply prompt ctau cuts false, // Do simultaneous fit false, // Flag to indicate if we want to fit pure signal MC numCores, // Number of cores used for fitting // Select the drawing options setLogScale, // Draw plot with log scale incSS, // Include Same Sign data zoomPsi, // Zoom Psi(2S) peak on extra pad nBins, // Number of bins used for plotting false // Compute the mean PT (NEED TO FIX) ) ) { return; } if (DSTAG.Contains("MC") && wantPureSMC) { if (!fitCharmonia( Workspace[Form("%s_PureS",DSTAG.Data())], cutVector.at(i), parIniVector.at(i), outputDir, // Select the type of datasets to fit DSTAG.Data(), true, // In this case we are fitting PbPb // Select the type of object to fit incJpsi, // Includes Jpsi model incPsi2S, // Includes Psi(2S) model incBkg, // Includes Background model // Select the fitting options cutCtau, // Apply prompt ctau cuts false, // Do simultaneous fit true, // Flag to indicate if we want to fit pure signal MC numCores, // Number of cores used for fitting // Select the drawing options setLogScale, // Draw plot with log scale incSS, // Include Same Sign data zoomPsi, // Zoom Psi(2S) peak on extra pad nBins, // Number of bins used for plotting false // Compute the mean PT (NEED TO FIX) ) ) { return; } } } if (fitPP) { if (!fitCharmonia( Workspace[DSTAG.Data()], cutVector.at(i), parIniVector.at(i), outputDir, // Select the type of datasets to fit DSTAG.Data(), false, // In this case we are fitting PP // Select the type of object to fit incJpsi, // Includes Jpsi model incPsi2S, // Includes Psi(2S) model incBkg, // Includes Background model // Select the fitting options cutCtau, // Apply prompt ctau cuts false, // Do simultaneous fit false, // Flag to indicate if we want to fit pure signal MC numCores, // Number of cores used for fitting // Select the drawing options setLogScale, // Draw plot with log scale incSS, // Include Same Sign data zoomPsi, // Zoom Psi(2S) peak on extra pad nBins, // Number of bins used for plotting false // Compute the mean PT (NEED TO FIX) ) ) { return; } if (DSTAG.Contains("MC") && wantPureSMC) { if (!fitCharmonia( Workspace[Form("%s_PureS",DSTAG.Data())], cutVector.at(i), parIniVector.at(i), outputDir, // Select the type of datasets to fit DSTAG.Data(), false, // In this case we are fitting PP // Select the type of object to fit incJpsi, // Includes Jpsi model incPsi2S, // Includes Psi(2S) model incBkg, // Includes Background model // Select the fitting options cutCtau, // Apply prompt ctau cuts false, // Do simultaneous fit true, // Flag to indicate if we want to fit pure signal MC numCores, // Number of cores used for fitting // Select the drawing options setLogScale, // Draw plot with log scale incSS, // Include Same Sign data zoomPsi, // Zoom Psi(2S) peak on extra pad nBins, // Number of bins used for plotting false // Compute the mean PT (NEED TO FIX) ) ) { return; } } } } } else { cout << "[ERROR] The workspace for " << DSTAG.Data() << " was not found!" << endl; return; } } } delete aDSTAG; };
MessagingSettings::MessagingSettings(const MessagingSettings& other) : settings(other.settings) { checkSettings(); }
MessagingSettings::MessagingSettings(Settings& settings) : settings(settings) { settings.fillEmptySettingsWithDefaults(DEFAULT_MESSAGING_SETTINGS_FILENAME()); checkSettings(); }