new function tags and fallback paths
This commit is contained in:
parent
c2db480d68
commit
146ef97311
@ -54,6 +54,7 @@ void AOCharButton::set_image(QString p_character)
|
||||
{
|
||||
QString image_path = ao_app->get_character_path(p_character) + "char_icon.png";
|
||||
QString legacy_path = ao_app->get_demothings_path() + p_character.toLower() + "_char_icon.png";
|
||||
QString alt_path = ao_app->get_demothings_path() + p_character.toLower() + "_off.png";
|
||||
|
||||
this->setText("");
|
||||
|
||||
|
@ -25,12 +25,15 @@ AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_
|
||||
void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix)
|
||||
{
|
||||
QString original_path = ao_app->get_character_path(p_char) + emote_prefix + p_emote.toLower() + ".gif";
|
||||
QString alt_path = ao_app->get_character_path(p_char) + p_emote.toLower() + ".png";
|
||||
QString placeholder_path = ao_app->get_theme_path() + "placeholder.gif";
|
||||
QString placeholder_default_path = ao_app->get_default_theme_path() + "placeholder.gif";
|
||||
QString gif_path;
|
||||
|
||||
if (file_exists(original_path))
|
||||
gif_path = original_path;
|
||||
else if (file_exists(alt_path))
|
||||
gif_path = alt_path;
|
||||
else if (file_exists(placeholder_path))
|
||||
gif_path = placeholder_path;
|
||||
else
|
||||
|
@ -27,6 +27,7 @@ void AOMovie::play(QString p_gif, QString p_char)
|
||||
QString gif_path;
|
||||
|
||||
QString custom_path = ao_app->get_character_path(p_char) + p_gif + ".gif";
|
||||
QString alt_path = ao_app->get_character_path(p_char) + p_gif + ".png";
|
||||
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";
|
||||
@ -34,6 +35,8 @@ void AOMovie::play(QString p_gif, QString p_char)
|
||||
|
||||
if (file_exists(custom_path))
|
||||
gif_path = custom_path;
|
||||
else if (file_exists(alt_path))
|
||||
gif_path = alt_path;
|
||||
else if (file_exists(theme_path))
|
||||
gif_path = theme_path;
|
||||
else if (file_exists(default_theme_path))
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
|
||||
#include "file_functions.h"
|
||||
|
||||
@ -8,3 +9,10 @@ bool file_exists(QString file_path)
|
||||
|
||||
return check_file.exists() && check_file.isFile();
|
||||
}
|
||||
|
||||
bool dir_exists(QString dir_path)
|
||||
{
|
||||
QDir check_dir(dir_path);
|
||||
|
||||
return check_dir.exists();
|
||||
}
|
||||
|
@ -4,5 +4,6 @@
|
||||
#include <QString>
|
||||
|
||||
bool file_exists(QString file_path);
|
||||
bool dir_exists(QString file_path);
|
||||
|
||||
#endif // FILE_FUNCTIONS_H
|
||||
|
@ -165,23 +165,6 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
||||
server_minor = version_list.at(2).toInt();
|
||||
}
|
||||
}
|
||||
|
||||
if (server_software == "v1312.150")
|
||||
{
|
||||
encryption_needed = false;
|
||||
custom_objection_enabled = true;
|
||||
}
|
||||
else if (server_software == "tsuserver3")
|
||||
{
|
||||
if (server_release >= 3)
|
||||
{
|
||||
yellow_text_enabled = true;
|
||||
flipping_enabled = true;
|
||||
custom_objection_enabled = true;
|
||||
improved_loading_enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
send_server_packet(new AOPacket("ID#AO2#" + get_version_string() + "#%"));
|
||||
}
|
||||
else if (header == "CT")
|
||||
@ -192,6 +175,19 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
||||
if (courtroom_constructed)
|
||||
w_courtroom->append_server_chatmessage(f_contents.at(0), f_contents.at(1));
|
||||
}
|
||||
else if (header == "FL")
|
||||
{
|
||||
if (f_packet.contains("yellowtext",Qt::CaseInsensitive))
|
||||
yellow_text_enabled = true;
|
||||
if (f_packet.contains("flipping",Qt::CaseInsensitive))
|
||||
flipping_enabled = true;
|
||||
if (f_packet.contains("customobjections",Qt::CaseInsensitive))
|
||||
custom_objection_enabled = true;
|
||||
if (f_packet.contains("fastloading",Qt::CaseInsensitive))
|
||||
improved_loading_enabled = true;
|
||||
if (f_packet.contains("noencryption",Qt::CaseInsensitive))
|
||||
encryption_needed = false;
|
||||
}
|
||||
else if (header == "PN")
|
||||
{
|
||||
if (f_contents.size() < 2)
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "aoapplication.h"
|
||||
#include "courtroom.h"
|
||||
|
||||
#include "file_functions.h"
|
||||
#include <QDir>
|
||||
#include <QDebug>
|
||||
|
||||
@ -16,7 +16,16 @@ QString AOApplication::get_base_path()
|
||||
#elif defined(ANDROID)
|
||||
return "/storage/extSdCard/AO2/";
|
||||
#else
|
||||
return (QDir::currentPath() + "/base/");
|
||||
QString default_path = "/base/";
|
||||
QString alt_path = "/data/";
|
||||
|
||||
if (dir_exists(default_path))
|
||||
return QDir::currentPath() + default_path;
|
||||
else if (dir_exists(alt_path))
|
||||
return QDir::currentPath() + alt_path;
|
||||
else
|
||||
return QDir::currentPath() + default_path;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -37,7 +46,14 @@ QString AOApplication::get_character_path(QString p_character)
|
||||
|
||||
QString AOApplication::get_demothings_path()
|
||||
{
|
||||
return get_base_path() + "misc/demothings/";
|
||||
QString default_path = "misc/demothings/";
|
||||
QString alt_path = "misc/RosterImages";
|
||||
if (dir_exists(default_path))
|
||||
return get_base_path() + default_path;
|
||||
else if (dir_exists(alt_path))
|
||||
return get_base_path() + alt_path;
|
||||
else
|
||||
return get_base_path() + default_path;
|
||||
}
|
||||
QString AOApplication::get_sounds_path()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user