aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCerapter <cerap@protonmail.com>2018-09-05 02:07:23 +0200
committerCerapter <cerap@protonmail.com>2018-09-05 02:07:23 +0200
commit12727fcf7f0684f916290113da4a76c331fadce9 (patch)
tree09dbf12188bf4316dc965237ac384456f9dc226e
parentadfe21afd6e5f4efc9c60b45590f4c086b9e0e52 (diff)
`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.
-rw-r--r--aoapplication.h3
-rw-r--r--aomovie.cpp5
-rw-r--r--aosfxplayer.cpp20
-rw-r--r--aosfxplayer.h2
-rw-r--r--courtroom.cpp41
-rw-r--r--text_file_functions.cpp28
6 files changed, 86 insertions, 13 deletions
diff --git a/aoapplication.h b/aoapplication.h
index 83403230..fc81d138 100644
--- a/aoapplication.h
+++ b/aoapplication.h
@@ -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);
diff --git a/aomovie.cpp b/aomovie.cpp
index 90c37010..d7727aa6 100644
--- a/aomovie.cpp
+++ b/aomovie.cpp
@@ -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;
diff --git a/aosfxplayer.cpp b/aosfxplayer.cpp
index 9089aecb..c8e15937 100644
--- a/aosfxplayer.cpp
+++ b/aosfxplayer.cpp
@@ -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 f_path;
+ 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 != "")
- f_path = ao_app->get_character_path(p_char) + p_sfx;
+ char_path = ao_app->get_character_path(p_char) + p_sfx;
+
+ QString f_path;
+
+ 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);
diff --git a/aosfxplayer.h b/aosfxplayer.h
index ab9fd979..4494b3e9 100644
--- a/aosfxplayer.h
+++ b/aosfxplayer.h
@@ -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);
diff --git a/courtroom.cpp b/courtroom.cpp
index 6df5f9fb..bf3d2d24 100644
--- a/courtroom.cpp
+++ b/courtroom.cpp
@@ -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());
diff --git a/text_file_functions.cpp b/text_file_functions.cpp
index b3f2a2d2..35d2788f 100644
--- a/text_file_functions.cpp
+++ b/text_file_functions.cpp
@@ -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";