Make chat rate limit configurable (#398)
Co-authored-by: stonedDiscord <10584181+stonedDiscord@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									31798583a9
								
							
						
					
					
						commit
						c42496e204
					
				@ -222,6 +222,9 @@ public:
 | 
				
			|||||||
  // Current wait time between messages for the queue system
 | 
					  // Current wait time between messages for the queue system
 | 
				
			||||||
  int stay_time();
 | 
					  int stay_time();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Returns Minimum amount of time (in miliseconds) that must pass before the next Enter key press will send your IC message. (new behaviour)
 | 
				
			||||||
 | 
					  int get_chat_ratelimit();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Returns whether the log should go upwards (new behaviour)
 | 
					  // Returns whether the log should go upwards (new behaviour)
 | 
				
			||||||
  // or downwards (vanilla behaviour).
 | 
					  // or downwards (vanilla behaviour).
 | 
				
			||||||
  bool get_log_goes_downwards();
 | 
					  bool get_log_goes_downwards();
 | 
				
			||||||
 | 
				
			|||||||
@ -58,6 +58,8 @@ private:
 | 
				
			|||||||
  QCheckBox *ui_desync_logs_cb;
 | 
					  QCheckBox *ui_desync_logs_cb;
 | 
				
			||||||
  QLabel *ui_instant_objection_lbl;
 | 
					  QLabel *ui_instant_objection_lbl;
 | 
				
			||||||
  QCheckBox *ui_instant_objection_cb;
 | 
					  QCheckBox *ui_instant_objection_cb;
 | 
				
			||||||
 | 
					  QLabel *ui_chat_ratelimit_lbl;
 | 
				
			||||||
 | 
					  QSpinBox *ui_chat_ratelimit_spinbox;
 | 
				
			||||||
  QLabel *ui_log_ic_actions_lbl;
 | 
					  QLabel *ui_log_ic_actions_lbl;
 | 
				
			||||||
  QCheckBox *ui_log_ic_actions_cb;
 | 
					  QCheckBox *ui_log_ic_actions_cb;
 | 
				
			||||||
  QFrame *ui_log_names_divider;
 | 
					  QFrame *ui_log_names_divider;
 | 
				
			||||||
 | 
				
			|||||||
@ -218,6 +218,19 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_instant_objection_cb);
 | 
					  ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_instant_objection_cb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  row += 1;
 | 
				
			||||||
 | 
					  ui_chat_ratelimit_lbl = new QLabel(ui_form_layout_widget);
 | 
				
			||||||
 | 
					  ui_chat_ratelimit_lbl->setText(tr("Chat Rate Limit:"));
 | 
				
			||||||
 | 
					  ui_chat_ratelimit_lbl->setToolTip(tr(
 | 
				
			||||||
 | 
					      "Minimum amount of time (in miliseconds) that must pass before the next Enter key press will send your IC message."));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_chat_ratelimit_lbl);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  ui_chat_ratelimit_spinbox = new QSpinBox(ui_form_layout_widget);
 | 
				
			||||||
 | 
					  ui_chat_ratelimit_spinbox->setMaximum(5000);
 | 
				
			||||||
 | 
					  ui_chat_ratelimit_spinbox->setValue(p_ao_app->get_chat_ratelimit());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_chat_ratelimit_spinbox);
 | 
				
			||||||
  row += 1;
 | 
					  row += 1;
 | 
				
			||||||
  ui_log_names_divider = new QFrame(ui_form_layout_widget);
 | 
					  ui_log_names_divider = new QFrame(ui_form_layout_widget);
 | 
				
			||||||
  ui_log_names_divider->setFrameShape(QFrame::HLine);
 | 
					  ui_log_names_divider->setFrameShape(QFrame::HLine);
 | 
				
			||||||
@ -824,6 +837,7 @@ void AOOptionsDialog::save_pressed()
 | 
				
			|||||||
  configini->setValue("desync_logs", ui_desync_logs_cb->isChecked());
 | 
					  configini->setValue("desync_logs", ui_desync_logs_cb->isChecked());
 | 
				
			||||||
  configini->setValue("stay_time", ui_stay_time_spinbox->value());
 | 
					  configini->setValue("stay_time", ui_stay_time_spinbox->value());
 | 
				
			||||||
  configini->setValue("instant_objection", ui_instant_objection_cb->isChecked());
 | 
					  configini->setValue("instant_objection", ui_instant_objection_cb->isChecked());
 | 
				
			||||||
 | 
					  configini->setValue("chat_ratelimit", ui_chat_ratelimit_spinbox->value());
 | 
				
			||||||
  configini->setValue("default_username", ui_username_textbox->text());
 | 
					  configini->setValue("default_username", ui_username_textbox->text());
 | 
				
			||||||
  configini->setValue("show_custom_shownames", ui_showname_cb->isChecked());
 | 
					  configini->setValue("show_custom_shownames", ui_showname_cb->isChecked());
 | 
				
			||||||
  configini->setValue("master", ui_ms_textbox->text());
 | 
					  configini->setValue("master", ui_ms_textbox->text());
 | 
				
			||||||
 | 
				
			|||||||
@ -1627,7 +1627,7 @@ void Courtroom::on_chat_return_pressed()
 | 
				
			|||||||
    return;
 | 
					    return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ui_ic_chat_message->blockSignals(true);
 | 
					  ui_ic_chat_message->blockSignals(true);
 | 
				
			||||||
  QTimer::singleShot(600, this,
 | 
					  QTimer::singleShot(ao_app->get_chat_ratelimit(), this,
 | 
				
			||||||
                     [=] { ui_ic_chat_message->blockSignals(false); });
 | 
					                     [=] { ui_ic_chat_message->blockSignals(false); });
 | 
				
			||||||
  // MS#
 | 
					  // MS#
 | 
				
			||||||
  // deskmod#
 | 
					  // deskmod#
 | 
				
			||||||
 | 
				
			|||||||
@ -52,6 +52,12 @@ int AOApplication::stay_time()
 | 
				
			|||||||
  return result;
 | 
					  return result;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int AOApplication::get_chat_ratelimit()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  int result = configini->value("chat_ratelimit", 300).toInt();
 | 
				
			||||||
 | 
					  return result;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool AOApplication::get_log_goes_downwards()
 | 
					bool AOApplication::get_log_goes_downwards()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  QString result =
 | 
					  QString result =
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user