diff options
| author | Leifa <26681464+TrickyLeifa@users.noreply.github.com> | 2024-07-12 14:06:27 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-12 14:06:27 +0200 |
| commit | d05636571e234bf28dd49830af52675e6bb20068 (patch) | |
| tree | 5c20f972419f4efc58e5f23e35f25467b5e3aa43 /src/courtroom.cpp | |
| parent | fb64ca386c51cc3942e1f38cfd76132b1b50e9db (diff) | |
| parent | 712269b4503989736b8b9b64eeeb69cab938b7f8 (diff) | |
Merge pull request #1016 from AttorneyOnline/restore-window-position
[Feature] Add support for windows position restore
Diffstat (limited to 'src/courtroom.cpp')
| -rw-r--r-- | src/courtroom.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 6350cd92..6def0b5e 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -9,13 +9,12 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() + , ao_app{p_ao_app} { - ao_app = p_ao_app; - - this->setWindowFlags((this->windowFlags() | Qt::CustomizeWindowHint) & ~Qt::WindowMaximizeButtonHint); + setWindowFlags((this->windowFlags() | Qt::CustomizeWindowHint) & ~Qt::WindowMaximizeButtonHint); + setObjectName("courtroom"); ao_app->initBASS(); - keepalive_timer = new QTimer(this); keepalive_timer->start(45000); @@ -1920,6 +1919,12 @@ void Courtroom::set_judge_buttons() show_judge_controls(ao_app->get_pos_is_judge(current_or_default_side())); } +void Courtroom::closeEvent(QCloseEvent *event) +{ + Options::getInstance().setWindowPosition(objectName(), pos()); + QMainWindow::closeEvent(event); +} + void Courtroom::on_chat_return_pressed() { if (is_muted) @@ -5204,7 +5209,7 @@ void Courtroom::on_pos_dropdown_context_menu_requested(const QPoint &pos) QMenu *menu = new QMenu(ui_iniswap_dropdown); menu->setAttribute(Qt::WA_DeleteOnClose); - menu->addAction(QString("Open background " + current_background), this, [=] { + menu->addAction(QString("Open background " + current_background), this, [=, this] { QString p_path = ao_app->get_real_path(VPath("background/" + current_background + "/")); if (!dir_exists(p_path)) { @@ -5316,7 +5321,7 @@ void Courtroom::on_iniswap_context_menu_requested(const QPoint &pos) } menu->addSeparator(); - menu->addAction(QString("Open character folder " + current_char), this, [=] { + menu->addAction(QString("Open character folder " + current_char), this, [=, this] { QString p_path = ao_app->get_real_path(VPath("characters/" + current_char + "/")); if (!dir_exists(p_path)) { @@ -6140,7 +6145,7 @@ void Courtroom::on_text_color_context_menu_requested(const QPoint &pos) QMenu *menu = new QMenu(this); menu->setAttribute(Qt::WA_DeleteOnClose); - menu->addAction(QString("Open currently used chat_config.ini"), this, [=] { + menu->addAction(QString("Open currently used chat_config.ini"), this, [=, this] { QString p_path = ao_app->get_asset("chat_config.ini", Options::getInstance().theme(), Options::getInstance().subTheme(), ao_app->default_theme, ao_app->get_chat(current_char)); if (!file_exists(p_path)) { |
