Issue #159: Launchpad application

This commit is contained in:
Jakub Melka 2024-03-17 13:29:24 +01:00
parent a72f2f7bac
commit f2ea50ae6e
13 changed files with 518 additions and 0 deletions

View File

@ -136,6 +136,7 @@ if(NOT PDF4QT_BUILD_ONLY_CORE_LIBRARY)
add_subdirectory(Pdf4QtViewer)
add_subdirectory(Pdf4QtPageMaster)
add_subdirectory(Pdf4QtDiff)
add_subdirectory(Pdf4QtLaunchPad)
add_subdirectory(WixInstaller)
endif()

View File

@ -0,0 +1,35 @@
# Copyright (C) 2024 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_executable(Pdf4QtLaunchPad
main.cpp
icon.rc
app.qrc
launchapplicationwidget.h launchapplicationwidget.cpp launchapplicationwidget.ui
launchdialog.h launchdialog.cpp launchdialog.ui
)
target_link_libraries(Pdf4QtLaunchPad PRIVATE Qt6::Core Qt6::Gui Qt6::Widgets)
set_target_properties(Pdf4QtLaunchPad PROPERTIES
WIN32_EXECUTABLE ON
MACOSX_BUNDLE ON
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_LIB_DIR}
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PDF4QT_INSTALL_BIN_DIR}
)
install(TARGETS Pdf4QtLaunchPad RUNTIME DESTINATION ${PDF4QT_INSTALL_BIN_DIR} LIBRARY DESTINATION ${PDF4QT_INSTALL_LIB_DIR})

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 7.0 KiB

9
Pdf4QtLaunchPad/app.qrc Normal file
View File

@ -0,0 +1,9 @@
<RCC>
<qresource prefix="/">
<file>app-icon.svg</file>
<file alias="app-editor.svg">../Pdf4QtEditor/app-icon.svg</file>
<file alias="app-viewer.svg">../Pdf4QtViewer/app-icon.svg</file>
<file alias="app-diff.svg">../Pdf4QtDiff/app-icon.svg</file>
<file alias="app-pagemaster.svg">../Pdf4QtPageMaster/app-icon.svg</file>
</qresource>
</RCC>

1
Pdf4QtLaunchPad/icon.rc Normal file
View File

@ -0,0 +1 @@
IDI_ICON1 ICON DISCARDABLE "app-icon.ico"

View File

@ -0,0 +1,48 @@
// Copyright (C) 2024 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/>.
#include "launchapplicationwidget.h"
#include "ui_launchapplicationwidget.h"
LaunchApplicationWidget::LaunchApplicationWidget(QWidget* parent)
: QWidget(parent)
, ui(new Ui::LaunchApplicationWidget)
{
ui->setupUi(this);
setFixedSize(4 * 128, 128);
}
LaunchApplicationWidget::~LaunchApplicationWidget()
{
delete ui;
}
QPushButton* LaunchApplicationWidget::getButton() const
{
return ui->pushButton;
}
QLabel* LaunchApplicationWidget::getTitleLabel() const
{
return ui->titleLabel;
}
QLabel* LaunchApplicationWidget::getDescriptionLabel() const
{
return ui->descriptionLabel;
}

View File

@ -0,0 +1,47 @@
// Copyright (C) 2024 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/>.
#ifndef LAUNCHAPPLICATIONWIDGET_H
#define LAUNCHAPPLICATIONWIDGET_H
#include <QWidget>
class QLabel;
class QPushButton;
namespace Ui
{
class LaunchApplicationWidget;
}
class LaunchApplicationWidget : public QWidget
{
Q_OBJECT
public:
explicit LaunchApplicationWidget(QWidget* parent);
virtual ~LaunchApplicationWidget() override;
QPushButton* getButton() const;
QLabel* getTitleLabel() const;
QLabel* getDescriptionLabel() const;
private:
Ui::LaunchApplicationWidget* ui;
};
#endif // LAUNCHAPPLICATIONWIDGET_H

View File

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>LaunchApplicationWidget</class>
<widget class="QWidget" name="LaunchApplicationWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>558</width>
<height>134</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="app.qrc">
<normaloff>:/app-icon.svg</normaloff>:/app-icon.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>128</width>
<height>128</height>
</size>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,1">
<item>
<widget class="QLabel" name="titleLabel">
<property name="font">
<font>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Title</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="descriptionLabel">
<property name="text">
<string>TextLabel</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="app.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -0,0 +1,88 @@
// Copyright (C) 2024 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/>.
#include "launchdialog.h"
#include "launchapplicationwidget.h"
#include "ui_launchdialog.h"
#include <QLabel>
#include <QPushButton>
#include <QProcess>
LaunchDialog::LaunchDialog(QWidget* parent)
: QDialog(parent, Qt::WindowStaysOnTopHint | Qt::Window | Qt::Dialog)
, ui(new Ui::LaunchDialog)
{
ui->setupUi(this);
ui->retranslateUi(this);
ui->appEditorWidget->getButton()->setIcon(QIcon(":/app-editor.svg"));
ui->appViewerWidget->getButton()->setIcon(QIcon(":/app-viewer.svg"));
ui->appDiffWidget->getButton()->setIcon(QIcon(":/app-diff.svg"));
ui->appPageMasterWidget->getButton()->setIcon(QIcon(":/app-pagemaster.svg"));
ui->appEditorWidget->getTitleLabel()->setText(tr("Editor"));
ui->appViewerWidget->getTitleLabel()->setText(tr("Viewer"));
ui->appDiffWidget->getTitleLabel()->setText(tr("Diff"));
ui->appPageMasterWidget->getTitleLabel()->setText(tr("PageMaster"));
ui->appEditorWidget->getDescriptionLabel()->setText(tr("Go beyond basic browsing. This tool packs a punch with a host of advanced features, including encryption, document reading, digital signature verification, annotation editing, and even support for searching text using regular expressions. Turn pages into images, and enhance your PDF interactions with multiple available plugins."));
ui->appViewerWidget->getDescriptionLabel()->setText(tr("Simplify your viewing experience. This lightweight viewer offers essential viewing functions in a clean, user-friendly interface."));
ui->appDiffWidget->getDescriptionLabel()->setText(tr("Spot differences effortlessly. This tool allows users to open two documents and receive a detailed list of differences. View these differences in a page-to-page window where they are clearly marked. Save these differences into an XML file for future reference."));
ui->appPageMasterWidget->getDescriptionLabel()->setText(tr("Take control of your documents. Manage whole documents or individual pages with ease. Merge documents into a single file, or split them into multiple ones. You can also move, clone, or add pages with a few clicks, all within an intuitive user interface."));
ui->appEditorWidget->getButton()->setDefault(true);
ui->appEditorWidget->getButton()->setFocus();
connect(ui->appEditorWidget->getButton(), &QPushButton::clicked, this, &LaunchDialog::startEditor);
connect(ui->appViewerWidget->getButton(), &QPushButton::clicked, this, &LaunchDialog::startViewer);
connect(ui->appDiffWidget->getButton(), &QPushButton::clicked, this, &LaunchDialog::startDiff);
connect(ui->appPageMasterWidget->getButton(), &QPushButton::clicked, this, &LaunchDialog::startPageMaster);
setFixedSize(minimumSizeHint());
}
LaunchDialog::~LaunchDialog()
{
delete ui;
}
void LaunchDialog::startEditor()
{
startProgram("Pdf4QtEditor");
}
void LaunchDialog::startViewer()
{
startProgram("Pdf4QtViewer");
}
void LaunchDialog::startPageMaster()
{
startProgram("Pdf4QtPageMaster");
}
void LaunchDialog::startDiff()
{
startProgram("Pdf4QtDiff");
}
void LaunchDialog::startProgram(const QString& program)
{
QProcess::startDetached(program);
close();
}

View File

@ -0,0 +1,47 @@
// Copyright (C) 2024 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/>.
#ifndef LAUNCHDIALOG_H
#define LAUNCHDIALOG_H
#include <QDialog>
namespace Ui
{
class LaunchDialog;
}
class LaunchDialog : public QDialog
{
Q_OBJECT
public:
explicit LaunchDialog(QWidget* parent);
virtual ~LaunchDialog() override;
private:
void startEditor();
void startViewer();
void startPageMaster();
void startDiff();
void startProgram(const QString& program);
Ui::LaunchDialog* ui;
};
#endif // LAUNCHDIALOG_H

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>LaunchDialog</class>
<widget class="QDialog" name="LaunchDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>525</width>
<height>272</height>
</rect>
</property>
<property name="windowTitle">
<string>Launch Application</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="LaunchApplicationWidget" name="appEditorWidget" native="true"/>
</item>
<item row="0" column="1">
<widget class="LaunchApplicationWidget" name="appViewerWidget" native="true"/>
</item>
<item row="1" column="0">
<widget class="LaunchApplicationWidget" name="appDiffWidget" native="true"/>
</item>
<item row="1" column="1">
<widget class="LaunchApplicationWidget" name="appPageMasterWidget" native="true"/>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>LaunchApplicationWidget</class>
<extends>QWidget</extends>
<header>launchapplicationwidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

54
Pdf4QtLaunchPad/main.cpp Normal file
View File

@ -0,0 +1,54 @@
// Copyright (C) 2024 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/>.
// Copyright (C) 2024 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/>.
#include "launchdialog.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication::setAttribute(Qt::AA_CompressHighFrequencyEvents, true);
QApplication application(argc, argv);
QCoreApplication::setOrganizationName("MelkaJ");
QCoreApplication::setApplicationName("PDF4QT LaunchPad");
QApplication::setApplicationDisplayName(QApplication::translate("Application", "PDF4QT LaunchPad"));
QIcon appIcon(":/app-icon.svg");
QApplication::setWindowIcon(appIcon);
LaunchDialog mainWindow(nullptr);
mainWindow.show();
return application.exec();
}