From 9799803529c57930a0e7f12e45cbcf2b2e4419eb Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 28 May 2020 02:08:40 +0200 Subject: Add support for mangadex --- include/Notification.hpp | 32 ++++++++++++++++++++++++++++++++ include/QuickMedia.hpp | 4 ++-- 2 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 include/Notification.hpp (limited to 'include') diff --git a/include/Notification.hpp b/include/Notification.hpp new file mode 100644 index 0000000..22f2f77 --- /dev/null +++ b/include/Notification.hpp @@ -0,0 +1,32 @@ +#pragma once + +#include "Program.h" +#include +#include + +namespace QuickMedia { + enum class Urgency { + LOW, + NORMAL, + CRITICAL + }; + + static const char* urgency_string(Urgency urgency) { + switch(urgency) { + case Urgency::LOW: + return "low"; + case Urgency::NORMAL: + return "normal"; + case Urgency::CRITICAL: + return "critical"; + } + assert(false); + return nullptr; + } + + static void show_notification(const std::string &title, const std::string &description, Urgency urgency = Urgency::NORMAL) { + const char *args[] = { "notify-send", "-u", urgency_string(urgency), "--", title.c_str(), description.c_str(), nullptr }; + exec_program_async(args, nullptr); + printf("Notification: title: %s, description: %s\n", title.c_str(), description.c_str()); + } +} \ No newline at end of file diff --git a/include/QuickMedia.hpp b/include/QuickMedia.hpp index bd72806..19d84a8 100644 --- a/include/QuickMedia.hpp +++ b/include/QuickMedia.hpp @@ -15,7 +15,7 @@ namespace QuickMedia { class Plugin; - class Manganelo; + class Manga; class Program { public: @@ -43,7 +43,7 @@ namespace QuickMedia { }; LoadImageResult load_image_by_index(int image_index, sf::Texture &image_texture, sf::String &error_message); - void download_chapter_images_if_needed(Manganelo *image_plugin); + void download_chapter_images_if_needed(Manga *image_plugin); void select_episode(BodyItem *item, bool start_from_beginning); // Returns Page::EXIT if empty -- cgit v1.2.3