Add and activate options for slot cards and computer type.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
8b458e61fb
commit
4873e1f020
4 changed files with 236 additions and 29 deletions
|
@ -90,6 +90,14 @@ void Preferences::setData(const Data & data)
|
|||
{
|
||||
initialiseDisks(myDisks, data.disks);
|
||||
initialiseDisks(myHDs, data.hds);
|
||||
|
||||
apple2Type->setCurrentIndex(data.apple2Type);
|
||||
mouse_4->setChecked(data.mouseInSlot4);
|
||||
cpm_5->setChecked(data.cpmInSlot5);
|
||||
hd_7->setChecked(data.hdInSlot7);
|
||||
|
||||
// synchronise
|
||||
on_hd_7_clicked(data.hdInSlot7);
|
||||
}
|
||||
|
||||
Preferences::Data Preferences::getData() const
|
||||
|
@ -99,6 +107,11 @@ Preferences::Data Preferences::getData() const
|
|||
fillData(myDisks, data.disks);
|
||||
fillData(myHDs, data.hds);
|
||||
|
||||
data.apple2Type = apple2Type->currentIndex();
|
||||
data.mouseInSlot4 = mouse_4->isChecked();
|
||||
data.cpmInSlot5 = cpm_5->isChecked();
|
||||
data.hdInSlot7 = hd_7->isChecked();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -145,22 +158,30 @@ void Preferences::on_hd2_activated(int index)
|
|||
checkDuplicates(myHDs, 1, index);
|
||||
}
|
||||
|
||||
void Preferences::on_pushButton_clicked()
|
||||
void Preferences::on_browse_disk1_clicked()
|
||||
{
|
||||
browseDisk(myDisks, 0);
|
||||
}
|
||||
|
||||
void Preferences::on_pushButton_2_clicked()
|
||||
void Preferences::on_browse_disk2_clicked()
|
||||
{
|
||||
browseDisk(myDisks, 1);
|
||||
}
|
||||
|
||||
void Preferences::on_pushButton_3_clicked()
|
||||
void Preferences::on_browse_hd1_clicked()
|
||||
{
|
||||
browseDisk(myHDs, 0);
|
||||
}
|
||||
|
||||
void Preferences::on_pushButton_4_clicked()
|
||||
void Preferences::on_browse_hd2_clicked()
|
||||
{
|
||||
browseDisk(myHDs, 1);
|
||||
}
|
||||
|
||||
void Preferences::on_hd_7_clicked(bool checked)
|
||||
{
|
||||
hd1->setEnabled(checked);
|
||||
hd2->setEnabled(checked);
|
||||
browse_hd1->setEnabled(checked);
|
||||
browse_hd2->setEnabled(checked);
|
||||
}
|
||||
|
|
|
@ -13,6 +13,10 @@ public:
|
|||
|
||||
struct Data
|
||||
{
|
||||
int apple2Type;
|
||||
bool mouseInSlot4;
|
||||
bool cpmInSlot5;
|
||||
bool hdInSlot7;
|
||||
std::vector<QString> disks;
|
||||
std::vector<QString> hds;
|
||||
};
|
||||
|
@ -28,13 +32,12 @@ private slots:
|
|||
void on_hd1_activated(int index);
|
||||
void on_hd2_activated(int index);
|
||||
|
||||
void on_pushButton_clicked();
|
||||
void on_browse_disk1_clicked();
|
||||
void on_browse_disk2_clicked();
|
||||
void on_browse_hd1_clicked();
|
||||
void on_browse_hd2_clicked();
|
||||
|
||||
void on_pushButton_2_clicked();
|
||||
|
||||
void on_pushButton_3_clicked();
|
||||
|
||||
void on_pushButton_4_clicked();
|
||||
void on_hd_7_clicked(bool checked);
|
||||
|
||||
private:
|
||||
std::vector<QComboBox *> myDisks;
|
||||
|
|
|
@ -7,18 +7,149 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>556</width>
|
||||
<height>300</height>
|
||||
<height>403</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Options</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="0">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="hardware">
|
||||
<attribute name="title">
|
||||
<string>Hardware</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="2">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Slots</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Slot 4</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="mouse_4">
|
||||
<property name="text">
|
||||
<string>Mouse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Slot 5</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="cpm_5">
|
||||
<property name="text">
|
||||
<string>CP/M</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Slot 7</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QCheckBox" name="hd_7">
|
||||
<property name="text">
|
||||
<string>Hard Disk</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="apple2Type">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Apple ][ (Original)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Apple ][+</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Apple //e</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Enhanced Apple //e</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pravets 82</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pravets 8M</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pravets 8A</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>TK3000 //e</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Computer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="disks">
|
||||
<attribute name="title">
|
||||
<string>Disks</string>
|
||||
|
@ -106,28 +237,28 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<widget class="QPushButton" name="browse_disk1">
|
||||
<property name="text">
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<widget class="QPushButton" name="browse_disk2">
|
||||
<property name="text">
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="pushButton_3">
|
||||
<widget class="QPushButton" name="browse_hd1">
|
||||
<property name="text">
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QPushButton" name="pushButton_4">
|
||||
<widget class="QPushButton" name="browse_hd2">
|
||||
<property name="text">
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
|
@ -137,16 +268,6 @@
|
|||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "ParallelPrinter.h"
|
||||
#include "Video.h"
|
||||
#include "SaveState.h"
|
||||
#include "Registry.h"
|
||||
|
||||
#include "linux/data.h"
|
||||
#include "linux/configuration.h"
|
||||
|
@ -41,13 +42,14 @@ namespace
|
|||
DiskInitialize();
|
||||
}
|
||||
|
||||
void startEmulator()
|
||||
void startEmulator(QWidget * window)
|
||||
{
|
||||
LoadConfiguration();
|
||||
|
||||
CheckCpu();
|
||||
|
||||
SetWindowTitle();
|
||||
window->setWindowTitle(g_pAppTitle);
|
||||
|
||||
FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES);
|
||||
|
||||
|
@ -104,6 +106,34 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
void setSlot4(const SS_CARDTYPE newCardType)
|
||||
{
|
||||
g_Slot4 = newCardType;
|
||||
REGSAVE(TEXT(REGVALUE_SLOT4), (DWORD)g_Slot4);
|
||||
}
|
||||
|
||||
void setSlot5(const SS_CARDTYPE newCardType)
|
||||
{
|
||||
g_Slot5 = newCardType;
|
||||
REGSAVE(TEXT(REGVALUE_SLOT5), (DWORD)g_Slot5);
|
||||
}
|
||||
|
||||
const std::vector<eApple2Type> computerTypes = {A2TYPE_APPLE2, A2TYPE_APPLE2PLUS, A2TYPE_APPLE2E, A2TYPE_APPLE2EENHANCED};
|
||||
|
||||
int getApple2ComputerType()
|
||||
{
|
||||
const eApple2Type type = GetApple2Type();
|
||||
const auto it = std::find(computerTypes.begin(), computerTypes.end(), type);
|
||||
if (it != computerTypes.end())
|
||||
{
|
||||
return std::distance(computerTypes.begin(), it);
|
||||
}
|
||||
else
|
||||
{
|
||||
// default to A2E
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FrameDrawDiskLEDS(HDC)
|
||||
|
@ -141,13 +171,12 @@ QApple::QApple(QWidget *parent) :
|
|||
|
||||
myEmulator = new Emulator(mdiArea);
|
||||
myEmulatorWindow = mdiArea->addSubWindow(myEmulator, Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint);
|
||||
myEmulatorWindow->setWindowTitle(g_pAppTitle);
|
||||
|
||||
myMSGap = 5;
|
||||
|
||||
initialiseEmulator();
|
||||
|
||||
startEmulator();
|
||||
startEmulator(myEmulatorWindow);
|
||||
}
|
||||
|
||||
void QApple::closeEvent(QCloseEvent *)
|
||||
|
@ -225,7 +254,8 @@ void QApple::on_actionReboot_triggered()
|
|||
{
|
||||
emit endEmulator();
|
||||
stopEmulator();
|
||||
startEmulator();
|
||||
startEmulator(myEmulatorWindow);
|
||||
myEmulatorWindow->setWindowTitle(g_pAppTitle);
|
||||
}
|
||||
|
||||
void QApple::on_actionBenchmark_triggered()
|
||||
|
@ -277,12 +307,44 @@ void QApple::on_actionOptions_triggered()
|
|||
}
|
||||
}
|
||||
|
||||
currentOptions.mouseInSlot4 = g_Slot4 == CT_MouseInterface;
|
||||
currentOptions.cpmInSlot5 = g_Slot5 == CT_Z80;
|
||||
currentOptions.hdInSlot7 = HD_CardIsEnabled();
|
||||
|
||||
currentOptions.apple2Type = getApple2ComputerType();
|
||||
|
||||
myPreferences.setData(currentOptions);
|
||||
|
||||
if (myPreferences.exec())
|
||||
{
|
||||
const Preferences::Data newOptions = myPreferences.getData();
|
||||
|
||||
if (currentOptions.apple2Type != newOptions.apple2Type)
|
||||
{
|
||||
const eApple2Type type = computerTypes[newOptions.apple2Type];
|
||||
SetApple2Type(type);
|
||||
REGSAVE(TEXT(REGVALUE_APPLE2_TYPE), type);
|
||||
const eCpuType cpu = ProbeMainCpuDefault(type);
|
||||
SetMainCpu(cpu);
|
||||
REGSAVE(TEXT(REGVALUE_CPU_TYPE), cpu);
|
||||
}
|
||||
|
||||
if (currentOptions.mouseInSlot4 != newOptions.mouseInSlot4)
|
||||
{
|
||||
const SS_CARDTYPE card = newOptions.mouseInSlot4 ? CT_MouseInterface : CT_Empty;
|
||||
setSlot4(card);
|
||||
}
|
||||
if (currentOptions.cpmInSlot5 != newOptions.cpmInSlot5)
|
||||
{
|
||||
const SS_CARDTYPE card = newOptions.cpmInSlot5 ? CT_Z80 : CT_Empty;
|
||||
setSlot5(card);
|
||||
}
|
||||
if (currentOptions.hdInSlot7 != newOptions.hdInSlot7)
|
||||
{
|
||||
REGSAVE(TEXT(REGVALUE_HDD_ENABLED), newOptions.hdInSlot7 ? 1 : 0);
|
||||
HD_SetEnabled(newOptions.hdInSlot7);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < diskIDs.size(); ++i)
|
||||
{
|
||||
if (currentOptions.disks[i] != newOptions.disks[i])
|
||||
|
|
Loading…
Add table
Reference in a new issue