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
memorycontainer.cpp
gamepadpaddle.cpp
video.cpp
qvideo.cpp
configuration.cpp
options.cpp
loggingcategory.cpp

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,4 @@
#include "video.h"
#include "qvideo.h"
#include <QPainter>
#include <QKeyEvent>
@ -11,28 +11,36 @@
#include "MouseInterface.h"
#include "Core.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);
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;
}
QImage Video::getScreen() const
QImage QVideo::getScreen() const
{
QImage frameBuffer = getScreenImage();
QImage screen = frameBuffer.copy(mySX, mySY, mySW, mySH);
@ -40,7 +48,7 @@ QImage Video::getScreen() const
return screen;
}
void Video::displayLogo()
void QVideo::displayLogo()
{
QImage frameBuffer = getScreenImage();
@ -48,7 +56,7 @@ void Video::displayLogo()
painter.drawImage(mySX, mySY, myLogo);
}
void Video::paintEvent(QPaintEvent *)
void QVideo::paintEvent(QPaintEvent *)
{
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))
{
@ -82,11 +90,11 @@ bool Video::event(QEvent *event)
}
else
{
return VIDEO_BASECLASS::event(event);
return QVIDEO_BASECLASS::event(event);
}
}
void Video::keyReleaseEvent(QKeyEvent *event)
void QVideo::keyReleaseEvent(QKeyEvent *event)
{
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();
@ -197,11 +205,11 @@ void Video::keyPressEvent(QKeyEvent *event)
}
else
{
VIDEO_BASECLASS::keyPressEvent(event);
QVIDEO_BASECLASS::keyPressEvent(event);
}
}
void Video::mouseMoveEvent(QMouseEvent *event)
void QVideo::mouseMoveEvent(QMouseEvent *event)
{
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();
@ -250,7 +258,7 @@ void Video::mousePressEvent(QMouseEvent *event)
}
}
void Video::mouseReleaseEvent(QMouseEvent *event)
void QVideo::mouseReleaseEvent(QMouseEvent *event)
{
CardManager & cardManager = GetCardMgr();

View file

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