[Feature] Add support for windows position restore#1016
Conversation
There was a problem hiding this comment.
This doesn't take into account whatever the user may or may not have screens available for positioning.
In the case of some monitors, depending on the port used, the screen may or may not be listed as available when they are not switched on. This code has the side effect of potentially moving the windows out of reach without any way of figuring out how to restore it if they're not tech-savvy enough.
And no, we shouldn't rely on tech-support to let everybody know how certain key combinations or window manager may be used depending on the system they use.
src/courtroom.cpp
Outdated
| auto maybe_point = Options::getInstance().windowPosition("courtroom"); | ||
| if (maybe_point.has_value()) { | ||
| qDebug() << maybe_point.value(); | ||
| QMainWindow::move(maybe_point.value()); |
src/aoapplication.cpp
Outdated
| int x = (geometry.width() - w_lobby->width()) / 2; | ||
| int y = (geometry.height() - w_lobby->height()) / 2; | ||
| w_lobby->move(x, y); | ||
| auto point = Options::getInstance().windowPosition("lobby"); |
There was a problem hiding this comment.
Same as previously stated.
src/options.h
Outdated
| */ | ||
| QSettings favorite; | ||
|
|
||
| QSettings windows; |
TrickyLeifa
left a comment
There was a problem hiding this comment.
Needs a more robust system for keeping track of screens before restoring position.
src/courtroom.cpp
Outdated
| if (Options::getInstance().restoreWindowPositionEnabled()) | ||
| { | ||
| auto maybe_point = Options::getInstance().windowPosition("courtroom"); | ||
| if (maybe_point.has_value() && ao_app->pointExistsOnScreen(maybe_point.value())) | ||
| { | ||
| qDebug() << maybe_point.value(); | ||
| QMainWindow::move(maybe_point.value()); | ||
| } | ||
| } |
There was a problem hiding this comment.
The position should be restored on creation of the courtroom, within AOApplication, not from within the Courtroom.
Additionally, it should be consistent with the Lobby, centering if required to the primary screen, no reason it shouldn't here.
No description provided.