| 9 | #include "helpwindow.h" |
| 10 | |
| 11 | ScriptingWindow::ScriptingWindow(const QVector<CANFrame> *frames, QWidget *parent) : |
| 12 | QDialog(parent), |
| 13 | ui(new Ui::ScriptingWindow) |
| 14 | { |
| 15 | ui->setupUi(this); |
| 16 | setWindowFlags(Qt::Window); |
| 17 | |
| 18 | editor = new JSEdit(); |
| 19 | editor->setFrameShape(JSEdit::NoFrame); |
| 20 | editor->setWordWrapMode(QTextOption::NoWrap); |
| 21 | editor->setTabStopWidth(4); |
| 22 | editor->setEnabled(false); |
| 23 | editor->setFont(QFont("Monospace", 12)); |
| 24 | editor->show(); |
| 25 | ui->verticalLayout->insertWidget(2,editor, 10); |
| 26 | |
| 27 | readSettings(); |
| 28 | |
| 29 | modelFrames = frames; |
| 30 | |
| 31 | connect(ui->btnLoadScript, &QAbstractButton::pressed, this, &ScriptingWindow::loadNewScript); |
| 32 | connect(ui->btnNewScript, &QAbstractButton::pressed, this, &ScriptingWindow::createNewScript); |
| 33 | connect(ui->btnRecompile, &QAbstractButton::pressed, this, &ScriptingWindow::recompileScript); |
| 34 | connect(ui->btnRemoveScript, &QAbstractButton::pressed, this, &ScriptingWindow::deleteCurrentScript); |
| 35 | connect(ui->btnRevertScript, &QAbstractButton::pressed, this, &ScriptingWindow::revertScript); |
| 36 | connect(ui->btnSaveScript, &QAbstractButton::pressed, this, &ScriptingWindow::saveScript); |
| 37 | connect(ui->btnClearLog, &QAbstractButton::pressed, this, &ScriptingWindow::clickedLogClear); |
| 38 | connect(ui->listLoadedScripts, &QListWidget::currentRowChanged, this, &ScriptingWindow::changeCurrentScript); |
| 39 | connect(ui->tableVariables, SIGNAL(cellChanged(int,int)), this, SLOT(updatedValue(int, int))); |
| 40 | |
| 41 | connect(CANConManager::getInstance(), &CANConManager::framesReceived, this, &ScriptingWindow::newFrames); |
| 42 | |
| 43 | connect(&valuesTimer, SIGNAL(timeout()), this, SLOT(valuesTimerElapsed())); |
| 44 | |
| 45 | currentScript = nullptr; |
| 46 | |
| 47 | elapsedTime.start(); |
| 48 | valuesTimer.start(1000); |
| 49 | |
| 50 | ui->tableVariables->insertColumn(0); |
| 51 | ui->tableVariables->insertColumn(1); |
| 52 | } |
| 53 | |
| 54 | ScriptingWindow::~ScriptingWindow() |
| 55 | { |
nothing calls this directly
no test coverage detected