Rename Video -> QVideo due to name clash.

Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
Andrea Odetti 2020-12-28 20:00:16 +00:00
parent 247b51b2ab
commit a1ba1d2cd1
9 changed files with 70 additions and 63 deletions

View file

@ -15,7 +15,7 @@ add_executable(qapple
emulator.cpp emulator.cpp
memorycontainer.cpp memorycontainer.cpp
gamepadpaddle.cpp gamepadpaddle.cpp
video.cpp qvideo.cpp
configuration.cpp configuration.cpp
options.cpp options.cpp
loggingcategory.cpp loggingcategory.cpp

View file

@ -44,6 +44,11 @@ bool Emulator::saveScreen(const QString & filename) const
return ui->video->getScreen().save(filename); return ui->video->getScreen().save(filename);
} }
void Emulator::loadVideoSettings()
{
ui->video->loadVideoSettings();
}
void Emulator::displayLogo() void Emulator::displayLogo()
{ {
ui->video->displayLogo(); ui->video->displayLogo();

View file

@ -22,6 +22,7 @@ public:
void refreshScreen(); // just repaint void refreshScreen(); // just repaint
bool saveScreen(const QString & filename) const; bool saveScreen(const QString & filename) const;
void loadVideoSettings();
void displayLogo(); void displayLogo();
void setZoom(QMdiSubWindow * window, const int x); void setZoom(QMdiSubWindow * window, const int x);

View file

@ -21,7 +21,7 @@
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="0" column="0">
<widget class="Video" name="video" native="true"> <widget class="QVideo" name="video" native="true">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>560</width> <width>560</width>
@ -37,9 +37,9 @@
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>
<class>Video</class> <class>QVideo</class>
<extends>QWidget</extends> <extends>QWidget</extends>
<header>video.h</header> <header>qvideo.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
</customwidgets> </customwidgets>

View file

@ -14,7 +14,6 @@
#include "Speaker.h" #include "Speaker.h"
#include "Mockingboard.h" #include "Mockingboard.h"
#include "Configuration/IPropertySheet.h" #include "Configuration/IPropertySheet.h"
#include "Windows/WinVideo.h"
#include <QMessageBox> #include <QMessageBox>
#include <QGamepad> #include <QGamepad>
@ -223,11 +222,13 @@ void getAppleWinPreferences(PreferenceData & data)
data.saveState = QString::fromStdString(saveState); data.saveState = QString::fromStdString(saveState);
} }
data.videoType = GetVideoType(); Video & video = GetVideo();
data.scanLines = IsVideoStyle(VS_HALF_SCANLINES);
data.verticalBlend = IsVideoStyle(VS_COLOR_VERTICAL_BLEND); data.videoType = video.GetVideoType();
data.hz50 = GetVideoRefreshRate() == VR_50HZ; data.scanLines = video.IsVideoStyle(VS_HALF_SCANLINES);
data.monochromeColor.setRgb(g_nMonochromeRGB); data.verticalBlend = video.IsVideoStyle(VS_COLOR_VERTICAL_BLEND);
data.hz50 = video.GetVideoRefreshRate() == VR_50HZ;
data.monochromeColor.setRgb(video.GetMonochromeRGB());
} }
void setAppleWinPreferences(const PreferenceData & currentData, const PreferenceData & newData) void setAppleWinPreferences(const PreferenceData & currentData, const PreferenceData & newData)
@ -301,25 +302,27 @@ void setAppleWinPreferences(const PreferenceData & currentData, const Preference
if (currentData.videoType != newData.videoType || currentData.scanLines != newData.scanLines || currentData.verticalBlend != newData.verticalBlend if (currentData.videoType != newData.videoType || currentData.scanLines != newData.scanLines || currentData.verticalBlend != newData.verticalBlend
|| currentData.hz50 != newData.hz50 || currentData.monochromeColor != newData.monochromeColor) || currentData.hz50 != newData.hz50 || currentData.monochromeColor != newData.monochromeColor)
{ {
Video & video = GetVideo();
const VideoType_e videoType = VideoType_e(newData.videoType); const VideoType_e videoType = VideoType_e(newData.videoType);
SetVideoType(videoType); video.SetVideoType(videoType);
VideoStyle_e videoStyle = VS_NONE; VideoStyle_e videoStyle = VS_NONE;
if (newData.scanLines) if (newData.scanLines)
videoStyle = VideoStyle_e(videoStyle | VS_HALF_SCANLINES); videoStyle = VideoStyle_e(videoStyle | VS_HALF_SCANLINES);
if (newData.verticalBlend) if (newData.verticalBlend)
videoStyle = VideoStyle_e(videoStyle | VS_COLOR_VERTICAL_BLEND); videoStyle = VideoStyle_e(videoStyle | VS_COLOR_VERTICAL_BLEND);
SetVideoStyle(videoStyle); video.SetVideoStyle(videoStyle);
const VideoRefreshRate_e videoRefreshRate = newData.hz50 ? VR_50HZ : VR_60HZ; const VideoRefreshRate_e videoRefreshRate = newData.hz50 ? VR_50HZ : VR_60HZ;
SetVideoRefreshRate(videoRefreshRate); video.SetVideoRefreshRate(videoRefreshRate);
const QColor color = newData.monochromeColor; const QColor color = newData.monochromeColor;
// be careful QRgb is opposite way round to COLORREF // be careful QRgb is opposite way round to COLORREF
g_nMonochromeRGB = RGB(color.red(), color.green(), color.blue()); video.SetMonochromeRGB(RGB(color.red(), color.green(), color.blue()));
Config_Save_Video(); video.Config_Save_Video();
VideoReinitialize(); video.VideoReinitialize();
GetFrame().VideoRedrawScreen(); GetFrame().VideoRedrawScreen();
} }

View file

@ -111,6 +111,7 @@ namespace
GetVideo().Initialize(); GetVideo().Initialize();
VideoSwitchVideocardPalette(RGB_GetVideocard(), GetVideo().GetVideoType()); VideoSwitchVideocardPalette(RGB_GetVideocard(), GetVideo().GetVideoType());
emulator->loadVideoSettings();
emulator->displayLogo(); emulator->displayLogo();
GetCardMgr().GetDisk2CardMgr().Reset(); GetCardMgr().GetDisk2CardMgr().Reset();
@ -151,20 +152,6 @@ namespace
} }
void FrameDrawDiskLEDS(HDC)
{
}
void FrameDrawDiskStatus(HDC)
{
}
void FrameRefreshStatus(int, bool)
{
}
// MessageBox // MessageBox
int MessageBox(HWND, const char * text, const char * caption, UINT type) int MessageBox(HWND, const char * text, const char * caption, UINT type)

View file

@ -30,7 +30,7 @@ SOURCES += main.cpp\
qresources.cpp \ qresources.cpp \
emulator.cpp \ emulator.cpp \
configuration.cpp \ configuration.cpp \
video.cpp \ qvideo.cpp \
memorycontainer.cpp \ memorycontainer.cpp \
preferences.cpp \ preferences.cpp \
gamepadpaddle.cpp \ gamepadpaddle.cpp \
@ -54,7 +54,7 @@ HEADERS += qapple.h \
options.h \ options.h \
qdirectsound.h \ qdirectsound.h \
configuration.h \ configuration.h \
video.h \ qvideo.h \
memorycontainer.h \ memorycontainer.h \
preferences.h \ preferences.h \
gamepadpaddle.h \ gamepadpaddle.h \

View file

@ -1,4 +1,4 @@
#include "video.h" #include "qvideo.h"
#include <QPainter> #include <QPainter>
#include <QKeyEvent> #include <QKeyEvent>
@ -11,28 +11,36 @@
#include "MouseInterface.h" #include "MouseInterface.h"
#include "Core.h" #include "Core.h"
#include "Video.h" #include "Video.h"
#include "Interface.h"
Video::Video(QWidget *parent) : VIDEO_BASECLASS(parent) QVideo::QVideo(QWidget *parent) : QVIDEO_BASECLASS(parent)
{ {
setMouseTracking(true); this->setMouseTracking(true);
myLogo = QImage(":/resources/APPLEWINLOGO.BMP").mirrored(false, true); myLogo = QImage(":/resources/APPLEWINLOGO.BMP").mirrored(false, true);
mySX = GetFrameBufferBorderWidth();
mySY = GetFrameBufferBorderHeight();
mySW = GetFrameBufferBorderlessWidth();
mySH = GetFrameBufferBorderlessHeight();
myWidth = GetFrameBufferWidth();
myHeight = GetFrameBufferHeight();
} }
QImage Video::getScreenImage() const void QVideo::loadVideoSettings()
{ {
QImage frameBuffer(g_pFramebufferbits, myWidth, myHeight, QImage::Format_ARGB32_Premultiplied); Video & video = GetVideo();
mySX = video.GetFrameBufferBorderWidth();
mySY = video.GetFrameBufferBorderHeight();
mySW = video.GetFrameBufferBorderlessWidth();
mySH = video.GetFrameBufferBorderlessHeight();
myWidth = video.GetFrameBufferWidth();
myHeight = video.GetFrameBufferHeight();
myFrameBuffer = video.GetFrameBuffer();
}
QImage QVideo::getScreenImage() const
{
QImage frameBuffer(myFrameBuffer, myWidth, myHeight, QImage::Format_ARGB32_Premultiplied);
return frameBuffer; return frameBuffer;
} }
QImage Video::getScreen() const QImage QVideo::getScreen() const
{ {
QImage frameBuffer = getScreenImage(); QImage frameBuffer = getScreenImage();
QImage screen = frameBuffer.copy(mySX, mySY, mySW, mySH); QImage screen = frameBuffer.copy(mySX, mySY, mySW, mySH);
@ -40,7 +48,7 @@ QImage Video::getScreen() const
return screen; return screen;
} }
void Video::displayLogo() void QVideo::displayLogo()
{ {
QImage frameBuffer = getScreenImage(); QImage frameBuffer = getScreenImage();
@ -48,7 +56,7 @@ void Video::displayLogo()
painter.drawImage(mySX, mySY, myLogo); painter.drawImage(mySX, mySY, myLogo);
} }
void Video::paintEvent(QPaintEvent *) void QVideo::paintEvent(QPaintEvent *)
{ {
QImage frameBuffer = getScreenImage(); QImage frameBuffer = getScreenImage();
@ -68,7 +76,7 @@ void Video::paintEvent(QPaintEvent *)
} }
} }
bool Video::event(QEvent *event) bool QVideo::event(QEvent *event)
{ {
if (isEnabled() && (event->type() == QEvent::KeyPress)) if (isEnabled() && (event->type() == QEvent::KeyPress))
{ {
@ -82,11 +90,11 @@ bool Video::event(QEvent *event)
} }
else else
{ {
return VIDEO_BASECLASS::event(event); return QVIDEO_BASECLASS::event(event);
} }
} }
void Video::keyReleaseEvent(QKeyEvent *event) void QVideo::keyReleaseEvent(QKeyEvent *event)
{ {
if (!event->isAutoRepeat()) if (!event->isAutoRepeat())
{ {
@ -104,10 +112,10 @@ void Video::keyReleaseEvent(QKeyEvent *event)
} }
} }
VIDEO_BASECLASS::keyReleaseEvent(event); QVIDEO_BASECLASS::keyReleaseEvent(event);
} }
void Video::keyPressEvent(QKeyEvent *event) void QVideo::keyPressEvent(QKeyEvent *event)
{ {
const int key = event->key(); const int key = event->key();
@ -197,11 +205,11 @@ void Video::keyPressEvent(QKeyEvent *event)
} }
else else
{ {
VIDEO_BASECLASS::keyPressEvent(event); QVIDEO_BASECLASS::keyPressEvent(event);
} }
} }
void Video::mouseMoveEvent(QMouseEvent *event) void QVideo::mouseMoveEvent(QMouseEvent *event)
{ {
CardManager & cardManager = GetCardMgr(); CardManager & cardManager = GetCardMgr();
@ -228,7 +236,7 @@ void Video::mouseMoveEvent(QMouseEvent *event)
} }
} }
void Video::mousePressEvent(QMouseEvent *event) void QVideo::mousePressEvent(QMouseEvent *event)
{ {
CardManager & cardManager = GetCardMgr(); CardManager & cardManager = GetCardMgr();
@ -250,7 +258,7 @@ void Video::mousePressEvent(QMouseEvent *event)
} }
} }
void Video::mouseReleaseEvent(QMouseEvent *event) void QVideo::mouseReleaseEvent(QMouseEvent *event)
{ {
CardManager & cardManager = GetCardMgr(); CardManager & cardManager = GetCardMgr();

View file

@ -1,18 +1,19 @@
#ifndef VIDEO_H #ifndef QVIDEO_H
#define VIDEO_H #define QVIDEO_H
#include <QOpenGLWidget> #include <QOpenGLWidget>
#define VIDEO_BASECLASS QOpenGLWidget #define QVIDEO_BASECLASS QOpenGLWidget
//#define VIDEO_BASECLASS QWidget //#define QVIDEO_BASECLASS QWidget
class Video : public VIDEO_BASECLASS class QVideo : public QVIDEO_BASECLASS
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit Video(QWidget *parent = nullptr); explicit QVideo(QWidget *parent = nullptr);
QImage getScreen() const; QImage getScreen() const;
void loadVideoSettings();
void displayLogo(); void displayLogo();
signals: signals:
@ -39,7 +40,9 @@ private:
int myWidth; int myWidth;
int myHeight; int myHeight;
quint8 * myFrameBuffer;
QImage getScreenImage() const; QImage getScreenImage() const;
}; };
#endif // VIDEO_H #endif // QVIDEO_H