aboutsummaryrefslogtreecommitdiff
path: root/plugins/MangaCombined.hpp
blob: 6999eb4d7ff77c3c86775385a1b1ce0fe35c6ce0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once

#include "Manga.hpp"
#include <vector>
#include <map>
#include "../include/AsyncTask.hpp"

namespace QuickMedia {
    struct MangaPlugin {
        std::unique_ptr<Page> page;
        std::string title;
        std::string service_name;
        std::string logo_path;
    };

    using MangaCombinedSearchThread = std::pair<MangaPlugin*, AsyncTask<BodyItems>>;

    class MangaCombinedSearchPage : public Page {
    public:
        MangaCombinedSearchPage(Program *program, std::vector<MangaPlugin> search_pages);
        const char* get_title() const override { return "Search"; }
        bool search_is_filter() override { return false; }
        SearchResult search(const std::string &str, BodyItems &result_items) override;
        PluginResult get_page(const std::string &str, int page, BodyItems &result_items) override;
        PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
        sf::Vector2i get_thumbnail_max_size() override { return sf::Vector2i(101, 141); };
    private:
        std::vector<MangaPlugin> search_pages;
        std::vector<MangaCombinedSearchThread> search_threads; // TODO: Use async task pool
    };
}