aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstonedDiscord <stoned@derpymail.org>2017-03-18 14:04:14 +0100
committerstonedDiscord <stoned@derpymail.org>2017-03-18 14:04:14 +0100
commit146ef9731189b45a81c0d3062d2365b34d12f60c (patch)
tree18a9cc3b78db21c092058ee29022bcf7954d5c9d
parentc2db480d68380ce665c9bb313152027eaa36300d (diff)
new function tags and fallback paths
-rw-r--r--aocharbutton.cpp1
-rw-r--r--aocharmovie.cpp3
-rw-r--r--aomovie.cpp3
-rw-r--r--file_functions.cpp8
-rw-r--r--file_functions.h1
-rw-r--r--packet_distribution.cpp30
-rw-r--r--path_functions.cpp22
7 files changed, 48 insertions, 20 deletions
diff --git a/aocharbutton.cpp b/aocharbutton.cpp
index d6edf804..b32be010 100644
--- a/aocharbutton.cpp
+++ b/aocharbutton.cpp
@@ -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("");
diff --git a/aocharmovie.cpp b/aocharmovie.cpp
index 71985237..40953e58 100644
--- a/aocharmovie.cpp
+++ b/aocharmovie.cpp
@@ -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
diff --git a/aomovie.cpp b/aomovie.cpp
index 9e1b64ee..2e7194ae 100644
--- a/aomovie.cpp
+++ b/aomovie.cpp
@@ -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))
diff --git a/file_functions.cpp b/file_functions.cpp
index a191d67f..bc9185f2 100644
--- a/file_functions.cpp
+++ b/file_functions.cpp
@@ -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();
+}
diff --git a/file_functions.h b/file_functions.h
index 5ecf14ac..81a90ed9 100644
--- a/file_functions.h
+++ b/file_functions.h
@@ -4,5 +4,6 @@
#include <QString>
bool file_exists(QString file_path);
+bool dir_exists(QString file_path);
#endif // FILE_FUNCTIONS_H
diff --git a/packet_distribution.cpp b/packet_distribution.cpp
index 8740f050..80a6b0e0 100644
--- a/packet_distribution.cpp
+++ b/packet_distribution.cpp
@@ -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)
diff --git a/path_functions.cpp b/path_functions.cpp
index 7f0b83cb..47fab063 100644
--- a/path_functions.cpp
+++ b/path_functions.cpp
@@ -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()
{