aboutsummaryrefslogtreecommitdiff
path: root/plugins/HotExamples.hpp
blob: 154f1abfbafbde1660607f1afe53573b9b891b12 (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
32
33
34
35
36
#pragma once

#include "Page.hpp"

namespace QuickMedia {
    void hot_examples_front_page_fill(BodyItems &body_items);

    class HotExamplesLanguageSelectPage : public Page {
    public:
        HotExamplesLanguageSelectPage(Program *program) : Page(program) {}
        const char* get_title() const override { return "Select language"; }
        PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
        bool submit_is_async() override { return false; }
    };

    class HotExamplesSearchPage : public Page {
    public:
        HotExamplesSearchPage(Program *program, const std::string &language) : Page(program), language(language) {}
        const char* get_title() const override { return "Select result"; }
        bool search_is_filter() override { return false; }
        SearchResult search(const std::string &str, BodyItems &result_items) override;
        PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
    private:
        std::string language;
    };

    class HotExamplesCodeExamplesPage : public Page {
    public:
        HotExamplesCodeExamplesPage(Program *program, std::string title) : Page(program), title(std::move(title)) {}
        const char* get_title() const override { return title.c_str(); }
        PluginResult submit(const std::string&, const std::string&, std::vector<Tab>&) override { return PluginResult::OK; }
        bool submit_is_async() override { return false; }
    private:
        std::string title;
    };
}