示例#1
0
int main(int argc, char *argv[])
{
  // g_type_init has been deprecated since version 2.36.
  // The type system is now initialised automatically.
  // g_type_init();

  // Settings object. 
  Settings mysettings(true);
  settings = &mysettings;

  // Create a new directories 'factory' and initialize it with argv[0]
  Directories = new directories(argv[0]);
  books_init(); // TEMP - MAP
  Directories->init(); // important step

  // Bibledit can read from or write to Bible data.
  // Syntax: bibledit-rdwrt -r|-w ...
  bool readdata = false;
  bool writedata = false;
  if (argc > 2) {
    readdata = (strcmp(argv[1], "-r") == 0);
    writedata = (strcmp(argv[1], "-w") == 0);
  }
  if (readdata ^ writedata) {
    // Do the reading or the writing.
    read_write_data (argc, argv, readdata, writedata);
  } else {
    // Nothing to do.
    gw_message (_("Nothing was done"));
  }

  // Quit.
  return 0;
}
示例#2
0
void initSettings()
{

    QCoreApplication::setOrganizationName("shanghaikairen");
    QCoreApplication::setApplicationName("analysis");

    QSettings mysettings("shanghaikairen","analysis");
    //  mysettings.setPath(QSettings::NativeFormat, QSettings::UserScope, "/shanghaikairen");
    qDebug() << mysettings.fileName();
    mysettings.clear();

    if(!mysettings.contains("calibration_results_count")){
        mysettings.setValue("calibration_results_count",1);
    }
    if((!mysettings.contains("calibration_results_in_result_1"))\
            && (!mysettings.contains("calibration_results_in_data_10"))){
        for(int tmp = 1;tmp <= 10;tmp++){
            //qDebug() << "calibrate_results";
            mysettings.setValue(QString("calibration_results_in_result_%1").arg(tmp)," ; ; ; ");
            mysettings.setValue(QString("calibration_results_in_data_%1").arg(tmp),"");
        }
    }

    QString tmpstr = "calibrate_input_s_";
    if(!mysettings.contains("calibrate_input_s_1")){
        for(int tmpnumber = 0; tmpnumber < 12 ;tmpnumber++){
            tmpstr.append(QString("%1").arg(tmpnumber));
            mysettings.setValue(tmpstr,"0.0000");
            tmpstr = "calibrate_input_s_";
        }
    }


    tmpstr = "s_count_data_";
    if(!mysettings.contains("s_count_data_1")){
        for(int tmpnumber = 0; tmpnumber < 12 ;tmpnumber++){
            tmpstr.append(QString("%1").arg(tmpnumber));
            qDebug() << tmpstr;
            mysettings.setValue(tmpstr,"");
            tmpstr = "s_count_data_";
        }
    }

    if(!mysettings.contains("work_curve_1") || !mysettings.contains("work_curve_9")){
        for(int i = 1;i <= 5 ; i++){
            mysettings.setValue(QString("work_curve_%1").arg(i),";;");
        }
        for(int i = 6 ; i <= 9 ; i++){
            mysettings.setValue(QString("work_curve_%1").arg(i),";;");
        }
    }


    //judge calibratemeasurement_count  whether is exit;if not exit create it.finally assign count variable.
    if(!mysettings.contains("calibratemeasurement_count")){
        mysettings.setValue("calibratemeasurement_count",0);
    }

    if(!mysettings.contains("count_voltage")){
        mysettings.setValue("count_voltage",578);
    }

    if(!mysettings.contains("light_voltage")){
        mysettings.setValue("light_voltage"," ");
    }

    if(!mysettings.contains("light_current")){
        mysettings.setValue("light_current"," ");
    }


    if(!mysettings.contains("machine_used_time")){
        mysettings.setValue("machine_used_time",0);
    }
    if(!mysettings.contains("most_use_time")){
        mysettings.setValue("most_use_time",0);
    }
    if (!mysettings.contains("passwd")){
        mysettings.setValue("passwd",111111);
    }

    // not set default value
    //    if(!mysettings.contains("proportion_1"))
    //      {
    //        mysettings.setValue("proportion_1", 0.1);
    //        mysettings.setValue("proportion_2", 1);
    //      }


    if(!mysettings.contains("sample_count")){
        mysettings.setValue("sample_count",0);
    }
}