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
This commit is contained in:
Crystalwarrior 2019-10-12 01:43:48 +03:00
parent 990f653e4a
commit 330aa97550
3 changed files with 27 additions and 7 deletions

View File

@ -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

View File

@ -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;

View File

@ -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;