mirror of https://github.com/JakubMelka/PDF4QT.git
Build fix
This commit is contained in:
parent
d6e5dd2b15
commit
905a9e4a8b
|
@ -55,7 +55,6 @@
|
|||
<file>resources/squiggly.svg</file>
|
||||
<file>resources/strikeout.svg</file>
|
||||
<file>resources/underline.svg</file>
|
||||
<file>../LICENSE.txt</file>
|
||||
<file>resources/annot-ellipse.svg</file>
|
||||
<file>resources/annot-freehand-curve.svg</file>
|
||||
<file>resources/annot-inline-text.svg</file>
|
||||
|
|
|
@ -575,10 +575,6 @@ void PDFProgramController::initialize(Features features,
|
|||
{
|
||||
connect(action, &QAction::triggered, this, &PDFProgramController::onActionCloseTriggered);
|
||||
}
|
||||
if (QAction* action = m_actionManager->getAction(PDFActionManager::DeveloperCreateInstaller))
|
||||
{
|
||||
connect(action, &QAction::triggered, this, &PDFProgramController::onActionDeveloperCreateInstaller);
|
||||
}
|
||||
if (QAction* action = m_actionManager->getAction(PDFActionManager::GetSource))
|
||||
{
|
||||
connect(action, &QAction::triggered, this, &PDFProgramController::onActionGetSource);
|
||||
|
@ -2371,247 +2367,6 @@ void PDFProgramController::onActionCloseTriggered()
|
|||
}
|
||||
}
|
||||
|
||||
void PDFProgramController::onActionDeveloperCreateInstaller()
|
||||
{
|
||||
QString directory = QFileDialog::getExistingDirectory(m_mainWindow, tr("Select Directory for Installer"));
|
||||
|
||||
if (directory.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Config.xml
|
||||
{
|
||||
QDir().mkpath(directory + "/config");
|
||||
QFile configFile(directory + "/config/config.xml");
|
||||
if (configFile.open(QFile::WriteOnly | QFile::Truncate))
|
||||
{
|
||||
QXmlStreamWriter configWriter(&configFile);
|
||||
configWriter.setAutoFormatting(true);
|
||||
configWriter.setAutoFormattingIndent(2);
|
||||
|
||||
configWriter.writeStartDocument();
|
||||
configWriter.writeStartElement("Installer");
|
||||
|
||||
configWriter.writeTextElement("Name", tr("PDF4QT"));
|
||||
configWriter.writeTextElement("Title", tr("PDF4QT Suite (library, viewer, editor, command line tool)"));
|
||||
configWriter.writeTextElement("Version", pdf::PDF_LIBRARY_VERSION);
|
||||
configWriter.writeTextElement("Publisher", tr("Jakub Melka"));
|
||||
configWriter.writeTextElement("StartMenuDir", "PDF4QT");
|
||||
configWriter.writeTextElement("TargetDir", "@ApplicationsDir@/PDF4QT");
|
||||
configWriter.writeTextElement("CreateLocalRepository", "true");
|
||||
configWriter.writeTextElement("InstallActionColumnVisible", "true");
|
||||
|
||||
configWriter.writeEndElement();
|
||||
configWriter.writeEndDocument();
|
||||
configFile.close();
|
||||
}
|
||||
}
|
||||
|
||||
// Installer project file
|
||||
{
|
||||
QString qtInstallDirectory = QT_INSTALL_DIRECTORY;
|
||||
int indexofQtRoot = qtInstallDirectory.lastIndexOf("/Qt/");
|
||||
QString binaryCreatorDirectory;
|
||||
|
||||
if (indexofQtRoot != -1)
|
||||
{
|
||||
indexofQtRoot += 4;
|
||||
QString qtRootDirectory = qtInstallDirectory.left(indexofQtRoot);
|
||||
QString qtInstallerFrameworkRoot = qtRootDirectory + "Tools/QtInstallerFramework/";
|
||||
|
||||
QDir qtInstallerFrameworkRootDir(qtInstallerFrameworkRoot);
|
||||
QStringList entries = qtInstallerFrameworkRootDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
|
||||
|
||||
if (!entries.isEmpty())
|
||||
{
|
||||
binaryCreatorDirectory = QString("%1/%2/bin").arg(qtInstallerFrameworkRoot, entries.back());
|
||||
binaryCreatorDirectory = QDir(binaryCreatorDirectory).absolutePath();
|
||||
}
|
||||
}
|
||||
|
||||
QFile configFile(directory + "/installer.pro");
|
||||
if (configFile.open(QFile::WriteOnly | QFile::Truncate))
|
||||
{
|
||||
QTextStream stream(&configFile);
|
||||
stream << "TEMPLATE = aux" << Qt::endl << Qt::endl;
|
||||
stream << "INSTALLER_NAME = $$PWD/instpdf4qt" << Qt::endl;
|
||||
stream << "INPUT = $$PWD/config/config.xml $$PWD/packages" << Qt::endl;
|
||||
stream << "pdfforqtinstaller.input = INPUT" << Qt::endl;
|
||||
stream << "pdfforqtinstaller.output = $$INSTALLER_NAME" << Qt::endl;
|
||||
stream << QString("pdfforqtinstaller.commands = %1/binarycreator -c $$PWD/config/config.xml -p $$PWD/packages ${QMAKE_FILE_OUT}").arg(binaryCreatorDirectory) << Qt::endl;
|
||||
stream << "pdfforqtinstaller.CONFIG += target_predeps no_link combine" << Qt::endl << Qt::endl;
|
||||
stream << "QMAKE_EXTRA_COMPILERS += pdfforqtinstaller";
|
||||
configFile.close();
|
||||
}
|
||||
}
|
||||
|
||||
// Packages
|
||||
QDir().mkpath(directory + "/packages");
|
||||
|
||||
auto addComponentMeta = [&](QString componentName, QString displayName, QString description, QString version, QString internalName, bool forcedInstallation, bool defaultInstall, bool addDefaultLicense, QString dependencies = QString())
|
||||
{
|
||||
QString componentMetaDirectory = directory + QString("/packages/%1/meta").arg(componentName);
|
||||
QDir().mkpath(componentMetaDirectory);
|
||||
|
||||
QString metaFileName = QString("%1/package.xml").arg(componentMetaDirectory);
|
||||
|
||||
QFile metaFile(metaFileName);
|
||||
if (metaFile.open(QFile::WriteOnly | QFile::Truncate))
|
||||
{
|
||||
QXmlStreamWriter metaFileWriter(&metaFile);
|
||||
metaFileWriter.setAutoFormatting(true);
|
||||
metaFileWriter.setAutoFormattingIndent(2);
|
||||
|
||||
metaFileWriter.writeStartDocument();
|
||||
metaFileWriter.writeStartElement("Package");
|
||||
|
||||
metaFileWriter.writeTextElement("DisplayName", displayName);
|
||||
metaFileWriter.writeTextElement("Description", description);
|
||||
metaFileWriter.writeTextElement("Version", version);
|
||||
metaFileWriter.writeTextElement("ReleaseDate", QDateTime::currentDateTime().toString("yyyy-MM-dd"));
|
||||
metaFileWriter.writeTextElement("Name", internalName);
|
||||
metaFileWriter.writeTextElement("ExpandedByDefault", "true");
|
||||
metaFileWriter.writeTextElement("ForcedInstallation", forcedInstallation ? "true" : "false");
|
||||
metaFileWriter.writeTextElement("Default", defaultInstall ? "true" : "false");
|
||||
|
||||
if (!dependencies.isEmpty())
|
||||
{
|
||||
metaFileWriter.writeTextElement("Dependencies", dependencies);
|
||||
}
|
||||
|
||||
if (addDefaultLicense)
|
||||
{
|
||||
QFile::copy(":/LICENSE.txt", QString("%1/LICENSE.txt").arg(componentMetaDirectory));
|
||||
|
||||
metaFileWriter.writeStartElement("Licenses");
|
||||
metaFileWriter.writeStartElement("License");
|
||||
metaFileWriter.writeAttribute("name", tr("License Agreement"));
|
||||
metaFileWriter.writeAttribute("file", tr("LICENSE.txt"));
|
||||
metaFileWriter.writeEndElement();
|
||||
metaFileWriter.writeEndElement();
|
||||
}
|
||||
|
||||
QString scriptFile = QString("%1/inst.qs").arg(componentMetaDirectory);
|
||||
if (QFile::exists(scriptFile))
|
||||
{
|
||||
metaFileWriter.writeTextElement("Script", "inst.qs");
|
||||
}
|
||||
|
||||
metaFileWriter.writeEndElement();
|
||||
metaFileWriter.writeEndDocument();
|
||||
metaFile.close();
|
||||
}
|
||||
};
|
||||
|
||||
auto addDirectoryContent = [&](QString componentName, QString applicationDirectory)
|
||||
{
|
||||
QString componentDataDirectory = directory + QString("/packages/%1/data/%2").arg(componentName, applicationDirectory);
|
||||
QDir().mkpath(componentDataDirectory);
|
||||
|
||||
QString applicationDataDirectory = QString("%1/%2").arg(QApplication::applicationDirPath(), applicationDirectory);
|
||||
QStringList fileNames = QDir(applicationDataDirectory).entryList(QDir::Files | QDir::NoDotAndDotDot);
|
||||
|
||||
for (QString fileName : fileNames)
|
||||
{
|
||||
QFile::copy(QString("%1/%2").arg(applicationDataDirectory, fileName), QString("%1/%2").arg(componentDataDirectory, fileName));
|
||||
}
|
||||
};
|
||||
|
||||
auto addFileContent = [&](QString componentName, QString filter)
|
||||
{
|
||||
QString componentDataDirectory = directory + QString("/packages/%1/data").arg(componentName);
|
||||
QDir().mkpath(componentDataDirectory);
|
||||
|
||||
QString applicationDataDirectory = QApplication::applicationDirPath();
|
||||
|
||||
QStringList fileNames = QDir(applicationDataDirectory).entryList(QStringList() << filter, QDir::Files | QDir::NoDotAndDotDot);
|
||||
|
||||
for (QString fileName : fileNames)
|
||||
{
|
||||
QFile::copy(QString("%1/%2").arg(applicationDataDirectory, fileName), QString("%1/%2").arg(componentDataDirectory, fileName));
|
||||
}
|
||||
};
|
||||
|
||||
auto addStartMenuShortcut = [&](QString componentName, QString exeFileNameWithoutSuffix, QString description)
|
||||
{
|
||||
QString componentMetaDirectory = directory + QString("/packages/%1/meta").arg(componentName);
|
||||
QDir().mkpath(componentMetaDirectory);
|
||||
|
||||
QString script =
|
||||
"function Component() \n"
|
||||
"{\n"
|
||||
"\n"
|
||||
"}\n"
|
||||
"Component.prototype.createOperations = function() \n"
|
||||
"{ \n"
|
||||
" component.createOperations(); \n"
|
||||
" if (systemInfo.productType === \"windows\") { \n"
|
||||
" component.addOperation(\"CreateShortcut\", \"@TargetDir@/%1.exe\", \"@StartMenuDir@/%2.lnk\", \n"
|
||||
" \"workingDirectory=@TargetDir@\", \"iconPath=@TargetDir@/%1.exe\", \n"
|
||||
" \"iconId=0\", \"description=%2\"); \n"
|
||||
" } \n"
|
||||
"} ";
|
||||
|
||||
script = script.arg(exeFileNameWithoutSuffix, description);
|
||||
|
||||
QFile installScriptFile(QString("%1/inst.qs").arg(componentMetaDirectory));
|
||||
if (installScriptFile.open(QFile::WriteOnly | QFile::Truncate))
|
||||
{
|
||||
QTextStream stream(&installScriptFile);
|
||||
stream << script;
|
||||
|
||||
installScriptFile.close();
|
||||
}
|
||||
};
|
||||
|
||||
// CoreLib package
|
||||
addStartMenuShortcut("pdf4qt_framework", "maintenancetool", tr("PDF4QT Maintenance Tool"));
|
||||
addComponentMeta("pdf4qt_framework", tr("Framework (Core libraries)"), tr("Framework libraries and other data files required to run all other programs."), pdf::PDF_LIBRARY_VERSION, "pdf4qt_framework", true, true, true);
|
||||
addDirectoryContent("pdf4qt_framework", "iconengines");
|
||||
addDirectoryContent("pdf4qt_framework", "imageformats");
|
||||
addDirectoryContent("pdf4qt_framework", "platforms");
|
||||
addDirectoryContent("pdf4qt_framework", "printsupport");
|
||||
addDirectoryContent("pdf4qt_framework", "styles");
|
||||
addDirectoryContent("pdf4qt_framework", "texttospeech");
|
||||
addFileContent("pdf4qt_framework", "*.dll");
|
||||
|
||||
addStartMenuShortcut("pdf4qt_v_lite", "Pdf4QtViewerLite", tr("PDF4QT Viewer Lite"));
|
||||
addComponentMeta("pdf4qt_v_lite", tr("Viewer (Lite)"), tr("Simple PDF viewer with basic functions."), pdf::PDF_LIBRARY_VERSION, "pdf4qt_v_lite", false, true, false);
|
||||
addFileContent("pdf4qt_v_lite", "Pdf4QtViewerLite.exe");
|
||||
|
||||
addStartMenuShortcut("pdf4qt_v_profi", "Pdf4QtViewerProfi", tr("PDF4QT Viewer Profi"));
|
||||
addComponentMeta("pdf4qt_v_profi", tr("Viewer (Profi)"), tr("Advanced PDF viewer with many functions, such as annotation editing, form filling, signature verification, and many optional plugins."), pdf::PDF_LIBRARY_VERSION, "pdf4qt_v_profi", false, true, false);
|
||||
addFileContent("pdf4qt_v_profi", "Pdf4QtViewerProfi.exe");
|
||||
|
||||
addStartMenuShortcut("pdf4qt_dpo", "Pdf4QtDocPageOrganizer", tr("PDF4QT DocPage Organizer"));
|
||||
addComponentMeta("pdf4qt_dpo", tr("DocPage Organizer"), tr("Document page organizer (split/merge documents, insert/remove/move/clone pages, insert blank pages and images to create a new document)."), pdf::PDF_LIBRARY_VERSION, "pdf4qt_dpo", false, true, false);
|
||||
addFileContent("pdf4qt_dpo", "Pdf4QtDocPageOrganizer.exe");
|
||||
|
||||
addStartMenuShortcut("pdf4qt_diff", "Pdf4QtDocDiff", tr("PDF4QT DocDiff"));
|
||||
addComponentMeta("pdf4qt_diff", tr("DocDiff"), tr("Compare content of two documents."), pdf::PDF_LIBRARY_VERSION, "pdf4qt_diff", false, true, false);
|
||||
addFileContent("pdf4qt_diff", "Pdf4QtDocDiff.exe");
|
||||
|
||||
addStartMenuShortcut("pdf4qt_tool", "PdfTool", tr("PDF4QT Command Line Tool"));
|
||||
addComponentMeta("pdf4qt_tool", tr("PdfTool"), tr("Command line tool for manipulation of PDF files with many functions."), pdf::PDF_LIBRARY_VERSION, "pdf4qt_tool", false, false, false);
|
||||
addFileContent("pdf4qt_tool", "PdfTool.exe");
|
||||
|
||||
addComponentMeta("pdf4qt_v_profi_plugins", tr("Viewer (Profi) | Plugins"), tr("Plugins for profi viewer providing additional functionality."), pdf::PDF_LIBRARY_VERSION, "pdf4qt_v_profi_plugins", false, false, false, "pdf4qt_v_profi");
|
||||
|
||||
for (const pdf::PDFPluginInfo& info : m_plugins)
|
||||
{
|
||||
QString pluginName = info.pluginFile;
|
||||
pluginName.remove(".dll");
|
||||
|
||||
QString componentName = QString("pdf4qt_v_profi_plugins.%1").arg(pluginName);
|
||||
addComponentMeta(componentName, info.name, info.description, info.version, componentName, false, false, false, "pdf4qt_v_profi");
|
||||
|
||||
QString componentDataDirectory = directory + QString("/packages/%1/data/pdfplugins").arg(componentName);
|
||||
QDir().mkpath(componentDataDirectory);
|
||||
QFile::copy(info.pluginFileWithPath, QString("%1/%2").arg(componentDataDirectory, info.pluginFile));
|
||||
}
|
||||
}
|
||||
|
||||
void PDFProgramController::onActionGetSource()
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl("https://github.com/JakubMelka/PDF4QT"));
|
||||
|
|
|
@ -179,7 +179,6 @@ public:
|
|||
ToolMagnifier,
|
||||
ToolScreenshot,
|
||||
ToolExtractImage,
|
||||
DeveloperCreateInstaller,
|
||||
BookmarkPage,
|
||||
BookmarkGoToNext,
|
||||
BookmarkGoToPrevious,
|
||||
|
@ -372,7 +371,6 @@ private:
|
|||
void onActionCertificateManagerTriggered();
|
||||
void onActionOpenTriggered();
|
||||
void onActionCloseTriggered();
|
||||
void onActionDeveloperCreateInstaller();
|
||||
void onActionGetSource();
|
||||
void onActionBecomeSponsor();
|
||||
void onActionAutomaticDocumentRefresh();
|
||||
|
|
|
@ -195,7 +195,6 @@ PDFViewerMainWindow::PDFViewerMainWindow(QWidget* parent) :
|
|||
m_actionManager->setAction(PDFActionManager::ToolMagnifier, ui->actionMagnifier);
|
||||
m_actionManager->setAction(PDFActionManager::ToolScreenshot, ui->actionScreenshot);
|
||||
m_actionManager->setAction(PDFActionManager::ToolExtractImage, ui->actionExtractImage);
|
||||
m_actionManager->setAction(PDFActionManager::DeveloperCreateInstaller, ui->actionDeveloperCreateInstaller);
|
||||
m_actionManager->setAction(PDFActionManager::BookmarkPage, ui->actionBookmarkPage);
|
||||
m_actionManager->setAction(PDFActionManager::BookmarkGoToNext, ui->actionGotoNextBookmark);
|
||||
m_actionManager->setAction(PDFActionManager::BookmarkGoToPrevious, ui->actionGotoPreviousBookmark);
|
||||
|
|
|
@ -139,7 +139,6 @@
|
|||
</property>
|
||||
<addaction name="actionShow_Text_Blocks"/>
|
||||
<addaction name="actionShow_Text_Lines"/>
|
||||
<addaction name="actionDeveloperCreateInstaller"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuEdit">
|
||||
<property name="title">
|
||||
|
@ -985,11 +984,6 @@
|
|||
<string>Go to previous line</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDeveloperCreateInstaller">
|
||||
<property name="text">
|
||||
<string>Create Installer</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionGetSource">
|
||||
<property name="icon">
|
||||
<iconset resource="pdf4qtviewer.qrc">
|
||||
|
|
Loading…
Reference in New Issue