summaryrefslogtreecommitdiff
path: root/src/bookmouse.hpp
blob: 2086ce876c91320bf85dc893af667a89a8e0b702 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef BOOKMOUSE_HPP
#define BOOKMOUSE_HPP

#include "file_dialog.hpp"
#include "archive.hpp"
#include "gl_context.hpp"
#include "imgui_context.hpp"
#include "sdl_context.hpp"
#include "sdl_main_window.hpp"

#include <memory>
#include <vector>

namespace bookmouse {

constexpr const char* AppName = "Bookmouse";
constexpr const char* AppVersionString = "1.0.0";

enum class PageLayout : uint8_t
{
    Single,
    Dual,
    Manga
};

class Bookmouse {
  public:
    Bookmouse() noexcept(false);

    int run();

  private:
    SDL_Event pollEvent();
    void updateState();
    void renderFrame();

    void menuing();
    void openDialog();

    void setArchive(std::unique_ptr<Archive>&& archive);

    SdlContext m_sdlContext;
    SdlMainWindow m_mainWindow;
    GlContext m_glContext;
    ImguiContext m_imgui;

    TimeFormat m_timeFormat{"%Y-%m-%d %H:%M"};

    bool m_running{true};
    bool m_openDialog{false};

    std::unique_ptr<FileDialog> m_fileDialog{nullptr};

    bool m_getContents{false};
    fud::String m_directoryName{"./"};
    fud::Directory m_directory;

    bool m_typeSelected{false};
    bool m_nameSelectede{false};
    bool m_sizeSelected{false};
    bool m_dateSelected{false};

    std::vector<DialogEntry> m_directoryContents{};

    std::unique_ptr<Archive> m_archive{nullptr};
    PageLayout m_pageLayout{PageLayout::Single};

    size_t m_pageNumber{0};

    // pageLeft
    // pageRight
    /*
    void setPages();
    void setPages(QLabel& label1, QLabel& label2);
    void setPagesNormal();
    void setPagesDual();
    void setPagesManga();
    */
};

} // namespace bookmouse

#endif