Add menu item to insert disks.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
1033c98028
commit
57934c1bc9
3 changed files with 54 additions and 1 deletions
|
@ -123,10 +123,12 @@ BYTE __stdcall SpkrToggle (WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nCycle
|
|||
void VideoInitialize() {}
|
||||
|
||||
QApple::QApple(QWidget *parent) :
|
||||
QMainWindow(parent)
|
||||
QMainWindow(parent), myDiskFileDialog(this)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
myDiskFileDialog.setFileMode(QFileDialog::AnyFile);
|
||||
|
||||
myEmulator = new Emulator(mdiArea);
|
||||
myEmulatorWindow = mdiArea->addSubWindow(myEmulator, Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint);
|
||||
|
||||
|
@ -206,3 +208,27 @@ void QApple::on_action4_3_triggered()
|
|||
{
|
||||
myEmulator->set43AspectRatio(myEmulatorWindow);
|
||||
}
|
||||
|
||||
void QApple::insertDisk(const int disk)
|
||||
{
|
||||
if (myDiskFileDialog.exec())
|
||||
{
|
||||
QStringList files = myDiskFileDialog.selectedFiles();
|
||||
if (files.size() == 1)
|
||||
{
|
||||
const std::string filename = files[0].toStdString();
|
||||
const bool createMissingDisk = true;
|
||||
DiskInsert(disk, filename.c_str(), IMAGE_USE_FILES_WRITE_PROTECT_STATUS, createMissingDisk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QApple::on_actionDisk_1_triggered()
|
||||
{
|
||||
insertDisk(DRIVE_1);
|
||||
}
|
||||
|
||||
void QApple::on_actionDisk_2_triggered()
|
||||
{
|
||||
insertDisk(DRIVE_2);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "ui_qapple.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
|
||||
class Emulator;
|
||||
|
||||
class QApple : public QMainWindow, private Ui::QApple
|
||||
|
@ -27,9 +29,16 @@ private slots:
|
|||
|
||||
void on_action4_3_triggered();
|
||||
|
||||
void on_actionDisk_1_triggered();
|
||||
|
||||
void on_actionDisk_2_triggered();
|
||||
|
||||
private:
|
||||
|
||||
void setNextTimer(const int ms);
|
||||
void insertDisk(const int disk);
|
||||
|
||||
QFileDialog myDiskFileDialog;
|
||||
|
||||
QMdiSubWindow * myEmulatorWindow;
|
||||
Emulator * myEmulator;
|
||||
|
|
|
@ -43,7 +43,15 @@
|
|||
<addaction name="actionStart"/>
|
||||
<addaction name="actionPause"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuDisks">
|
||||
<property name="title">
|
||||
<string>Disks</string>
|
||||
</property>
|
||||
<addaction name="actionDisk_1"/>
|
||||
<addaction name="actionDisk_2"/>
|
||||
</widget>
|
||||
<addaction name="menuSystem"/>
|
||||
<addaction name="menuDisks"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="mainToolBar">
|
||||
<attribute name="toolBarArea">
|
||||
|
@ -85,6 +93,16 @@
|
|||
<string>x2</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDisk_1">
|
||||
<property name="text">
|
||||
<string>Disk 1...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDisk_2">
|
||||
<property name="text">
|
||||
<string>Disk 2...</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
|
|
Loading…
Add table
Reference in a new issue