From cef0ebc6eb2ac549a5475bee332be35ab7f565fc Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 19 Aug 2020 19:16:41 +0300 Subject: IC log rewrite (#259) * Rewrite the IC Log code to drastically reduce code duplication and have both downward and upward mode in the same function Regenerate the IC Log in set_widgets() function, making sure the maximum_blocks is accounted for and clearing the log to prepare for different log mode (upwards/downwards) if it's different from previous Add placeholder text telling the user the direction in which the log will go Remove useless first_message_sent global boolean, a remnant from a w e a k e r c o d e r m a n * Add log_colors boolean to reduce color I/O happening in append_ic_text (optimization meme) Clear the IC log when log_colors setting changes and reload theme is pressed Fix https://github.com/AttorneyOnline/AO2-Client/issues/221 * Add configurable margin between IC log entries Add configurable newline/singleline log mode Options in settings for these * Add optional timestamps * Un-hardcode "played music" from the chatlogpiece and introduce the "action" argument so that "presented evidence" is fully supported now Translate "has presented evidence" Regenerate IC chatlog instead of clearing it, properly updating every element with the new configurations * Go away *temp, code duplication making me shid and cry rn Why is this not done in append_ic_text, or why isn't there a dedicated ic logging func aAAAaaaaAAAaa Fix presenting evidence not being properly logged Fix timestamp being UTC instead of local time (local time will not be as confusing) * okok it was a joke a big ol bamboozle you got gnomed haha rick rolled beaned stickbugged I did NOT copy paste code, no, I actually intended to fix copy pasted code all along. log_ic_text was always planned. (Fix copypasted code for ic_chatlog_history and consolidate it into a single log_ic_text func) --- src/aooptionsdialog.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'src/aooptionsdialog.cpp') diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index 6cedee8d..4e6aca65 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -120,6 +120,49 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_length_spinbox); + row += 1; + ui_log_newline_lbl = new QLabel(ui_form_layout_widget); + ui_log_newline_lbl->setText(tr("Log newline:")); + ui_log_newline_lbl->setToolTip( + tr("If ticked, new messages will appear separated, " + "with the message coming on the next line after the name. " + "When unticked, it displays it as 'name: message'.")); + + ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_log_newline_lbl); + + ui_log_newline_cb = new QCheckBox(ui_form_layout_widget); + ui_log_newline_cb->setChecked(p_ao_app->get_log_newline()); + + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_log_newline_cb); + + row += 1; + ui_log_margin_lbl = new QLabel(ui_form_layout_widget); + ui_log_margin_lbl->setText(tr("Log margin:")); + ui_log_margin_lbl->setToolTip(tr( + "The distance in pixels between each entry in the IC log. " + "Default: 0.")); + + ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_log_margin_lbl); + + ui_log_margin_spinbox = new QSpinBox(ui_form_layout_widget); + ui_log_margin_spinbox->setMaximum(1000); + ui_log_margin_spinbox->setValue(p_ao_app->get_log_margin()); + + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_log_margin_spinbox); + + row += 1; + ui_log_timestamp_lbl = new QLabel(ui_form_layout_widget); + ui_log_timestamp_lbl->setText(tr("Log timestamp:")); + ui_log_timestamp_lbl->setToolTip( + tr("If ticked, log will contain a timestamp in UTC before the name.")); + + ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_log_timestamp_lbl); + + ui_log_timestamp_cb = new QCheckBox(ui_form_layout_widget); + ui_log_timestamp_cb->setChecked(p_ao_app->get_log_timestamp()); + + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_log_timestamp_cb); + row += 1; ui_log_names_divider = new QFrame(ui_form_layout_widget); ui_log_names_divider->setFrameShape(QFrame::HLine); @@ -726,6 +769,9 @@ void AOOptionsDialog::save_pressed() configini->setValue("theme", ui_theme_combobox->currentText()); configini->setValue("log_goes_downwards", ui_downwards_cb->isChecked()); configini->setValue("log_maximum", ui_length_spinbox->value()); + configini->setValue("log_newline", ui_log_newline_cb->isChecked()); + configini->setValue("log_margin", ui_log_margin_spinbox->value()); + configini->setValue("log_timestamp", ui_log_timestamp_cb->isChecked()); configini->setValue("default_username", ui_username_textbox->text()); configini->setValue("show_custom_shownames", ui_showname_cb->isChecked()); configini->setValue("master", ui_ms_textbox->text()); -- cgit From 9eb0f53db1ae87058458eae267f2a72e3a0a8091 Mon Sep 17 00:00:00 2001 From: scatterflower <2956568+scatterflower@users.noreply.github.com> Date: Wed, 19 Aug 2020 16:40:37 -0500 Subject: Reset BASS when switching devices; drop Qt Multimedia support (#262) * Allow changing audio device on the fly while in a server * Use default audio device if device in config doesn't exist * Automatically change audio device to default when current one is invalid * Destroy Qt Multimedia support It was decided that there was not enough attention being given to Qt Multimedia support to justify its continued maintenance simply as a libre alternative to BASS. While substantial changes to audio were being made in 2.8, the Qt Multimedia support code fell behind in disrepair. It's clear that there is no vested interest in implementing audio features twice for the sake of licensing. When it's time to switch to another audio library, it will be done unilaterally. * CI: Use BASS for Linux build Co-authored-by: oldmud0 --- src/aooptionsdialog.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'src/aooptionsdialog.cpp') diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index 4e6aca65..6fc4d03e 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -445,7 +445,6 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_audio_device_combobox->addItem("default"); //TODO translate this without breaking the default audio device } -#ifdef BASSAUDIO BASS_DEVICEINFO info; for (a = 0; BASS_GetDeviceInfo(a, &info); a++) { ui_audio_device_combobox->addItem(info.name); @@ -453,15 +452,6 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_audio_device_combobox->setCurrentIndex( ui_audio_device_combobox->count() - 1); } -#elif defined QTAUDIO - foreach (const QAudioDeviceInfo &deviceInfo, - QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)) { - ui_audio_device_combobox->addItem(deviceInfo.deviceName()); - if (p_ao_app->get_audio_output_device() == deviceInfo.deviceName()) - ui_audio_device_combobox->setCurrentIndex( - ui_audio_device_combobox->count() - 1); - } -#endif ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_audio_device_combobox); @@ -816,6 +806,7 @@ void AOOptionsDialog::save_pressed() configini->setValue("casing_can_host_cases", ui_casing_cm_cases_textbox->text()); + ao_app->initBASS(); callwordsini->close(); done(0); } -- cgit