Add a search bar for server list
Add options for sticky sounds, sticky effects and sticky preanims Optimize the search for areas and music (previously, area search also searched for music in the background, causing lag with huge music lists)
This commit is contained in:
parent
ce3269cc36
commit
7aa24bf501
@ -188,6 +188,18 @@ public:
|
||||
// from the config.ini.
|
||||
bool is_colorlog_enabled();
|
||||
|
||||
// Returns the value of whether sticky sounds should be a thing.
|
||||
// from the config.ini.
|
||||
bool is_stickysounds_enabled();
|
||||
|
||||
// Returns the value of whether sticky effects should be a thing.
|
||||
// from the config.ini.
|
||||
bool is_stickyeffects_enabled();
|
||||
|
||||
// Returns the value of whether sticky preanims should be a thing.
|
||||
// from the config.ini.
|
||||
bool is_stickypres_enabled();
|
||||
|
||||
// Returns the value of the maximum amount of lines the IC chatlog
|
||||
// may contain, from config.ini.
|
||||
int get_max_log_size();
|
||||
|
@ -75,6 +75,15 @@ private:
|
||||
QLabel *ui_colorlog_lbl;
|
||||
QCheckBox *ui_colorlog_cb;
|
||||
|
||||
QLabel *ui_stickysounds_lbl;
|
||||
QCheckBox *ui_stickysounds_cb;
|
||||
|
||||
QLabel *ui_stickyeffects_lbl;
|
||||
QCheckBox *ui_stickyeffects_cb;
|
||||
|
||||
QLabel *ui_stickypres_lbl;
|
||||
QCheckBox *ui_stickypres_cb;
|
||||
|
||||
QWidget *ui_callwords_tab;
|
||||
QWidget *ui_callwords_widget;
|
||||
QVBoxLayout *ui_callwords_layout;
|
||||
|
@ -66,6 +66,7 @@ private:
|
||||
AOButton *ui_about;
|
||||
|
||||
QTreeWidget *ui_server_list;
|
||||
QLineEdit *ui_server_search;
|
||||
|
||||
QLabel *ui_player_count;
|
||||
AOTextArea *ui_description;
|
||||
@ -97,6 +98,7 @@ private slots:
|
||||
void on_about_clicked();
|
||||
void on_server_list_clicked(QTreeWidgetItem* p_item, int column);
|
||||
void on_server_list_doubleclicked(QTreeWidgetItem* p_item, int column);
|
||||
void on_server_search_edited(QString p_text);
|
||||
void on_chatfield_return_pressed();
|
||||
};
|
||||
|
||||
|
@ -12,7 +12,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi
|
||||
|
||||
ui_settings_buttons = new QDialogButtonBox(this);
|
||||
|
||||
QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding);
|
||||
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
|
||||
sizePolicy1.setHorizontalStretch(0);
|
||||
sizePolicy1.setVerticalStretch(0);
|
||||
sizePolicy1.setHeightForWidth(ui_settings_buttons->sizePolicy().hasHeightForWidth());
|
||||
@ -39,7 +39,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi
|
||||
ui_gameplay_tab->setSizePolicy(sizePolicy1);
|
||||
ui_settings_tabs->addTab(ui_gameplay_tab, tr("Gameplay"));
|
||||
ui_form_layout_widget = new QWidget(ui_gameplay_tab);
|
||||
ui_form_layout_widget->setGeometry(QRect(10, 10, 361, 211));
|
||||
ui_form_layout_widget->setGeometry(QRect(10, 10, 361, 361));
|
||||
ui_form_layout_widget->setSizePolicy(sizePolicy1);
|
||||
|
||||
ui_gameplay_form = new QFormLayout(ui_form_layout_widget);
|
||||
@ -242,6 +242,42 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi
|
||||
|
||||
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_colorlog_cb);
|
||||
|
||||
row += 1;
|
||||
ui_stickysounds_lbl = new QLabel(ui_form_layout_widget);
|
||||
ui_stickysounds_lbl->setText(tr("Sticky Sounds:"));
|
||||
ui_stickysounds_lbl->setToolTip(tr("Turn this on to prevent the sound dropdown from clearing the sound after playing it."));
|
||||
|
||||
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_stickysounds_lbl);
|
||||
|
||||
ui_stickysounds_cb = new QCheckBox(ui_form_layout_widget);
|
||||
ui_stickysounds_cb->setChecked(ao_app->is_stickysounds_enabled());
|
||||
|
||||
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_stickysounds_cb);
|
||||
|
||||
row += 1;
|
||||
ui_stickyeffects_lbl = new QLabel(ui_form_layout_widget);
|
||||
ui_stickyeffects_lbl->setText(tr("Sticky Effects:"));
|
||||
ui_stickyeffects_lbl->setToolTip(tr("Turn this on to prevent the effects dropdown from clearing the effect after playing it."));
|
||||
|
||||
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_stickyeffects_lbl);
|
||||
|
||||
ui_stickyeffects_cb = new QCheckBox(ui_form_layout_widget);
|
||||
ui_stickyeffects_cb->setChecked(ao_app->is_stickyeffects_enabled());
|
||||
|
||||
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_stickyeffects_cb);
|
||||
|
||||
row += 1;
|
||||
ui_stickypres_lbl = new QLabel(ui_form_layout_widget);
|
||||
ui_stickypres_lbl->setText(tr("Sticky Preanims:"));
|
||||
ui_stickypres_lbl->setToolTip(tr("Turn this on to prevent preanimation checkbox from clearing after playing the emote."));
|
||||
|
||||
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_stickypres_lbl);
|
||||
|
||||
ui_stickypres_cb = new QCheckBox(ui_form_layout_widget);
|
||||
ui_stickypres_cb->setChecked(ao_app->is_stickypres_enabled());
|
||||
|
||||
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_stickypres_cb);
|
||||
|
||||
QScrollArea *scroll = new QScrollArea;
|
||||
scroll->setWidget(ui_form_layout_widget);
|
||||
ui_gameplay_tab->setLayout(new QVBoxLayout);
|
||||
@ -599,6 +635,9 @@ void AOOptionsDialog::save_pressed()
|
||||
configini->setValue("effects", ui_effects_cb->isChecked());
|
||||
configini->setValue("framenetwork", ui_framenetwork_cb->isChecked());
|
||||
configini->setValue("colorlog", ui_colorlog_cb->isChecked());
|
||||
configini->setValue("stickysounds", ui_stickysounds_cb->isChecked());
|
||||
configini->setValue("stickyeffects", ui_stickyeffects_cb->isChecked());
|
||||
configini->setValue("stickypres", ui_stickypres_cb->isChecked());
|
||||
|
||||
|
||||
QFile* callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini");
|
||||
|
@ -1214,6 +1214,7 @@ void Courtroom::enter_courtroom()
|
||||
void Courtroom::list_music()
|
||||
{
|
||||
ui_music_list->clear();
|
||||
ui_music_search->setText("");
|
||||
|
||||
QString f_file = "courtroom_design.ini";
|
||||
|
||||
@ -1256,6 +1257,7 @@ void Courtroom::list_music()
|
||||
void Courtroom::list_areas()
|
||||
{
|
||||
ui_area_list->clear();
|
||||
ui_music_search->setText("");
|
||||
|
||||
QString f_file = "courtroom_design.ini";
|
||||
|
||||
@ -1292,41 +1294,38 @@ void Courtroom::list_areas()
|
||||
i_area.append(arup_locks.at(n_area));
|
||||
}
|
||||
|
||||
if (i_area.toLower().contains(ui_music_search->text().toLower()))
|
||||
{
|
||||
QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_area_list);
|
||||
treeItem->setText(0, area_list.at(n_area));
|
||||
treeItem->setText(1, i_area);
|
||||
QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_area_list);
|
||||
treeItem->setText(0, area_list.at(n_area));
|
||||
treeItem->setText(1, i_area);
|
||||
|
||||
if (ao_app->arup_enabled)
|
||||
if (ao_app->arup_enabled)
|
||||
{
|
||||
// Coloring logic here.
|
||||
treeItem->setBackground(0, free_brush);
|
||||
if (arup_locks.at(n_area) == "LOCKED")
|
||||
{
|
||||
// Coloring logic here.
|
||||
treeItem->setBackground(0, free_brush);
|
||||
if (arup_locks.at(n_area) == "LOCKED")
|
||||
{
|
||||
treeItem->setBackground(1, locked_brush);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (arup_statuses.at(n_area) == "LOOKING-FOR-PLAYERS")
|
||||
treeItem->setBackground(1, lfp_brush);
|
||||
else if (arup_statuses.at(n_area) == "CASING")
|
||||
treeItem->setBackground(1, casing_brush);
|
||||
else if (arup_statuses.at(n_area) == "RECESS")
|
||||
treeItem->setBackground(1, recess_brush);
|
||||
else if (arup_statuses.at(n_area) == "RP")
|
||||
treeItem->setBackground(1, rp_brush);
|
||||
else if (arup_statuses.at(n_area) == "GAMING")
|
||||
treeItem->setBackground(1, gaming_brush);
|
||||
}
|
||||
treeItem->setBackground(1, locked_brush);
|
||||
}
|
||||
else
|
||||
{
|
||||
treeItem->setBackground(1, free_brush);
|
||||
if (arup_statuses.at(n_area) == "LOOKING-FOR-PLAYERS")
|
||||
treeItem->setBackground(1, lfp_brush);
|
||||
else if (arup_statuses.at(n_area) == "CASING")
|
||||
treeItem->setBackground(1, casing_brush);
|
||||
else if (arup_statuses.at(n_area) == "RECESS")
|
||||
treeItem->setBackground(1, recess_brush);
|
||||
else if (arup_statuses.at(n_area) == "RP")
|
||||
treeItem->setBackground(1, rp_brush);
|
||||
else if (arup_statuses.at(n_area) == "GAMING")
|
||||
treeItem->setBackground(1, gaming_brush);
|
||||
}
|
||||
|
||||
++n_listed_areas;
|
||||
}
|
||||
else
|
||||
{
|
||||
treeItem->setBackground(1, free_brush);
|
||||
}
|
||||
|
||||
++n_listed_areas;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1412,6 +1411,13 @@ void Courtroom::on_chat_return_pressed()
|
||||
packet_contents.append(current_side);
|
||||
|
||||
packet_contents.append(get_char_sfx());
|
||||
if (ui_pre->isChecked() && !ao_app->is_stickysounds_enabled())
|
||||
{
|
||||
ui_sfx_dropdown->blockSignals(true);
|
||||
ui_sfx_dropdown->setCurrentIndex(0);
|
||||
ui_sfx_dropdown->blockSignals(false);
|
||||
ui_sfx_remove->hide();
|
||||
}
|
||||
|
||||
int f_emote_mod = ao_app->get_emote_mod(current_char, current_emote);
|
||||
|
||||
@ -1568,10 +1574,13 @@ void Courtroom::on_chat_return_pressed()
|
||||
QString fx_sound = ao_app->get_effect_sound(effect, current_char);
|
||||
QString p_effect = ao_app->read_char_ini(current_char, "effects", "Options");
|
||||
packet_contents.append(effect + "|" + p_effect + "|" + fx_sound);
|
||||
ui_effects_dropdown->blockSignals(true);
|
||||
ui_effects_dropdown->setCurrentIndex(0);
|
||||
ui_effects_dropdown->blockSignals(false);
|
||||
effect = "";
|
||||
if (!ao_app->is_stickyeffects_enabled())
|
||||
{
|
||||
ui_effects_dropdown->blockSignals(true);
|
||||
ui_effects_dropdown->setCurrentIndex(0);
|
||||
ui_effects_dropdown->blockSignals(false);
|
||||
effect = "";
|
||||
}
|
||||
}
|
||||
|
||||
ao_app->send_server_packet(new AOPacket("MS", packet_contents));
|
||||
@ -1658,7 +1667,8 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
|
||||
realization_state = 0;
|
||||
screenshake_state = 0;
|
||||
is_presenting_evidence = false;
|
||||
ui_pre->setChecked(false);
|
||||
if (!ao_app->is_stickypres_enabled())
|
||||
ui_pre->setChecked(false);
|
||||
ui_hold_it->set_image("holdit");
|
||||
ui_objection->set_image("objection");
|
||||
ui_take_that->set_image("takethat");
|
||||
@ -3327,25 +3337,52 @@ void Courtroom::on_ooc_toggle_clicked()
|
||||
void Courtroom::on_music_search_edited(QString p_text)
|
||||
{
|
||||
// Iterate through all QTreeWidgetItem items
|
||||
QTreeWidgetItemIterator it(ui_music_list);
|
||||
while (*it)
|
||||
if (!ui_music_list->isHidden())
|
||||
{
|
||||
(*it)->setHidden(p_text != "");
|
||||
++it;
|
||||
QTreeWidgetItemIterator it(ui_music_list);
|
||||
while (*it)
|
||||
{
|
||||
(*it)->setHidden(p_text != "");
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ui_area_list->isHidden())
|
||||
{
|
||||
QTreeWidgetItemIterator ait(ui_area_list);
|
||||
while (*ait)
|
||||
{
|
||||
(*ait)->setHidden(p_text != "");
|
||||
++ait;
|
||||
}
|
||||
}
|
||||
|
||||
if (p_text != "")
|
||||
{
|
||||
//Search in metadata
|
||||
QList<QTreeWidgetItem*> clist = ui_music_list->findItems(ui_music_search->text(), Qt::MatchContains|Qt::MatchRecursive, 1);
|
||||
foreach(QTreeWidgetItem* item, clist)
|
||||
if (!ui_music_list->isHidden())
|
||||
{
|
||||
if (item->parent() != nullptr) //So the category shows up too
|
||||
item->parent()->setHidden(false);
|
||||
item->setHidden(false);
|
||||
//Search in metadata
|
||||
QList<QTreeWidgetItem*> clist = ui_music_list->findItems(ui_music_search->text(), Qt::MatchContains|Qt::MatchRecursive, 1);
|
||||
foreach(QTreeWidgetItem* item, clist)
|
||||
{
|
||||
if (item->parent() != nullptr) //So the category shows up too
|
||||
item->parent()->setHidden(false);
|
||||
item->setHidden(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (!ui_area_list->isHidden())
|
||||
{
|
||||
//Search in metadata
|
||||
QList<QTreeWidgetItem*> alist = ui_area_list->findItems(ui_music_search->text(), Qt::MatchContains|Qt::MatchRecursive, 1);
|
||||
foreach(QTreeWidgetItem* item, alist)
|
||||
{
|
||||
if (item->parent() != nullptr) //So the category shows up too
|
||||
item->parent()->setHidden(false);
|
||||
item->setHidden(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
list_areas();
|
||||
}
|
||||
|
||||
void Courtroom::on_pos_dropdown_changed(int p_index)
|
||||
|
@ -159,10 +159,13 @@ void Courtroom::select_emote(int p_id)
|
||||
{
|
||||
ui_pre->setChecked(!ui_pre->isChecked());
|
||||
}
|
||||
else if (emote_mod == 1 || emote_mod == 4)
|
||||
ui_pre->setChecked(true);
|
||||
else
|
||||
ui_pre->setChecked(false);
|
||||
else if (!ao_app->is_stickypres_enabled())
|
||||
{
|
||||
if (emote_mod == 1 || emote_mod == 4)
|
||||
ui_pre->setChecked(true);
|
||||
else
|
||||
ui_pre->setChecked(false);
|
||||
}
|
||||
|
||||
ui_emote_dropdown->setCurrentIndex(current_emote);
|
||||
|
||||
|
@ -25,6 +25,10 @@ Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow()
|
||||
ui_server_list->setHeaderLabels({"#", "Name"});//, "Players"});
|
||||
ui_server_list->hideColumn(0);
|
||||
|
||||
ui_server_search = new QLineEdit(this);
|
||||
ui_server_search->setFrame(false);
|
||||
ui_server_search->setPlaceholderText(tr("Search"));
|
||||
|
||||
ui_player_count = new QLabel(this);
|
||||
ui_description = new AOTextArea(this);
|
||||
ui_description->setOpenExternalLinks(true);
|
||||
@ -53,6 +57,7 @@ Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow()
|
||||
connect(ui_about, SIGNAL(clicked()), this, SLOT(on_about_clicked()));
|
||||
connect(ui_server_list, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(on_server_list_clicked(QTreeWidgetItem*, int)));
|
||||
connect(ui_server_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(on_server_list_doubleclicked(QTreeWidgetItem*, int)));
|
||||
connect(ui_server_search, SIGNAL(textChanged(QString)), this, SLOT(on_server_search_edited(QString)));
|
||||
connect(ui_chatmessage, SIGNAL(returnPressed()), this, SLOT(on_chatfield_return_pressed()));
|
||||
connect(ui_cancel, SIGNAL(clicked()), ao_app, SLOT(loading_cancelled()));
|
||||
|
||||
@ -116,6 +121,9 @@ void Lobby::set_widgets()
|
||||
ui_server_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
|
||||
"font: bold;");
|
||||
|
||||
set_size_and_pos(ui_server_search, "server_search");
|
||||
ui_server_search->setStyleSheet("background-color: rgba(0, 0, 0, 0);");
|
||||
|
||||
set_size_and_pos(ui_player_count, "player_count");
|
||||
ui_player_count->setText(tr("Offline"));
|
||||
ui_player_count->setStyleSheet("font: bold;"
|
||||
@ -409,6 +417,30 @@ void Lobby::on_server_list_doubleclicked(QTreeWidgetItem* p_item, int column)
|
||||
on_connect_released();
|
||||
}
|
||||
|
||||
void Lobby::on_server_search_edited(QString p_text)
|
||||
{
|
||||
// Iterate through all QTreeWidgetItem items
|
||||
QTreeWidgetItemIterator it(ui_server_list);
|
||||
while (*it)
|
||||
{
|
||||
(*it)->setHidden(p_text != "");
|
||||
++it;
|
||||
}
|
||||
|
||||
if (p_text != "")
|
||||
{
|
||||
//Search in metadata
|
||||
QList<QTreeWidgetItem*> clist = ui_server_list->findItems(ui_server_search->text(), Qt::MatchContains|Qt::MatchRecursive, 1);
|
||||
foreach(QTreeWidgetItem* item, clist)
|
||||
{
|
||||
if (item->parent() != nullptr) //So the category shows up too
|
||||
item->parent()->setHidden(false);
|
||||
item->setHidden(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Lobby::on_chatfield_return_pressed()
|
||||
{
|
||||
//no you can't send empty messages
|
||||
@ -435,13 +467,14 @@ void Lobby::list_servers()
|
||||
ui_server_list->setSortingEnabled(false);
|
||||
ui_server_list->clear();
|
||||
|
||||
ui_server_search->setText("");
|
||||
|
||||
int i = 0;
|
||||
for (server_type i_server : ao_app->get_server_list())
|
||||
{
|
||||
QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_server_list);
|
||||
treeItem->setText(0, QString::number(i));
|
||||
treeItem->setText(1, i_server.name);
|
||||
// treeItem->setText(2, "-");
|
||||
i++;
|
||||
}
|
||||
ui_server_list->setSortingEnabled(true);
|
||||
|
@ -987,6 +987,24 @@ bool AOApplication::is_colorlog_enabled()
|
||||
return result.startsWith("true");
|
||||
}
|
||||
|
||||
bool AOApplication::is_stickysounds_enabled()
|
||||
{
|
||||
QString result = configini->value("stickysounds", "false").value<QString>();
|
||||
return result.startsWith("true");
|
||||
}
|
||||
|
||||
bool AOApplication::is_stickyeffects_enabled()
|
||||
{
|
||||
QString result = configini->value("stickyeffects", "false").value<QString>();
|
||||
return result.startsWith("true");
|
||||
}
|
||||
|
||||
bool AOApplication::is_stickypres_enabled()
|
||||
{
|
||||
QString result = configini->value("stickypres", "false").value<QString>();
|
||||
return result.startsWith("true");
|
||||
}
|
||||
|
||||
bool AOApplication::get_casing_enabled()
|
||||
{
|
||||
QString result = configini->value("casing_enabled", "false").value<QString>();
|
||||
|
Loading…
Reference in New Issue
Block a user