Example #1
0
/*
  Uploader handles uploading a binary image to a board.  It reads the board profile for the 
  currently selected board to determine which uploader to use.  Then it fires up a QProcess
  and runs the uploader with flags determined by settings in Preferences.  It prints output
  from the upload process back to the console output in the MainWindow.
*/
Uploader::Uploader(MainWindow *mainWindow) : QProcess( )
{
  this->mainWindow = mainWindow;
  uploaderProgress = new QProgressDialog( );
  connect(uploaderProgress, SIGNAL(canceled()), this, SLOT(kill()));
  connect(uploaderProgress, SIGNAL(finished(int)), this, SLOT(onProgressDialogFinished(int)));
  connect(this, SIGNAL(readyReadStandardOutput()), this, SLOT(filterOutput()));
  connect(this, SIGNAL(readyReadStandardError()), this, SLOT(filterError()));
  connect(this, SIGNAL(started()), this, SLOT(uploadStarted()));
  connect(this, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(uploadFinished(int, QProcess::ExitStatus)));
  connect(this, SIGNAL(error(QProcess::ProcessError)), this, SLOT(onError(QProcess::ProcessError)));
}
Example #2
0
/*
  Uploader handles uploading a binary image to a board.  It fires up a QProcess
  and runs the uploader with flags determined by settings in Preferences.
*/
Uploader::Uploader(MainWindow *mainWindow) : QDialog( 0 )
{
  this->mainWindow = mainWindow;
  setupUi(this);
  connect(this, SIGNAL(finished(int)), this, SLOT(onDialogClosed()));
  connect(&uploader, SIGNAL(readyReadStandardOutput()), this, SLOT(filterOutput()));
  connect(&uploader, SIGNAL(readyReadStandardError()), this, SLOT(filterError()));
  connect(&uploader, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(uploadFinished(int, QProcess::ExitStatus)));
  connect(&uploader, SIGNAL(error(QProcess::ProcessError)), this, SLOT(onError(QProcess::ProcessError)));
  connect(browseButton, SIGNAL(clicked()), this, SLOT(onBrowseButton()));
  connect(uploadButton, SIGNAL(clicked()), this, SLOT(onUploadButton()));

  QSettings settings;
  QString lastFilePath = settings.value("last_firmware_upload", QDir::homePath()).toString();
  browseEdit->setText(lastFilePath);
  progressBar->reset();
  resize(gridLayout->sizeHint());
}