Added Unload Disk Image action.

This commit is contained in:
Mark Long 2015-12-01 14:21:09 -06:00
parent 26b1eea952
commit 80d4a47d9d
2 changed files with 11 additions and 1 deletions

View File

@ -10,9 +10,11 @@ MainWindow::MainWindow(QWidget *parent) :
ui->setupUi(this); ui->setupUi(this);
m_disk = 0; m_disk = 0;
ui->action_Unload_Disk_Image->setEnabled(false);
connect(ui->action_Quit, SIGNAL(triggered()), qApp, SLOT(quit())); connect(ui->action_Quit, SIGNAL(triggered()), qApp, SLOT(quit()));
connect(ui->action_Load_Disk_Image, SIGNAL(triggered()), SLOT(showLoadDialog())); connect(ui->action_Load_Disk_Image, SIGNAL(triggered()), SLOT(showLoadDialog()));
connect(ui->action_Unload_Disk_Image, SIGNAL(triggered()), SLOT(unloadDiskFile()));
connect(this, SIGNAL(diskFileLoading(QString, DiskFile*)), connect(this, SIGNAL(diskFileLoading(QString, DiskFile*)),
ui->catalogWidget, SLOT(prepForNewDisk(QString,DiskFile*))); ui->catalogWidget, SLOT(prepForNewDisk(QString,DiskFile*)));
connect(this, SIGNAL(diskFileLoaded(QString,DiskFile*)), connect(this, SIGNAL(diskFileLoaded(QString,DiskFile*)),
@ -35,6 +37,7 @@ void MainWindow::loadDiskFile(QString filename)
m_disk = new DiskFile(); m_disk = new DiskFile();
emit diskFileLoading(filename,m_disk); emit diskFileLoading(filename,m_disk);
if (m_disk->read(filename)) { if (m_disk->read(filename)) {
ui->action_Unload_Disk_Image->setEnabled(true);
emit diskFileLoaded(filename,m_disk); emit diskFileLoaded(filename,m_disk);
} else { } else {
emit diskFileLoadFailed(filename,m_disk); emit diskFileLoadFailed(filename,m_disk);
@ -48,6 +51,7 @@ void MainWindow::unloadDiskFile()
emit diskFileUnloading(m_disk); emit diskFileUnloading(m_disk);
delete m_disk; delete m_disk;
m_disk = 0; m_disk = 0;
ui->action_Unload_Disk_Image->setEnabled(false);
emit diskFileUnloaded(); emit diskFileUnloaded();
} }

View File

@ -75,6 +75,7 @@
<string>&amp;File</string> <string>&amp;File</string>
</property> </property>
<addaction name="action_Load_Disk_Image"/> <addaction name="action_Load_Disk_Image"/>
<addaction name="action_Unload_Disk_Image"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="action_Quit"/> <addaction name="action_Quit"/>
</widget> </widget>
@ -102,6 +103,11 @@
<string>&amp;Quit</string> <string>&amp;Quit</string>
</property> </property>
</action> </action>
<action name="action_Unload_Disk_Image">
<property name="text">
<string>&amp;Unload Disk Image</string>
</property>
</action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>