misc folder given purpose as the 'default' for shouts and chatboxes.

- Default bubbles.
- Default shout sounds.
- Custom chatbox.
- Custom colours for the chatbox.
- No need to have duplicate files of bubbles and shouts all over the
character folders.
This commit is contained in:
Cerapter 2018-09-05 02:07:23 +02:00
parent adfe21afd6
commit 12727fcf7f
6 changed files with 86 additions and 13 deletions

View File

@ -205,6 +205,9 @@ public:
//Returns the color with p_identifier from p_file
QColor get_color(QString p_identifier, QString p_file);
// Returns the colour from the misc folder.
QColor get_chat_color(QString p_identifier, QString p_chat);
//Returns the sfx with p_identifier from sounds.ini in the current theme path
QString get_sfx(QString p_identifier);

View File

@ -32,13 +32,16 @@ void AOMovie::play(QString p_gif, QString p_char, QString p_custom_theme)
else
custom_path = ao_app->get_character_path(p_char) + p_gif + "_bubble.gif";
QString misc_path = ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + p_gif + "_bubble.gif";
QString custom_theme_path = ao_app->get_base_path() + "themes/" + p_custom_theme + "/" + p_gif + ".gif";
QString theme_path = ao_app->get_theme_path() + p_gif + ".gif";
QString default_theme_path = ao_app->get_default_theme_path() + p_gif + ".gif";
QString placeholder_path = ao_app->get_theme_path() + "placeholder.gif";
QString default_placeholder_path = ao_app->get_default_theme_path() + "placeholder.gif";
if (file_exists(custom_path))
if (file_exists(misc_path))
gif_path = misc_path;
else if (file_exists(custom_path))
gif_path = custom_path;
else if (file_exists(custom_theme_path))
gif_path = custom_theme_path;

View File

@ -1,4 +1,5 @@
#include "aosfxplayer.h"
#include "file_functions.h"
AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app)
{
@ -14,17 +15,28 @@ AOSfxPlayer::~AOSfxPlayer()
}
void AOSfxPlayer::play(QString p_sfx, QString p_char)
void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout)
{
m_sfxplayer->stop();
p_sfx = p_sfx.toLower();
QString misc_path = "";
QString char_path = "";
QString sound_path = ao_app->get_sounds_path() + p_sfx;
if (shout != "")
misc_path = ao_app->get_base_path() + "misc/" + shout + "/" + p_sfx;
if (p_char != "")
char_path = ao_app->get_character_path(p_char) + p_sfx;
QString f_path;
if (p_char != "")
f_path = ao_app->get_character_path(p_char) + p_sfx;
if (file_exists(char_path))
f_path = char_path;
else if (file_exists(misc_path))
f_path = misc_path;
else
f_path = ao_app->get_sounds_path() + p_sfx;
f_path = sound_path;
m_sfxplayer->setMedia(QUrl::fromLocalFile(f_path));
set_volume(m_volume);

View File

@ -14,7 +14,7 @@ public:
AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app);
~AOSfxPlayer();
void play(QString p_sfx, QString p_char = "");
void play(QString p_sfx, QString p_char = "", QString shout = "");
void stop();
void set_volume(int p_volume);

View File

@ -1228,20 +1228,20 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
{
case 1:
ui_vp_objection->play("holdit", f_char, f_custom_theme);
objection_player->play("holdit.wav", f_char);
objection_player->play("holdit.wav", f_char, f_custom_theme);
break;
case 2:
ui_vp_objection->play("objection", f_char, f_custom_theme);
objection_player->play("objection.wav", f_char);
objection_player->play("objection.wav", f_char, f_custom_theme);
break;
case 3:
ui_vp_objection->play("takethat", f_char, f_custom_theme);
objection_player->play("takethat.wav", f_char);
objection_player->play("takethat.wav", f_char, f_custom_theme);
break;
//case 4 is AO2 only
case 4:
ui_vp_objection->play("custom", f_char, f_custom_theme);
objection_player->play("custom.wav", f_char);
objection_player->play("custom.wav", f_char, f_custom_theme);
break;
default:
qDebug() << "W: Logic error in objection switch statement!";
@ -1288,7 +1288,7 @@ void Courtroom::handle_chatmessage_2()
ui_vp_chatbox->set_image("chatmed.png");
else
{
QString chatbox_path = ao_app->get_base_path() + "misc/" + chatbox + ".png";
QString chatbox_path = ao_app->get_base_path() + "misc/" + chatbox + "/chatbox.png";
ui_vp_chatbox->set_image_from_path(chatbox_path);
}
@ -2377,7 +2377,23 @@ void Courtroom::set_scene()
void Courtroom::set_text_color()
{
switch (m_chatmessage[TEXT_COLOR].toInt())
QColor textcolor = ao_app->get_chat_color(m_chatmessage[TEXT_COLOR], ao_app->get_chat(m_chatmessage[CHAR_NAME]));
ui_vp_message->setTextBackgroundColor(QColor(0,0,0,0));
ui_vp_message->setTextColor(textcolor);
QString style = "background-color: rgba(0, 0, 0, 0);";
style.append("color: rgb(");
style.append(QString::number(textcolor.red()));
style.append(", ");
style.append(QString::number(textcolor.green()));
style.append(", ");
style.append(QString::number(textcolor.blue()));
style.append(")");
ui_vp_message->setStyleSheet(style);
/*switch (m_chatmessage[TEXT_COLOR].toInt())
{
case GREEN:
ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
@ -2414,7 +2430,7 @@ void Courtroom::set_text_color()
ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
"color: white");
}
}*/
}
void Courtroom::set_ip_list(QString p_list)
@ -2629,8 +2645,19 @@ void Courtroom::on_ooc_return_pressed()
else if (ooc_message.startsWith("/switch_am"))
{
on_switch_area_music_clicked();
ui_ooc_chat_message->clear();
return;
}
else if (ooc_message.startsWith("/enable_blocks"))
{
ao_app->shownames_enabled = true;
ao_app->charpairs_enabled = true;
ao_app->arup_enabled = true;
ao_app->modcall_reason_enabled = true;
on_reload_theme_clicked();
ui_ooc_chat_message->clear();
return;
}
QStringList packet_contents;
packet_contents.append(ui_ooc_chat_name->text());

View File

@ -257,6 +257,34 @@ QColor AOApplication::get_color(QString p_identifier, QString p_file)
return return_color;
}
QColor AOApplication::get_chat_color(QString p_identifier, QString p_chat)
{
p_identifier = p_identifier.prepend("c");
QString design_ini_path = get_base_path() + "misc/" + p_chat + "/config.ini";
QString default_path = get_base_path() + "misc/default/config.ini";
QString f_result = read_design_ini(p_identifier, design_ini_path);
QColor return_color(255, 255, 255);
if (f_result == "")
{
f_result = read_design_ini(p_identifier, default_path);
if (f_result == "")
return return_color;
}
QStringList color_list = f_result.split(",");
if (color_list.size() < 3)
return return_color;
return_color.setRed(color_list.at(0).toInt());
return_color.setGreen(color_list.at(1).toInt());
return_color.setBlue(color_list.at(2).toInt());
return return_color;
}
QString AOApplication::get_sfx(QString p_identifier)
{
QString design_ini_path = get_theme_path() + "courtroom_sounds.ini";