Skip to content

Commit

Permalink
QApple: fix VidHD.
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
  • Loading branch information
audetto committed Dec 12, 2021
1 parent 28e5703 commit b80f7c5
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 8 deletions.
8 changes: 8 additions & 0 deletions source/frontends/qt/options.cpp
Expand Up @@ -60,6 +60,9 @@ namespace

void insertHD(HarddiskInterfaceCard * pHarddiskCard, const QString & filename, const int disk)
{
if (!pHarddiskCard)
return;

if (filename.isEmpty())
{
pHarddiskCard->Unplug(disk);
Expand Down Expand Up @@ -200,6 +203,7 @@ void getAppleWinPreferences(PreferenceData & data)
}

data.enhancedSpeed = pDisk2Card && pDisk2Card->GetEnhanceDisk();
data.cardInSlot3 = cardManager.QuerySlot(SLOT3);
data.cardInSlot4 = cardManager.QuerySlot(SLOT4);
data.cardInSlot5 = cardManager.QuerySlot(SLOT5);
data.hdInSlot7 = pHarddiskCard;
Expand Down Expand Up @@ -257,6 +261,10 @@ void setAppleWinPreferences(const std::shared_ptr<QtFrame> & frame, const Prefer
SetMainCpu(cpu);
REGSAVE(TEXT(REGVALUE_CPU_TYPE), cpu);
}
if (currentData.cardInSlot3 != newData.cardInSlot3)
{
SetSlot(SLOT3, newData.cardInSlot3);
}
if (currentData.cardInSlot4 != newData.cardInSlot4)
{
SetSlot(SLOT4, newData.cardInSlot4);
Expand Down
1 change: 1 addition & 0 deletions source/frontends/qt/options.h
Expand Up @@ -32,6 +32,7 @@ struct PreferenceData
GlobalOptions options;

eApple2Type apple2Type;
SS_CARDTYPE cardInSlot3;
SS_CARDTYPE cardInSlot4;
SS_CARDTYPE cardInSlot5;
bool hdInSlot7;
Expand Down
5 changes: 5 additions & 0 deletions source/frontends/qt/preferences.cpp
Expand Up @@ -121,6 +121,7 @@ namespace
const std::vector<eApple2Type> computerTypes = {A2TYPE_APPLE2, A2TYPE_APPLE2PLUS, A2TYPE_APPLE2JPLUS, A2TYPE_APPLE2E,
A2TYPE_APPLE2EENHANCED, A2TYPE_PRAVETS82, A2TYPE_PRAVETS8M, A2TYPE_PRAVETS8A,
A2TYPE_BASE64A, A2TYPE_TK30002E};
const std::vector<SS_CARDTYPE> cardsInSlot3 = {CT_Empty, CT_Uthernet, CT_Uthernet2, CT_VidHD};
const std::vector<SS_CARDTYPE> cardsInSlot4 = {CT_Empty, CT_MouseInterface, CT_MockingboardC, CT_Phasor};
const std::vector<SS_CARDTYPE> cardsInSlot5 = {CT_Empty, CT_Z80, CT_MockingboardC, CT_SAM};

Expand Down Expand Up @@ -219,6 +220,9 @@ void Preferences::setData(const PreferenceData & data)
const int apple2Index = getIndexInList(computerTypes, data.apple2Type, 2);
ui->apple2Type->setCurrentIndex(apple2Index);

const int slot3Index = getIndexInList(cardsInSlot3, data.cardInSlot3, 0);
ui->slot3_combo->setCurrentIndex(slot3Index);

const int slot4Index = getIndexInList(cardsInSlot4, data.cardInSlot4, 0);
ui->slot4_combo->setCurrentIndex(slot4Index);

Expand Down Expand Up @@ -266,6 +270,7 @@ PreferenceData Preferences::getData() const
data.mockingboardVolume = ui->mb_volume->maximum() - ui->mb_volume->value();
data.enhancedSpeed = ui->enhanced_speed->isChecked();
data.apple2Type = computerTypes[ui->apple2Type->currentIndex()];
data.cardInSlot3 = cardsInSlot3[ui->slot3_combo->currentIndex()];
data.cardInSlot4 = cardsInSlot4[ui->slot4_combo->currentIndex()];
data.cardInSlot5 = cardsInSlot5[ui->slot5_combo->currentIndex()];
data.hdInSlot7 = ui->hd_7->isChecked();
Expand Down
45 changes: 38 additions & 7 deletions source/frontends/qt/preferences.ui
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>648</width>
<height>319</height>
<height>335</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -40,28 +40,28 @@
<string>Slots</string>
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="4" column="0">
<item row="5" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Slot 4</string>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Slot 5</string>
</property>
</widget>
</item>
<item row="6" column="0">
<item row="7" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Slot 7</string>
</property>
</widget>
</item>
<item row="6" column="1">
<item row="7" column="1">
<widget class="QCheckBox" name="hd_7">
<property name="text">
<string>Hard Disk</string>
Expand Down Expand Up @@ -118,7 +118,7 @@
</property>
</widget>
</item>
<item row="4" column="1">
<item row="5" column="1">
<widget class="QComboBox" name="slot4_combo">
<item>
<property name="text">
Expand All @@ -142,7 +142,7 @@
</item>
</widget>
</item>
<item row="5" column="1">
<item row="6" column="1">
<widget class="QComboBox" name="slot5_combo">
<item>
<property name="text">
Expand All @@ -166,6 +166,37 @@
</item>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_21">
<property name="text">
<string>Slot 3</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="slot3_combo">
<item>
<property name="text">
<string>Empty</string>
</property>
</item>
<item>
<property name="text">
<string>Uthernet</string>
</property>
</item>
<item>
<property name="text">
<string>Uthernet II</string>
</property>
</item>
<item>
<property name="text">
<string>Video HD</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down
2 changes: 2 additions & 0 deletions source/frontends/qt/qapple.pro
Expand Up @@ -52,6 +52,8 @@ LIBS += -L$$PWD/../../../build/source/frontends/qt/QHexView -lqhexview-lib
LIBS += -levdev

INCLUDEPATH += $$PWD/../../../source
INCLUDEPATH += $$PWD/../../../source/linux/libwindows
INCLUDEPATH += $$PWD/QHexView
INCLUDEPATH += /usr/include/minizip

QMAKE_RPATHDIR += $ORIGIN/../..
5 changes: 4 additions & 1 deletion source/frontends/qt/qvideo.cpp
Expand Up @@ -31,6 +31,9 @@ void QVideo::loadVideoSettings()
myWidth = video.GetFrameBufferWidth();
myHeight = video.GetFrameBufferHeight();

myLogoX = mySX + video.GetFrameBufferCentringOffsetX();
myLogoY = mySY + video.GetFrameBufferCentringOffsetY();

myFrameBuffer = video.GetFrameBuffer();
}

Expand Down Expand Up @@ -58,7 +61,7 @@ void QVideo::displayLogo()
QImage frameBuffer = getScreenImage();

QPainter painter(&frameBuffer);
painter.drawImage(mySX, mySY, myLogo);
painter.drawImage(myLogoX, myLogoY, myLogo);
}

void QVideo::paintEvent(QPaintEvent *)
Expand Down
3 changes: 3 additions & 0 deletions source/frontends/qt/qvideo.h
Expand Up @@ -41,6 +41,9 @@ public slots:
int myWidth;
int myHeight;

int myLogoX;
int myLogoY;

quint8 * myFrameBuffer;

QImage getScreenImage() const;
Expand Down

0 comments on commit b80f7c5

Please sign in to comment.