mirror of https://github.com/JakubMelka/PDF4QT.git
#Issue 25: Plugin compilation + icons for programs
This commit is contained in:
parent
e5775906cf
commit
0c4b5fbc82
|
@ -27,6 +27,7 @@ add_executable(Pdf4QtDocDiff
|
|||
mainwindow.ui
|
||||
settingsdockwidget.ui
|
||||
resources.qrc
|
||||
icon.rc
|
||||
)
|
||||
|
||||
target_link_libraries(Pdf4QtDocDiff PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGLWidgets)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
IDI_ICON1 ICON DISCARDABLE "app-icon.ico"
|
|
@ -28,6 +28,7 @@ add_executable(Pdf4QtDocPageOrganizer
|
|||
mainwindow.ui
|
||||
selectbookmarkstoregroupdialog.ui
|
||||
resources.qrc
|
||||
icon.rc
|
||||
)
|
||||
|
||||
target_link_libraries(Pdf4QtDocPageOrganizer PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
IDI_ICON1 ICON DISCARDABLE "app-icon.ico"
|
|
@ -119,4 +119,7 @@ target_link_libraries(Pdf4QtLib PRIVATE JPEG::JPEG)
|
|||
target_include_directories(Pdf4QtLib INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/sources)
|
||||
target_include_directories(Pdf4QtLib PUBLIC ${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR})
|
||||
|
||||
set_target_properties(Pdf4QtLib PROPERTIES
|
||||
VERSION ${PDF4QT_VERSION}
|
||||
SOVERSION ${PDF4QT_VERSION})
|
||||
|
||||
|
|
|
@ -33,6 +33,11 @@ int qt_default_dpi_y() { return 96; }
|
|||
namespace pdf
|
||||
{
|
||||
|
||||
static constexpr bool isScalingNeeded()
|
||||
{
|
||||
return QT_VERSION_MAJOR < 6;
|
||||
}
|
||||
|
||||
int PDFWidgetUtils::getPixelSize(const QPaintDevice* device, pdf::PDFReal sizeMM)
|
||||
{
|
||||
const int width = device->width();
|
||||
|
@ -50,27 +55,53 @@ int PDFWidgetUtils::getPixelSize(const QPaintDevice* device, pdf::PDFReal sizeMM
|
|||
|
||||
int PDFWidgetUtils::scaleDPI_x(const QPaintDevice* device, int unscaledSize)
|
||||
{
|
||||
const double logicalDPI_x = device->logicalDpiX();
|
||||
const double defaultDPI_x = qt_default_dpi_x();
|
||||
return (logicalDPI_x / defaultDPI_x) * unscaledSize;
|
||||
if constexpr (isScalingNeeded())
|
||||
{
|
||||
const double logicalDPI_x = device->logicalDpiX();
|
||||
const double defaultDPI_x = qt_default_dpi_x();
|
||||
return (logicalDPI_x / defaultDPI_x) * unscaledSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
return unscaledSize;
|
||||
}
|
||||
}
|
||||
|
||||
int PDFWidgetUtils::scaleDPI_y(const QPaintDevice* device, int unscaledSize)
|
||||
{
|
||||
const double logicalDPI_y = device->logicalDpiY();
|
||||
const double defaultDPI_y = qt_default_dpi_y();
|
||||
return (logicalDPI_y / defaultDPI_y) * unscaledSize;
|
||||
if constexpr (isScalingNeeded())
|
||||
{
|
||||
const double logicalDPI_y = device->logicalDpiY();
|
||||
const double defaultDPI_y = qt_default_dpi_y();
|
||||
return (logicalDPI_y / defaultDPI_y) * unscaledSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
return unscaledSize;
|
||||
}
|
||||
}
|
||||
|
||||
PDFReal PDFWidgetUtils::scaleDPI_x(const QPaintDevice* device, PDFReal unscaledSize)
|
||||
{
|
||||
const double logicalDPI_x = device->logicalDpiX();
|
||||
const double defaultDPI_x = qt_default_dpi_x();
|
||||
return (logicalDPI_x / defaultDPI_x) * unscaledSize;
|
||||
if constexpr (isScalingNeeded())
|
||||
{
|
||||
const double logicalDPI_x = device->logicalDpiX();
|
||||
const double defaultDPI_x = qt_default_dpi_x();
|
||||
return (logicalDPI_x / defaultDPI_x) * unscaledSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
return unscaledSize;
|
||||
}
|
||||
}
|
||||
|
||||
void PDFWidgetUtils::scaleWidget(QWidget* widget, QSize unscaledSize)
|
||||
{
|
||||
if constexpr (!isScalingNeeded())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const double logicalDPI_x = widget->logicalDpiX();
|
||||
const double logicalDPI_y = widget->logicalDpiY();
|
||||
const double defaultDPI_x = qt_default_dpi_x();
|
||||
|
@ -84,15 +115,22 @@ void PDFWidgetUtils::scaleWidget(QWidget* widget, QSize unscaledSize)
|
|||
|
||||
QSize PDFWidgetUtils::scaleDPI(const QPaintDevice* widget, QSize unscaledSize)
|
||||
{
|
||||
const double logicalDPI_x = widget->logicalDpiX();
|
||||
const double logicalDPI_y = widget->logicalDpiY();
|
||||
const double defaultDPI_x = qt_default_dpi_x();
|
||||
const double defaultDPI_y = qt_default_dpi_y();
|
||||
if constexpr (isScalingNeeded())
|
||||
{
|
||||
const double logicalDPI_x = widget->logicalDpiX();
|
||||
const double logicalDPI_y = widget->logicalDpiY();
|
||||
const double defaultDPI_x = qt_default_dpi_x();
|
||||
const double defaultDPI_y = qt_default_dpi_y();
|
||||
|
||||
const int width = (logicalDPI_x / defaultDPI_x) * unscaledSize.width();
|
||||
const int height = (logicalDPI_y / defaultDPI_y) * unscaledSize.height();
|
||||
const int width = (logicalDPI_x / defaultDPI_x) * unscaledSize.width();
|
||||
const int height = (logicalDPI_y / defaultDPI_y) * unscaledSize.height();
|
||||
|
||||
return QSize(width, height);
|
||||
return QSize(width, height);
|
||||
}
|
||||
else
|
||||
{
|
||||
return unscaledSize;
|
||||
}
|
||||
}
|
||||
|
||||
void PDFWidgetUtils::style(QWidget* widget)
|
||||
|
|
|
@ -58,3 +58,7 @@ GENERATE_EXPORT_HEADER(Pdf4QtViewer
|
|||
target_link_libraries(Pdf4QtViewer PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets Qt6::PrintSupport Qt6::TextToSpeech Qt6::Xml Qt6::OpenGLWidgets)
|
||||
target_include_directories(Pdf4QtViewer INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_include_directories(Pdf4QtViewer PUBLIC ${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR})
|
||||
|
||||
set_target_properties(Pdf4QtLib PROPERTIES
|
||||
VERSION ${PDF4QT_VERSION}
|
||||
SOVERSION ${PDF4QT_VERSION})
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
add_executable(Pdf4QtViewerLite
|
||||
main.cpp
|
||||
icon.rc
|
||||
)
|
||||
|
||||
target_link_libraries(Pdf4QtViewerLite PRIVATE Pdf4QtLib Pdf4QtViewer Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
IDI_ICON1 ICON DISCARDABLE "app-icon.ico"
|
|
@ -0,0 +1,33 @@
|
|||
# Copyright (C) 2022 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
|
||||
# with the written consent of the copyright owner, 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/>.
|
||||
|
||||
add_library(AudioBookPlugin SHARED
|
||||
audiobookcreator.cpp
|
||||
audiobookplugin.cpp
|
||||
audiotextstreameditordockwidget.cpp
|
||||
audiotextstreameditordockwidget.ui
|
||||
icons.qrc
|
||||
)
|
||||
|
||||
target_link_libraries(AudioBookPlugin PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGLWidgets)
|
||||
|
||||
set_target_properties(AudioBookPlugin PROPERTIES
|
||||
VERSION ${PDF4QT_VERSION}
|
||||
SOVERSION ${PDF4QT_VERSION}
|
||||
LIBRARY_OUTPUT_DIRECTORY ${PDF4QT_PLUGINS_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY ${PDF4QT_PLUGINS_DIR})
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
# Copyright (C) 2022 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
|
||||
# with the written consent of the copyright owner, 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/>.
|
||||
|
||||
set(PDF4QT_PLUGINS_DIR ${PROJECT_BINARY_DIR}/pdfplugins)
|
||||
|
||||
add_subdirectory(AudioBookPlugin)
|
||||
add_subdirectory(DimensionsPlugin)
|
||||
add_subdirectory(ObjectInspectorPlugin)
|
||||
add_subdirectory(OutputPreviewPlugin)
|
||||
add_subdirectory(RedactPlugin)
|
||||
add_subdirectory(SignaturePlugin)
|
||||
add_subdirectory(SoftProofingPlugin)
|
|
@ -0,0 +1,33 @@
|
|||
# Copyright (C) 2022 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
|
||||
# with the written consent of the copyright owner, 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/>.
|
||||
|
||||
add_library(DimensionsPlugin SHARED
|
||||
dimensionsplugin.cpp
|
||||
dimensiontool.cpp
|
||||
settingsdialog.cpp
|
||||
settingsdialog.ui
|
||||
icons.qrc
|
||||
)
|
||||
|
||||
target_link_libraries(DimensionsPlugin PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGLWidgets)
|
||||
|
||||
set_target_properties(DimensionsPlugin PROPERTIES
|
||||
VERSION ${PDF4QT_VERSION}
|
||||
SOVERSION ${PDF4QT_VERSION}
|
||||
LIBRARY_OUTPUT_DIRECTORY ${PDF4QT_PLUGINS_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY ${PDF4QT_PLUGINS_DIR})
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
# Copyright (C) 2022 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
|
||||
# with the written consent of the copyright owner, 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/>.
|
||||
|
||||
add_library(ObjectInspectorPlugin SHARED
|
||||
objectinspectordialog.cpp
|
||||
objectinspectorplugin.cpp
|
||||
objectstatisticsdialog.cpp
|
||||
objectviewerwidget.cpp
|
||||
pdfobjectinspectortreeitemmodel.cpp
|
||||
statisticsgraphwidget.cpp
|
||||
objectinspectordialog.ui
|
||||
objectstatisticsdialog.ui
|
||||
objectviewerwidget.ui
|
||||
statisticsgraphwidget.ui
|
||||
icons.qrc
|
||||
)
|
||||
|
||||
target_link_libraries(ObjectInspectorPlugin PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGLWidgets)
|
||||
|
||||
set_target_properties(ObjectInspectorPlugin PROPERTIES
|
||||
VERSION ${PDF4QT_VERSION}
|
||||
SOVERSION ${PDF4QT_VERSION}
|
||||
LIBRARY_OUTPUT_DIRECTORY ${PDF4QT_PLUGINS_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY ${PDF4QT_PLUGINS_DIR})
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
# Copyright (C) 2022 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
|
||||
# with the written consent of the copyright owner, 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/>.
|
||||
|
||||
add_library(OutputPreviewPlugin SHARED
|
||||
inkcoveragedialog.cpp
|
||||
outputpreviewdialog.cpp
|
||||
outputpreviewplugin.cpp
|
||||
outputpreviewwidget.cpp
|
||||
inkcoveragedialog.ui
|
||||
outputpreviewdialog.ui
|
||||
icons.qrc
|
||||
)
|
||||
|
||||
target_link_libraries(OutputPreviewPlugin PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGLWidgets)
|
||||
|
||||
set_target_properties(OutputPreviewPlugin PROPERTIES
|
||||
VERSION ${PDF4QT_VERSION}
|
||||
SOVERSION ${PDF4QT_VERSION}
|
||||
LIBRARY_OUTPUT_DIRECTORY ${PDF4QT_PLUGINS_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY ${PDF4QT_PLUGINS_DIR})
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
# Copyright (C) 2022 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
|
||||
# with the written consent of the copyright owner, 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/>.
|
||||
|
||||
add_library(RedactPlugin SHARED
|
||||
createredacteddocumentdialog.cpp
|
||||
redactplugin.cpp
|
||||
createredacteddocumentdialog.ui
|
||||
icons.qrc
|
||||
)
|
||||
|
||||
target_link_libraries(RedactPlugin PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGLWidgets)
|
||||
|
||||
set_target_properties(RedactPlugin PROPERTIES
|
||||
VERSION ${PDF4QT_VERSION}
|
||||
SOVERSION ${PDF4QT_VERSION}
|
||||
LIBRARY_OUTPUT_DIRECTORY ${PDF4QT_PLUGINS_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY ${PDF4QT_PLUGINS_DIR})
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
# Copyright (C) 2022 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
|
||||
# with the written consent of the copyright owner, 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/>.
|
||||
|
||||
add_library(SignaturePlugin SHARED
|
||||
signatureplugin.cpp
|
||||
signdialog.cpp
|
||||
signdialog.ui
|
||||
icons.qrc
|
||||
)
|
||||
|
||||
target_link_libraries(SignaturePlugin PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGLWidgets)
|
||||
target_link_libraries(SignaturePlugin PRIVATE OpenSSL::SSL OpenSSL::Crypto)
|
||||
|
||||
set_target_properties(SignaturePlugin PROPERTIES
|
||||
VERSION ${PDF4QT_VERSION}
|
||||
SOVERSION ${PDF4QT_VERSION}
|
||||
LIBRARY_OUTPUT_DIRECTORY ${PDF4QT_PLUGINS_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY ${PDF4QT_PLUGINS_DIR})
|
||||
|
||||
|
|
@ -441,7 +441,7 @@ void SignaturePlugin::onSignDigitally()
|
|||
{
|
||||
QString offsetString = QString::number(offset);
|
||||
offsetString = offsetString.leftJustified(static_cast<int>(offsetMarkStringLength), ' ', true);
|
||||
const auto index = buffer.data().lastIndexOf(QString(offsetMarkString), indexOfSignature);
|
||||
const auto index = buffer.data().lastIndexOf(QByteArray(offsetMarkString, offsetMarkStringLength), indexOfSignature);
|
||||
buffer.seek(index);
|
||||
buffer.write(offsetString.toLocal8Bit());
|
||||
};
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
# Copyright (C) 2022 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
|
||||
# with the written consent of the copyright owner, 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/>.
|
||||
|
||||
add_library(SoftProofingPlugin SHARED
|
||||
softproofingplugin.cpp
|
||||
settingsdialog.cpp
|
||||
settingsdialog.ui
|
||||
icons.qrc
|
||||
)
|
||||
|
||||
target_link_libraries(SoftProofingPlugin PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGLWidgets)
|
||||
|
||||
set_target_properties(SoftProofingPlugin PROPERTIES
|
||||
VERSION ${PDF4QT_VERSION}
|
||||
SOVERSION ${PDF4QT_VERSION}
|
||||
LIBRARY_OUTPUT_DIRECTORY ${PDF4QT_PLUGINS_DIR}
|
||||
RUNTIME_OUTPUT_DIRECTORY ${PDF4QT_PLUGINS_DIR})
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
add_executable(Pdf4QtViewerProfi
|
||||
main.cpp
|
||||
icon.rc
|
||||
)
|
||||
|
||||
target_link_libraries(Pdf4QtViewerProfi PRIVATE Pdf4QtLib Pdf4QtViewer Qt6::Core Qt6::Gui Qt6::Widgets)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
IDI_ICON1 ICON DISCARDABLE "app-icon.ico"
|
Loading…
Reference in New Issue