mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-07-09 00:28:42 +12:00
Qt: Optionally remember window pos/size
This commit is contained in:
parent
7ae8412919
commit
818271c7ad
3 changed files with 66 additions and 10 deletions
|
@ -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
|
||||
|
@ -221,6 +231,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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue