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); } } }
bool RKCaughtX11Window::close (bool also_delete) { RK_TRACE (MISC); if (killed_in_r || RKGlobals::rInterface ()->backendIsDead ()) { return RKMDIWindow::close (also_delete); } if (rk_native_device) rk_native_device->stopInteraction (); QString status = i18n ("Closing device (saving history)"); if (!close_attempted) { RCommand* c = new RCommand ("dev.off (" + QString::number (device_number) + ')', RCommand::App, i18n ("Shutting down device number %1", device_number)); setStatusMessage (status, c); RKGlobals::rInterface ()->issueCommand (c); close_attempted = true; } else { if (KMessageBox::questionYesNo (this, i18n ("<p>The graphics device is being closed, saving the last plot to the plot history. This may take a while, if the R backend is still busy. You can close the graphics device immediately, in case it is stuck. However, the last plot may be missing from the plot history, if you do this.</p>") #ifdef Q_WS_X11 + i18n ("<p>Note: On X11, the embedded window may be expurged, and you will have to close it manually in this case.</p>") #endif , status, KGuiItem (i18n ("Close immediately")), KGuiItem (i18n ("Keep waiting"))) == KMessageBox::Yes) forceClose (); } return false; }