checkpoint
This commit is contained in:
parent
3c876211c2
commit
bfa4a8cd72
60 changed files with 239 additions and 87 deletions
|
|
@ -1,12 +1,17 @@
|
|||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
#include <QMessageBox>
|
||||
#include <QFileDialog>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, ui(new Ui::MainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
QAction *actionLoad = new QAction(tr("Load"), this);
|
||||
ui->menuLoad->addAction(actionLoad);
|
||||
|
||||
connect(actionLoad, &QAction::triggered, this, &MainWindow::onLoadTriggered);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
|
|
@ -24,9 +29,19 @@ void MainWindow::on_readButton_clicked()
|
|||
}
|
||||
|
||||
try {
|
||||
unsigned char val = m.readByte(addr);
|
||||
unsigned char val = machine.readByte(addr);
|
||||
ui->valueLabel->setText(QString::number(val));
|
||||
} catch (const std::out_of_range &e) {
|
||||
QMessageBox::warning(this, "Napaka", "Naslov je izven meje pomnilnika!");
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::onLoadTriggered() {
|
||||
QString filename = QFileDialog::getOpenFileName(this, tr("Open Object File"), "", tr("Object Files (*.obj)"));
|
||||
if (!filename.isEmpty()) {
|
||||
bool ok = loader.loadObj(machine, filename.toStdString());
|
||||
if (!ok) {
|
||||
QMessageBox::warning(this, tr("Error"), tr("Failed to load file"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue