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); }
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(avrArgs.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); } }
avrOutputDialog::avrOutputDialog(QWidget *parent, QString prog, QStringList arg, QString wTitle, int closeBehaviour, bool displayDetails) : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint), ui(new Ui::avrOutputDialog), kill_timer(NULL), hasErrors(false) { ui->setupUi(this); #ifdef __APPLE__ QFont newFont("Courier", 13); ui->plainTextEdit->setFont(newFont); ui->plainTextEdit->setAttribute(Qt::WA_MacNormalSize); #endif #if defined WIN32 || !defined __GNUC__ QFont newFont("Courier", 9); ui->plainTextEdit->setFont(newFont); #endif cmdLine = prog; closeOpt = closeBehaviour; if (cmdLine.isEmpty()) { if (arg.count()<2) { closeOpt = AVR_DIALOG_FORCE_CLOSE; QTimer::singleShot(0, this, SLOT(forceClose())); } else { sourceFile=arg.at(0); destFile=arg.at(1); if (!displayDetails) { ui->plainTextEdit->hide(); QTimer::singleShot(0, this, SLOT(shrink())); } else { ui->checkBox->setChecked(true); } ui->progressBar->setMaximum(127); QTimer::singleShot(500, this, SLOT(doCopy())); } } else { if (wTitle.isEmpty()) setWindowTitle(getProgrammer() + " " + tr("result")); else setWindowTitle(getProgrammer() + " - " + wTitle); QFile exec; winTitle=wTitle; if (!(exec.exists(prog))) { QMessageBox::critical(this, "Companion", getProgrammer() + " " + tr("executable not found")); closeOpt = AVR_DIALOG_FORCE_CLOSE; QTimer::singleShot(0, this, SLOT(forceClose())); } else { foreach(QString str, arg) cmdLine.append(" " + str); lfuse = 0; hfuse = 0; efuse = 0; phase=0; currLine.clear(); if (!displayDetails) { ui->plainTextEdit->hide(); QTimer::singleShot(0, this, SLOT(shrink())); } else { ui->checkBox->setChecked(true); } process = new QProcess(this); connect(process,SIGNAL(readyReadStandardError()), this, SLOT(doAddTextStdErr())); connect(process,SIGNAL(started()),this,SLOT(doProcessStarted())); connect(process,SIGNAL(readyReadStandardOutput()),this,SLOT(doAddTextStdOut())); connect(process,SIGNAL(finished(int)),this,SLOT(doFinished(int))); #if !__GNUC__ kill_timer = new QTimer(this); connect(kill_timer, SIGNAL(timeout()), this, SLOT(killTimerElapsed())); kill_timer->start(2000); #endif process->start(prog,arg); } } }