WP34sFlashDialog::WP34sFlashDialog(WP34sFlash& aFlash, QWidget* aParent) : QDialog(aParent), flash(aFlash), flashStarted(false), closeAllowed(false) { setWindowTitle(FLASH_DIALOG_TITLE); QVBoxLayout* dialogLayout=new QVBoxLayout; dialogLayout->setSizeConstraint(QLayout::SetFixedSize); setLayout(dialogLayout); QWidget* progressWidget=new QWidget; QVBoxLayout* progressLayout=new QVBoxLayout; progressWidget->setLayout(progressLayout); progressBar=new QProgressBar; progressLayout->addWidget(progressBar); progressLabel=new QLabel; progressLayout->addWidget(progressLabel); dialogLayout->addWidget(progressWidget); console=new QTextEdit; console->setReadOnly(true); console->setLineWrapMode(QTextEdit::FixedColumnWidth); console->setLineWrapColumnOrWidth(DEFAULT_CONSOLE_WIDTH); setConsoleWidth(console); dialogLayout->addWidget(console); closeButton=new QPushButton("Close"); closeButton->setEnabled(false); connect(closeButton, SIGNAL(clicked(bool)), this, SLOT(onCloseButtonClicked(bool))); dialogLayout->addWidget(closeButton); connect(this, SIGNAL(reportInEventLoop(const QString&)), this, SLOT(onReport(const QString&)), Qt::BlockingQueuedConnection); connect(this, SIGNAL(reportErrorInEventLoop(const QString&)), this, SLOT(onReportError(const QString&)), Qt::BlockingQueuedConnection); connect(this, SIGNAL(reportBytesInEventLoop(const QString&, const QByteArray&, bool)), this, SLOT(onReportBytes(const QString&, const QByteArray&, bool)), Qt::BlockingQueuedConnection); connect(this, SIGNAL(prepareProgressReportInEventLoop(int)), this, SLOT(onPrepareProgressReport(int)), Qt::BlockingQueuedConnection); connect(this, SIGNAL(reportProgressInEventLoop(int)), this, SLOT(onReportProgress(int)), Qt::BlockingQueuedConnection); connect(this, SIGNAL(endProgressInEventLoop()), this, SLOT(onEndProgress()), Qt::BlockingQueuedConnection); }
/*--------------------------------------------------------------------------*/ int scilinesdefault(void) { #ifndef _MSC_VER char tc_buf[1024]; /* holds termcap buffer */ if (tgetent(tc_buf, getenv("TERM")) == 1) { setConsoleLines(tgetnum("li")); /* retrieve from the term info the number of lines */ setConsoleWidth(tgetnum("co")); /* And the number of columns */ } else { /* Haven't been able to detect the terminal */ setConsoleLines(DEFAULT_NUMBERS_LINES); setConsoleWidth(DEFAULT_NUMBERS_COLUMNS); } #else if ( (getScilabMode() != SCILAB_STD) && (getScilabMode() != SCILAB_API) ) { /* -NW or -NWNI mode */ int X = getXConsoleScreenSize(); int Y = getYConsoleScreenSize(); if (X < DEFAULT_NUMBERS_COLUMNS) { X = DEFAULT_NUMBERS_COLUMNS; } if (Y < DEFAULT_NUMBERS_LINES) { Y = DEFAULT_NUMBERS_LINES; } setConsoleWidth(X); setConsoleLines(Y); } else { setConsoleLines(DEFAULT_NUMBERS_LINES); setConsoleWidth(DEFAULT_NUMBERS_COLUMNS); } #endif return 0; }
/*--------------------------------------------------------------------------*/ int scilines(int nblines, int nbcolumns) { setConsoleLines(nblines); setConsoleWidth(nbcolumns); return 0; }