Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
651c493
Add "edit" and "open folder" actions for dropdowns:
Crystalwarrior Jun 2, 2022
96f5d4d
add "open themes folder" button for the settings menu under "reload t…
Crystalwarrior Jun 3, 2022
a7a17be
braces
stonedDiscord Jun 6, 2022
fb7574e
bracesUpdate src/courtroom.cpp
stonedDiscord Jun 6, 2022
869d48b
bracesUpdate src/courtroom.cpp
stonedDiscord Jun 6, 2022
fee8624
bracesbracesbracesUpdate src/aooptionsdialog.cpp
stonedDiscord Jun 6, 2022
f9d7c25
bracesbraces
stonedDiscord Jun 6, 2022
dfc480f
braces
stonedDiscord Jun 6, 2022
001bfc1
braces
stonedDiscord Jun 6, 2022
ad63800
bracesUpdate braces
stonedDiscord Jun 6, 2022
98364df
Update sbraces
stonedDiscord Jun 6, 2022
a476f01
more braces, shut up bot
stonedDiscord Jun 6, 2022
4e3bdb0
Merge branch 'more-dropdown-actions' of https://github.com/AttorneyOn…
stonedDiscord Jun 6, 2022
cf7c768
fuck you bot
stonedDiscord Jun 6, 2022
d949e8f
bastard bot
stonedDiscord Jun 6, 2022
1ac558e
Merge branch 'master' into more-dropdown-actions
Crystalwarrior Jul 18, 2022
a34b735
Fix build fail
Crystalwarrior Jul 18, 2022
da0560e
Fix several actions not doing anything
Crystalwarrior Jul 27, 2022
3628ebe
Expand the "open folder" buttons to open all recognized mounted folde…
Crystalwarrior Jul 27, 2022
6abc6fa
I forgot about the themes button 😭
Crystalwarrior Jul 27, 2022
4682f29
Update "open themes folders" button texxt
Crystalwarrior Jul 27, 2022
8c2b6df
Merge branch 'master' into more-dropdown-actions
stonedDiscord Jul 30, 2022
04518b0
Change "open all mounted path folders" into just "open base folder" r…
Crystalwarrior Jul 30, 2022
e98e947
Implement "Play <sfx_name>" for the Play action, and only show it if …
Crystalwarrior Jul 30, 2022
30517a0
Remove some "open folder" context menu buttons
oldmud0 Jul 31, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/aooptionsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class AOOptionsDialog : public QDialog {
QLabel *ui_subtheme_label;
QComboBox *ui_subtheme_combobox;
QPushButton *ui_theme_reload_button;
QPushButton *ui_theme_folder_button;
QLabel *ui_evidence_double_click_lbl;
QCheckBox *ui_evidence_double_click_cb;
QLabel *ui_animated_theme_lbl;
Expand Down
4 changes: 4 additions & 0 deletions include/courtroom.h
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,7 @@ class Courtroom : public QMainWindow {
void set_char_select();
void set_char_select_page();
void char_clicked(int n_char);
void on_char_button_context_menu_requested(const QPoint &pos);
void put_button_in_place(int starting, int chars_on_this_page);
void filter_character_list();

Expand Down Expand Up @@ -884,6 +885,7 @@ private slots:
void on_emote_dropdown_changed(int p_index);
void on_pos_dropdown_changed(int p_index);
void on_pos_dropdown_changed(QString p_text);
void on_pos_dropdown_context_menu_requested(const QPoint &pos);
void on_pos_remove_clicked();

void on_iniswap_dropdown_changed(int p_index);
Expand Down Expand Up @@ -943,6 +945,7 @@ private slots:
void on_prosecution_plus_clicked();

void on_text_color_changed(int p_color);
void on_text_color_context_menu_requested(const QPoint &pos);
void set_text_color_dropdown();

void on_music_slider_moved(int p_value);
Expand Down Expand Up @@ -973,6 +976,7 @@ private slots:
void on_showname_enable_clicked();

void on_evidence_button_clicked();
void on_evidence_context_menu_requested(const QPoint &pos);

void on_evidence_delete_clicked();
bool on_evidence_x_clicked();
Expand Down
17 changes: 16 additions & 1 deletion src/aooptionsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_subtheme_combobox);

row += 1;

ui_theme_reload_button = new QPushButton(ui_form_layout_widget);
ui_theme_reload_button->setText(tr("Reload Theme"));
ui_theme_reload_button->setToolTip(
Expand All @@ -129,6 +128,22 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
connect(ui_theme_reload_button, &QPushButton::clicked, this,
&AOOptionsDialog::on_reload_theme_clicked);

row += 1;
ui_theme_folder_button = new QPushButton(ui_form_layout_widget);
ui_theme_folder_button->setText(tr("Open Theme Folder"));
ui_theme_folder_button->setToolTip(
tr("Open the theme folder of the currently selected theme."));
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_theme_folder_button);
connect(ui_theme_folder_button, &QPushButton::clicked, this,
[=] {
QString p_path = ao_app->get_real_path(ao_app->get_theme_path("", ui_theme_combobox->itemText(ui_theme_combobox->currentIndex())));
if (!dir_exists(p_path)) {
return;
}
QDesktopServices::openUrl(QUrl::fromLocalFile(p_path));
}
);

row += 1;
ui_animated_theme_lbl = new QLabel(ui_form_layout_widget);
ui_animated_theme_lbl->setText(tr("Animated Theme:"));
Expand Down
37 changes: 37 additions & 0 deletions src/charselect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,41 @@ void Courtroom::char_clicked(int n_char)
}
}

void Courtroom::on_char_button_context_menu_requested(const QPoint &pos)
{
AOCharButton* button = qobject_cast<AOCharButton*>(sender());
int n_char = ui_char_button_list.indexOf(button);
if (n_char == -1)
{
return;
}

QString char_name = char_list.at(n_char).name;
QString char_ini_path = ao_app->get_real_path(
ao_app->get_character_path(char_name, "char.ini"));

if (!file_exists(char_ini_path)) {
call_error(tr("Could not find character (char.ini) for %1").arg(char_name));
return;
}

QMenu *menu = new QMenu(this);
menu->addAction(QString("Edit " + char_name + "/char.ini"), this,
[=] { QDesktopServices::openUrl(QUrl::fromLocalFile(char_ini_path)); }
);
menu->addSeparator();
menu->addAction(QString("Open character folder " + char_name), this,
[=] {
QString p_path = ao_app->get_real_path(VPath("characters/" + char_name + "/"));
if (!dir_exists(p_path)) {
return;
}
QDesktopServices::openUrl(QUrl::fromLocalFile(p_path));
Comment thread
Crystalwarrior marked this conversation as resolved.
}
Comment thread
Crystalwarrior marked this conversation as resolved.
Comment thread
Crystalwarrior marked this conversation as resolved.
);
Comment thread
Crystalwarrior marked this conversation as resolved.
menu->popup(button->mapToGlobal(pos));
}

void Courtroom::put_button_in_place(int starting, int chars_on_this_page)
{
if (ui_char_button_list_filtered.size() == 0)
Expand Down Expand Up @@ -249,6 +284,7 @@ void Courtroom::character_loading_finished()
for (int n = 0; n < char_list.size(); n++) {
AOCharButton *char_button =
new AOCharButton(ui_char_buttons, ao_app, 0, 0, char_list.at(n).taken);
char_button->setContextMenuPolicy(Qt::CustomContextMenu);
char_button->reset();
char_button->hide();
char_button->set_image(char_list.at(n).name);
Expand Down Expand Up @@ -282,6 +318,7 @@ void Courtroom::character_loading_finished()

connect(char_button, &AOCharButton::clicked,
[this, n]() { this->char_clicked(n); });
connect(char_button, &AOCharButton::customContextMenuRequested, this, &Courtroom::on_char_button_context_menu_requested);

// This part here serves as a way of showing to the player that the game is
// still running, it is just loading the pictures of the characters.
Expand Down
113 changes: 106 additions & 7 deletions src/courtroom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_music_search->setObjectName("ui_music_search");

ui_pos_dropdown = new QComboBox(this);
ui_pos_dropdown->setContextMenuPolicy(Qt::CustomContextMenu);
ui_pos_dropdown->view()->setTextElideMode(Qt::ElideLeft);
ui_pos_dropdown->setObjectName("ui_pos_dropdown");

Expand Down Expand Up @@ -359,6 +360,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_prosecution_minus->setObjectName("ui_prosecution_minus");

ui_text_color = new QComboBox(this);
ui_text_color->setContextMenuPolicy(Qt::CustomContextMenu);
ui_text_color->setObjectName("ui_text_color");

ui_music_slider = new QSlider(Qt::Horizontal, this);
Expand Down Expand Up @@ -401,6 +403,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_pair_button->setObjectName("ui_pair_button");

ui_evidence_button = new AOButton(this, ao_app);
ui_evidence_button->setContextMenuPolicy(Qt::CustomContextMenu);
ui_evidence_button->setObjectName("ui_evidence_button");

initialize_emotes();
Expand Down Expand Up @@ -431,6 +434,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
QOverload<int>::of(&Courtroom::on_pos_dropdown_changed));
connect(ui_pos_dropdown, &QComboBox::editTextChanged, this,
QOverload<QString>::of(&Courtroom::on_pos_dropdown_changed));
connect(ui_pos_dropdown, &QComboBox::customContextMenuRequested, this,
&Courtroom::on_pos_dropdown_context_menu_requested);
connect(ui_pos_remove, &AOButton::clicked, this, &Courtroom::on_pos_remove_clicked);

connect(ui_iniswap_dropdown, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
Expand Down Expand Up @@ -500,6 +505,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()

connect(ui_text_color, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&Courtroom::on_text_color_changed);
connect(ui_text_color, &QComboBox::customContextMenuRequested, this,
&Courtroom::on_text_color_context_menu_requested);

connect(ui_music_slider, &QSlider::valueChanged, this,
&Courtroom::on_music_slider_moved);
Expand Down Expand Up @@ -554,6 +561,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()

connect(ui_evidence_button, &AOButton::clicked, this,
&Courtroom::on_evidence_button_clicked);
connect(ui_evidence_button, &QComboBox::customContextMenuRequested, this,
&Courtroom::on_evidence_context_menu_requested);

connect(qApp, QOverload<Qt::ApplicationState>::of(&QApplication::applicationStateChanged), this,
&Courtroom::on_application_state_changed);
Expand Down Expand Up @@ -4444,6 +4453,25 @@ void Courtroom::on_pos_dropdown_changed(QString p_text)
set_side(p_text);
}

void Courtroom::on_pos_dropdown_context_menu_requested(const QPoint &pos)
{
QMenu *menu = ui_iniswap_dropdown->lineEdit()->createStandardContextMenu();

menu->setAttribute(Qt::WA_DeleteOnClose);
menu->addSeparator();

menu->addAction(QString("Open background " + current_background), this,
[=] {
QString p_path = ao_app->get_real_path(VPath("background/" + current_background + "/"));
if (!dir_exists(p_path)) {
return;
}
QDesktopServices::openUrl(QUrl::fromLocalFile(p_path));
}
);
menu->popup(ui_iniswap_dropdown->mapToGlobal(pos));
}

void Courtroom::on_pos_remove_clicked()
{
ui_pos_dropdown->blockSignals(true);
Expand Down Expand Up @@ -4545,18 +4573,32 @@ void Courtroom::on_iniswap_context_menu_requested(const QPoint &pos)
if (file_exists(ao_app->get_real_path(
ao_app->get_character_path(current_char, "char.ini"))))
menu->addAction(QString("Edit " + current_char + "/char.ini"), this,
SLOT(on_iniswap_edit_requested()));
&Courtroom::on_iniswap_edit_requested);
if (ui_iniswap_dropdown->itemText(ui_iniswap_dropdown->currentIndex()) !=
char_list.at(m_cid).name)
menu->addAction(QString("Remove " + current_char), this,
SLOT(on_iniswap_remove_clicked()));
&Courtroom::on_iniswap_remove_clicked);

menu->addSeparator();
menu->addAction(QString("Open character folder " + current_char), this,
[=] {
QString p_path = ao_app->get_real_path(VPath("characters/" + current_char + "/"));
if (!dir_exists(p_path)) {
return;
Comment thread
stonedDiscord marked this conversation as resolved.
}

QDesktopServices::openUrl(QUrl::fromLocalFile(p_path));
}
Comment thread
Crystalwarrior marked this conversation as resolved.
);
menu->popup(ui_iniswap_dropdown->mapToGlobal(pos));
}

void Courtroom::on_iniswap_edit_requested()
{
QString p_path = ao_app->get_real_path(ao_app->get_character_path(current_char, "char.ini"));
if (!file_exists(p_path))
if (!file_exists(p_path)) {
return;
}
QDesktopServices::openUrl(QUrl::fromLocalFile(p_path));
}

Expand Down Expand Up @@ -4602,8 +4644,9 @@ void Courtroom::set_sfx_dropdown()
for (const QString &sound : qAsConst(sound_list)) {
QStringList unpacked = sound.split("=");
QString display = unpacked[0].trimmed();
if (unpacked.size() > 1)
if (unpacked.size() > 1) {
display = unpacked[1].trimmed();
}

display_sounds.append(display);
}
Expand Down Expand Up @@ -4638,7 +4681,11 @@ void Courtroom::on_sfx_context_menu_requested(const QPoint &pos)

menu->setAttribute(Qt::WA_DeleteOnClose);
menu->addSeparator();
menu->addAction(QString("Play"), this, &Courtroom::on_sfx_play_clicked);
// SFX is not "Nothing" or "Default"?
if (get_char_sfx() != "0" && get_char_sfx() != "1" && get_char_sfx() != "-") {
// Add an option to play the SFX
menu->addAction(QString("Play " + get_char_sfx()), this, &Courtroom::on_sfx_play_clicked);;
}
if (file_exists(ao_app->get_real_path(
ao_app->get_character_path(current_char, "soundlist.ini"))))
menu->addAction(QString("Edit " + current_char + "/soundlist.ini"), this,
Expand All @@ -4648,6 +4695,16 @@ void Courtroom::on_sfx_context_menu_requested(const QPoint &pos)
&Courtroom::on_sfx_edit_requested);
if (!custom_sfx.isEmpty())
menu->addAction(QString("Clear Edit Text"), this, &Courtroom::on_sfx_remove_clicked);
menu->addSeparator();
menu->addAction(QString("Open base sounds folder"), this,
[=] {
QString p_path = ao_app->get_base_path() + "sounds/general/";
if (!dir_exists(p_path)) {
return;
}
QDesktopServices::openUrl(QUrl::fromLocalFile(p_path));
}
);
menu->popup(ui_sfx_dropdown->mapToGlobal(pos));
}

Expand Down Expand Up @@ -4721,9 +4778,9 @@ void Courtroom::on_effects_context_menu_requested(const QPoint &pos)
QString("Open misc/" +
ao_app->read_char_ini(current_char, "effects", "Options") +
" folder"),
this, SLOT(on_character_effects_edit_requested()));
this, &Courtroom::on_character_effects_edit_requested);
menu->addAction(QString("Open theme's effects folder"), this,
SLOT(on_effects_edit_requested()));
&Courtroom::on_effects_edit_requested);
menu->popup(ui_effects_dropdown->mapToGlobal(pos));
}
void Courtroom::on_effects_edit_requested()
Expand Down Expand Up @@ -4913,6 +4970,17 @@ void Courtroom::on_music_list_context_menu_requested(const QPoint &pos)
connect(menu->actions().back(), &QAction::toggled, this,
&Courtroom::music_synchronize);

menu->addSeparator();
menu->addAction(QString("Open base music folder"), this,
[=] {
QString p_path = ao_app->get_base_path() + "sounds/music/";
if (!dir_exists(p_path)) {
return;
}
QDesktopServices::openUrl(QUrl::fromLocalFile(p_path));
}
);

menu->popup(ui_music_list->mapToGlobal(pos));
}

Expand Down Expand Up @@ -5225,6 +5293,22 @@ void Courtroom::on_prosecution_plus_clicked()
new AOPacket("HP#2#" + QString::number(f_state) + "#%"));
}
Comment thread
Crystalwarrior marked this conversation as resolved.

Comment thread
Crystalwarrior marked this conversation as resolved.
void Courtroom::on_text_color_context_menu_requested(const QPoint &pos)
{
QMenu *menu = new QMenu(this);

Comment thread
Crystalwarrior marked this conversation as resolved.
menu->addAction(QString("Open currently used chat_config.ini"), this,
[=] {
QString p_path = ao_app->get_asset("chat_config.ini", ao_app->current_theme, ao_app->get_subtheme(), ao_app->default_theme, ao_app->get_chat(current_char));
Comment thread
Crystalwarrior marked this conversation as resolved.
if (!file_exists(p_path)) {
Comment thread
Crystalwarrior marked this conversation as resolved.
return;
}
QDesktopServices::openUrl(QUrl::fromLocalFile(p_path));
Comment thread
Crystalwarrior marked this conversation as resolved.
}
);
menu->popup(ui_text_color->mapToGlobal(pos));
}

void Courtroom::set_text_color_dropdown()
{
// Clear the lists
Expand Down Expand Up @@ -5529,6 +5613,21 @@ void Courtroom::on_evidence_button_clicked()
}
}

Comment thread
Crystalwarrior marked this conversation as resolved.
void Courtroom::on_evidence_context_menu_requested(const QPoint &pos)
Comment thread
Crystalwarrior marked this conversation as resolved.
{
QMenu *menu = new QMenu(this);
Comment thread
Crystalwarrior marked this conversation as resolved.
menu->addAction(QString("Open base evidence folder"), this,
[=] {
Comment thread
Crystalwarrior marked this conversation as resolved.
QString p_path = ao_app->get_base_path() + "evidence/";
if (!dir_exists(p_path)) {
return;
}
QDesktopServices::openUrl(QUrl::fromLocalFile(p_path));
}
);
menu->popup(ui_evidence_button->mapToGlobal(pos));
Comment thread
Crystalwarrior marked this conversation as resolved.
}
Comment thread
Crystalwarrior marked this conversation as resolved.

Comment thread
Crystalwarrior marked this conversation as resolved.
Comment thread
Crystalwarrior marked this conversation as resolved.
void Courtroom::on_switch_area_music_clicked()
{
if (ui_area_list->isHidden()) {
Expand Down