PDF4QT/Pdf4QtViewer/pdfviewersettingsdialog.h

139 lines
4.5 KiB
C
Raw Normal View History

2021-04-30 20:12:10 +02:00
// Copyright (C) 2019-2021 Jakub Melka
2019-12-07 17:59:03 +01:00
//
2020-12-20 19:03:58 +01:00
// This file is part of Pdf4Qt.
2019-12-07 17:59:03 +01:00
//
2020-12-20 19:03:58 +01:00
// Pdf4Qt is free software: you can redistribute it and/or modify
2019-12-07 17:59:03 +01:00
// 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
2021-04-30 20:12:10 +02:00
// with the written consent of the copyright owner, any later version.
2019-12-07 17:59:03 +01:00
//
2020-12-20 19:03:58 +01:00
// Pdf4Qt is distributed in the hope that it will be useful,
2019-12-07 17:59:03 +01:00
// 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
2020-12-20 19:03:58 +01:00
// along with Pdf4Qt. If not, see <https://www.gnu.org/licenses/>.
2019-12-07 17:59:03 +01:00
2019-09-06 19:07:52 +02:00
#ifndef PDFVIEWERSETTINGSDIALOG_H
#define PDFVIEWERSETTINGSDIALOG_H
#include "pdfviewersettings.h"
2020-11-17 18:28:34 +01:00
#include "pdfplugin.h"
2019-09-06 19:07:52 +02:00
#include <QDialog>
class QListWidgetItem;
2020-06-28 18:55:09 +02:00
class QNetworkReply;
class QNetworkAccessManager;
2019-09-06 19:07:52 +02:00
namespace Ui
{
class PDFViewerSettingsDialog;
}
namespace pdfviewer
{
class PDFViewerSettingsDialog : public QDialog
{
Q_OBJECT
public:
2020-02-01 11:56:40 +01:00
struct OtherSettings
{
int maximumRecentFileCount = 0;
};
/// Constructor
/// \param settings Viewer settings
/// \param cmsSettings Color management system settings
2020-02-01 11:56:40 +01:00
/// \param otherSettings Other settings
2020-06-28 18:55:09 +02:00
/// \param certificateStore Certificate store
/// \param actions Actions
/// \param cmsManager CMS manager
/// \param parent Parent widget
explicit PDFViewerSettingsDialog(const PDFViewerSettings::Settings& settings,
const pdf::PDFCMSSettings& cmsSettings,
2020-02-01 11:56:40 +01:00
const OtherSettings& otherSettings,
2020-06-28 18:55:09 +02:00
const pdf::PDFCertificateStore& certificateStore,
2020-12-20 16:36:07 +01:00
const std::vector<QAction*>& actions,
pdf::PDFCMSManager* cmsManager,
2020-11-17 18:28:34 +01:00
const QStringList& enabledPlugins,
const pdf::PDFPluginInfos& plugins,
QWidget* parent);
2019-09-06 19:07:52 +02:00
virtual ~PDFViewerSettingsDialog() override;
2019-12-16 19:46:29 +01:00
virtual void accept() override;
2020-06-28 18:55:09 +02:00
virtual void reject() override;
2019-12-16 19:46:29 +01:00
2019-09-06 19:07:52 +02:00
enum Page : int
{
EngineSettings,
RenderingSettings,
2019-11-30 16:26:32 +01:00
ShadingSettings,
2019-12-15 19:28:25 +01:00
CacheSettings,
2019-12-16 19:46:29 +01:00
ShortcutSettings,
ColorManagementSystemSettings,
2020-02-01 11:56:40 +01:00
SecuritySettings,
2020-02-13 18:31:00 +01:00
UISettings,
2020-04-22 20:00:44 +02:00
SpeechSettings,
2020-06-27 17:28:03 +02:00
FormSettings,
2020-11-17 18:28:34 +01:00
SignatureSettings,
PluginsSettings
2019-09-06 19:07:52 +02:00
};
2019-09-07 19:01:54 +02:00
const PDFViewerSettings::Settings& getSettings() const { return m_settings; }
const pdf::PDFCMSSettings& getCMSSettings() const { return m_cmsSettings; }
2020-02-01 11:56:40 +01:00
const OtherSettings& getOtherSettings() const { return m_otherSettings; }
2020-06-28 18:55:09 +02:00
const pdf::PDFCertificateStore& getCertificateStore() const { return m_certificateStore; }
2020-11-17 18:28:34 +01:00
const QStringList& getEnabledPlugins() const { return m_enabledPlugins; }
2019-09-07 19:01:54 +02:00
2019-09-06 19:07:52 +02:00
private slots:
void on_optionsPagesWidget_currentItemChanged(QListWidgetItem* current, QListWidgetItem* previous);
2019-12-25 14:34:37 +01:00
void on_cmsProfileDirectoryButton_clicked();
2020-06-28 18:55:09 +02:00
void on_trustedCertificateStoreDownloadEUTLButton_clicked();
void on_removeCertificateButton_clicked();
2019-09-06 19:07:52 +02:00
private:
2019-09-07 19:01:54 +02:00
void loadData();
void saveData();
2020-06-28 18:55:09 +02:00
void updateTrustedCertificatesTable();
void updateTrustedCertificatesTableActions();
2019-12-16 19:46:29 +01:00
void loadActionShortcutsTable();
bool saveActionShortcutsTable();
2020-11-17 18:28:34 +01:00
void loadPluginsTable();
void savePluginsTable();
void updatePluginInformation();
2020-02-13 18:31:00 +01:00
void setSpeechEngine(const QString& engine);
2020-06-28 18:55:09 +02:00
/// Returns true, if dialog can be closed. If not, then message is displayed
/// and false is returned.
bool canCloseDialog();
2019-09-06 19:07:52 +02:00
Ui::PDFViewerSettingsDialog* ui;
2019-09-07 19:01:54 +02:00
PDFViewerSettings::Settings m_settings;
pdf::PDFCMSSettings m_cmsSettings;
2020-02-01 11:56:40 +01:00
OtherSettings m_otherSettings;
2019-12-16 19:46:29 +01:00
QList<QAction*> m_actions;
2019-09-07 19:01:54 +02:00
bool m_isLoadingData;
2020-02-13 18:31:00 +01:00
QStringList m_textToSpeechEngines;
QString m_currentSpeechEngine;
2020-06-28 18:55:09 +02:00
pdf::PDFCertificateStore m_certificateStore;
2020-11-17 18:28:34 +01:00
QStringList m_enabledPlugins;
pdf::PDFPluginInfos m_plugins;
2020-06-28 18:55:09 +02:00
QNetworkAccessManager* m_networkAccessManager;
QNetworkReply* m_downloadCertificatesFromEUTLReply;
2019-09-06 19:07:52 +02:00
};
} // namespace pdfviewer
#endif // PDFVIEWERSETTINGSDIALOG_H