From 85362d58c120a7bd121f68506fe5afad7071c29b Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 3 May 2018 20:37:08 +0200 Subject: Change image directory, change emoji size --- include/Cache.hpp | 3 +++ src/Cache.cpp | 11 +++++++++-- src/Channel.cpp | 2 +- src/Text.cpp | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/include/Cache.hpp b/include/Cache.hpp index 19b811a..71226cc 100644 --- a/include/Cache.hpp +++ b/include/Cache.hpp @@ -50,6 +50,9 @@ namespace dchat // Creates directory if it doesn't exist (recursively). Throws boost exception on failure static boost::filesystem::path getDchatDir(); + // Creates directory if it doesn't exist (recursively). Throws boost exception on failure + static boost::filesystem::path getImagesDir(); + static void loadBindsFromFile(); static void replaceBindsInFile(const std::unordered_map &binds); diff --git a/src/Cache.cpp b/src/Cache.cpp index fe377e8..0610a18 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp @@ -63,6 +63,13 @@ namespace dchat return dchatHomeDir; } + boost::filesystem::path Cache::getImagesDir() + { + boost::filesystem::path imagesDir = getDchatDir() / "images"; + boost::filesystem::create_directories(imagesDir); + return imagesDir; + } + void Cache::loadBindsFromFile() { StringView fileContent; @@ -157,7 +164,7 @@ namespace dchat bool failed = exitStatus != 0; if(!failed) { - boost::filesystem::path filepath = getDchatDir(); + boost::filesystem::path filepath = getImagesDir(); odhtdb::Hash urlHash(it->url.data(), it->url.size()); filepath /= urlHash.toString(); @@ -209,7 +216,7 @@ namespace dchat return it->second; // TODO: Verify hashed url is not too long for filepath on windows - boost::filesystem::path filepath = getDchatDir(); + boost::filesystem::path filepath = getImagesDir(); odhtdb::Hash urlHash(url.data(), url.size()); filepath /= urlHash.toString(); diff --git a/src/Channel.cpp b/src/Channel.cpp index ce8c76c..ae66e3c 100644 --- a/src/Channel.cpp +++ b/src/Channel.cpp @@ -45,7 +45,7 @@ namespace dchat } { - Message *message = new Message(&systemUser, u8"[emoji](https://discordemoji.com/assets/emoji/PepeDab.gif)"); + Message *message = new Message(&systemUser, u8"[emoji](https://discordemoji.com/assets/emoji/PepeDab.gif)[emoji](https://cdn.discordapp.com/emojis/398569871761473538.png?v=1)"); messageBoard.addMessage(message); } diff --git a/src/Text.cpp b/src/Text.cpp index b22a27d..02ea6fa 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -8,7 +8,7 @@ namespace dchat { const float TAB_WIDTH = 4.0f; const float EMOJI_PADDING = 5.0f; - const float EMOJI_SCALE_WITH_TEXT = 1.0f; + const float EMOJI_SCALE_WITH_TEXT = 1.7f; const float EMOJI_SCALE_STANDALONE = 5.0f; Text::Text(const sf::Font *_font) : -- cgit v1.2.3