2021-05-10 21:50:15 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2021, Matthew Olsson <mattco@serenityos.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2021-05-24 08:34:44 +03:00
|
|
|
#include "NumericInput.h"
|
2021-05-10 21:50:15 +03:00
|
|
|
#include "PDFViewer.h"
|
2021-05-24 07:34:06 +03:00
|
|
|
#include "SidebarWidget.h"
|
2023-01-02 17:15:14 +03:00
|
|
|
#include <AK/NonnullRefPtr.h>
|
|
|
|
#include <AK/RefPtr.h>
|
2021-05-24 07:34:06 +03:00
|
|
|
#include <LibGUI/Action.h>
|
2022-03-29 07:19:45 +03:00
|
|
|
#include <LibGUI/ActionGroup.h>
|
2022-11-23 16:16:52 +03:00
|
|
|
#include <LibGUI/CheckBox.h>
|
2021-05-10 21:50:15 +03:00
|
|
|
#include <LibGUI/Widget.h>
|
|
|
|
|
|
|
|
class PDFViewer;
|
2022-12-14 18:13:13 +03:00
|
|
|
class PagedErrorsModel;
|
2021-05-10 21:50:15 +03:00
|
|
|
|
|
|
|
class PDFViewerWidget final : public GUI::Widget {
|
|
|
|
C_OBJECT(PDFViewerWidget)
|
2021-05-24 07:34:06 +03:00
|
|
|
|
2021-05-10 21:50:15 +03:00
|
|
|
public:
|
2021-05-24 07:34:06 +03:00
|
|
|
~PDFViewerWidget() override = default;
|
|
|
|
|
2021-07-21 22:21:03 +03:00
|
|
|
void initialize_menubar(GUI::Window&);
|
2023-02-09 05:02:46 +03:00
|
|
|
void open_file(StringView path, NonnullOwnPtr<Core::File> file);
|
2021-05-10 21:50:15 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
PDFViewerWidget();
|
|
|
|
|
2022-03-29 07:19:45 +03:00
|
|
|
void initialize_toolbar(GUI::Toolbar&);
|
2023-02-09 05:02:46 +03:00
|
|
|
PDF::PDFErrorOr<void> try_open_file(StringView path, NonnullOwnPtr<Core::File> file);
|
2022-03-29 07:19:45 +03:00
|
|
|
|
2021-05-10 21:50:15 +03:00
|
|
|
RefPtr<PDFViewer> m_viewer;
|
2021-05-24 07:34:06 +03:00
|
|
|
RefPtr<SidebarWidget> m_sidebar;
|
2022-12-14 18:13:13 +03:00
|
|
|
NonnullRefPtr<PagedErrorsModel> m_paged_errors_model;
|
|
|
|
RefPtr<GUI::TreeView> m_errors_tree_view;
|
2021-05-24 08:34:44 +03:00
|
|
|
RefPtr<NumericInput> m_page_text_box;
|
|
|
|
RefPtr<GUI::Label> m_total_page_label;
|
|
|
|
RefPtr<GUI::Action> m_go_to_prev_page_action;
|
|
|
|
RefPtr<GUI::Action> m_go_to_next_page_action;
|
|
|
|
RefPtr<GUI::Action> m_toggle_sidebar_action;
|
2022-01-02 23:58:51 +03:00
|
|
|
RefPtr<GUI::Action> m_zoom_in_action;
|
|
|
|
RefPtr<GUI::Action> m_zoom_out_action;
|
|
|
|
RefPtr<GUI::Action> m_reset_zoom_action;
|
2022-01-03 02:24:11 +03:00
|
|
|
RefPtr<GUI::Action> m_rotate_counterclockwise_action;
|
|
|
|
RefPtr<GUI::Action> m_rotate_clockwise_action;
|
2022-03-29 07:19:45 +03:00
|
|
|
GUI::ActionGroup m_page_view_action_group;
|
|
|
|
RefPtr<GUI::Action> m_page_view_mode_single;
|
|
|
|
RefPtr<GUI::Action> m_page_view_mode_multiple;
|
2022-11-23 16:16:52 +03:00
|
|
|
RefPtr<GUI::CheckBox> m_show_clipping_paths;
|
2022-11-24 21:11:06 +03:00
|
|
|
RefPtr<GUI::CheckBox> m_show_images;
|
2022-01-02 23:58:51 +03:00
|
|
|
|
2021-05-24 07:34:06 +03:00
|
|
|
bool m_sidebar_open { false };
|
2021-05-10 21:50:15 +03:00
|
|
|
ByteBuffer m_buffer;
|
|
|
|
};
|