Merge branch 'master' into metal2

This commit is contained in:
Samuliak 2024-11-01 08:43:40 +01:00
commit d459f9c1c3
No known key found for this signature in database
5 changed files with 91 additions and 15 deletions

View file

@ -99,12 +99,22 @@ MainWindow::MainWindow(QApplication* app, QWidget* parent) : QMainWindow(parent)
}
}
if (emu->getConfig().appVersionOnWindow) {
setWindowTitle("Alber v" PANDA3DS_VERSION);
}
// Handle UI configs before setting up the emulator thread
{
auto& config = emu->getConfig();
auto& windowSettings = config.windowSettings;
if (emu->getConfig().printAppVersion) {
printf("Welcome to Panda3DS v%s!\n", PANDA3DS_VERSION);
if (windowSettings.showAppVersion) {
setWindowTitle("Alber v" PANDA3DS_VERSION);
}
if (windowSettings.rememberPosition) {
setGeometry(windowSettings.x, windowSettings.y, windowSettings.width, config.windowSettings.height);
}
if (config.printAppVersion) {
printf("Welcome to Panda3DS v%s!\n", PANDA3DS_VERSION);
}
}
// The emulator graphics context for the thread should be initialized in the emulator thread due to how GL contexts work
@ -224,6 +234,15 @@ void MainWindow::closeEvent(QCloseEvent *event) {
if (emuThread.joinable()) {
emuThread.join();
}
// Cache window position/size in config file to restore next time
const QRect& windowGeometry = geometry();
auto& windowConfig = emu->getConfig().windowSettings;
windowConfig.x = windowGeometry.x();
windowConfig.y = windowGeometry.y();
windowConfig.width = windowGeometry.width();
windowConfig.height = windowGeometry.height();
}
// Cleanup when the main window closes