mirror of https://github.com/mgba-emu/mgba.git
Qt: Add option for disabling OSD messages
This commit is contained in:
parent
54b92bee16
commit
546f787eb3
1
CHANGES
1
CHANGES
|
@ -83,6 +83,7 @@ Misc:
|
|||
- Qt: Printer quality of life improvements (fixes mgba.io/i/1540)
|
||||
- Qt: Add copy and QoL improvements to graphic views (closes mgba.io/i/1541)
|
||||
- Qt: Show list of all sprites in sprite view
|
||||
- Qt: Add option for disabling OSD messages
|
||||
|
||||
0.7.3: (2019-09-15)
|
||||
Emulation fixes:
|
||||
|
|
|
@ -75,6 +75,10 @@ void Display::interframeBlending(bool lock) {
|
|||
m_interframeBlending = lock;
|
||||
}
|
||||
|
||||
void Display::showOSDMessages(bool enable) {
|
||||
m_showOSD = enable;
|
||||
}
|
||||
|
||||
void Display::filter(bool filter) {
|
||||
m_filter = filter;
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ public:
|
|||
bool isIntegerScalingLocked() const { return m_lockIntegerScaling; }
|
||||
bool hasInterframeBlending() const { return m_interframeBlending; }
|
||||
bool isFiltered() const { return m_filter; }
|
||||
bool isShowOSD() const { return m_showOSD; }
|
||||
|
||||
virtual void startDrawing(std::shared_ptr<CoreController>) = 0;
|
||||
virtual bool isDrawing() const = 0;
|
||||
|
@ -66,6 +67,7 @@ public slots:
|
|||
virtual void lockAspectRatio(bool lock);
|
||||
virtual void lockIntegerScaling(bool lock);
|
||||
virtual void interframeBlending(bool enable);
|
||||
virtual void showOSDMessages(bool enable);
|
||||
virtual void filter(bool filter);
|
||||
virtual void framePosted() = 0;
|
||||
virtual void setShaders(struct VDir*) = 0;
|
||||
|
@ -85,6 +87,7 @@ private:
|
|||
static const int MOUSE_DISAPPEAR_TIMER = 1000;
|
||||
|
||||
MessagePainter m_messagePainter;
|
||||
bool m_showOSD = true;
|
||||
bool m_lockAspectRatio = false;
|
||||
bool m_lockIntegerScaling = false;
|
||||
bool m_interframeBlending = false;
|
||||
|
|
|
@ -111,6 +111,7 @@ void DisplayGL::startDrawing(std::shared_ptr<CoreController> controller) {
|
|||
lockAspectRatio(isAspectRatioLocked());
|
||||
lockIntegerScaling(isIntegerScalingLocked());
|
||||
interframeBlending(hasInterframeBlending());
|
||||
showOSDMessages(isShowOSD());
|
||||
filter(isFiltered());
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
|
||||
messagePainter()->resize(size(), isAspectRatioLocked(), devicePixelRatioF());
|
||||
|
@ -184,6 +185,13 @@ void DisplayGL::interframeBlending(bool enable) {
|
|||
}
|
||||
}
|
||||
|
||||
void DisplayGL::showOSDMessages(bool enable) {
|
||||
Display::showOSDMessages(enable);
|
||||
if (m_drawThread) {
|
||||
QMetaObject::invokeMethod(m_painter, "showOSD", Q_ARG(bool, enable));
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayGL::filter(bool filter) {
|
||||
Display::filter(filter);
|
||||
if (m_drawThread) {
|
||||
|
@ -370,6 +378,10 @@ void PainterGL::interframeBlending(bool enable) {
|
|||
m_backend->interframeBlending = enable;
|
||||
}
|
||||
|
||||
void PainterGL::showOSD(bool enable) {
|
||||
m_showOSD = enable;
|
||||
}
|
||||
|
||||
void PainterGL::filter(bool filter) {
|
||||
m_backend->filter = filter;
|
||||
if (m_started && !m_active) {
|
||||
|
@ -458,7 +470,7 @@ void PainterGL::performDraw() {
|
|||
m_backend->resized(m_backend, m_size.width() * r, m_size.height() * r);
|
||||
m_backend->drawFrame(m_backend);
|
||||
m_painter.endNativePainting();
|
||||
if (m_messagePainter) {
|
||||
if (m_showOSD && m_messagePainter) {
|
||||
m_messagePainter->paint(&m_painter);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ public slots:
|
|||
void lockAspectRatio(bool lock) override;
|
||||
void lockIntegerScaling(bool lock) override;
|
||||
void interframeBlending(bool enable) override;
|
||||
void showOSDMessages(bool enable) override;
|
||||
void filter(bool filter) override;
|
||||
void framePosted() override;
|
||||
void setShaders(struct VDir*) override;
|
||||
|
@ -102,6 +103,7 @@ public slots:
|
|||
void lockAspectRatio(bool lock);
|
||||
void lockIntegerScaling(bool lock);
|
||||
void interframeBlending(bool enable);
|
||||
void showOSD(bool enable);
|
||||
void filter(bool filter);
|
||||
void resizeContext();
|
||||
|
||||
|
@ -127,6 +129,7 @@ private:
|
|||
bool m_started = false;
|
||||
std::shared_ptr<CoreController> m_context = nullptr;
|
||||
bool m_supportsShaders;
|
||||
bool m_showOSD;
|
||||
VideoShader m_shader{};
|
||||
VideoBackend* m_backend = nullptr;
|
||||
QSize m_size;
|
||||
|
|
|
@ -122,5 +122,7 @@ void DisplayQt::paintEvent(QPaintEvent*) {
|
|||
}
|
||||
painter.drawImage(full, m_backing, QRect(0, 0, m_width, m_height));
|
||||
painter.setOpacity(1);
|
||||
if (isShowOSD()) {
|
||||
messagePainter()->paint(&painter);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -377,6 +377,7 @@ void SettingsView::updateConfig() {
|
|||
saveSetting("lockAspectRatio", m_ui.lockAspectRatio);
|
||||
saveSetting("lockIntegerScaling", m_ui.lockIntegerScaling);
|
||||
saveSetting("interframeBlending", m_ui.interframeBlending);
|
||||
saveSetting("showOSD", m_ui.showOSD);
|
||||
saveSetting("volume", m_ui.volume);
|
||||
saveSetting("mute", m_ui.mute);
|
||||
saveSetting("fastForwardVolume", m_ui.volumeFf);
|
||||
|
@ -547,6 +548,7 @@ void SettingsView::reloadConfig() {
|
|||
loadSetting("lockAspectRatio", m_ui.lockAspectRatio);
|
||||
loadSetting("lockIntegerScaling", m_ui.lockIntegerScaling);
|
||||
loadSetting("interframeBlending", m_ui.interframeBlending);
|
||||
loadSetting("showOSD", m_ui.showOSD, true);
|
||||
loadSetting("volume", m_ui.volume, 0x100);
|
||||
loadSetting("mute", m_ui.mute, false);
|
||||
loadSetting("fastForwardVolume", m_ui.volumeFf, m_ui.volume->value());
|
||||
|
|
|
@ -562,7 +562,21 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<item row="9" column="1">
|
||||
<widget class="QCheckBox" name="pauseOnMinimize">
|
||||
<property name="text">
|
||||
<string>Pause when minimized</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0" colspan="2">
|
||||
<widget class="Line" name="line_17">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QCheckBox" name="showFps">
|
||||
<property name="text">
|
||||
<string>Show FPS in title bar</string>
|
||||
|
@ -572,41 +586,21 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0" colspan="2">
|
||||
<item row="13" column="1">
|
||||
<widget class="QCheckBox" name="useDiscordPresence">
|
||||
<property name="text">
|
||||
<string>Enable Discord Rich Presence</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="0" colspan="2">
|
||||
<widget class="Line" name="line_13">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="0" colspan="2">
|
||||
<widget class="Line" name="line_16">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="1">
|
||||
<widget class="QCheckBox" name="cheatAutosave">
|
||||
<property name="text">
|
||||
<string>Automatically save cheats</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="1">
|
||||
<widget class="QCheckBox" name="cheatAutoload">
|
||||
<property name="text">
|
||||
<string>Automatically load cheats</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<item row="15" column="1">
|
||||
<widget class="QCheckBox" name="autosave">
|
||||
<property name="text">
|
||||
<string>Automatically save state</string>
|
||||
|
@ -616,7 +610,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="1">
|
||||
<item row="16" column="1">
|
||||
<widget class="QCheckBox" name="autoload">
|
||||
<property name="text">
|
||||
<string>Automatically load state</string>
|
||||
|
@ -626,17 +620,40 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QCheckBox" name="useDiscordPresence">
|
||||
<property name="text">
|
||||
<string>Enable Discord Rich Presence</string>
|
||||
<item row="17" column="0" colspan="2">
|
||||
<widget class="Line" name="line_16">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QCheckBox" name="pauseOnMinimize">
|
||||
<item row="18" column="1">
|
||||
<widget class="QCheckBox" name="cheatAutosave">
|
||||
<property name="text">
|
||||
<string>Pause when minimized</string>
|
||||
<string>Automatically save cheats</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="19" column="1">
|
||||
<widget class="QCheckBox" name="cheatAutoload">
|
||||
<property name="text">
|
||||
<string>Automatically load cheats</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<widget class="QCheckBox" name="showOSD">
|
||||
<property name="text">
|
||||
<string>Show OSD messages</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -738,6 +738,7 @@ void Window::gameStarted() {
|
|||
m_config->updateOption("lockIntegerScaling");
|
||||
m_config->updateOption("lockAspectRatio");
|
||||
m_config->updateOption("interframeBlending");
|
||||
m_config->updateOption("showOSD");
|
||||
if (m_savedScale > 0) {
|
||||
resizeFrame(size * m_savedScale);
|
||||
}
|
||||
|
@ -908,6 +909,7 @@ void Window::reloadDisplayDriver() {
|
|||
m_display->lockIntegerScaling(opts->lockIntegerScaling);
|
||||
m_display->interframeBlending(opts->interframeBlending);
|
||||
m_display->filter(opts->resampleVideo);
|
||||
m_config->updateOption("showOSD");
|
||||
#if defined(BUILD_GL) || defined(BUILD_GLES2)
|
||||
if (opts->shader) {
|
||||
struct VDir* shader = VDirOpen(opts->shader);
|
||||
|
@ -1603,6 +1605,13 @@ void Window::setupMenu(QMenuBar* menubar) {
|
|||
}
|
||||
}, this);
|
||||
|
||||
ConfigOption* showOSD = m_config->addOption("showOSD");
|
||||
showOSD->connect([this](const QVariant& value) {
|
||||
if (m_display) {
|
||||
m_display->showOSDMessages(value.toBool());
|
||||
}
|
||||
}, this);
|
||||
|
||||
m_actions.addHiddenAction(tr("Exit fullscreen"), "exitFullScreen", this, &Window::exitFullScreen, "frame", QKeySequence("Esc"));
|
||||
|
||||
m_actions.addHeldAction(tr("GameShark Button (held)"), "holdGSButton", [this](bool held) {
|
||||
|
|
Loading…
Reference in New Issue