13 #include <QVBoxLayout>
17 #define executableSuffix ".exe"
19 #define executableSuffix ""
26 font = QFont(
"Courier New");
28 font.setStyleHint(QFont::Courier);
29 font.setFixedPitch(
true);
32 QWidget *all =
new QWidget();
33 QVBoxLayout *allLayout =
new QVBoxLayout();
35 output =
new QTextEdit(
this);
37 output->setUndoRedoEnabled(
false);
38 output->setTextFormat(Qt::LogText);
39 output->setLineWrapMode(QTextEdit::NoWrap);
41 allLayout->addWidget(
output);
43 input =
new QLineEdit(
this);
45 allLayout->addWidget(
input);
46 all->setLayout(allLayout);
48 setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
49 parent_->setWidget(all);
55 input->installEventFilter(
this);
73 h = Size.height() +
input->sizeHint().height();
87 QStringList Arguments;
89 OctavePath = QDir::toNativeSeparators(OctavePath+
"/"+
"octave"+QString(
executableSuffix));
91 QFileInfo progOctave(OctavePath);
93 if (! progOctave.exists()) {
94 qDebug() <<
"Octave not found: " << OctavePath;
95 QMessageBox::critical(0, QObject::tr(
"Error"),
96 QObject::tr(
"Octave not found in: %1\n\n"
97 "Set the Octave location on the application settings.").arg(OctavePath));
101 Program = OctavePath;
102 Arguments <<
"--no-history" <<
"-i" <<
"-f" <<
"-p"
116 QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
121 qDebug() <<
"Command :" << Program << Arguments.join(
" ");
126 output->setText(tr(
"ERROR: Cannot start Octave!"));
145 output->setTextColor(QColor(Qt::blue));
147 QString cmdstr = cmd +
"\n";
156 QFileInfo info(name);
164 if(!
input->text().stripWhiteSpace().isEmpty())
174 if (event->type() == QEvent::KeyPress) {
175 QKeyEvent* keyEvent =
static_cast<QKeyEvent*
>(event);
176 if (keyEvent->key() == Qt::Key_PageUp) {
185 else if(keyEvent->key() == Qt::Key_PageDown) {
206 output->setTextColor(QColor(Qt::black));
221 output->setTextColor(QColor(Qt::red));
229 qDebug() <<
"Octave ended status" << status;
void slotOctaveEnded(int status)
bool eventFilter(QObject *obj, QEvent *event)
tQucsSettings QucsSettings
Definitions and declarations for the main application.
void runOctaveScript(const QString &)
OctaveWindow(QDockWidget *)
void sendCommand(const QString &)