aboutsummaryrefslogtreecommitdiff
path: root/plugins/MangaCombined.hpp
blob: 39a143c5717496df5e3259839e0ce30b89d69a3d (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
#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;
    };

    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;
        void cancel_operation() override;
    private:
        std::vector<MangaPlugin> search_pages;
        std::vector<MangaCombinedSearchThread> search_threads; // TODO: Use async task pool
    };
}