mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2024-12-25 07:51:42 +01:00
Lite version of the viewer
This commit is contained in:
parent
7614ab8240
commit
fd902ac525
@ -26,7 +26,8 @@ SUBDIRS += \
|
||||
UnitTests \
|
||||
Pdf4QtViewer \
|
||||
Pdf4QtViewerPlugins \
|
||||
Pdf4QtViewerProfi
|
||||
Pdf4QtViewerProfi \
|
||||
Pdf4QtViewerLite
|
||||
|
||||
CodeGenerator.depends = Pdf4QtLib
|
||||
JBIG2_Viewer.depends = Pdf4QtLib
|
||||
@ -36,3 +37,4 @@ UnitTests.depends = Pdf4QtLib
|
||||
Pdf4QtViewer.depends = Pdf4QtLib
|
||||
Pdf4QtViewerPlugins.depends = Pdf4QtLib
|
||||
Pdf4QtViewerProfi.depends = Pdf4QtViewer
|
||||
Pdf4QtViewerLite.depends = Pdf4QtViewer
|
||||
|
@ -50,6 +50,7 @@ SOURCES += \
|
||||
pdftexttospeech.cpp \
|
||||
pdfundoredomanager.cpp \
|
||||
pdfviewermainwindow.cpp \
|
||||
pdfviewermainwindowlite.cpp \
|
||||
pdfviewersettings.cpp \
|
||||
pdfviewersettingsdialog.cpp
|
||||
|
||||
@ -67,6 +68,7 @@ HEADERS += \
|
||||
pdfundoredomanager.h \
|
||||
pdfviewerglobal.h \
|
||||
pdfviewermainwindow.h \
|
||||
pdfviewermainwindowlite.h \
|
||||
pdfviewersettings.h \
|
||||
pdfviewersettingsdialog.h
|
||||
|
||||
@ -78,6 +80,7 @@ FORMS += \
|
||||
pdfrendertoimagesdialog.ui \
|
||||
pdfsidebarwidget.ui \
|
||||
pdfviewermainwindow.ui \
|
||||
pdfviewermainwindowlite.ui \
|
||||
pdfviewersettingsdialog.ui
|
||||
|
||||
CONFIG += force_debug_info
|
||||
|
441
Pdf4QtViewer/pdfviewermainwindowlite.cpp
Normal file
441
Pdf4QtViewer/pdfviewermainwindowlite.cpp
Normal file
@ -0,0 +1,441 @@
|
||||
// Copyright (C) 2020 Jakub Melka
|
||||
//
|
||||
// This file is part of Pdf4Qt.
|
||||
//
|
||||
// Pdf4Qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Pdf4Qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with Pdf4Qt. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include "PDFViewerMainWindowLite.h"
|
||||
#include "ui_PDFViewerMainWindowLite.h"
|
||||
|
||||
#include "pdfaboutdialog.h"
|
||||
#include "pdfsidebarwidget.h"
|
||||
#include "pdfadvancedfindwidget.h"
|
||||
#include "pdfviewersettingsdialog.h"
|
||||
#include "pdfdocumentpropertiesdialog.h"
|
||||
#include "pdfrendertoimagesdialog.h"
|
||||
#include "pdfoptimizedocumentdialog.h"
|
||||
|
||||
#include "pdfdocumentreader.h"
|
||||
#include "pdfvisitor.h"
|
||||
#include "pdfstreamfilters.h"
|
||||
#include "pdfdrawwidget.h"
|
||||
#include "pdfdrawspacecontroller.h"
|
||||
#include "pdfrenderingerrorswidget.h"
|
||||
#include "pdffont.h"
|
||||
#include "pdfitemmodels.h"
|
||||
#include "pdfutils.h"
|
||||
#include "pdfsendmail.h"
|
||||
#include "pdfexecutionpolicy.h"
|
||||
#include "pdfwidgetutils.h"
|
||||
#include "pdfdocumentwriter.h"
|
||||
#include "pdfsignaturehandler.h"
|
||||
#include "pdfadvancedtools.h"
|
||||
#include "pdfwidgetutils.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QSettings>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QCloseEvent>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QStandardPaths>
|
||||
#include <QDockWidget>
|
||||
#include <QTreeView>
|
||||
#include <QLayout>
|
||||
#include <QHeaderView>
|
||||
#include <QInputDialog>
|
||||
#include <QSpinBox>
|
||||
#include <QLabel>
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QDesktopServices>
|
||||
#include <QFileDialog>
|
||||
#include <QLockFile>
|
||||
#include <QtPrintSupport/QPrinter>
|
||||
#include <QtPrintSupport/QPrintDialog>
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
#include <QPluginLoader>
|
||||
#include <QToolButton>
|
||||
#include <QActionGroup>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include "Windows.h"
|
||||
#endif
|
||||
|
||||
namespace pdfviewer
|
||||
{
|
||||
|
||||
PDFViewerMainWindowLite::PDFViewerMainWindowLite(QWidget* parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::PDFViewerMainWindowLite),
|
||||
m_actionManager(new PDFActionManager(this)),
|
||||
m_programController(new PDFProgramController(this)),
|
||||
m_sidebarWidget(nullptr),
|
||||
m_sidebarDockWidget(nullptr),
|
||||
m_pageNumberSpinBox(nullptr),
|
||||
m_pageNumberLabel(nullptr),
|
||||
m_pageZoomSpinBox(nullptr),
|
||||
m_isLoadingUI(false),
|
||||
m_progress(new pdf::PDFProgress(this)),
|
||||
m_taskbarButton(new QWinTaskbarButton(this)),
|
||||
m_progressTaskbarIndicator(nullptr),
|
||||
m_progressDialog(nullptr),
|
||||
m_isChangingProgressStep(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
setAcceptDrops(true);
|
||||
|
||||
// Initialize toolbar icon size
|
||||
adjustToolbar(ui->mainToolBar);
|
||||
|
||||
// Initialize task bar progress
|
||||
m_progressTaskbarIndicator = m_taskbarButton->progress();
|
||||
|
||||
// Initialize actions
|
||||
m_actionManager->setAction(PDFActionManager::Open, ui->actionOpen);
|
||||
m_actionManager->setAction(PDFActionManager::Close, ui->actionClose);
|
||||
m_actionManager->setAction(PDFActionManager::Quit, ui->actionQuit);
|
||||
m_actionManager->setAction(PDFActionManager::ZoomIn, ui->actionZoom_In);
|
||||
m_actionManager->setAction(PDFActionManager::ZoomOut, ui->actionZoom_Out);
|
||||
m_actionManager->setAction(PDFActionManager::RotateRight, ui->actionRotateRight);
|
||||
m_actionManager->setAction(PDFActionManager::RotateLeft, ui->actionRotateLeft);
|
||||
m_actionManager->setAction(PDFActionManager::Print, ui->actionPrint);
|
||||
m_actionManager->setAction(PDFActionManager::GoToDocumentStart, ui->actionGoToDocumentStart);
|
||||
m_actionManager->setAction(PDFActionManager::GoToDocumentEnd, ui->actionGoToDocumentEnd);
|
||||
m_actionManager->setAction(PDFActionManager::GoToNextPage, ui->actionGoToNextPage);
|
||||
m_actionManager->setAction(PDFActionManager::GoToPreviousPage, ui->actionGoToPreviousPage);
|
||||
m_actionManager->setAction(PDFActionManager::GoToNextLine, ui->actionGoToNextLine);
|
||||
m_actionManager->setAction(PDFActionManager::GoToPreviousLine, ui->actionGoToPreviousLine);
|
||||
m_actionManager->setAction(PDFActionManager::RenderOptionAntialiasing, ui->actionRenderOptionAntialiasing);
|
||||
m_actionManager->setAction(PDFActionManager::RenderOptionTextAntialiasing, ui->actionRenderOptionTextAntialiasing);
|
||||
m_actionManager->setAction(PDFActionManager::RenderOptionSmoothPictures, ui->actionRenderOptionSmoothPictures);
|
||||
m_actionManager->setAction(PDFActionManager::RenderOptionIgnoreOptionalContentSettings, ui->actionRenderOptionIgnoreOptionalContentSettings);
|
||||
m_actionManager->setAction(PDFActionManager::RenderOptionDisplayAnnotations, ui->actionRenderOptionDisplayAnnotations);
|
||||
m_actionManager->setAction(PDFActionManager::RenderOptionInvertColors, ui->actionInvertColors);
|
||||
m_actionManager->setAction(PDFActionManager::Properties, ui->actionProperties);
|
||||
m_actionManager->setAction(PDFActionManager::Options, ui->actionOptions);
|
||||
m_actionManager->setAction(PDFActionManager::About, ui->actionAbout);
|
||||
m_actionManager->setAction(PDFActionManager::SendByMail, ui->actionSend_by_E_Mail);
|
||||
m_actionManager->setAction(PDFActionManager::FitPage, ui->actionFitPage);
|
||||
m_actionManager->setAction(PDFActionManager::FitWidth, ui->actionFitWidth);
|
||||
m_actionManager->setAction(PDFActionManager::FitHeight, ui->actionFitHeight);
|
||||
m_actionManager->setAction(PDFActionManager::ShowRenderingErrors, ui->actionRendering_Errors);
|
||||
m_actionManager->setAction(PDFActionManager::PageLayoutSinglePage, ui->actionPageLayoutSinglePage);
|
||||
m_actionManager->setAction(PDFActionManager::PageLayoutContinuous, ui->actionPageLayoutContinuous);
|
||||
m_actionManager->setAction(PDFActionManager::PageLayoutTwoPages, ui->actionPageLayoutTwoPages);
|
||||
m_actionManager->setAction(PDFActionManager::PageLayoutTwoColumns, ui->actionPageLayoutTwoColumns);
|
||||
m_actionManager->setAction(PDFActionManager::PageLayoutFirstPageOnRightSide, ui->actionFirstPageOnRightSide);
|
||||
m_actionManager->initActions(pdf::PDFWidgetUtils::scaleDPI(this, QSize(24, 24)), true);
|
||||
|
||||
for (QAction* action : m_programController->getRecentFileManager()->getActions())
|
||||
{
|
||||
ui->menuFile->insertAction(ui->actionQuit, action);
|
||||
}
|
||||
ui->menuFile->insertSeparator(ui->actionQuit);
|
||||
|
||||
connect(ui->actionQuit, &QAction::triggered, this, &PDFViewerMainWindowLite::onActionQuitTriggered);
|
||||
|
||||
m_pageNumberSpinBox = new QSpinBox(this);
|
||||
m_pageNumberLabel = new QLabel(this);
|
||||
m_pageNumberSpinBox->setFixedWidth(pdf::PDFWidgetUtils::scaleDPI_x(m_pageNumberSpinBox, 80));
|
||||
m_pageNumberSpinBox->setAlignment(Qt::AlignCenter);
|
||||
connect(m_pageNumberSpinBox, &QSpinBox::editingFinished, this, &PDFViewerMainWindowLite::onPageNumberSpinboxEditingFinished);
|
||||
|
||||
// Page control
|
||||
ui->mainToolBar->addSeparator();
|
||||
ui->mainToolBar->addAction(ui->actionGoToDocumentStart);
|
||||
ui->mainToolBar->addAction(ui->actionGoToPreviousPage);
|
||||
ui->mainToolBar->addWidget(m_pageNumberSpinBox);
|
||||
ui->mainToolBar->addWidget(m_pageNumberLabel);
|
||||
ui->mainToolBar->addAction(ui->actionGoToNextPage);
|
||||
ui->mainToolBar->addAction(ui->actionGoToDocumentEnd);
|
||||
|
||||
// Zoom
|
||||
ui->mainToolBar->addSeparator();
|
||||
ui->mainToolBar->addAction(ui->actionZoom_In);
|
||||
ui->mainToolBar->addAction(ui->actionZoom_Out);
|
||||
|
||||
m_pageZoomSpinBox = new QDoubleSpinBox(this);
|
||||
m_pageZoomSpinBox->setMinimum(pdf::PDFDrawWidgetProxy::getMinZoom() * 100);
|
||||
m_pageZoomSpinBox->setMaximum(pdf::PDFDrawWidgetProxy::getMaxZoom() * 100);
|
||||
m_pageZoomSpinBox->setDecimals(2);
|
||||
m_pageZoomSpinBox->setSuffix(tr("%"));
|
||||
m_pageZoomSpinBox->setFixedWidth(pdf::PDFWidgetUtils::scaleDPI_x(m_pageNumberSpinBox, 80));
|
||||
m_pageZoomSpinBox->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
|
||||
connect(m_pageZoomSpinBox, &QDoubleSpinBox::editingFinished, this, &PDFViewerMainWindowLite::onPageZoomSpinboxEditingFinished);
|
||||
ui->mainToolBar->addWidget(m_pageZoomSpinBox);
|
||||
|
||||
// Fit page, width, height
|
||||
ui->mainToolBar->addAction(ui->actionFitPage);
|
||||
ui->mainToolBar->addAction(ui->actionFitWidth);
|
||||
ui->mainToolBar->addAction(ui->actionFitHeight);
|
||||
ui->mainToolBar->addSeparator();
|
||||
|
||||
// Special tools
|
||||
m_programController->initialize(PDFProgramController::TextToSpeech, this, this, m_actionManager, m_progress);
|
||||
setCentralWidget(m_programController->getPdfWidget());
|
||||
setFocusProxy(m_programController->getPdfWidget());
|
||||
|
||||
m_sidebarWidget = new PDFSidebarWidget(m_programController->getPdfWidget()->getDrawWidgetProxy(), m_programController->getTextToSpeech(), m_programController->getCertificateStore(), m_programController->getSettings(), this);
|
||||
m_sidebarDockWidget = new QDockWidget(tr("Sidebar"), this);
|
||||
m_sidebarDockWidget->setObjectName("SidebarDockWidget");
|
||||
m_sidebarDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
|
||||
m_sidebarDockWidget->setWidget(m_sidebarWidget);
|
||||
addDockWidget(Qt::LeftDockWidgetArea, m_sidebarDockWidget);
|
||||
m_sidebarDockWidget->hide();
|
||||
connect(m_sidebarWidget, &PDFSidebarWidget::actionTriggered, m_programController, &PDFProgramController::onActionTriggered);
|
||||
|
||||
ui->menuView->addSeparator();
|
||||
ui->menuView->addAction(m_sidebarDockWidget->toggleViewAction());
|
||||
m_sidebarDockWidget->toggleViewAction()->setObjectName("actionSidebar");
|
||||
m_actionManager->addAdditionalAction(m_sidebarDockWidget->toggleViewAction());
|
||||
|
||||
connect(m_progress, &pdf::PDFProgress::progressStarted, this, &PDFViewerMainWindowLite::onProgressStarted);
|
||||
connect(m_progress, &pdf::PDFProgress::progressStep, this, &PDFViewerMainWindowLite::onProgressStep);
|
||||
connect(m_progress, &pdf::PDFProgress::progressFinished, this, &PDFViewerMainWindowLite::onProgressFinished);
|
||||
|
||||
m_programController->finishInitialization();
|
||||
|
||||
if (pdf::PDFToolManager* toolManager = m_programController->getToolManager())
|
||||
{
|
||||
connect(toolManager, &pdf::PDFToolManager::messageDisplayRequest, statusBar(), &QStatusBar::showMessage);
|
||||
}
|
||||
}
|
||||
|
||||
PDFViewerMainWindowLite::~PDFViewerMainWindowLite()
|
||||
{
|
||||
delete m_programController;
|
||||
m_programController = nullptr;
|
||||
|
||||
delete m_actionManager;
|
||||
m_actionManager = nullptr;
|
||||
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void PDFViewerMainWindowLite::onActionQuitTriggered()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
void PDFViewerMainWindowLite::onPageNumberSpinboxEditingFinished()
|
||||
{
|
||||
if (m_isLoadingUI)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_pageNumberSpinBox->hasFocus())
|
||||
{
|
||||
m_programController->getPdfWidget()->setFocus();
|
||||
}
|
||||
|
||||
m_programController->getPdfWidget()->getDrawWidgetProxy()->goToPage(m_pageNumberSpinBox->value() - 1);
|
||||
}
|
||||
|
||||
void PDFViewerMainWindowLite::onPageZoomSpinboxEditingFinished()
|
||||
{
|
||||
if (m_isLoadingUI)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_pageZoomSpinBox->hasFocus())
|
||||
{
|
||||
m_programController->getPdfWidget()->setFocus();
|
||||
}
|
||||
|
||||
m_programController->getPdfWidget()->getDrawWidgetProxy()->zoom(m_pageZoomSpinBox->value() / 100.0);
|
||||
}
|
||||
|
||||
void PDFViewerMainWindowLite::onProgressStarted(pdf::ProgressStartupInfo info)
|
||||
{
|
||||
Q_ASSERT(!m_progressDialog);
|
||||
if (info.showDialog)
|
||||
{
|
||||
m_progressDialog = new QProgressDialog(info.text, QString(), 0, 100, this);
|
||||
m_progressDialog->setWindowModality(Qt::WindowModal);
|
||||
m_progressDialog->setCancelButton(nullptr);
|
||||
}
|
||||
|
||||
m_progressTaskbarIndicator->setRange(0, 100);
|
||||
m_progressTaskbarIndicator->reset();
|
||||
m_progressTaskbarIndicator->show();
|
||||
|
||||
m_programController->setIsBusy(true);
|
||||
m_programController->updateActionsAvailability();
|
||||
}
|
||||
|
||||
void PDFViewerMainWindowLite::onProgressStep(int percentage)
|
||||
{
|
||||
if (m_isChangingProgressStep)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pdf::PDFTemporaryValueChange guard(&m_isChangingProgressStep, true);
|
||||
|
||||
if (m_progressDialog)
|
||||
{
|
||||
m_progressDialog->setValue(percentage);
|
||||
}
|
||||
|
||||
m_progressTaskbarIndicator->setValue(percentage);
|
||||
}
|
||||
|
||||
void PDFViewerMainWindowLite::onProgressFinished()
|
||||
{
|
||||
if (m_progressDialog)
|
||||
{
|
||||
m_progressDialog->hide();
|
||||
m_progressDialog->deleteLater();
|
||||
m_progressDialog = nullptr;
|
||||
}
|
||||
m_progressTaskbarIndicator->hide();
|
||||
|
||||
m_programController->setIsBusy(false);
|
||||
m_programController->updateActionsAvailability();
|
||||
}
|
||||
|
||||
void PDFViewerMainWindowLite::updateUI(bool fullUpdate)
|
||||
{
|
||||
pdf::PDFTemporaryValueChange guard(&m_isLoadingUI, true);
|
||||
|
||||
if (fullUpdate)
|
||||
{
|
||||
if (pdf::PDFDocument* document = m_programController->getDocument())
|
||||
{
|
||||
size_t pageCount = document->getCatalog()->getPageCount();
|
||||
m_pageNumberSpinBox->setMinimum(1);
|
||||
m_pageNumberSpinBox->setMaximum(static_cast<int>(pageCount));
|
||||
m_pageNumberSpinBox->setEnabled(true);
|
||||
m_pageNumberLabel->setText(tr(" / %1").arg(pageCount));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pageNumberSpinBox->setEnabled(false);
|
||||
m_pageNumberLabel->setText(QString());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<pdf::PDFInteger> currentPages = m_programController->getPdfWidget()->getDrawWidget()->getCurrentPages();
|
||||
if (!currentPages.empty())
|
||||
{
|
||||
m_pageNumberSpinBox->setValue(currentPages.front() + 1);
|
||||
|
||||
// Prefetch pages, if it is enabled
|
||||
if (m_programController->getSettings()->isPagePrefetchingEnabled())
|
||||
{
|
||||
m_programController->getPdfWidget()->getDrawWidgetProxy()->prefetchPages(currentPages.back());
|
||||
}
|
||||
}
|
||||
|
||||
m_sidebarWidget->setCurrentPages(currentPages);
|
||||
}
|
||||
|
||||
m_pageZoomSpinBox->setValue(m_programController->getPdfWidget()->getDrawWidgetProxy()->getZoom() * 100);
|
||||
}
|
||||
|
||||
QMenu* PDFViewerMainWindowLite::addToolMenu(QString name)
|
||||
{
|
||||
return ui->menuTools->addMenu(name);
|
||||
}
|
||||
|
||||
void PDFViewerMainWindowLite::setStatusBarMessage(QString message, int time)
|
||||
{
|
||||
statusBar()->showMessage(message, time);
|
||||
}
|
||||
|
||||
void PDFViewerMainWindowLite::setDocument(const pdf::PDFModifiedDocument& document)
|
||||
{
|
||||
if (m_sidebarWidget)
|
||||
{
|
||||
m_sidebarWidget->setDocument(document, *m_programController->getSignatures());
|
||||
}
|
||||
|
||||
if (m_sidebarWidget)
|
||||
{
|
||||
if (m_sidebarWidget->isEmpty())
|
||||
{
|
||||
m_sidebarDockWidget->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_sidebarDockWidget->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PDFViewerMainWindowLite::adjustToolbar(QToolBar* toolbar)
|
||||
{
|
||||
QSize iconSize = pdf::PDFWidgetUtils::scaleDPI(this, QSize(24, 24));
|
||||
toolbar->setIconSize(iconSize);
|
||||
}
|
||||
|
||||
void PDFViewerMainWindowLite::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
if (!m_programController->canClose())
|
||||
{
|
||||
// Jakub Melka: Do not allow to close the application, if document
|
||||
// reading is running.
|
||||
event->ignore();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_programController->writeSettings();
|
||||
m_programController->closeDocument();
|
||||
event->accept();
|
||||
}
|
||||
}
|
||||
|
||||
void PDFViewerMainWindowLite::showEvent(QShowEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
m_taskbarButton->setWindow(windowHandle());
|
||||
}
|
||||
|
||||
void PDFViewerMainWindowLite::dragEnterEvent(QDragEnterEvent* event)
|
||||
{
|
||||
if (event->mimeData()->hasUrls())
|
||||
{
|
||||
event->setDropAction(Qt::LinkAction);
|
||||
event->accept();
|
||||
}
|
||||
}
|
||||
|
||||
void PDFViewerMainWindowLite::dragMoveEvent(QDragMoveEvent* event)
|
||||
{
|
||||
if (event->mimeData()->hasUrls())
|
||||
{
|
||||
event->setDropAction(Qt::LinkAction);
|
||||
event->accept();
|
||||
}
|
||||
}
|
||||
|
||||
void PDFViewerMainWindowLite::dropEvent(QDropEvent* event)
|
||||
{
|
||||
if (event->mimeData()->hasUrls())
|
||||
{
|
||||
QList<QUrl> urls = event->mimeData()->urls();
|
||||
if (urls.size() == 1)
|
||||
{
|
||||
m_programController->openDocument(urls.front().toLocalFile());
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace pdfviewer
|
125
Pdf4QtViewer/pdfviewermainwindowlite.h
Normal file
125
Pdf4QtViewer/pdfviewermainwindowlite.h
Normal file
@ -0,0 +1,125 @@
|
||||
// Copyright (C) 2020 Jakub Melka
|
||||
//
|
||||
// This file is part of Pdf4Qt.
|
||||
//
|
||||
// Pdf4Qt is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Pdf4Qt is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with Pdf4Qt. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef PDFVIEWERMAINWINDOWLITE_H
|
||||
#define PDFVIEWERMAINWINDOWLITE_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 <QFuture>
|
||||
#include <QTreeView>
|
||||
#include <QMainWindow>
|
||||
#include <QWinTaskbarButton>
|
||||
#include <QWinTaskbarProgress>
|
||||
#include <QFutureWatcher>
|
||||
#include <QProgressDialog>
|
||||
|
||||
class QLabel;
|
||||
class QSpinBox;
|
||||
class QSettings;
|
||||
class QDoubleSpinBox;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class PDFViewerMainWindowLite;
|
||||
}
|
||||
|
||||
namespace pdf
|
||||
{
|
||||
class PDFAction;
|
||||
class PDFWidget;
|
||||
class PDFDocument;
|
||||
class PDFOptionalContentTreeItemModel;
|
||||
}
|
||||
|
||||
namespace pdfviewer
|
||||
{
|
||||
class PDFSidebarWidget;
|
||||
class PDFAdvancedFindWidget;
|
||||
|
||||
class Pdf4QtVIEWERLIBSHARED_EXPORT PDFViewerMainWindowLite : public QMainWindow, public IMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PDFViewerMainWindowLite(QWidget *parent = nullptr);
|
||||
virtual ~PDFViewerMainWindowLite() 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;
|
||||
|
||||
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::PDFViewerMainWindowLite* 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;
|
||||
QWinTaskbarButton* m_taskbarButton;
|
||||
QWinTaskbarProgress* m_progressTaskbarIndicator;
|
||||
|
||||
QProgressDialog* m_progressDialog;
|
||||
bool m_isChangingProgressStep;
|
||||
};
|
||||
|
||||
} // namespace pdfviewer
|
||||
|
||||
#endif // PDFVIEWERMAINWINDOWLITE_H
|
437
Pdf4QtViewer/pdfviewermainwindowlite.ui
Normal file
437
Pdf4QtViewer/pdfviewermainwindowlite.ui
Normal file
@ -0,0 +1,437 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PDFViewerMainWindowLite</class>
|
||||
<widget class="QMainWindow" name="PDFViewerMainWindowLite">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>770</width>
|
||||
<height>572</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>PDF Viewer</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget"/>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>770</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
<property name="title">
|
||||
<string>File</string>
|
||||
</property>
|
||||
<addaction name="actionOpen"/>
|
||||
<addaction name="actionClose"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionSend_by_E_Mail"/>
|
||||
<addaction name="actionPrint"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionProperties"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionQuit"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuGoTo">
|
||||
<property name="title">
|
||||
<string>Go To</string>
|
||||
</property>
|
||||
<addaction name="actionGoToDocumentStart"/>
|
||||
<addaction name="actionGoToDocumentEnd"/>
|
||||
<addaction name="actionGoToPreviousPage"/>
|
||||
<addaction name="actionGoToNextPage"/>
|
||||
<addaction name="actionGoToPreviousLine"/>
|
||||
<addaction name="actionGoToNextLine"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuView">
|
||||
<property name="title">
|
||||
<string>View</string>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuPage_Layout">
|
||||
<property name="title">
|
||||
<string>Page Layout</string>
|
||||
</property>
|
||||
<addaction name="actionPageLayoutSinglePage"/>
|
||||
<addaction name="actionPageLayoutContinuous"/>
|
||||
<addaction name="actionPageLayoutTwoPages"/>
|
||||
<addaction name="actionPageLayoutTwoColumns"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionFirstPageOnRightSide"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuRendering_Options">
|
||||
<property name="title">
|
||||
<string>Rendering Options</string>
|
||||
</property>
|
||||
<addaction name="actionRenderOptionAntialiasing"/>
|
||||
<addaction name="actionRenderOptionTextAntialiasing"/>
|
||||
<addaction name="actionRenderOptionSmoothPictures"/>
|
||||
<addaction name="actionRenderOptionIgnoreOptionalContentSettings"/>
|
||||
<addaction name="actionRenderOptionDisplayAnnotations"/>
|
||||
</widget>
|
||||
<addaction name="menuPage_Layout"/>
|
||||
<addaction name="menuRendering_Options"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionRotateRight"/>
|
||||
<addaction name="actionRotateLeft"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionZoom_In"/>
|
||||
<addaction name="actionZoom_Out"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionFitPage"/>
|
||||
<addaction name="actionFitWidth"/>
|
||||
<addaction name="actionFitHeight"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionInvertColors"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuTools">
|
||||
<property name="title">
|
||||
<string>Tools</string>
|
||||
</property>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionRendering_Errors"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionOptions"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuHelp">
|
||||
<property name="title">
|
||||
<string>Help</string>
|
||||
</property>
|
||||
<addaction name="actionAbout"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
<addaction name="menuView"/>
|
||||
<addaction name="menuGoTo"/>
|
||||
<addaction name="menuTools"/>
|
||||
<addaction name="menuHelp"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="mainToolBar">
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="actionOpen"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusBar"/>
|
||||
<action name="actionOpen">
|
||||
<property name="icon">
|
||||
<iconset resource="pdf4qtviewer.qrc">
|
||||
<normaloff>:/resources/open.svg</normaloff>:/resources/open.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionClose">
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionQuit">
|
||||
<property name="icon">
|
||||
<iconset resource="pdf4qtviewer.qrc">
|
||||
<normaloff>:/resources/quit.svg</normaloff>:/resources/quit.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Quit</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPageLayoutSinglePage">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Single Page</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+1</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPageLayoutContinuous">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Continuous</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+2</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPageLayoutTwoPages">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Two Pages</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+3</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPageLayoutTwoColumns">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Two columns</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+4</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFirstPageOnRightSide">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>First page on right side</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>First page on right side</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+5</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRendering_Errors">
|
||||
<property name="icon">
|
||||
<iconset resource="pdf4qtviewer.qrc">
|
||||
<normaloff>:/resources/rendering-errors.svg</normaloff>:/resources/rendering-errors.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rendering Errors</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+E</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRenderOptionAntialiasing">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Antialiasing</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRenderOptionTextAntialiasing">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Text Antialiasing</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRenderOptionSmoothPictures">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Smooth Pictures</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRenderOptionIgnoreOptionalContentSettings">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Ignore Optional Content Settings</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOptions">
|
||||
<property name="icon">
|
||||
<iconset resource="pdf4qtviewer.qrc">
|
||||
<normaloff>:/resources/settings.svg</normaloff>:/resources/settings.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Options...</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+K</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionZoom_In">
|
||||
<property name="icon">
|
||||
<iconset resource="pdf4qtviewer.qrc">
|
||||
<normaloff>:/resources/zoom-in.svg</normaloff>:/resources/zoom-in.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Zoom In</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionZoom_Out">
|
||||
<property name="icon">
|
||||
<iconset resource="pdf4qtviewer.qrc">
|
||||
<normaloff>:/resources/zoom-out.svg</normaloff>:/resources/zoom-out.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Zoom Out</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAbout">
|
||||
<property name="text">
|
||||
<string>About</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFitPage">
|
||||
<property name="icon">
|
||||
<iconset resource="pdf4qtviewer.qrc">
|
||||
<normaloff>:/resources/zoom-fit.svg</normaloff>:/resources/zoom-fit.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fit Page</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFitWidth">
|
||||
<property name="icon">
|
||||
<iconset resource="pdf4qtviewer.qrc">
|
||||
<normaloff>:/resources/zoom-fit-horizontal.svg</normaloff>:/resources/zoom-fit-horizontal.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fit Width</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>W</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFitHeight">
|
||||
<property name="icon">
|
||||
<iconset resource="pdf4qtviewer.qrc">
|
||||
<normaloff>:/resources/zoom-fit-vertical.svg</normaloff>:/resources/zoom-fit-vertical.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fit Height</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>H</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionProperties">
|
||||
<property name="icon">
|
||||
<iconset resource="pdf4qtviewer.qrc">
|
||||
<normaloff>:/resources/info.svg</normaloff>:/resources/info.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Properties</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSend_by_E_Mail">
|
||||
<property name="icon">
|
||||
<iconset resource="pdf4qtviewer.qrc">
|
||||
<normaloff>:/resources/send-mail.svg</normaloff>:/resources/send-mail.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Send by E-Mail</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionInvertColors">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Invert Colors</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRotateRight">
|
||||
<property name="icon">
|
||||
<iconset resource="pdf4qtviewer.qrc">
|
||||
<normaloff>:/resources/rotate-right.svg</normaloff>:/resources/rotate-right.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rotate Right</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRotateLeft">
|
||||
<property name="icon">
|
||||
<iconset resource="pdf4qtviewer.qrc">
|
||||
<normaloff>:/resources/rotate-left.svg</normaloff>:/resources/rotate-left.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rotate Left</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPrint">
|
||||
<property name="icon">
|
||||
<iconset resource="pdf4qtviewer.qrc">
|
||||
<normaloff>:/resources/print.svg</normaloff>:/resources/print.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Print</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRenderOptionDisplayAnnotations">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Display Annotations</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionGoToDocumentStart">
|
||||
<property name="icon">
|
||||
<iconset resource="pdf4qtviewer.qrc">
|
||||
<normaloff>:/resources/previous-start.svg</normaloff>:/resources/previous-start.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Go to document start</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionGoToDocumentEnd">
|
||||
<property name="icon">
|
||||
<iconset resource="pdf4qtviewer.qrc">
|
||||
<normaloff>:/resources/next-end.svg</normaloff>:/resources/next-end.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Go to document end</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionGoToNextPage">
|
||||
<property name="icon">
|
||||
<iconset resource="pdf4qtviewer.qrc">
|
||||
<normaloff>:/resources/next-page.svg</normaloff>:/resources/next-page.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Go to next page</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionGoToPreviousPage">
|
||||
<property name="icon">
|
||||
<iconset resource="pdf4qtviewer.qrc">
|
||||
<normaloff>:/resources/previous-page.svg</normaloff>:/resources/previous-page.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Go to previous page</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionGoToNextLine">
|
||||
<property name="icon">
|
||||
<iconset resource="pdf4qtviewer.qrc">
|
||||
<normaloff>:/resources/next.svg</normaloff>:/resources/next.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Go to next line</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionGoToPreviousLine">
|
||||
<property name="icon">
|
||||
<iconset resource="pdf4qtviewer.qrc">
|
||||
<normaloff>:/resources/previous.svg</normaloff>:/resources/previous.svg</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Go to previous line</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources>
|
||||
<include location="pdf4qtviewer.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
44
Pdf4QtViewerLite/Pdf4QtViewerLite.pro
Normal file
44
Pdf4QtViewerLite/Pdf4QtViewerLite.pro
Normal file
@ -0,0 +1,44 @@
|
||||
# Copyright (C) 2018-2020 Jakub Melka
|
||||
#
|
||||
# This file is part of Pdf4Qt.
|
||||
#
|
||||
# Pdf4Qt is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Pdf4Qt is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with Pdf4Qt. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
QT += core gui widgets winextras
|
||||
|
||||
TARGET = Pdf4QtViewerLite
|
||||
TEMPLATE = app
|
||||
|
||||
VERSION = 1.0.0
|
||||
|
||||
RC_ICONS = $$PWD/app-icon.ico
|
||||
|
||||
QMAKE_TARGET_DESCRIPTION = "PDF viewer for Qt, Lite version"
|
||||
QMAKE_TARGET_COPYRIGHT = "(c) Jakub Melka 2018-2020"
|
||||
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
QMAKE_CXXFLAGS += /std:c++latest /utf-8
|
||||
|
||||
INCLUDEPATH += $$PWD/../PDF4QtLib/Sources $$PWD/../PDF4QtViewer
|
||||
DESTDIR = $$OUT_PWD/..
|
||||
LIBS += -L$$OUT_PWD/..
|
||||
LIBS += -lPDF4QtLib -lPDF4QtViewer
|
||||
CONFIG += force_debug_info
|
||||
|
||||
application.files = $$DESTDIR/Pdf4QtViewerLite.exe
|
||||
application.path = $$DESTDIR/install
|
||||
INSTALLS += application
|
||||
|
||||
SOURCES += \
|
||||
main.cpp
|
BIN
Pdf4QtViewerLite/app-icon.ico
Normal file
BIN
Pdf4QtViewerLite/app-icon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 251 KiB |
34
Pdf4QtViewerLite/main.cpp
Normal file
34
Pdf4QtViewerLite/main.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
#include "pdfviewermainwindowlite.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCommandLineParser>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication::setAttribute(Qt::AA_CompressHighFrequencyEvents, true);
|
||||
QApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true);
|
||||
QApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity, true);
|
||||
QApplication application(argc, argv);
|
||||
|
||||
QCoreApplication::setOrganizationName("MelkaJ");
|
||||
QCoreApplication::setApplicationName("PDF4QT Viewer Lite");
|
||||
QCoreApplication::setApplicationVersion("1.0.0");
|
||||
QApplication::setApplicationDisplayName(QApplication::translate("Application", "PDF4QT Viewer Lite"));
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription(QCoreApplication::applicationName());
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
parser.addPositionalArgument("file", "The PDF file to open.");
|
||||
parser.process(application);
|
||||
|
||||
pdfviewer::PDFViewerMainWindowLite mainWindow;
|
||||
mainWindow.show();
|
||||
|
||||
QStringList arguments = application.arguments();
|
||||
if (arguments.size() > 1)
|
||||
{
|
||||
mainWindow.getProgramController()->openDocument(arguments[1]);
|
||||
}
|
||||
|
||||
return application.exec();
|
||||
}
|
Loading…
Reference in New Issue
Block a user