mirror of
https://github.com/arabine/open-story-teller.git
synced 2025-12-07 01:15:14 +01:00
Working pack! fix VM, new icons...
This commit is contained in:
parent
0112c935d2
commit
b619eaefe6
22 changed files with 424 additions and 175 deletions
|
|
@ -193,22 +193,22 @@ chip32_result_t chip32_step(chip32_ctx_t *ctx)
|
||||||
const uint8_t reg = _NEXT_BYTE;
|
const uint8_t reg = _NEXT_BYTE;
|
||||||
_CHECK_REGISTER_VALID(reg)
|
_CHECK_REGISTER_VALID(reg)
|
||||||
ctx->registers[PC] = ctx->registers[reg] - 1;
|
ctx->registers[PC] = ctx->registers[reg] - 1;
|
||||||
// save all temporary registers on stack
|
// // save all temporary registers on stack
|
||||||
ctx->registers[SP] -= 4*10; // reserve memory
|
// ctx->registers[SP] -= 4*10; // reserve memory
|
||||||
// fill memory
|
// // fill memory
|
||||||
for (int i = 0; i < 10; i++) {
|
// for (int i = 0; i < 10; i++) {
|
||||||
leu32_put(&ctx->ram.mem[ctx->registers[SP] + i*4], ctx->registers[T0 + i]);
|
// leu32_put(&ctx->ram.mem[ctx->registers[SP] + i*4], ctx->registers[T0 + i]);
|
||||||
}
|
// }
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case OP_RET:
|
case OP_RET:
|
||||||
{
|
{
|
||||||
ctx->registers[PC] = ctx->registers[RA] - 1;
|
ctx->registers[PC] = ctx->registers[RA] - 1;
|
||||||
// restore all temporary registers on stack
|
// restore all temporary registers on stack
|
||||||
for (int i = 0; i < 10; i++) {
|
// for (int i = 0; i < 10; i++) {
|
||||||
ctx->registers[T0 + i] = leu32_get(&ctx->ram.mem[ctx->registers[SP] + i*4]);
|
// ctx->registers[T0 + i] = leu32_get(&ctx->ram.mem[ctx->registers[SP] + i*4]);
|
||||||
}
|
// }
|
||||||
ctx->registers[SP] += 4*10; // free memory
|
// ctx->registers[SP] += 4*10; // free memory
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case OP_STORE:
|
case OP_STORE:
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ typedef enum
|
||||||
R7,
|
R7,
|
||||||
R8,
|
R8,
|
||||||
R9,
|
R9,
|
||||||
// Temporaties are automatically saved on stack across a call
|
// Temporaries are automatically saved on stack across a call
|
||||||
T0,
|
T0,
|
||||||
T1,
|
T1,
|
||||||
T2,
|
T2,
|
||||||
|
|
|
||||||
BIN
story-editor/assets/check-mark.png
Normal file
BIN
story-editor/assets/check-mark.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
BIN
story-editor/assets/home.png
Normal file
BIN
story-editor/assets/home.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
BIN
story-editor/assets/left.png
Normal file
BIN
story-editor/assets/left.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7 KiB |
BIN
story-editor/assets/pause-button.png
Normal file
BIN
story-editor/assets/pause-button.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 43 KiB |
BIN
story-editor/assets/right.png
Normal file
BIN
story-editor/assets/right.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7 KiB |
|
|
@ -1 +1 @@
|
||||||
Subproject commit e1c9ee891129e24c5703d5044509faabd8725923
|
Subproject commit d5250cd445a6fa2177075603f1ca5580c3498c8e
|
||||||
|
|
@ -9,25 +9,24 @@
|
||||||
; t2: increment 4
|
; t2: increment 4
|
||||||
; t3: current media address
|
; t3: current media address
|
||||||
; t4: where to jump when OK button is pressed
|
; t4: where to jump when OK button is pressed
|
||||||
|
; t5: address of the "choice" array
|
||||||
|
mov t5, r0 ; we save R0
|
||||||
|
|
||||||
.media_loop_start:
|
.media_loop_start:
|
||||||
load t0, @r0, 4 ; Le premier élément est le nombre de choix possibles, t0 = 3 (exemple)
|
load t0, @t5, 4 ; Le premier élément est le nombre de choix possibles, t0 = 3 (exemple)
|
||||||
lcons t1, 1
|
lcons t1, 1
|
||||||
lcons t2, 4
|
lcons t2, 4
|
||||||
mov t3, r0
|
mov t3, t5
|
||||||
.media_loop:
|
.media_loop:
|
||||||
add t3, t2 ; @++
|
add t3, t2 ; @++
|
||||||
|
|
||||||
|
|
||||||
; --------- We call a media transition node
|
; --------- We call a media transition node
|
||||||
push r0 ; save r0
|
load r0, @t3, 4 ; r0 = content in ram at address in T3
|
||||||
load r0, @t3, 4 ; r0 = content in ram at address in T4
|
|
||||||
call r0 ; call subroutine
|
call r0 ; call subroutine
|
||||||
|
|
||||||
; Return argument in R0: the address of the node to call whe OK is pressed
|
; Return argument in R0: the address of the node to call whe OK is pressed
|
||||||
; save it in t4
|
; save it in t4
|
||||||
mov t4, r0
|
mov t4, r0
|
||||||
pop r0
|
|
||||||
|
|
||||||
; wait for event (OK or wheel)
|
; wait for event (OK or wheel)
|
||||||
syscall 2
|
syscall 2
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,6 @@
|
||||||
#include <QTextBlock>
|
#include <QTextBlock>
|
||||||
#include <QFontMetrics>
|
#include <QFontMetrics>
|
||||||
|
|
||||||
//![constructor]
|
|
||||||
|
|
||||||
CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent)
|
CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent)
|
||||||
{
|
{
|
||||||
lineNumberArea = new LineNumberArea(this);
|
lineNumberArea = new LineNumberArea(this);
|
||||||
|
|
@ -14,6 +12,8 @@ CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent)
|
||||||
connect(this, &CodeEditor::updateRequest, this, &CodeEditor::updateLineNumberArea);
|
connect(this, &CodeEditor::updateRequest, this, &CodeEditor::updateLineNumberArea);
|
||||||
connect(this, &CodeEditor::cursorPositionChanged, this, &CodeEditor::highlightCurrentLine);
|
connect(this, &CodeEditor::cursorPositionChanged, this, &CodeEditor::highlightCurrentLine);
|
||||||
|
|
||||||
|
connect(lineNumberArea, &LineNumberArea::sigLineNumberAreaClicked, this, &CodeEditor::sigLineNumberAreaClicked);
|
||||||
|
|
||||||
setTabStopDistance(QFontMetricsF(font()).horizontalAdvance(' ') * 4);
|
setTabStopDistance(QFontMetricsF(font()).horizontalAdvance(' ') * 4);
|
||||||
|
|
||||||
updateLineNumberAreaWidth(0);
|
updateLineNumberAreaWidth(0);
|
||||||
|
|
@ -100,6 +100,14 @@ void CodeEditor::lineNumberAreaPaintEvent(QPaintEvent *event)
|
||||||
painter.setPen(Qt::black);
|
painter.setPen(Qt::black);
|
||||||
painter.drawText(0, top, lineNumberArea->width(), fontMetrics().height(),
|
painter.drawText(0, top, lineNumberArea->width(), fontMetrics().height(),
|
||||||
Qt::AlignRight, number);
|
Qt::AlignRight, number);
|
||||||
|
|
||||||
|
if (m_breakpoints.contains(blockNumber +1))
|
||||||
|
{
|
||||||
|
QRectF rectangle(0, top, fontMetrics().height(), fontMetrics().height());
|
||||||
|
painter.setPen(Qt::red);
|
||||||
|
painter.setBrush(QBrush(Qt::red));
|
||||||
|
painter.drawEllipse(rectangle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
block = block.next();
|
block = block.next();
|
||||||
|
|
@ -109,4 +117,46 @@ void CodeEditor::lineNumberAreaPaintEvent(QPaintEvent *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//![extraAreaPaintEvent_2]
|
|
||||||
|
int CodeEditor::ComputeLine(const QPointF &p)
|
||||||
|
{
|
||||||
|
int line = -1;
|
||||||
|
|
||||||
|
QTextBlock block = firstVisibleBlock();
|
||||||
|
|
||||||
|
while (block.isValid())
|
||||||
|
{
|
||||||
|
int top = qRound(blockBoundingGeometry(block).top());
|
||||||
|
int bottom = top + qRound(blockBoundingRect(block).height());
|
||||||
|
|
||||||
|
if ((p.y() >= top) && (p.y() <= bottom))
|
||||||
|
{
|
||||||
|
line = block.blockNumber() + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
block = block.next();
|
||||||
|
}
|
||||||
|
|
||||||
|
return line;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CodeEditor::SetBreakPoints(const std::set<int> &bkp)
|
||||||
|
{
|
||||||
|
m_breakpoints = bkp;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LineNumberArea::mouseReleaseEvent(QMouseEvent *event) {
|
||||||
|
if (event->button() == Qt::LeftButton)
|
||||||
|
{
|
||||||
|
QPointF p = event->position();
|
||||||
|
int line = codeEditor->ComputeLine(p);
|
||||||
|
// qDebug() << "Clicked line: " << line;
|
||||||
|
if (line >= 0)
|
||||||
|
{
|
||||||
|
emit sigLineNumberAreaClicked(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
#define CODEEDITOR_H
|
#define CODEEDITOR_H
|
||||||
|
|
||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
|
#include <set>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QPaintEvent;
|
class QPaintEvent;
|
||||||
|
|
@ -12,7 +13,6 @@ QT_END_NAMESPACE
|
||||||
|
|
||||||
class LineNumberArea;
|
class LineNumberArea;
|
||||||
|
|
||||||
//![codeeditordefinition]
|
|
||||||
|
|
||||||
class CodeEditor : public QPlainTextEdit
|
class CodeEditor : public QPlainTextEdit
|
||||||
{
|
{
|
||||||
|
|
@ -24,6 +24,12 @@ public:
|
||||||
void lineNumberAreaPaintEvent(QPaintEvent *event);
|
void lineNumberAreaPaintEvent(QPaintEvent *event);
|
||||||
int lineNumberAreaWidth();
|
int lineNumberAreaWidth();
|
||||||
|
|
||||||
|
int ComputeLine(const QPointF &p);
|
||||||
|
void SetBreakPoints(const std::set<int> & bkp);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void sigLineNumberAreaClicked(int line);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *event) override;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
|
|
||||||
|
|
@ -33,14 +39,15 @@ private slots:
|
||||||
void updateLineNumberArea(const QRect &rect, int dy);
|
void updateLineNumberArea(const QRect &rect, int dy);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget *lineNumberArea;
|
LineNumberArea *lineNumberArea;
|
||||||
|
std::set<int> m_breakpoints;
|
||||||
};
|
};
|
||||||
|
|
||||||
//![codeeditordefinition]
|
|
||||||
//![extraarea]
|
|
||||||
|
|
||||||
class LineNumberArea : public QWidget
|
class LineNumberArea : public QWidget
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LineNumberArea(CodeEditor *editor) : QWidget(editor), codeEditor(editor)
|
LineNumberArea(CodeEditor *editor) : QWidget(editor), codeEditor(editor)
|
||||||
{}
|
{}
|
||||||
|
|
@ -50,6 +57,11 @@ public:
|
||||||
return QSize(codeEditor->lineNumberAreaWidth(), 0);
|
return QSize(codeEditor->lineNumberAreaWidth(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void sigLineNumberAreaClicked(int line);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event) override
|
void paintEvent(QPaintEvent *event) override
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,6 @@ MainWindow::MainWindow()
|
||||||
addToolBar(Qt::LeftToolBarArea, m_toolbar);
|
addToolBar(Qt::LeftToolBarArea, m_toolbar);
|
||||||
m_toolbar->setVisible(true);
|
m_toolbar->setVisible(true);
|
||||||
|
|
||||||
connect(m_toolbar, &ToolBar::sigDefaultDocksPosition, this, &MainWindow::slotDefaultDocksPosition);
|
|
||||||
|
|
||||||
createStatusBar();
|
createStatusBar();
|
||||||
|
|
||||||
m_logDock = new LogDock();
|
m_logDock = new LogDock();
|
||||||
|
|
@ -82,10 +80,6 @@ MainWindow::MainWindow()
|
||||||
addDockWidget(Qt::DockWidgetArea::RightDockWidgetArea, m_ostHmiDock);
|
addDockWidget(Qt::DockWidgetArea::RightDockWidgetArea, m_ostHmiDock);
|
||||||
m_toolbar->AddDockToMenu(m_ostHmiDock->toggleViewAction(), m_ostHmiDock);
|
m_toolbar->AddDockToMenu(m_ostHmiDock->toggleViewAction(), m_ostHmiDock);
|
||||||
|
|
||||||
connect(m_ostHmiDock, &OstHmiDock::sigOkButton, [&]() {
|
|
||||||
QCoreApplication::postEvent(this, new VmEvent(VmEvent::evOkButton));
|
|
||||||
});
|
|
||||||
|
|
||||||
m_resourcesDock = new ResourcesDock(m_project, m_resourceModel);
|
m_resourcesDock = new ResourcesDock(m_project, m_resourceModel);
|
||||||
addDockWidget(Qt::DockWidgetArea::RightDockWidgetArea, m_resourcesDock);
|
addDockWidget(Qt::DockWidgetArea::RightDockWidgetArea, m_resourcesDock);
|
||||||
m_toolbar->AddDockToMenu(m_resourcesDock->toggleViewAction(), m_resourcesDock);
|
m_toolbar->AddDockToMenu(m_resourcesDock->toggleViewAction(), m_resourcesDock);
|
||||||
|
|
@ -98,18 +92,6 @@ MainWindow::MainWindow()
|
||||||
addDockWidget(Qt::DockWidgetArea::RightDockWidgetArea, m_vmDock);
|
addDockWidget(Qt::DockWidgetArea::RightDockWidgetArea, m_vmDock);
|
||||||
m_toolbar->AddDockToMenu(m_vmDock->toggleViewAction(), m_vmDock);
|
m_toolbar->AddDockToMenu(m_vmDock->toggleViewAction(), m_vmDock);
|
||||||
|
|
||||||
connect(m_vmDock, &VmDock::sigCompile, [&]() {
|
|
||||||
// m_scriptEditorDock->setScript(m_project.BuildResources());
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(m_vmDock, &VmDock::sigStepInstruction, [&]() {
|
|
||||||
QCoreApplication::postEvent(this, new VmEvent(VmEvent::evStep));
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(m_vmDock, &VmDock::sigBuild, [&]() {
|
|
||||||
BuildScript();
|
|
||||||
});
|
|
||||||
|
|
||||||
m_ramView = new MemoryViewDock("RamViewDock", "RAM");
|
m_ramView = new MemoryViewDock("RamViewDock", "RAM");
|
||||||
addDockWidget(Qt::DockWidgetArea::RightDockWidgetArea, m_ramView);
|
addDockWidget(Qt::DockWidgetArea::RightDockWidgetArea, m_ramView);
|
||||||
m_toolbar->AddDockToMenu(m_ramView->toggleViewAction(), m_ramView);
|
m_toolbar->AddDockToMenu(m_ramView->toggleViewAction(), m_ramView);
|
||||||
|
|
@ -125,6 +107,71 @@ MainWindow::MainWindow()
|
||||||
m_chooseFileUi.setupUi(m_chooseFileDialog);
|
m_chooseFileUi.setupUi(m_chooseFileDialog);
|
||||||
m_chooseFileDialog->close();
|
m_chooseFileDialog->close();
|
||||||
|
|
||||||
|
m_newProjectDialog = new NewProjectDialog(this);
|
||||||
|
m_newProjectDialog->hide();
|
||||||
|
|
||||||
|
// TODO: merge both
|
||||||
|
m_model.registerNode<MediaNodeModel>("MediaNode");
|
||||||
|
m_model.addModel("MediaNode", "Story Teller");
|
||||||
|
|
||||||
|
// Prepare run timer
|
||||||
|
m_runTimer = new QTimer(this);
|
||||||
|
m_runTimer->setSingleShot(true);
|
||||||
|
|
||||||
|
// VM Initialize
|
||||||
|
m_chip32_ctx.stack_size = 512;
|
||||||
|
|
||||||
|
m_chip32_ctx.rom.mem = m_rom_data;
|
||||||
|
m_chip32_ctx.rom.addr = 0;
|
||||||
|
m_chip32_ctx.rom.size = sizeof(m_rom_data);
|
||||||
|
|
||||||
|
m_chip32_ctx.ram.mem = m_ram_data;
|
||||||
|
m_chip32_ctx.ram.addr = sizeof(m_rom_data);
|
||||||
|
m_chip32_ctx.ram.size = sizeof(m_ram_data);
|
||||||
|
|
||||||
|
Callback<uint8_t(uint8_t)>::func = std::bind(&MainWindow::Syscall, this, std::placeholders::_1);
|
||||||
|
m_chip32_ctx.syscall = static_cast<syscall_t>(Callback<uint8_t(uint8_t)>::callback);
|
||||||
|
|
||||||
|
// Install event handler now that everything is initialized
|
||||||
|
Callback<void(QtMsgType , const QMessageLogContext &, const QString &)>::func = std::bind(&MainWindow::MessageOutput, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
|
||||||
|
auto cb = static_cast<message_output_t>(Callback<void(QtMsgType , const QMessageLogContext &, const QString &)>::callback);
|
||||||
|
|
||||||
|
qInstallMessageHandler(cb);
|
||||||
|
|
||||||
|
readSettings(); // restore all windows preferences
|
||||||
|
qDebug() << "Settings location: " << m_settings.fileName();
|
||||||
|
qDebug() << "Welcome to StoryTeller Editor";
|
||||||
|
|
||||||
|
CloseProject();
|
||||||
|
RefreshProjectInformation();
|
||||||
|
|
||||||
|
// =================================== CONNECTIONS ===================================
|
||||||
|
connect(m_toolbar, &ToolBar::sigDefaultDocksPosition, this, &MainWindow::slotDefaultDocksPosition);
|
||||||
|
|
||||||
|
connect(m_ostHmiDock, &OstHmiDock::sigOkButton, [&]() {
|
||||||
|
QCoreApplication::postEvent(this, new VmEvent(VmEvent::evOkButton));
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(m_ostHmiDock, &OstHmiDock::sigLeftButton, [&]() {
|
||||||
|
QCoreApplication::postEvent(this, new VmEvent(VmEvent::evLeftButton));
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(m_ostHmiDock, &OstHmiDock::sigRightButton, [&]() {
|
||||||
|
QCoreApplication::postEvent(this, new VmEvent(VmEvent::evRightButton));
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(m_vmDock, &VmDock::sigCompile, [&]() {
|
||||||
|
// m_scriptEditorDock->setScript(m_project.BuildResources());
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(m_vmDock, &VmDock::sigStepInstruction, [&]() {
|
||||||
|
QCoreApplication::postEvent(this, new VmEvent(VmEvent::evStep));
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(m_vmDock, &VmDock::sigBuild, [&]() {
|
||||||
|
BuildScript();
|
||||||
|
});
|
||||||
|
|
||||||
connect(&m_model, &StoryGraphModel::sigChooseFile, [&](NodeId id, const QString &type) {
|
connect(&m_model, &StoryGraphModel::sigChooseFile, [&](NodeId id, const QString &type) {
|
||||||
m_chooseFileUi.tableView->setModel(&m_resourcesDock->getModel());
|
m_chooseFileUi.tableView->setModel(&m_resourcesDock->getModel());
|
||||||
m_chooseFileDialog->exec();
|
m_chooseFileDialog->exec();
|
||||||
|
|
@ -145,33 +192,6 @@ MainWindow::MainWindow()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
m_newProjectDialog = new NewProjectDialog(this);
|
|
||||||
m_newProjectDialog->hide();
|
|
||||||
|
|
||||||
// TODO: merge both
|
|
||||||
m_model.registerNode<MediaNodeModel>("MediaNode");
|
|
||||||
m_model.addModel("MediaNode", "Story Teller");
|
|
||||||
|
|
||||||
// m_project.Load("packs/BE8949F60D854F54828419A1BDAED36A/pack.json");
|
|
||||||
|
|
||||||
// DisplayNode(m_project.m_tree, QtNodes::InvalidNodeId);
|
|
||||||
|
|
||||||
// VM Initialize
|
|
||||||
|
|
||||||
m_chip32_ctx.stack_size = 512;
|
|
||||||
|
|
||||||
m_chip32_ctx.rom.mem = m_rom_data;
|
|
||||||
m_chip32_ctx.rom.addr = 0;
|
|
||||||
m_chip32_ctx.rom.size = sizeof(m_rom_data);
|
|
||||||
|
|
||||||
m_chip32_ctx.ram.mem = m_ram_data;
|
|
||||||
m_chip32_ctx.ram.addr = sizeof(m_rom_data);
|
|
||||||
m_chip32_ctx.ram.size = sizeof(m_ram_data);
|
|
||||||
|
|
||||||
|
|
||||||
Callback<uint8_t(uint8_t)>::func = std::bind(&MainWindow::Syscall, this, std::placeholders::_1);
|
|
||||||
m_chip32_ctx.syscall = static_cast<syscall_t>(Callback<uint8_t(uint8_t)>::callback);
|
|
||||||
|
|
||||||
connect(m_toolbar, &ToolBar::sigNew, this, [&]() {
|
connect(m_toolbar, &ToolBar::sigNew, this, [&]() {
|
||||||
NewProject();
|
NewProject();
|
||||||
});
|
});
|
||||||
|
|
@ -181,7 +201,7 @@ MainWindow::MainWindow()
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(m_toolbar, &ToolBar::sigOpen, this, [&]() {
|
connect(m_toolbar, &ToolBar::sigOpen, this, [&]() {
|
||||||
OpenProjectDialog();
|
OpenProjectDialog();
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(m_toolbar, &ToolBar::sigClose, this, [&]() {
|
connect(m_toolbar, &ToolBar::sigClose, this, [&]() {
|
||||||
|
|
@ -201,26 +221,15 @@ MainWindow::MainWindow()
|
||||||
BuildAndRun();
|
BuildAndRun();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Install event handler now that everythin is initialized
|
|
||||||
Callback<void(QtMsgType , const QMessageLogContext &, const QString &)>::func = std::bind(&MainWindow::MessageOutput, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
|
|
||||||
auto cb = static_cast<message_output_t>(Callback<void(QtMsgType , const QMessageLogContext &, const QString &)>::callback);
|
|
||||||
|
|
||||||
|
|
||||||
qInstallMessageHandler(cb);
|
|
||||||
|
|
||||||
readSettings(); // restore all windows preferences
|
|
||||||
qDebug() << "Settings location: " << m_settings.fileName();
|
|
||||||
qDebug() << "Welcome to StoryTeller Editor";
|
|
||||||
|
|
||||||
CloseProject();
|
|
||||||
RefreshProjectInformation();
|
|
||||||
|
|
||||||
// Prepare run timer
|
|
||||||
m_runTimer = new QTimer(this);
|
|
||||||
m_runTimer->setSingleShot(true);
|
|
||||||
connect(m_runTimer, &QTimer::timeout, this, [&]() {
|
connect(m_runTimer, &QTimer::timeout, this, [&]() {
|
||||||
if (m_dbg.run_result == VM_OK)
|
if (m_dbg.run_result == VM_OK)
|
||||||
{
|
{
|
||||||
|
if (m_dbg.m_breakpoints.contains(m_dbg.line + 1))
|
||||||
|
{
|
||||||
|
qDebug() << "Breakpoint on line: " << (m_dbg.line + 1);
|
||||||
|
m_dbg.free_run = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
stepInstruction();
|
stepInstruction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -231,7 +240,7 @@ MainWindow::MainWindow()
|
||||||
}
|
}
|
||||||
else if (m_dbg.run_result == VM_FINISHED)
|
else if (m_dbg.run_result == VM_FINISHED)
|
||||||
{
|
{
|
||||||
m_dbg.running = false;
|
m_dbg.free_run = false;
|
||||||
}
|
}
|
||||||
else if (m_dbg.run_result == VM_WAIT_EVENT)
|
else if (m_dbg.run_result == VM_WAIT_EVENT)
|
||||||
{
|
{
|
||||||
|
|
@ -240,12 +249,29 @@ MainWindow::MainWindow()
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(&m_model, &StoryGraphModel::sigAudioStopped, this, [&]() {
|
connect(&m_model, &StoryGraphModel::sigAudioStopped, this, [&]() {
|
||||||
|
QCoreApplication::postEvent(this, new VmEvent(VmEvent::evAudioFinished));
|
||||||
|
});
|
||||||
|
|
||||||
if ((m_dbg.run_result == VM_WAIT_EVENT) && (m_dbg.running))
|
connect(m_scriptEditorDock, &ScriptEditorDock::sigLineNumberAreaClicked, this, [&](int line) {
|
||||||
|
|
||||||
|
// On cherche si une instruction existe à cette ligne
|
||||||
|
std::vector<Chip32::Instr>::const_iterator ptr = m_assembler.Begin();
|
||||||
|
for (; ptr != m_assembler.End(); ++ptr)
|
||||||
{
|
{
|
||||||
m_dbg.run_result = VM_OK;
|
if ((ptr->line == line) && ptr->isRomCode())
|
||||||
// Continue execution of node
|
{
|
||||||
m_runTimer->start(100);
|
if (m_dbg.m_breakpoints.contains(line))
|
||||||
|
{
|
||||||
|
m_dbg.m_breakpoints.erase(line);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_dbg.m_breakpoints.insert(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_scriptEditorDock->SetBreakPoints(m_dbg.m_breakpoints);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -273,7 +299,7 @@ void MainWindow::BuildAndRun()
|
||||||
// 4. Run the VM code!
|
// 4. Run the VM code!
|
||||||
if (m_dbg.run_result == VM_OK)
|
if (m_dbg.run_result == VM_OK)
|
||||||
{
|
{
|
||||||
m_dbg.running = true;
|
m_dbg.free_run = true;
|
||||||
m_runTimer->start(100);
|
m_runTimer->start(100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -433,7 +459,7 @@ void MainWindow::highlightNextLine()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Not found
|
// Not found
|
||||||
qDebug() << "Reached end or instruction not found: " << m_dbg.line;
|
qDebug() << "Reached end or instruction not found line: " << m_dbg.line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -458,6 +484,25 @@ QString MainWindow::GetFileNameFromMemory(uint32_t addr)
|
||||||
return QString(strBuf);
|
return QString(strBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::EventFinished(uint32_t replyEvent)
|
||||||
|
{
|
||||||
|
if (m_dbg.run_result == VM_WAIT_EVENT)
|
||||||
|
{
|
||||||
|
// Result event is in R0
|
||||||
|
m_chip32_ctx.registers[R0] = replyEvent;
|
||||||
|
m_dbg.run_result = VM_OK;
|
||||||
|
|
||||||
|
if (m_dbg.free_run)
|
||||||
|
{
|
||||||
|
m_runTimer->start(100);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
stepInstruction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool MainWindow::event(QEvent *event)
|
bool MainWindow::event(QEvent *event)
|
||||||
{
|
{
|
||||||
if (event->type() == VmEvent::evStep)
|
if (event->type() == VmEvent::evStep)
|
||||||
|
|
@ -473,16 +518,19 @@ bool MainWindow::event(QEvent *event)
|
||||||
}
|
}
|
||||||
else if (event->type() == VmEvent::evOkButton)
|
else if (event->type() == VmEvent::evOkButton)
|
||||||
{
|
{
|
||||||
VmEvent *myEvent = static_cast<VmEvent *>(event);
|
EventFinished(0x01);
|
||||||
|
}
|
||||||
if (m_dbg.run_result == VM_WAIT_EVENT)
|
else if (event->type() == VmEvent::evLeftButton)
|
||||||
{
|
{
|
||||||
// Result event is in R1
|
EventFinished(0x02);
|
||||||
m_chip32_ctx.registers[R1] = 0x01;
|
}
|
||||||
m_dbg.run_result = VM_OK;
|
else if (event->type() == VmEvent::evRightButton)
|
||||||
m_runTimer->start(100);
|
{
|
||||||
}
|
EventFinished(0x04);
|
||||||
|
}
|
||||||
|
else if (event->type() == VmEvent::evAudioFinished)
|
||||||
|
{
|
||||||
|
EventFinished(0x08);
|
||||||
}
|
}
|
||||||
|
|
||||||
// false means it should be send to target also. as in , we dont remove it.
|
// false means it should be send to target also. as in , we dont remove it.
|
||||||
|
|
@ -547,7 +595,7 @@ void MainWindow::stepInstruction()
|
||||||
void MainWindow::BuildScript()
|
void MainWindow::BuildScript()
|
||||||
{
|
{
|
||||||
m_dbg.run_result = VM_FINISHED;
|
m_dbg.run_result = VM_FINISHED;
|
||||||
m_dbg.running = false;
|
m_dbg.free_run = false;
|
||||||
|
|
||||||
if (m_assembler.Parse(m_scriptEditorDock->getScript().toStdString()) == true )
|
if (m_assembler.Parse(m_scriptEditorDock->getScript().toStdString()) == true )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -54,10 +54,12 @@ struct DebugContext
|
||||||
{
|
{
|
||||||
uint32_t event_mask{0};
|
uint32_t event_mask{0};
|
||||||
bool wait_event{0};
|
bool wait_event{0};
|
||||||
bool running{false};
|
bool free_run{false};
|
||||||
int line{-1};
|
int line{-1};
|
||||||
chip32_result_t run_result{VM_FINISHED};
|
chip32_result_t run_result{VM_FINISHED};
|
||||||
|
|
||||||
|
std::set<int> m_breakpoints;
|
||||||
|
|
||||||
static void DumpCodeAssembler(Chip32::Assembler & assembler) {
|
static void DumpCodeAssembler(Chip32::Assembler & assembler) {
|
||||||
|
|
||||||
for (std::vector<Chip32::Instr>::const_iterator iter = assembler.Begin();
|
for (std::vector<Chip32::Instr>::const_iterator iter = assembler.Begin();
|
||||||
|
|
@ -109,6 +111,9 @@ public:
|
||||||
{}
|
{}
|
||||||
static const QEvent::Type evStep = static_cast<QEvent::Type>(QEvent::User + 1);
|
static const QEvent::Type evStep = static_cast<QEvent::Type>(QEvent::User + 1);
|
||||||
static const QEvent::Type evOkButton = static_cast<QEvent::Type>(QEvent::User + 2);
|
static const QEvent::Type evOkButton = static_cast<QEvent::Type>(QEvent::User + 2);
|
||||||
|
static const QEvent::Type evLeftButton = static_cast<QEvent::Type>(QEvent::User + 3);
|
||||||
|
static const QEvent::Type evRightButton = static_cast<QEvent::Type>(QEvent::User + 4);
|
||||||
|
static const QEvent::Type evAudioFinished = static_cast<QEvent::Type>(QEvent::User + 5);
|
||||||
|
|
||||||
uint8_t ev{0};
|
uint8_t ev{0};
|
||||||
};
|
};
|
||||||
|
|
@ -186,6 +191,7 @@ private:
|
||||||
void EnableProject();
|
void EnableProject();
|
||||||
void OpenProject(const QString &filePath);
|
void OpenProject(const QString &filePath);
|
||||||
QString ReadResourceFile(const QString &fileName);
|
QString ReadResourceFile(const QString &fileName);
|
||||||
|
void EventFinished(uint32_t replyEvent);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAIN_WINDOW_H
|
#endif // MAIN_WINDOW_H
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
MediaNodeModel::MediaNodeModel(StoryGraphModel &model)
|
MediaNodeModel::MediaNodeModel(StoryGraphModel &model)
|
||||||
: m_model(model)
|
: m_model(model)
|
||||||
, m_widget(new QWidget())
|
, m_widget(new StoryNodeWidgetBase())
|
||||||
{
|
{
|
||||||
m_ui.setupUi(m_widget);
|
m_ui.setupUi(m_widget);
|
||||||
m_ui.image->setText("Image will appear here");
|
m_ui.image->setText("Image will appear here");
|
||||||
|
|
@ -73,12 +73,18 @@ MediaNodeModel::MediaNodeModel(StoryGraphModel &model)
|
||||||
_nodeStyle.GradientColor2 = bgColor;
|
_nodeStyle.GradientColor2 = bgColor;
|
||||||
_nodeStyle.GradientColor3 = bgColor;
|
_nodeStyle.GradientColor3 = bgColor;
|
||||||
_nodeStyle.NormalBoundaryColor = bgColor;
|
_nodeStyle.NormalBoundaryColor = bgColor;
|
||||||
_nodeStyle.FontColor = QColor(206, 206, 206);
|
_nodeStyle.FontColor = Qt::white;
|
||||||
_nodeStyle.FontColorFaded = QColor(125, 125, 125);
|
_nodeStyle.FontColorFaded = QColor(125, 125, 125);
|
||||||
_nodeStyle.ShadowColor = QColor(20, 20, 20);
|
_nodeStyle.ShadowColor = QColor(20, 20, 20);
|
||||||
_nodeStyle.ConnectionPointColor = QColor(125, 125, 125);
|
_nodeStyle.ConnectionPointColor = QColor(125, 125, 125);
|
||||||
_nodeStyle.FilledConnectionPointColor = QColor(206, 206, 206);
|
_nodeStyle.FilledConnectionPointColor = QColor(206, 206, 206);
|
||||||
|
|
||||||
|
_nodeStyle.SelectedBoundaryColor = QColor(20, 146, 202);
|
||||||
|
_nodeStyle.Opacity = 1.0;
|
||||||
|
_nodeStyle.PenWidth = 0;
|
||||||
|
_nodeStyle.HoveredPenWidth = 2.0;
|
||||||
|
_nodeStyle.ConnectionPointDiameter = 3.5;
|
||||||
|
|
||||||
setNodeStyle(_nodeStyle);
|
setNodeStyle(_nodeStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -239,12 +245,18 @@ std::string MediaNodeModel::Build()
|
||||||
{
|
{
|
||||||
std::unordered_set<ConnectionId> conns = m_model.allConnectionIds(getNodeId());
|
std::unordered_set<ConnectionId> conns = m_model.allConnectionIds(getNodeId());
|
||||||
|
|
||||||
auto it = conns.begin();
|
|
||||||
++it;
|
for (auto c : conns)
|
||||||
// On place dans R0 le prochain noeud à exécuter en cas de OK
|
{
|
||||||
ss << "lcons r0, "
|
if (c.outNodeId == getNodeId())
|
||||||
<< m_model.GetNodeEntryLabel(it->inNodeId) << "\n"
|
{
|
||||||
<< "ret\n";
|
// On place dans R0 le prochain noeud à exécuter en cas de OK
|
||||||
|
ss << "lcons r0, "
|
||||||
|
<< m_model.GetNodeEntryLabel(c.inNodeId) << "\n"
|
||||||
|
<< "ret\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else // Choice node
|
else // Choice node
|
||||||
{
|
{
|
||||||
|
|
@ -346,3 +358,15 @@ std::string MediaNodeModel::EntryLabel() const
|
||||||
ss << ".mediaEntry" << std::setw(4) << std::setfill('0') << getNodeId();
|
ss << ".mediaEntry" << std::setw(4) << std::setfill('0') << getNodeId();
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StoryNodeWidgetBase::StoryNodeWidgetBase() {
|
||||||
|
// setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
|
||||||
|
|
||||||
|
// setAttribute(Qt::WA_NoSystemBackground);
|
||||||
|
setAttribute(Qt::WA_TranslucentBackground);
|
||||||
|
// setAttribute(Qt::WA_PaintOnScreen);
|
||||||
|
|
||||||
|
// setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||||
|
|
||||||
|
setStyleSheet("QLabel { background-color: rgba(0,0,0,0) }; QWidget { background-color: rgba(0,0,0,0) };");
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,13 @@ using QtNodes::PortType;
|
||||||
#include "story_graph_model.h"
|
#include "story_graph_model.h"
|
||||||
#include "story_node_base.h"
|
#include "story_node_base.h"
|
||||||
|
|
||||||
|
class StoryNodeWidgetBase : public QWidget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
StoryNodeWidgetBase();
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
/// The model dictates the number of inputs and outputs for the Node.
|
/// The model dictates the number of inputs and outputs for the Node.
|
||||||
/// In this example it has no logic.
|
/// In this example it has no logic.
|
||||||
class MediaNodeModel : public StoryNodeBase
|
class MediaNodeModel : public StoryNodeBase
|
||||||
|
|
@ -72,7 +79,7 @@ private:
|
||||||
StoryGraphModel &m_model;
|
StoryGraphModel &m_model;
|
||||||
|
|
||||||
unsigned int m_ports{1};
|
unsigned int m_ports{1};
|
||||||
QWidget *m_widget;
|
StoryNodeWidgetBase *m_widget;
|
||||||
|
|
||||||
QString m_soundFilePath;
|
QString m_soundFilePath;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,5 +11,10 @@
|
||||||
<file>../assets/welcome.png</file>
|
<file>../assets/welcome.png</file>
|
||||||
<file>../assets/play-circle-green.png</file>
|
<file>../assets/play-circle-green.png</file>
|
||||||
<file>../scripts/media.asm</file>
|
<file>../scripts/media.asm</file>
|
||||||
|
<file>../assets/home.png</file>
|
||||||
|
<file>../assets/left.png</file>
|
||||||
|
<file>../assets/pause-button.png</file>
|
||||||
|
<file>../assets/right.png</file>
|
||||||
|
<file>../assets/check-mark.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
||||||
|
|
@ -7,15 +7,21 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>338</width>
|
<width>338</width>
|
||||||
<height>443</height>
|
<height>326</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Story Teller Emulator</string>
|
<string>Story Teller Emulator</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="dockWidgetContents">
|
<widget class="QWidget" name="dockWidgetContents">
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item row="0" column="0">
|
<item>
|
||||||
<widget class="QLabel" name="display">
|
<widget class="QLabel" name="display">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
|
@ -46,63 +52,140 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<property name="title">
|
<item>
|
||||||
<string>Commands</string>
|
<widget class="QPushButton" name="leftButton">
|
||||||
</property>
|
<property name="sizePolicy">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
<item>
|
<horstretch>0</horstretch>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<verstretch>0</verstretch>
|
||||||
<item>
|
</sizepolicy>
|
||||||
<widget class="QDial" name="rotary"/>
|
</property>
|
||||||
</item>
|
<property name="text">
|
||||||
<item>
|
<string/>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
</property>
|
||||||
<item>
|
<property name="icon">
|
||||||
<widget class="QPushButton" name="okButton">
|
<iconset resource="ost-editor.qrc">
|
||||||
<property name="text">
|
<normaloff>:/assets/left.png</normaloff>:/assets/left.png</iconset>
|
||||||
<string>Ok</string>
|
</property>
|
||||||
</property>
|
<property name="iconSize">
|
||||||
</widget>
|
<size>
|
||||||
</item>
|
<width>45</width>
|
||||||
<item>
|
<height>35</height>
|
||||||
<widget class="QPushButton" name="homeButton">
|
</size>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>Home</string>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
</widget>
|
<item>
|
||||||
</item>
|
<widget class="QPushButton" name="okButton">
|
||||||
<item>
|
<property name="text">
|
||||||
<widget class="QPushButton" name="pauseButton">
|
<string/>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>Pause</string>
|
<property name="icon">
|
||||||
</property>
|
<iconset resource="ost-editor.qrc">
|
||||||
</widget>
|
<normaloff>:/assets/check-mark.png</normaloff>:/assets/check-mark.png</iconset>
|
||||||
</item>
|
</property>
|
||||||
</layout>
|
<property name="iconSize">
|
||||||
</item>
|
<size>
|
||||||
</layout>
|
<width>35</width>
|
||||||
</item>
|
<height>35</height>
|
||||||
<item>
|
</size>
|
||||||
<spacer name="verticalSpacer">
|
</property>
|
||||||
<property name="orientation">
|
<property name="flat">
|
||||||
<enum>Qt::Vertical</enum>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
</widget>
|
||||||
<size>
|
</item>
|
||||||
<width>20</width>
|
<item>
|
||||||
<height>129</height>
|
<widget class="QPushButton" name="rightButton">
|
||||||
</size>
|
<property name="sizePolicy">
|
||||||
</property>
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
</spacer>
|
<horstretch>0</horstretch>
|
||||||
</item>
|
<verstretch>0</verstretch>
|
||||||
</layout>
|
</sizepolicy>
|
||||||
</widget>
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="ost-editor.qrc">
|
||||||
|
<normaloff>:/assets/right.png</normaloff>:/assets/right.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>45</width>
|
||||||
|
<height>35</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pauseButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="ost-editor.qrc">
|
||||||
|
<normaloff>:/assets/pause-button.png</normaloff>:/assets/pause-button.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>30</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="homeButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="ost-editor.qrc">
|
||||||
|
<normaloff>:/assets/home.png</normaloff>:/assets/home.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>30</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources>
|
||||||
|
<include location="ost-editor.qrc"/>
|
||||||
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@ OstHmiDock::OstHmiDock()
|
||||||
m_uiOstDisplay.setupUi(this);
|
m_uiOstDisplay.setupUi(this);
|
||||||
|
|
||||||
connect(m_uiOstDisplay.okButton, &QPushButton::clicked, this, &OstHmiDock::sigOkButton);
|
connect(m_uiOstDisplay.okButton, &QPushButton::clicked, this, &OstHmiDock::sigOkButton);
|
||||||
|
connect(m_uiOstDisplay.leftButton, &QPushButton::clicked, this, &OstHmiDock::sigLeftButton);
|
||||||
|
connect(m_uiOstDisplay.rightButton, &QPushButton::clicked, this, &OstHmiDock::sigRightButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OstHmiDock::SetImage(const QString &fileName)
|
void OstHmiDock::SetImage(const QString &fileName)
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@ public:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sigOkButton();
|
void sigOkButton();
|
||||||
|
void sigLeftButton();
|
||||||
|
void sigRightButton();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::ostDisplay m_uiOstDisplay;
|
Ui::ostDisplay m_uiOstDisplay;
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@ ScriptEditorDock::ScriptEditorDock()
|
||||||
m_editor = new CodeEditor(this);
|
m_editor = new CodeEditor(this);
|
||||||
m_highlighter = new Highlighter(m_editor->document());
|
m_highlighter = new Highlighter(m_editor->document());
|
||||||
setWidget(m_editor);
|
setWidget(m_editor);
|
||||||
|
|
||||||
|
connect(m_editor, &CodeEditor::sigLineNumberAreaClicked, this, &ScriptEditorDock::sigLineNumberAreaClicked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEditorDock::HighlightLine(int line)
|
void ScriptEditorDock::HighlightLine(int line)
|
||||||
|
|
@ -25,3 +27,8 @@ QString ScriptEditorDock::getScript() const
|
||||||
{
|
{
|
||||||
return m_editor->toPlainText();
|
return m_editor->toPlainText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScriptEditorDock::SetBreakPoints(const std::set<int> &bkp)
|
||||||
|
{
|
||||||
|
m_editor->SetBreakPoints(bkp);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,11 @@ public:
|
||||||
void setScript(const std::string &script);
|
void setScript(const std::string &script);
|
||||||
QString getScript() const;
|
QString getScript() const;
|
||||||
|
|
||||||
|
void SetBreakPoints(const std::set<int> & bkp);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void sigLineNumberAreaClicked(int line);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CodeEditor *m_editor{nullptr};
|
CodeEditor *m_editor{nullptr};
|
||||||
Highlighter *m_highlighter;
|
Highlighter *m_highlighter;
|
||||||
|
|
|
||||||
|
|
@ -186,8 +186,7 @@ QVariant StoryGraphModel::nodeData(NodeId nodeId, NodeRole role) const
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NodeRole::Style: {
|
case NodeRole::Style: {
|
||||||
auto style = StyleCollection::nodeStyle();
|
result = model->nodeStyle().toJson().toVariantMap();
|
||||||
result = style.toJson().toVariantMap();
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NodeRole::InternalData:
|
case NodeRole::InternalData:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue