Ejemplo n.º 1
0
void load_configuration(string filename)
{

	FILE *fp = fopen(filename.c_str(), "r");


	if (!fp)
	{
		printf("couldn't open file: %s\n", filename.c_str() );
		return;
	}


	fseek(fp, 0, SEEK_END);
	unsigned int fsize = ftell(fp);
	rewind(fp);

	char *fbuffer = (char *)malloc( sizeof(char) * fsize );

	unsigned int success = fread (fbuffer,1,fsize,fp);

	if (success != fsize)
	{
		printf("fread error\n");
	}


	fbuffer[fsize-1] = 0;
	fclose(fp);




	///////////////////////////
	// parse data
	readSetting(fbuffer, "video", "display_x", INI_DATA_TYPE_UINT, &displayWidth);
	readSetting(fbuffer, "video", "display_y", INI_DATA_TYPE_UINT, &displayHeight);
	readSetting(fbuffer, "video", "display_bpp", INI_DATA_TYPE_UINT, &displayBpp);

	unsigned int fullscreen = 0;
	readSetting(fbuffer, "video", "fullscreen", INI_DATA_TYPE_UINT, &fullscreen);
	if (fullscreen == 0)
		displayFullscreen = false;
	else
		displayFullscreen = true;

	unsigned int hw_cursor = 1;
	readSetting(fbuffer, "video", "hardware_cursor", INI_DATA_TYPE_UINT, &hw_cursor);
	if (hw_cursor == 0)
		hardwareCursor = false;
	else
		hardwareCursor = true;

	//printf("hwc=%u, fs=%u\n", (unsigned int)hardwareCursor, (unsigned int)displayFullscreen );



	free(fbuffer);
}
Ejemplo n.º 2
0
void ChineseCalendar::createTray()
{
    this->actionShow = new QAction(tr("隐藏/显示"), this);
    connect(actionShow, SIGNAL(triggered()), this, SLOT(showOrHide()));
    QShortcut *shortcut = new QShortcut(QKeySequence("Ctrl+H"), this);
    connect(shortcut, SIGNAL(activated()), this, SLOT(showOrHide()));

    this->actionAutoStart = new QAction(tr("AutoStart"), this);
    this->actionAutoStart->setCheckable(true);
    connect(actionAutoStart, SIGNAL(triggered(bool)), this, SLOT(setAutoStart(bool)));

    this->actionStaysOnTop = new QAction(tr("总在最前"), this);
    this->actionStaysOnTop->setCheckable(true);
    connect(actionStaysOnTop, SIGNAL(triggered()), this, SLOT(slotChangeMode()));

    this->actionStaysOnBottom = new QAction(tr("总在最后"), this);
    this->actionStaysOnBottom->setCheckable(true);
    connect(actionStaysOnBottom, SIGNAL(triggered()), this, SLOT(slotChangeMode()));

    this->actionStaysNormal = new QAction(tr("普通模式"), this);
    this->actionStaysNormal->setCheckable(true);
    this->actionStaysNormal->setChecked(true);
    connect(actionStaysNormal, SIGNAL(triggered()), this, SLOT(slotChangeMode()));

    // default skin
    this->actionDefault = new QAction(tr("Default"), this);
    actionDefault->setCheckable(true);
    actionDefault->setChecked(true);
    m_skinName = QString("default");
    connect(actionDefault, SIGNAL(triggered()), this, SLOT(slotChangeSkin()));

    // blue skin
    this->actionSkin = new QAction(tr("Blue"), this);
    actionSkin->setCheckable(true);
    connect(actionSkin, SIGNAL(triggered()), this, SLOT(slotChangeSkin()));

    this->skinMenu = new QMenu(tr("换肤"), this);
    this->skinMenu->addAction(actionDefault);
    this->skinMenu->addAction(actionSkin);

    QActionGroup *actSkinGrp = new QActionGroup(this);
    actSkinGrp->addAction(actionDefault);
    actSkinGrp->addAction(actionSkin);

    readSetting();
    actionDefault->setChecked(m_skinName == "default");
    actionSkin->setChecked(m_skinName == "blue");

    // read user customizated skin files
    readSkinFiles();

    foreach (QString strSkin, m_strFileList)
    {
        QAction *actionNew = new QAction(strSkin, this);
        actionNew->setCheckable(true);
        actionNew->setChecked(m_skinName == strSkin);
        actSkinGrp->addAction(actionNew);
        this->skinMenu->addAction(actionNew);
        connect(actionNew, SIGNAL(triggered()), this, SLOT(slotChangeSkin()));
    }
Ejemplo n.º 3
0
static void
updateSetting (CCSBackend *backend, CCSContext *context, CCSPlugin *plugin, CCSSetting *setting)
{
    if (readInit (backend, context))
    {
	readSetting (backend, context, setting);
	readDone (backend, context);
    }
}
Ejemplo n.º 4
0
const QString Configuration::pathSSL() const
{
    QDir dir(QApplication::applicationDirPath());
#if defined Q_OS_MAC
    dir.cdUp();
    dir.cd("Resources");
#endif
    const QString ssl_file = dir.canonicalPath()
            + QDir::separator() + readSetting(QStringLiteral("application/ssl"));
    return ssl_file;
}
DVRServer * DVRServerSettingsReader::readServer(int serverId) const
{
    Q_ASSERT(serverId >= 0);

    DVRServer *server = new DVRServer(serverId);
    server->configuration().setDisplayName(readSetting(serverId, QLatin1String("displayName")).toString());
    server->configuration().setHostname(readSetting(serverId, QLatin1String("hostname")).toString());
    server->configuration().setPort(readSetting(serverId, QLatin1String("port")).toInt());
    server->configuration().setUsername(readSetting(serverId, QLatin1String("username")).toString());
    server->configuration().setPassword(readSetting(serverId, QLatin1String("password")).toString());
    server->configuration().setAutoConnect(readSetting(serverId, QLatin1String("autoConnect"), true).toBool());
    server->configuration().setSslDigest(readSetting(serverId, QLatin1String("sslDigest")).toByteArray());
    server->configuration().setConnectionType(readSetting(serverId, QLatin1String("connectionType"), DVRServerConnectionType::RTSP).toInt());

    return server;
}
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: spiderNewDownload((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3]))); break;
        case 1: spiderNewDownload((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 2: showDownloadDialog(); break;
        case 3: readSetting(); break;
        case 4: saveSetting(); break;
        case 5: iconActivated((*reinterpret_cast< QSystemTrayIcon::ActivationReason(*)>(_a[1]))); break;
        case 6: dlAddNew((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3])),(*reinterpret_cast< bool(*)>(_a[4])),(*reinterpret_cast< bool(*)>(_a[5])),(*reinterpret_cast< QString(*)>(_a[6])),(*reinterpret_cast< QString(*)>(_a[7])),(*reinterpret_cast< QString(*)>(_a[8])),(*reinterpret_cast< QString(*)>(_a[9]))); break;
        case 7: dlAddBatch(); break;
        case 8: dlSiteGrabber(); break;
        case 9: dlImport(); break;
        case 10: dlExport(); break;
        case 11: dlCloseWindow(); break;
        case 12: dlQuitApps(); break;
        case 13: jsResume(); break;
        case 14: jsStop(); break;
        case 15: jsStopAll(); break;
        case 16: jsRemove(); break;
        case 17: jsRemoveAllComplete(); break;
        case 18: jsRestart(); break;
        case 19: queStartQue(); break;
        case 20: queStopQue(); break;
        case 21: queManageQue(); break;
        case 22: queSchedule(); break;
        case 23: settingPreference(); break;
        case 24: settingConfigure(); break;
        case 25: settingView(); break;
        case 26: toolsScriptManager(); break;
        case 27: toolsSpeedMapper(); break;
        case 28: helpManual(); break;
        case 29: helpCredit(); break;
        case 30: terimaList((*reinterpret_cast< QStringList(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 31: terimaGrabber((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3])),(*reinterpret_cast< QStringList(*)>(_a[4]))); break;
        case 32: { QStringList _r = generateOptions();
            if (_a[0]) *reinterpret_cast< QStringList*>(_a[0]) = _r; }  break;
        case 33: getItemStat((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 34: deactiveMenu(); break;
        default: ;
        }
        _id -= 35;
    }
    return _id;
}
Ejemplo n.º 7
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    int x=(QApplication::desktop()->width() - this->width())/2;
    int y=(QApplication::desktop()->height() - this->height())/2;
    int readSet=readSetting();
    ui->setupUi(this);
    this->move (x,y);
    ui->txtbInfo->document()->setMaximumBlockCount(MaxLine);
    ui->btStart->setShortcut(Qt::Key_A);
    ui->btOpen->setShortcut(Qt::Key_O);
    ui->btQuit->setShortcut(Qt::Key_S);
    ui->lbInfo->setText(welcome);
    autoStart();
    autoHideWin();
}
Ejemplo n.º 8
0
docItem::docItem(QList<int> _list, int _curr, int _doc, QWidget *parent):QDialog(parent){
    ui.setupUi(this);
    list = _list;
    curr = _curr;
    doc = _doc;

    QSqlQuery _v(QString("select docs.vid from docs where docs.id = \'%1\'").arg(doc));
    _v.next();
    vid = _v.value(0).toInt();

    ui.spinBox_id_book->hide();
    ui.tableWidget_res->setColumnHidden(0, true);    
    ui.tableWidget_res->setColumnHidden(7, true);
    ui.tableWidget_res->setColumnHidden(8, true);

    if (vid == 1){
        ui.tableWidget_res->setColumnHidden(6, true);
        ui.radioButton_identifier->hide();
    } else if (vid == 2){
        ui.lineEdit_place->hide();
        ui.label_3->hide();
        ui.lineEdit_identifier->setReadOnly(true);
    }

    openItem();

    readSetting();
    connect(ui.pushButton_close, SIGNAL(clicked()), this, SLOT(close()));
    connect(ui.lineEdit_search, SIGNAL(textEdited(QString)), this, SLOT(searchBook(QString)));
    connect(ui.tableWidget_res, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(selectBook()));

    connect(ui.pushButton_save, SIGNAL(clicked()), this, SLOT(saveItem()));
    connect(ui.pushButton_del, SIGNAL(clicked()), this, SLOT(deleteItem()));

    connect(ui.pushButton_toFirst, SIGNAL(clicked()), this, SLOT(toFirst()));
    connect(ui.pushButton_toLast, SIGNAL(clicked()), this, SLOT(toLast()));
    connect(ui.pushButton_toNext, SIGNAL(clicked()), this, SLOT(toNext()));
    connect(ui.pushButton_toPrev, SIGNAL(clicked()), this, SLOT(toPrev()));

}
Ejemplo n.º 9
0
readers::readers(QWidget *parent):QMainWindow(parent){
    ui.setupUi(this);

    ui.groupBox_columns->hide();
    readSetting();
    selectColumns();

    updateReaders();

    connect(ui.actionClose, SIGNAL(triggered()), this, SLOT(close()));
    connect(ui.toolButton_col, SIGNAL(clicked(bool)), ui.groupBox_columns, SLOT(setVisible(bool)));

    connect (ui.checkBox_fam, SIGNAL(clicked()), this, SLOT(selectColumns()));
    connect(ui.checkBox_ima, SIGNAL(clicked()), this, SLOT(selectColumns()));
    connect(ui.checkBox_otc, SIGNAL(clicked()), this, SLOT(selectColumns()));
    connect(ui.checkBox_data_r, SIGNAL(clicked()), this, SLOT(selectColumns()));
    connect(ui.checkBox_num, SIGNAL(clicked()), this, SLOT(selectColumns()));
    connect(ui.checkBox_phone, SIGNAL(clicked()), this, SLOT(selectColumns()));
    connect(ui.checkBox_address, SIGNAL(clicked()), this, SLOT(selectColumns()));
    connect(ui.checkBox_doc, SIGNAL(clicked()), this, SLOT(selectColumns()));

    connect(ui.actionAdd, SIGNAL(triggered()), this, SLOT(addReaders()));
    connect(ui.tableWidget_readers, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(openReaders()));
}
Ejemplo n.º 10
0
void NAOCamera::readCameraSettings()
{
    // read in current camera settings.
    m_settings.brightness = readSetting(V4L2_CID_BRIGHTNESS);
    m_settings.contrast = readSetting(V4L2_CID_CONTRAST);
    m_settings.saturation = readSetting(V4L2_CID_SATURATION);
    m_settings.hue = readSetting(V4L2_CID_HUE);
    m_settings.redChroma = readSetting(V4L2_CID_RED_BALANCE);
    m_settings.blueChroma = readSetting(V4L2_CID_BLUE_BALANCE);
    m_settings.gain = readSetting(V4L2_CID_GAIN);
    m_settings.exposure = readSetting(V4L2_CID_EXPOSURE);

    m_settings.autoExposure = readSetting(V4L2_CID_AUTOEXPOSURE);
    m_settings.autoWhiteBalance = readSetting(V4L2_CID_AUTO_WHITE_BALANCE);
    m_settings.autoGain = readSetting(V4L2_CID_AUTOGAIN);
    
    
    m_settings.p_gain.set(m_settings.gain);
    m_settings.p_exposure.set(m_settings.exposure);
    m_settings.p_brightness.set(m_settings.brightness);
    m_settings.p_contrast.set(m_settings.contrast);
    m_settings.p_saturation.set(m_settings.saturation);
    m_settings.p_hue.set(m_settings.hue);
    m_settings.p_redChroma.set(m_settings.redChroma);
    m_settings.p_blueChroma.set(m_settings.blueChroma);

    // Auto values
    m_settings.p_autoExposure.set(m_settings.autoExposure);
    m_settings.p_autoWhiteBalance.set(m_settings.autoWhiteBalance);
    m_settings.p_autoGain.set(m_settings.autoGain);

    
}
Ejemplo n.º 11
0
const QString Configuration::oauthEndpointToken() const
{
    return readSetting(QStringLiteral("oauth/endpoints/token"));
}
Ejemplo n.º 12
0
QString ConfigManager::getThemePath(){

    return readSetting("path/themePath", ":/data/qss/scribus-dark.qss");
}
Ejemplo n.º 13
0
bool Configuration::has_network() const
{
    return !readSetting(QStringLiteral("application/url")).trimmed().isEmpty();
}
Ejemplo n.º 14
0
const QString Configuration::dataEndpointImageAlingment() const
{
    return readSetting(QStringLiteral("data/endpoints/imagealignment"));
}
Ejemplo n.º 15
0
const QString Configuration::dataEndpointUsers() const
{
    return readSetting(QStringLiteral("data/endpoints/user"));
}
Ejemplo n.º 16
0
const QString Configuration::dataEndpointFigures() const
{
    return readSetting(QStringLiteral("data/endpoints/figure"));
}
Ejemplo n.º 17
0
const QString Configuration::dataEndpointDatasets() const
{
    return readSetting(QStringLiteral("data/endpoints/dataset"));
}
Ejemplo n.º 18
0
QString ConfigManager::getIconPath(){

    return readSetting("path/iconPath", ":/data/icons/dark/");
}
Ejemplo n.º 19
0
void RPiCamera::readCameraSettings()
{
    m_settings.exposureAuto               = readSetting(V4L2_CID_EXPOSURE_AUTO);
    m_settings.autoWhiteBalance           = readSetting(V4L2_CID_AUTO_WHITE_BALANCE);
    m_settings.whiteBalanceTemperature    = readSetting(V4L2_CID_WHITE_BALANCE_TEMPERATURE);
    m_settings.exposureAutoPriority       = readSetting(V4L2_CID_EXPOSURE_AUTO_PRIORITY);
    m_settings.brightness                 = readSetting(V4L2_CID_BRIGHTNESS);
    m_settings.contrast                   = readSetting(V4L2_CID_CONTRAST);
    m_settings.saturation                 = readSetting(V4L2_CID_SATURATION);
    m_settings.gain                       = readSetting(V4L2_CID_GAIN);
    m_settings.exposureAbsolute           = readSetting(V4L2_CID_EXPOSURE_ABSOLUTE);
    m_settings.powerLineFrequency         = readSetting(V4L2_CID_POWER_LINE_FREQUENCY);
    m_settings.sharpness                  = readSetting(V4L2_CID_SHARPNESS);

    m_settings.p_exposureAuto.set(m_settings.exposureAuto);
    m_settings.p_autoWhiteBalance.set(m_settings.autoWhiteBalance);
    m_settings.p_whiteBalanceTemperature.set(m_settings.whiteBalanceTemperature);
    m_settings.p_exposureAutoPriority.set(m_settings.exposureAutoPriority);
    m_settings.p_brightness.set(m_settings.brightness);
    m_settings.p_contrast.set(m_settings.contrast);
    m_settings.p_saturation.set(m_settings.saturation);
    m_settings.p_gain.set(m_settings.gain);
    m_settings.p_exposureAbsolute.set(m_settings.exposureAbsolute);
    m_settings.p_powerLineFrequency.set(m_settings.powerLineFrequency);
    m_settings.p_sharpness.set(m_settings.sharpness);

#if DEBUG_NUCAMERA_VERBOSITY > 1
    debug << "RPiCamera::readCameraSettings()" << endl;
    debug << "\texposureAuto " << m_settings.exposureAuto  << endl;
    debug << "autoWhiteBalance " << m_settings.autoWhiteBalance  << endl;
    debug << "whiteBalanceTemperature " << m_settings.whiteBalanceTemperature  << endl;
    debug << "exposureAutoPriority " << m_settings.exposureAutoPriority  << endl;
    debug << "brightness " << m_settings.brightness  << endl;
    debug << "contrast " << m_settings.contrast  << endl;
    debug << "saturation " << m_settings.saturation  << endl;
    debug << "gain " << m_settings.gain  << endl;
    debug << "exposureAbsolute " << m_settings.exposureAbsolute  << endl;
    debug << "powerLineFrequency " << m_settings.powerLineFrequency  << endl;
    debug << "sharpness " << m_settings.sharpness  << endl;
#endif
}
Ejemplo n.º 20
0
const QString Configuration::oauthSecret() const
{
    return readSetting(QStringLiteral("oauth/secret"));
}
Ejemplo n.º 21
0
const QString Configuration::oauthScope() const
{
    return readSetting(QStringLiteral("oauth/scope"));
}
Ejemplo n.º 22
0
// oauth
const QString Configuration::oauthClientID() const
{
    return readSetting(QStringLiteral("oauth/clientid"));
}
Ejemplo n.º 23
0
// version
const QString Configuration::dataEndpointMinVersion() const
{
    return readSetting(QStringLiteral("data/endpoints/version"));
}
Ejemplo n.º 24
0
const QString Configuration::EndPointUrl() const
{
    return readSetting(QStringLiteral("application/url"));
}
Ejemplo n.º 25
0
//====================================
int main(int argc, char *argv[])
//====================================
{
  char syscom[120];
  int ch,i,x;

  currentStep = 1;
  currentLoop = 0;



  strcpy(gplFile,"gpl.txt");

  inrpt[0] = IR0;
  inrpt[1] = IR1;
  inrpt[2] = IR2;
  inrpt[3] = IR3;
  inrpt[4] = IR4;
  inrpt[5] = IR5;


  sprintf(syscom,"ls *.conf > %s;",fileProjList);
  x=system(syscom);
  sprintf(syscom,"rm %s;touch %s;",fileTemp,fileTemp);
  x=system(syscom);
  sprintf(syscom,"rm %s;touch %s;",fileError,fileError);
  x=system(syscom);
  sprintf(syscom,"rm %s;touch %s;",fileServError,fileServError);
  x=system(syscom);
  sprintf(syscom,"rm %s;touch %s;",fileCopyError,fileCopyError);
  x=system(syscom);

  err = fopen(fileError,"w"); // Issue 15

  readSetting();
  readConfig(currentConf);


  initSim();

  resetSim();

  readSimulation();

  readSketchInfo();

  setRange(confBoardType);

  init(confWinMode);

  unoInfo();
  show(slog);

  if(confLogFile == S_YES)resetFile("log.txt");

  readMsg(gplFile);

  openCommand();
  
  delwin(uno);
  delwin(ser);
  delwin(slog);
  delwin(msg);
  endwin();

  fclose(err);

}
Ejemplo n.º 26
0
// data access
const QString Configuration::dataEndpointChips() const
{
    return readSetting(QStringLiteral("data/endpoints/chip"));
}
Ejemplo n.º 27
0
const QString Configuration::oauthEndpointAuthorize() const
{
    return readSetting(QStringLiteral("oauth/endpoints/authorize"));
}
Ejemplo n.º 28
0
const QString Configuration::dataEndpointSelections() const
{
    return readSetting(QStringLiteral("data/endpoints/selection"));
}