Files
PDF4QT/Pdf4QtLibGui/pdfviewermainwindow.h
2025-04-27 12:39:06 +02:00

132 lines
4.0 KiB
C++

// MIT License
//
// Copyright (c) 2018-2025 Jakub Melka and Contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef PDFVIEWERMAINWINDOW_H
#define PDFVIEWERMAINWINDOW_H
#include "pdfviewerglobal.h"
#include "pdfcatalog.h"
#include "pdfrenderer.h"
#include "pdfprogress.h"
#include "pdfdocument.h"
#include "pdfviewersettings.h"
#include "pdfdocumentreader.h"
#include "pdfdocumentpropertiesdialog.h"
#include "pdfwidgettool.h"
#include "pdfrecentfilemanager.h"
#include "pdftexttospeech.h"
#include "pdfannotation.h"
#include "pdfform.h"
#include "pdfundoredomanager.h"
#include "pdfplugin.h"
#include "pdfprogramcontroller.h"
#include "pdfwintaskbarprogress.h"
#include <QFuture>
#include <QTreeView>
#include <QMainWindow>
#include <QFutureWatcher>
#include <QProgressBar>
#include <QLabel>
class QLabel;
class QSpinBox;
class QSettings;
class QDoubleSpinBox;
namespace Ui
{
class PDFViewerMainWindow;
}
namespace pdf
{
class PDFAction;
class PDFWidget;
class PDFDocument;
class PDFOptionalContentTreeItemModel;
}
namespace pdfviewer
{
class PDFSidebarWidget;
class PDFAdvancedFindWidget;
class PDF4QTLIBGUILIBSHARED_EXPORT PDFViewerMainWindow : public QMainWindow, public IMainWindow
{
Q_OBJECT
public:
explicit PDFViewerMainWindow(QWidget *parent = nullptr);
virtual ~PDFViewerMainWindow() override;
virtual void closeEvent(QCloseEvent* event) override;
virtual void showEvent(QShowEvent* event) override;
PDFProgramController* getProgramController() const { return m_programController; }
virtual void updateUI(bool fullUpdate) override;
virtual QMenu* addToolMenu(QString name) override;
virtual void setStatusBarMessage(QString message, int time) override;
virtual void setDocument(const pdf::PDFModifiedDocument& document) override;
virtual void adjustToolbar(QToolBar* toolbar) override;
virtual pdf::PDFTextSelection getSelectedText() const override;
protected:
virtual void dragEnterEvent(QDragEnterEvent* event) override;
virtual void dragMoveEvent(QDragMoveEvent* event) override;
virtual void dropEvent(QDropEvent* event) override;
private:
void onActionQuitTriggered();
void onPageNumberSpinboxEditingFinished();
void onPageZoomSpinboxEditingFinished();
void onProgressStarted(pdf::ProgressStartupInfo info);
void onProgressStep(int percentage);
void onProgressFinished();
QIcon createStickyNoteIcon(QString key) const;
Ui::PDFViewerMainWindow* ui;
PDFActionManager* m_actionManager;
PDFProgramController* m_programController;
PDFSidebarWidget* m_sidebarWidget;
QDockWidget* m_sidebarDockWidget;
QSpinBox* m_pageNumberSpinBox;
QLabel* m_pageNumberLabel;
QDoubleSpinBox* m_pageZoomSpinBox;
bool m_isLoadingUI;
pdf::PDFProgress* m_progress;
PDFWinTaskBarProgress* m_progressTaskbarIndicator;
QProgressBar* m_progressBarOnStatusBar;
QLabel* m_progressBarLeftLabelOnStatusBar;
bool m_isChangingProgressStep;
};
} // namespace pdfviewer
#endif // PDFVIEWERMAINWINDOW_H