From 3acaa9ef53167d07cb43e671b67b4c9bec9a2f51 Mon Sep 17 00:00:00 2001 From: tallbl0nde <40382856+tallbl0nde@users.noreply.github.com> Date: Sun, 25 Jul 2021 18:05:46 +0930 Subject: [PATCH] App: Handle overflowing text better --- Application/libs/Aether | 2 +- Application/source/ui/frame/AlbumInfo.cpp | 12 ++++-------- Application/source/ui/frame/ArtistInfo.cpp | 9 +++------ Application/source/ui/frame/PlaylistInfo.cpp | 9 +++------ Application/source/ui/screen/Home.cpp | 2 -- 5 files changed, 11 insertions(+), 23 deletions(-) diff --git a/Application/libs/Aether b/Application/libs/Aether index 91536eb..188b471 160000 --- a/Application/libs/Aether +++ b/Application/libs/Aether @@ -1 +1 @@ -Subproject commit 91536eba79cd3111d32e3667c16aea6bba65ae36 +Subproject commit 188b4719fa03149c28bf0d645b38350743905890 diff --git a/Application/source/ui/frame/AlbumInfo.cpp b/Application/source/ui/frame/AlbumInfo.cpp index ee2d856..8d44cdb 100644 --- a/Application/source/ui/frame/AlbumInfo.cpp +++ b/Application/source/ui/frame/AlbumInfo.cpp @@ -95,37 +95,33 @@ namespace Frame { this->bottomContainer->addElement(this->image); // Fetch image (id3 tags) - Aether::BorderButton * button = new Aether::BorderButton(txt->x(), this->imagePath->y() + this->imagePath->h() + 20, this->w() * 0.3, 50, 2, "", 20, [this]() { + Aether::BorderButton * button = new Aether::BorderButton(txt->x(), this->imagePath->y() + this->imagePath->h() + 20, this->w() * 0.3, 50, 2, "Common.ReplaceFile"_lang, 20, [this]() { this->createFileBrowser(FBType::Audio); }); - button->setString("Common.ReplaceFile"_lang); button->setBorderColour(this->app->theme()->FG()); button->setTextColour(this->app->theme()->FG()); this->bottomContainer->addElement(button); // Fetch image (local image) - button = new Aether::BorderButton(button->x() + button->w() + this->w()*0.02, button->y(), this->w() * 0.3, 50, 2, "", 20, [this]() { + button = new Aether::BorderButton(button->x() + button->w() + this->w()*0.02, button->y(), this->w() * 0.3, 50, 2, "Common.ReplaceSD"_lang, 20, [this]() { this->createFileBrowser(FBType::Image); }); - button->setString("Common.ReplaceSD"_lang); button->setBorderColour(this->app->theme()->FG()); button->setTextColour(this->app->theme()->FG()); this->bottomContainer->addElement(button); // Fetch image (TheAudioDB) - button = new Aether::BorderButton(txt->x(), button->y() + button->h() + 20, this->w() * 0.3, 50, 2, "", 20, [this]() { + button = new Aether::BorderButton(txt->x(), button->y() + button->h() + 20, this->w() * 0.3, 50, 2, "Common.ReplaceAudioDB"_lang, 20, [this]() { this->createAudioDBOverlay(); }); - button->setString("Common.ReplaceAudioDB"_lang); button->setBorderColour(this->app->theme()->FG()); button->setTextColour(this->app->theme()->FG()); this->bottomContainer->addElement(button); // Remove image - button = new Aether::BorderButton(button->x() + button->w() + this->w()*0.02, button->y(), this->w() * 0.3, 50, 2, "", 20, [this]() { + button = new Aether::BorderButton(button->x() + button->w() + this->w()*0.02, button->y(), this->w() * 0.3, 50, 2, "Common.RemoveImage"_lang, 20, [this]() { this->removeImage(); }); - button->setString("Common.RemoveImage"_lang); button->setBorderColour(this->app->theme()->FG()); button->setTextColour(this->app->theme()->FG()); this->bottomContainer->addElement(button); diff --git a/Application/source/ui/frame/ArtistInfo.cpp b/Application/source/ui/frame/ArtistInfo.cpp index aa873c3..1e983c8 100644 --- a/Application/source/ui/frame/ArtistInfo.cpp +++ b/Application/source/ui/frame/ArtistInfo.cpp @@ -95,29 +95,26 @@ namespace Frame { // Fetch image (local) Aether::Container * c = new Aether::Container(txt->x(), this->imagePath->y() + this->imagePath->h() + 20, this->w()*0.62, 50); - Aether::BorderButton * button = new Aether::BorderButton(c->x(), c->y(), this->w() * 0.3, 50, 2, "", 20, [this]() { + Aether::BorderButton * button = new Aether::BorderButton(c->x(), c->y(), this->w() * 0.3, 50, 2, "Common.ReplaceSD"_lang, 20, [this]() { this->createFileBrowser(); }); - button->setString("Common.ReplaceSD"_lang); button->setBorderColour(this->app->theme()->FG()); button->setTextColour(this->app->theme()->FG()); c->addElement(button); // Fetch image (TheAudioDB) - button = new Aether::BorderButton(button->x() + button->w() + this->w()*0.02, button->y(), this->w() * 0.3, 50, 2, "", 20, [this]() { + button = new Aether::BorderButton(button->x() + button->w() + this->w()*0.02, button->y(), this->w() * 0.3, 50, 2, "Common.ReplaceAudioDB"_lang, 20, [this]() { this->createAudioDBOverlay(); }); - button->setString("Common.ReplaceAudioDB"_lang); button->setBorderColour(this->app->theme()->FG()); button->setTextColour(this->app->theme()->FG()); c->addElement(button); this->bottomContainer->addElement(c); // Remove image - button = new Aether::BorderButton(txt->x() + this->w()*0.16, button->y() + button->h() + 20, this->w() * 0.3, 50, 2, "", 20, [this]() { + button = new Aether::BorderButton(txt->x() + this->w()*0.16, button->y() + button->h() + 20, this->w() * 0.3, 50, 2, "Common.RemoveImage"_lang, 20, [this]() { this->removeImage(); }); - button->setString("Common.RemoveImage"_lang); button->setBorderColour(this->app->theme()->FG()); button->setTextColour(this->app->theme()->FG()); this->bottomContainer->addElement(button); diff --git a/Application/source/ui/frame/PlaylistInfo.cpp b/Application/source/ui/frame/PlaylistInfo.cpp index a652ce0..bc5aae5 100644 --- a/Application/source/ui/frame/PlaylistInfo.cpp +++ b/Application/source/ui/frame/PlaylistInfo.cpp @@ -97,28 +97,25 @@ namespace Frame { this->bottomContainer->addElement(this->image); // Fetch image (id3 tags) - Aether::BorderButton * button = new Aether::BorderButton(txt->x(), this->imagePath->y() + this->imagePath->h() + 20, this->w() * 0.3, 50, 2, "", 20, [this]() { + Aether::BorderButton * button = new Aether::BorderButton(txt->x(), this->imagePath->y() + this->imagePath->h() + 20, this->w() * 0.3, 50, 2, "Common.ReplaceFile"_lang, 20, [this]() { this->createFileBrowser(FBType::Audio); }); - button->setString("Common.ReplaceFile"_lang); button->setBorderColour(this->app->theme()->FG()); button->setTextColour(this->app->theme()->FG()); this->bottomContainer->addElement(button); // Fetch image (local image) - button = new Aether::BorderButton(button->x() + button->w() + this->w()*0.02, button->y(), this->w() * 0.3, 50, 2, "", 20, [this]() { + button = new Aether::BorderButton(button->x() + button->w() + this->w()*0.02, button->y(), this->w() * 0.3, 50, 2, "Common.ReplaceSD"_lang, 20, [this]() { this->createFileBrowser(FBType::Image); }); - button->setString("Common.ReplaceSD"_lang); button->setBorderColour(this->app->theme()->FG()); button->setTextColour(this->app->theme()->FG()); this->bottomContainer->addElement(button); // Remove image - button = new Aether::BorderButton(button->x() - this->w()*0.16, button->y() + button->h() + 20, this->w() * 0.3, 50, 2, "", 20, [this]() { + button = new Aether::BorderButton(button->x() - this->w()*0.16, button->y() + button->h() + 20, this->w() * 0.3, 50, 2, "Common.RemoveImage"_lang, 20, [this]() { this->removeImage(); }); - button->setString("Common.RemoveImage"_lang); button->setBorderColour(this->app->theme()->FG()); button->setTextColour(this->app->theme()->FG()); this->bottomContainer->addElement(button); diff --git a/Application/source/ui/screen/Home.cpp b/Application/source/ui/screen/Home.cpp index 1913a00..1f9632b 100644 --- a/Application/source/ui/screen/Home.cpp +++ b/Application/source/ui/screen/Home.cpp @@ -472,7 +472,6 @@ namespace Screen { int maxW = this->backButton->w() - 70 - this->backIcon->w(); this->backText = new Aether::Text(0, 0, "Common.Back"_lang, 26); while (this->backText->textureWidth() > maxW) { - // TODO: Fix // This renders the text each time but should be fine :P this->backText->setFontSize(this->backText->fontSize()-2); } @@ -496,7 +495,6 @@ namespace Screen { maxW = quitButton->w() - 70 - quitIcon->w(); Aether::Text * quitText = new Aether::Text(0, 0, "Common.Quit"_lang, 26); while (quitText->textureWidth() > maxW) { - // TODO: Fix // This renders the text each time but should be fine :P quitText->setFontSize(quitText->fontSize()-2); }