Пример #1
0
void preferencesDialog::initSettings()
{
#ifdef SKY
    int dnloadVersion ;
		QSettings settings("er9x-eePskye", "eePskye");
#else
    QSettings settings("er9x-eePe", "eePe");
		populateDownloads( ui->downloadVerCB ) ;
#endif    

    int i=ui->locale_QB->findData(settings.value("locale",QLocale::system().name()).toString());
    if(i<0) i=0;
    ui->locale_QB->setCurrentIndex(i);

    ui->channelorderCB->setCurrentIndex(settings.value("default_channel_order", 0).toInt());
    ui->stickmodeCB->setCurrentIndex(settings.value("default_mode", 1).toInt());
    ui->downloadVerCB->setCurrentIndex(settings.value("download-version", 0).toInt());
    ui->ProcessorCB->setCurrentIndex(settings.value("processor", 0).toInt());

    ui->startupCheck_er9x->setChecked(settings.value("startup_check_er9x", true).toBool());
    ui->startupCheck_eepe->setChecked(settings.value("startup_check_eepe", true).toBool());

    ui->showSplash->setChecked(settings.value("show_splash", true).toBool());

    currentER9Xrev = settings.value("currentER9Xrev", 1).toInt();
    ui->DefaultVersionCB->setCurrentIndex(settings.value("default_EE_version", 0).toInt());

    ui->er9x_ver_label->setText(QString("r%1").arg(currentER9Xrev));
#ifdef Q_OS_WIN32
	avrLoc = settings.value("avrdude_location", QFileInfo("avrdude.exe").absoluteFilePath()).toString();
#elif __APPLE__
	avrLoc = settings.value("avrdude_location", "/usr/local/bin/avrdude").toString();
#else
	avrLoc = settings.value("avrdude_location", "avrdude").toString();
#endif

  populateProgrammers() ;
  ui->avrdude_programmer->model()->sort(0);
	QString str = settings.value("avr_arguments").toString();
	avrArgs = str.split(" ", QString::SkipEmptyParts);
	avrProgrammer =  settings.value("programmer", QString("usbasp")).toString();
	avrMCU =  settings.value("mcu", QString("m64")).toString();
	avrPort =  settings.value("avr_port", "").toString();

	ui->avrdude_location->setText(getAVRDUDE());
	ui->avrArgs->setText(getAVRArgs().join(" "));

	int idx1 = ui->avrdude_programmer->findText(getProgrammer());
	int idx2 = ui->avrdude_port->findText(getPort());
	int idx3 = ui->avrdude_mcu->findText(getMCU());
	if(idx1>=0) ui->avrdude_programmer->setCurrentIndex(idx1);
	if(idx2>=0) ui->avrdude_port->setCurrentIndex(idx2);
	if(idx3>=0) ui->avrdude_mcu->setCurrentIndex(idx3);
}
Пример #2
0
void burnConfigDialog::getSettings()
{
    avrLoc   = g.avrdudeLocation();
    sambaLoc = g.sambaLocation();
    dfuLoc =   g.dfuLocation();

#if defined WIN32 || !defined __GNUC__
    if ( avrLoc.isEmpty())
        avrLoc = QFileInfo("avrdude.exe").absoluteFilePath();
    if ( sambaLoc.isEmpty())
        sambaLoc = QFileInfo("sam-ba.exe").absoluteFilePath();
    if ( dfuLoc.isEmpty())
        dfuLoc =  QFileInfo("dfu-util.exe").absoluteFilePath();
#elif defined __APPLE__
    if ( avrLoc.isEmpty())
        avrLoc = "/usr/local/bin/avrdude";
    if ( sambaLoc.isEmpty())
        sambaLoc = "/usr/local/bin/sam-ba";
    if ( dfuLoc.isEmpty())
        dfuLoc =  QFileInfo("/opt/local/bin/dfu-util").absoluteFilePath();
#else
    if ( avrLoc.isEmpty())
        avrLoc = "/usr/bin/avrdude";
    if ( sambaLoc.isEmpty())
        sambaLoc = "/usr/bin/sam-ba";
    if ( dfuLoc.isEmpty())
        dfuLoc =  QFileInfo("/usr/bin/dfu-util").absoluteFilePath();
#endif

    dfuArgs = g.dfuArguments().split(" ", QString::SkipEmptyParts);
    avrArgs = g.avrArguments().split(" ", QString::SkipEmptyParts);
    avrProgrammer =  g.programmer();
    avrPort = g.avrPort();
    avrMCU = g.mcu();
    armMCU = g.armMcu();
    sambaPort = g.sambaPort();

    ui->avrdude_location->setText(getAVRDUDE());
    ui->avrArgs->setText(getAVRArgs().join(" "));

    ui->samba_location->setText(getSAMBA());
    ui->samba_port->setText(getSambaPort());

    ui->dfu_location->setText(getDFU());
    ui->dfuArgs->setText(getDFUArgs().join(" "));

    int idx1 = ui->avrdude_programmer->findText(getProgrammer());
    int idx2 = ui->avrdude_port->findText(getPort());
    int idx3 = ui->avrdude_mcu->findText(getMCU());
    int idx4 = ui->arm_mcu->findText(getArmMCU());
    if(idx1>=0) ui->avrdude_programmer->setCurrentIndex(idx1);
    if(idx2>=0) ui->avrdude_port->setCurrentIndex(idx2);
    if(idx3>=0) ui->avrdude_mcu->setCurrentIndex(idx3);
    if(idx4>=0) ui->arm_mcu->setCurrentIndex(idx4);
    QFile file;
    if (file.exists(avrLoc)) {
        ui->pushButton_3->setEnabled(true);
    } else {
        ui->pushButton_3->setDisabled(true);
    }
}