ui changes
This commit is contained in:
parent
1fb7d52842
commit
d3ab78e76c
6 changed files with 131 additions and 17 deletions
|
|
@ -17,6 +17,8 @@
|
|||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QFont>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
class Loader;
|
||||
|
||||
|
|
@ -69,8 +71,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
ui->regF_bin_field->setValidator(floatBinValidator);
|
||||
|
||||
|
||||
connect(m_controller.get(), &MachineController::tick, this, &MainWindow::updateRegisterDisplays);
|
||||
connect(m_controller.get(), &MachineController::tick, this, &MainWindow::updateMemoryDisplay);
|
||||
connect(m_controller.get(), &MachineController::tick, this, &MainWindow::updateRegisterDisplays, Qt::QueuedConnection);
|
||||
connect(m_controller.get(), &MachineController::tick, this, &MainWindow::updateMemoryDisplay, Qt::QueuedConnection);
|
||||
|
||||
connectRegisterFields();
|
||||
|
||||
|
|
@ -95,15 +97,16 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
connect(ui->DisasmDec65536Btn, &QPushButton::clicked, this, &MainWindow::onDisassemblyDec256);
|
||||
connect(ui->DisasmGoToStart, &QPushButton::clicked, this, &MainWindow::onDisassemblyGoToStart);
|
||||
connect(ui->DisasmGoToEnd, &QPushButton::clicked, this, &MainWindow::onDisassemblyGoToEnd);
|
||||
connect(m_controller.get(), &MachineController::tick, this, &MainWindow::updateDisassemblyDisplay);
|
||||
connect(m_controller.get(), &MachineController::tick, this, &MainWindow::updateDisassemblyDisplay, Qt::QueuedConnection);
|
||||
|
||||
// Connect menu actions
|
||||
connect(ui->actionLoad_Object_File, &QAction::triggered, this, &MainWindow::loadObjectFile);
|
||||
|
||||
setupMemoryDisplay();
|
||||
setupDisassemblyDisplay();
|
||||
|
||||
loadInstructionSet();
|
||||
//loadDemoProgram();
|
||||
Loader loader(m_machine, std::string(PATH_RESOURCES) + "print.obj");
|
||||
loader.load();
|
||||
// Don't load any program by default - user will load via File menu
|
||||
|
||||
updateRegisterDisplays();
|
||||
updateMemoryDisplay();
|
||||
|
|
@ -760,7 +763,7 @@ MainWindow::DisassembledInstruction MainWindow::disassembleAt(int address)
|
|||
QString addrMode = "";
|
||||
|
||||
if (p) {
|
||||
ea += m_machine->getPC();
|
||||
ea += (address + 3);
|
||||
addrMode = " (PC)";
|
||||
} else if (b) {
|
||||
ea += m_machine->getB();
|
||||
|
|
@ -918,3 +921,38 @@ void MainWindow::updateMemoryDisplay()
|
|||
|
||||
ui->MemoryScrollArea->setWidget(container);
|
||||
}
|
||||
|
||||
void MainWindow::loadObjectFile()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this,
|
||||
tr("Load Object File"),
|
||||
QString(),
|
||||
tr("Object Files (*.obj);;All Files (*)"));
|
||||
|
||||
if (fileName.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// Stop execution if running
|
||||
m_controller->stop();
|
||||
|
||||
// Reset machine state
|
||||
m_machine->reset();
|
||||
|
||||
// Load the object file
|
||||
Loader loader(m_machine, fileName.toStdString());
|
||||
loader.load();
|
||||
|
||||
// Update displays
|
||||
updateRegisterDisplays();
|
||||
updateMemoryDisplay();
|
||||
updateDisassemblyDisplay();
|
||||
|
||||
QMessageBox::information(this, tr("Success"),
|
||||
tr("Object file loaded successfully"));
|
||||
} catch (const std::exception &e) {
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Failed to load object file: %1").arg(e.what()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue