mirror of https://github.com/mgba-emu/mgba.git
Qt: Show checkmark for window sizes
This commit is contained in:
parent
cf8e84a1f8
commit
8e735a4668
1
CHANGES
1
CHANGES
|
@ -113,6 +113,7 @@ Misc:
|
||||||
- GBA BIOS: Stub out SoundBias
|
- GBA BIOS: Stub out SoundBias
|
||||||
- Qt: Gamepads can now have both buttons and analog axes mapped to the same key
|
- Qt: Gamepads can now have both buttons and analog axes mapped to the same key
|
||||||
- Qt: Increase usability of key mapper
|
- Qt: Increase usability of key mapper
|
||||||
|
- Qt: Show checkmark for window sizes
|
||||||
|
|
||||||
0.2.1: (2015-05-13)
|
0.2.1: (2015-05-13)
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
|
|
|
@ -103,6 +103,8 @@ public:
|
||||||
const QKeySequence& shortcut, const QString& visibleName, const QString& name);
|
const QKeySequence& shortcut, const QString& visibleName, const QString& name);
|
||||||
void addMenu(QMenu* menu, QMenu* parent = nullptr);
|
void addMenu(QMenu* menu, QMenu* parent = nullptr);
|
||||||
|
|
||||||
|
QAction* getAction(const QString& name);
|
||||||
|
|
||||||
QKeySequence shortcutAt(const QModelIndex& index) const;
|
QKeySequence shortcutAt(const QModelIndex& index) const;
|
||||||
bool isMenuAt(const QModelIndex& index) const;
|
bool isMenuAt(const QModelIndex& index) const;
|
||||||
|
|
||||||
|
|
|
@ -427,11 +427,27 @@ void Window::keyReleaseEvent(QKeyEvent* event) {
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::resizeEvent(QResizeEvent*) {
|
void Window::resizeEvent(QResizeEvent* event) {
|
||||||
if (!isFullScreen()) {
|
if (!isFullScreen()) {
|
||||||
m_config->setOption("height", m_screenWidget->height());
|
m_config->setOption("height", m_screenWidget->height());
|
||||||
m_config->setOption("width", m_screenWidget->width());
|
m_config->setOption("width", m_screenWidget->width());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int factor = 0;
|
||||||
|
if (event->size().width() % VIDEO_HORIZONTAL_PIXELS == 0 && event->size().height() % VIDEO_VERTICAL_PIXELS == 0 &&
|
||||||
|
event->size().width() / VIDEO_HORIZONTAL_PIXELS == event->size().height() / VIDEO_VERTICAL_PIXELS) {
|
||||||
|
factor = event->size().width() / VIDEO_HORIZONTAL_PIXELS;
|
||||||
|
}
|
||||||
|
for (QMap<int, QAction*>::iterator iter = m_frameSizes.begin(); iter != m_frameSizes.end(); ++iter) {
|
||||||
|
bool enableSignals = iter.value()->blockSignals(true);
|
||||||
|
if (iter.key() == factor) {
|
||||||
|
iter.value()->setChecked(true);
|
||||||
|
} else {
|
||||||
|
iter.value()->setChecked(false);
|
||||||
|
}
|
||||||
|
iter.value()->blockSignals(enableSignals);
|
||||||
|
}
|
||||||
|
|
||||||
m_config->setOption("fullscreen", isFullScreen());
|
m_config->setOption("fullscreen", isFullScreen());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -920,10 +936,12 @@ void Window::setupMenu(QMenuBar* menubar) {
|
||||||
m_shortcutController->addMenu(frameMenu, avMenu);
|
m_shortcutController->addMenu(frameMenu, avMenu);
|
||||||
for (int i = 1; i <= 6; ++i) {
|
for (int i = 1; i <= 6; ++i) {
|
||||||
QAction* setSize = new QAction(tr("%1x").arg(QString::number(i)), avMenu);
|
QAction* setSize = new QAction(tr("%1x").arg(QString::number(i)), avMenu);
|
||||||
|
setSize->setCheckable(true);
|
||||||
connect(setSize, &QAction::triggered, [this, i]() {
|
connect(setSize, &QAction::triggered, [this, i]() {
|
||||||
showNormal();
|
showNormal();
|
||||||
resizeFrame(VIDEO_HORIZONTAL_PIXELS * i, VIDEO_VERTICAL_PIXELS * i);
|
resizeFrame(VIDEO_HORIZONTAL_PIXELS * i, VIDEO_VERTICAL_PIXELS * i);
|
||||||
});
|
});
|
||||||
|
m_frameSizes[i] = setSize;
|
||||||
addControlledAction(frameMenu, setSize, QString("frame%1x").arg(QString::number(i)));
|
addControlledAction(frameMenu, setSize, QString("frame%1x").arg(QString::number(i)));
|
||||||
}
|
}
|
||||||
QKeySequence fullscreenKeys;
|
QKeySequence fullscreenKeys;
|
||||||
|
|
|
@ -148,6 +148,7 @@ private:
|
||||||
GameController* m_controller;
|
GameController* m_controller;
|
||||||
Display* m_display;
|
Display* m_display;
|
||||||
QList<QAction*> m_gameActions;
|
QList<QAction*> m_gameActions;
|
||||||
|
QMap<int, QAction*> m_frameSizes;
|
||||||
LogController m_log;
|
LogController m_log;
|
||||||
LogView* m_logView;
|
LogView* m_logView;
|
||||||
LoadSaveState* m_stateWindow;
|
LoadSaveState* m_stateWindow;
|
||||||
|
|
Loading…
Reference in New Issue