Skip to content

[Feature] Add support for windows position restore#1016

Merged
TrickyLeifa merged 10 commits intomasterfrom
restore-window-position
Jul 12, 2024
Merged

[Feature] Add support for windows position restore#1016
TrickyLeifa merged 10 commits intomasterfrom
restore-window-position

Conversation

@Salanto
Copy link
Contributor

@Salanto Salanto commented Jul 11, 2024

No description provided.

@Salanto Salanto requested a review from TrickyLeifa July 11, 2024 14:26
Copy link
Contributor

@TrickyLeifa TrickyLeifa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

auto maybe_point = Options::getInstance().windowPosition("courtroom");
if (maybe_point.has_value()) {
qDebug() << maybe_point.value();
QMainWindow::move(maybe_point.value());
Copy link
Contributor

@TrickyLeifa TrickyLeifa Jul 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above.

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");
Copy link
Contributor

@TrickyLeifa TrickyLeifa Jul 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as previously stated.

src/options.h Outdated
*/
QSettings favorite;

QSettings windows;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't used...

Copy link
Contributor

@TrickyLeifa TrickyLeifa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a more robust system for keeping track of screens before restoring position.

@Salanto Salanto requested a review from TrickyLeifa July 11, 2024 22:12
@Salanto Salanto linked an issue Jul 12, 2024 that may be closed by this pull request
Comment on lines +1373 to +1381
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());
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@TrickyLeifa TrickyLeifa merged commit d056365 into master Jul 12, 2024
@TrickyLeifa TrickyLeifa deleted the restore-window-position branch July 12, 2024 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Restore Window Position

2 participants