58 lines
1.4 KiB
C++
58 lines
1.4 KiB
C++
#ifndef MAINWINDOW_H
|
|
#define MAINWINDOW_H
|
|
|
|
#include <QMainWindow>
|
|
#include <memory>
|
|
|
|
class MachineController;
|
|
class Machine;
|
|
class QLineEdit;
|
|
|
|
namespace Ui {
|
|
class MainWindow;
|
|
}
|
|
|
|
class MainWindow : public QMainWindow
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit MainWindow(QWidget *parent = nullptr);
|
|
~MainWindow();
|
|
|
|
std::shared_ptr<Machine> machine() const { return m_machine; }
|
|
MachineController* controller() const { return m_controller.get(); }
|
|
|
|
void startExecution();
|
|
void stopExecution();
|
|
void stepExecution();
|
|
|
|
void setTestRegisterValues();
|
|
|
|
private slots:
|
|
void updateRegisterDisplays();
|
|
void updateMemoryDisplay();
|
|
void onRegisterFieldChanged();
|
|
void onMemoryInc256();
|
|
void onMemoryInc4096();
|
|
void onMemoryInc65536();
|
|
void onMemoryDec256();
|
|
void onMemoryDec4096();
|
|
void onMemoryDec65536();
|
|
|
|
private:
|
|
Ui::MainWindow *ui;
|
|
std::shared_ptr<Machine> m_machine;
|
|
std::unique_ptr<MachineController> m_controller;
|
|
int m_memoryOffset = 0;
|
|
|
|
void connectRegisterFields();
|
|
void updateSingleRegisterDisplay(const QString& fieldName, int value);
|
|
void updateAllFormatsForRegister(const QString& regPrefix, int value);
|
|
void updateFloatRegisterFormats(const QString& regPrefix, double value);
|
|
void handleFloatRegisterFieldChanged(QLineEdit* field, const QString& objectName);
|
|
void loadDemoProgram();
|
|
void setupMemoryDisplay();
|
|
};
|
|
|
|
#endif // MAINWINDOW_H
|