From 3c3002122ece4909ad9ca49fbf67715379c4f5ef Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 29 Jul 2022 18:36:58 +0300 Subject: Add settings option for Evidence double-click that can be turned off (single-click evidence view) and more (#749) * Add 'evidence_one_click_view' courtroom_design.ini function, which allows you to treat every click as if it's a double-click (meaning every click will bring evidence overlay) Fix name not being set to read only when evidence is initialized If evidence is double-clicked and overlay is visible, trigger "on_x_clicked" behavior Make sure evidence is selected when double-click is called Stop hovering from changing name text if overlay is visible Simplify on_evidence_x_clicked "modified" check by simply checking if "ui_evidence_ok" is visible * Fix pressing "cancel" when trying to switch between evidence still acting the same as "discard" * Remove unnecessary ic message input focus setters for evidence, make only the Present button set focus on ic message input * Fix second page ignoring the evidence_one_click_view setting because of a wrong ID being used for the double-click call * Make evidence_switch() have everything required to properly switch between private/global * Make evidence cursor start at the top when looking at evidence description * Change it from theme setting to settings option * Make evidence double click default option to "true" due to it being the default for years Co-authored-by: Salanto <62221668+Salanto@users.noreply.github.com> --- src/aooptionsdialog.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/aooptionsdialog.cpp') diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index 18e2f716..4bb15cb5 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -465,6 +465,18 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_category_stop_cb); + row += 1; + ui_evidence_double_click_lbl = new QLabel(ui_form_layout_widget); + ui_evidence_double_click_lbl->setText(tr("Evidence Double Click:")); + ui_evidence_double_click_lbl->setToolTip( + tr("If ticked, Evidence needs a double-click to view rather than a single click.")); + + ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_evidence_double_click_lbl); + + ui_evidence_double_click_cb = new QCheckBox(ui_form_layout_widget); + + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_evidence_double_click_cb); + // Finish gameplay tab QScrollArea *scroll = new QScrollArea(this); scroll->setWidget(ui_form_layout_widget); @@ -1210,6 +1222,7 @@ void AOOptionsDialog::update_values() { ui_suppress_audio_spinbox->setValue(ao_app->get_default_suppress_audio()); ui_bliprate_spinbox->setValue(ao_app->read_blip_rate()); ui_default_showname_textbox->setText(ao_app->get_default_showname()); + ui_evidence_double_click_cb->setChecked(ao_app->get_evidence_double_click()); auto *defaultMount = new QListWidgetItem(tr("%1 (default)") .arg(ao_app->get_base_path())); @@ -1273,6 +1286,7 @@ void AOOptionsDialog::save_pressed() configini->setValue("demo_logging_enabled", ui_log_demo_cb->isChecked()); configini->setValue("continuous_playback", ui_continuous_cb->isChecked()); configini->setValue("category_stop", ui_category_stop_cb->isChecked()); + configini->setValue("evidence_double_click", ui_evidence_double_click_cb->isChecked()); QFile *callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini"); if (callwordsini->open(QIODevice::WriteOnly | QIODevice::Truncate | -- cgit