Skip to content

Commit

Permalink
feat: add CDFS Automount CD/DVD option in GUI
Browse files Browse the repository at this point in the history
This is useful if you want to mount CDs on Workbench
  • Loading branch information
midwan committed Jan 9, 2025
1 parent 44c6ce7 commit b3365c9
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/osdep/gui/PanelHD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ static gcn::Button* cmdCreateHardfile;
static gcn::Button* cmdAddCDDrive;
static gcn::Button* cmdAddTapeDrive;

static gcn::CheckBox* chkCDFSAutomount;
static gcn::CheckBox* chkCD;
static gcn::DropDown* cboCDFile;
static gcn::Button* cmdCDEject;
Expand Down Expand Up @@ -262,6 +263,8 @@ class CDCheckActionListener : public gcn::ActionListener
}
else if (actionEvent.getSource() == chkCDTurbo)
changed_prefs.cd_speed = chkCDTurbo->isSelected() ? 0 : 100;
else if (actionEvent.getSource() == chkCDFSAutomount)
changed_prefs.automount_cddrives = chkCDFSAutomount->isSelected();

RefreshPanelHD();
RefreshPanelQuickstart();
Expand Down Expand Up @@ -462,6 +465,13 @@ void InitPanelHD(const config_category& category)
cdButtonActionListener = new CDButtonActionListener();
cdFileActionListener = new CDFileActionListener();

chkCDFSAutomount = new gcn::CheckBox("CDFS automount CD/DVD drives");
chkCDFSAutomount->setId("chkCDFSAutomount");
chkCDFSAutomount->setBaseColor(gui_base_color);
chkCDFSAutomount->setBackgroundColor(gui_background_color);
chkCDFSAutomount->setForegroundColor(gui_foreground_color);
chkCDFSAutomount->addActionListener(cdCheckActionListener);

chkCD = new gcn::CheckBox("CD drive/image");
chkCD->setId("chkCD");
chkCD->setBaseColor(gui_base_color);
Expand Down Expand Up @@ -534,7 +544,9 @@ void InitPanelHD(const config_category& category)
category.panel->add(cmdCreateHardfile, cmdAddTapeDrive->getX() + cmdAddTapeDrive->getWidth() + DISTANCE_NEXT_X, posY);
posY += cmdCreateHardfile->getHeight() + DISTANCE_NEXT_Y * 2;

category.panel->add(chkCD, DISTANCE_BORDER, posY + 2);
category.panel->add(chkCDFSAutomount, DISTANCE_BORDER, posY + 2);
posY = chkCDFSAutomount->getY() + chkCDFSAutomount->getHeight() + DISTANCE_NEXT_Y;
category.panel->add(chkCD, DISTANCE_BORDER, posY);
category.panel->add(cmdCDEject, category.panel->getWidth() - cmdCDEject->getWidth() - DISTANCE_BORDER, posY);
category.panel->add(cmdCDSelectFile, cmdCDEject->getX() - DISTANCE_NEXT_X - cmdCDSelectFile->getWidth(), posY);
posY += cmdCDSelectFile->getHeight() + DISTANCE_NEXT_Y;
Expand Down Expand Up @@ -570,6 +582,7 @@ void ExitPanelHD()
delete cmdAddTapeDrive;
delete cmdCreateHardfile;

delete chkCDFSAutomount;
delete chkCD;
delete cmdCDEject;
delete cmdCDSelectFile;
Expand Down Expand Up @@ -769,6 +782,7 @@ void RefreshPanelHD()
}
}

chkCDFSAutomount->setSelected(changed_prefs.automount_cddrives);
chkCD->setSelected(changed_prefs.cdslots[0].inuse);
cmdCDEject->setEnabled(changed_prefs.cdslots[0].inuse);
cmdCDSelectFile->setEnabled(changed_prefs.cdslots[0].inuse);
Expand Down

0 comments on commit b3365c9

Please sign in to comment.