aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCrystalwarrior <varsash@gmail.com>2019-10-12 01:43:48 +0300
committerCrystalwarrior <varsash@gmail.com>2019-10-12 01:43:48 +0300
commit330aa9755095cd4f12f028452d268c50311d3710 (patch)
treeb5fb6bf39032266db2151cd118c0cee71459558c /src
parent990f653e4a063a684b5d5584c7454c36a1036a85 (diff)
Properly handle "true song name" even with folders/categories and file formats (paving way for folder-categorized music lists set up by servers)
Prevent BG's from falling back on default BG path (this isn't really user-convenient and causes more trouble than its worth, e.g. stands appearing on BG's that dont' want stands to appear) Implement Case Cafe's method of categorization for (a) and (b) emotes
Diffstat (limited to 'src')
-rw-r--r--src/aocharmovie.cpp1
-rw-r--r--src/aoscene.cpp22
-rw-r--r--src/courtroom.cpp11
3 files changed, 27 insertions, 7 deletions
diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp
index b05d7f64..9bbb8761 100644
--- a/src/aocharmovie.cpp
+++ b/src/aocharmovie.cpp
@@ -28,6 +28,7 @@ void AOCharMovie::load_image(QString p_char, QString p_emote, QString emote_pref
QList<QString> pathlist;
pathlist = {
ao_app->get_image_suffix(ao_app->get_character_path(p_char, emote_prefix + p_emote)), //Default path
+ ao_app->get_image_suffix(ao_app->get_character_path(p_char, emote_prefix + "/" + p_emote)),//Path check if it's categorized into a folder
ao_app->get_character_path(p_char, p_emote + ".png"), //Non-animated path if emote_prefix fails
ao_app->get_image_suffix(ao_app->get_theme_path("placeholder")), //Theme placeholder path
ao_app->get_image_suffix(ao_app->get_default_theme_path("placeholder")), //Default theme placeholder path
diff --git a/src/aoscene.cpp b/src/aoscene.cpp
index c9314258..527d25db 100644
--- a/src/aoscene.cpp
+++ b/src/aoscene.cpp
@@ -13,8 +13,15 @@ AOScene::AOScene(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent)
void AOScene::set_image(QString p_image)
{
QString background_path = ao_app->get_image_suffix(ao_app->get_background_path(p_image));
- if (!file_exists(background_path))
- background_path = ao_app->get_image_suffix(ao_app->get_default_background_path(p_image)); //Default path
+ if (!file_exists(background_path)) //If image is missing, clear current image
+ {
+ //background_path = ao_app->get_image_suffix(ao_app->get_default_background_path(p_image)); //Default path
+ this->clear();
+ this->setMovie(nullptr);
+
+ m_movie->stop();
+ return;
+ }
if (file_exists(background_path) && background_path == last_image)
return;
@@ -46,8 +53,15 @@ void AOScene::set_legacy_desk(QString p_image)
{
QString desk_path = ao_app->get_image_suffix(ao_app->get_background_path(p_image));
- if (!file_exists(desk_path))
- desk_path = ao_app->get_image_suffix(ao_app->get_default_background_path(p_image)); //Default path
+ if (!file_exists(desk_path)) //If image is missing, clear current image
+ {
+ //desk_path = ao_app->get_image_suffix(ao_app->get_default_background_path(p_image)); //Default path
+ this->clear();
+ this->setMovie(nullptr);
+
+ m_movie->stop();
+ return;
+ }
if (file_exists(desk_path) && desk_path == last_image)
return;
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index 7d2f183f..42927918 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -127,7 +127,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_area_list = new QListWidget(this);
ui_area_list->hide();
ui_music_list = new QTreeWidget(this);
- ui_music_list->setColumnCount(1);
+ ui_music_list->setColumnCount(2);
+ ui_music_list->hideColumn(1);
ui_music_list->setHeaderHidden(true);
ui_music_list->header()->setStretchLastSection(false);
ui_music_list->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
@@ -1184,13 +1185,15 @@ void Courtroom::list_music()
{
QString i_song = music_list.at(n_song);
QString i_song_listname = i_song.left(i_song.lastIndexOf("."));
+ i_song_listname = i_song_listname.right(i_song_listname.length() - (i_song_listname.lastIndexOf("/") + 1));
QTreeWidgetItem *treeItem;
if (i_song_listname != i_song && parent != nullptr) //not a category, parent exists
treeItem = new QTreeWidgetItem(parent);
else
treeItem = new QTreeWidgetItem(ui_music_list);
- treeItem->setText(0, i_song);
+ treeItem->setText(0, i_song_listname);
+ treeItem->setText(1, i_song);
music_row_to_number.append(n_song);
QString song_path = ao_app->get_music_path(i_song);
@@ -2825,7 +2828,8 @@ void Courtroom::handle_song(QStringList *p_contents)
return;
QString f_song = f_contents.at(0);
- QString f_song_clear = f_song.left(f_song.lastIndexOf(".")).right(f_song.lastIndexOf("/"));
+ QString f_song_clear = f_song.left(f_song.lastIndexOf("."));
+ f_song_clear = f_song_clear.right(f_song_clear.length() - (f_song_clear.lastIndexOf("/") + 1));
int n_char = f_contents.at(1).toInt();
bool looping = true;
@@ -3779,6 +3783,7 @@ void Courtroom::on_music_list_double_clicked(QTreeWidgetItem *p_item, int column
if (is_muted)
return;
+ column = 1; //Column 1 is always the metadata (which we want)
QString p_song = p_item->text(column);
QStringList packet_contents;