-
Notifications
You must be signed in to change notification settings - Fork 80
Save size, position for Main Window, Output Window on program start #630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
0ee4e7e
1fabc4c
08d1dc5
6d2f732
04509a8
10477d2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ | |
| #include "CommonFramework/Startup/NewVersionCheck.h" | ||
| #include "CommonFramework/Options/ResolutionOption.h" | ||
| #include "CommonFramework/Options/Environment/ThemeSelectorOption.h" | ||
| #include "CommonFramework/Windows/DpiScaler.h" | ||
| #include "PanelLists.h" | ||
| #include "WindowTracker.h" | ||
| #include "ButtonDiagram.h" | ||
|
|
@@ -46,6 +47,16 @@ MainWindow::MainWindow(QWidget* parent) | |
| GlobalSettings::instance().WINDOW_SIZE->WIDTH, | ||
| GlobalSettings::instance().WINDOW_SIZE->HEIGHT | ||
| ); | ||
| // move main window to desired position on startup | ||
| auto const screen_geometry = QGuiApplication::primaryScreen()->availableGeometry(); | ||
| uint32_t const screen_width = (uint32_t)screen_geometry.width(); | ||
| uint32_t const screen_height = (uint32_t)screen_geometry.height(); | ||
| uint32_t initial_x_pos_main = GlobalSettings::instance().WINDOW_SIZE->INITIAL_X_POS; | ||
| uint32_t initial_y_pos_main = GlobalSettings::instance().WINDOW_SIZE->INITIAL_Y_POS; | ||
| uint32_t move_x_main = std::min(initial_x_pos_main, screen_width-100); | ||
|
||
| uint32_t move_y_main = std::min(initial_y_pos_main, screen_height-100); | ||
| move(scale_dpi_width(move_x_main), scale_dpi_height(move_y_main)); | ||
|
|
||
| centralwidget = new QWidget(this); | ||
| centralwidget->setObjectName(QString::fromUtf8("centralwidget")); | ||
| setCentralWidget(centralwidget); | ||
|
|
@@ -201,14 +212,28 @@ MainWindow::MainWindow(QWidget* parent) | |
| m_output_window.reset(new FileWindowLoggerWindow((FileWindowLogger&)global_logger_raw())); | ||
| QPushButton* output = new QPushButton("Output Window", support_box); | ||
| buttons->addWidget(output); | ||
| auto show_output_window = [&](){ | ||
| m_output_window->show(); | ||
| m_output_window->raise(); // bring the window to front on macOS | ||
| m_output_window->activateWindow(); // bring the window to front on Windows | ||
| }; | ||
| connect( | ||
| output, &QPushButton::clicked, | ||
| this, [this](bool){ | ||
| m_output_window->show(); | ||
| m_output_window->raise(); // bring the window to front on macOS | ||
| m_output_window->activateWindow(); // bring the window to front on Windows | ||
| this, [&](bool){ | ||
| show_output_window(); | ||
| } | ||
| ); | ||
|
|
||
| if (GlobalSettings::instance().LOG_WINDOW_STARTUP){ // show the Output Window on startup | ||
| show_output_window(); | ||
| } | ||
|
|
||
| // move the output window to desired position on startup | ||
| uint32_t initial_x_pos_log = GlobalSettings::instance().LOG_WINDOW_SIZE->INITIAL_X_POS; | ||
| uint32_t initial_y_pos_log = GlobalSettings::instance().LOG_WINDOW_SIZE->INITIAL_Y_POS; | ||
| uint32_t move_x_log = std::min(initial_x_pos_log, screen_width-100); | ||
| uint32_t move_y_log = std::min(initial_y_pos_log, screen_height-100); | ||
| m_output_window->move(scale_dpi_width(move_x_log), scale_dpi_height(move_y_log)); | ||
| } | ||
| { | ||
| QPushButton* settings = new QPushButton("Settings", support_box); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does this get used? I see it set, but it's never read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest, I just copy pasted it without understanding its purpose.
I now understand what it's for and I don't need it at this time.