Hide developer mode

This commit is contained in:
Jakub Melka 2021-05-04 18:40:51 +02:00
parent 2c03d0b4f3
commit c0cdcb28de
6 changed files with 62 additions and 30 deletions

View File

@ -282,6 +282,7 @@ PDFViewerMainWindow::PDFViewerMainWindow(QWidget* parent) :
connect(m_progress, &pdf::PDFProgress::progressFinished, this, &PDFViewerMainWindow::onProgressFinished); connect(m_progress, &pdf::PDFProgress::progressFinished, this, &PDFViewerMainWindow::onProgressFinished);
m_programController->finishInitialization(); m_programController->finishInitialization();
updateDeveloperMenu();
if (pdf::PDFToolManager* toolManager = m_programController->getToolManager()) if (pdf::PDFToolManager* toolManager = m_programController->getToolManager())
{ {
@ -384,6 +385,12 @@ void PDFViewerMainWindow::onProgressFinished()
m_programController->updateActionsAvailability(); m_programController->updateActionsAvailability();
} }
void PDFViewerMainWindow::updateDeveloperMenu()
{
bool isDeveloperMode = m_programController->getSettings()->getSettings().m_allowDeveloperMode;
ui->menuDeveloper->menuAction()->setVisible(isDeveloperMode);
}
void PDFViewerMainWindow::updateUI(bool fullUpdate) void PDFViewerMainWindow::updateUI(bool fullUpdate)
{ {
pdf::PDFTemporaryValueChange guard(&m_isLoadingUI, true); pdf::PDFTemporaryValueChange guard(&m_isLoadingUI, true);

View File

@ -101,6 +101,8 @@ private:
void onProgressStep(int percentage); void onProgressStep(int percentage);
void onProgressFinished(); void onProgressFinished();
void updateDeveloperMenu();
QIcon createStickyNoteIcon(QString key) const; QIcon createStickyNoteIcon(QString key) const;
Ui::PDFViewerMainWindow* ui; Ui::PDFViewerMainWindow* ui;

View File

@ -53,6 +53,7 @@ void PDFViewerSettings::readSettings(QSettings& settings, const pdf::PDFCMSSetti
m_settings.m_instancedFontCacheLimit = settings.value("instancedFontCacheLimit", defaultSettings.m_instancedFontCacheLimit).toInt(); m_settings.m_instancedFontCacheLimit = settings.value("instancedFontCacheLimit", defaultSettings.m_instancedFontCacheLimit).toInt();
m_settings.m_allowLaunchApplications = settings.value("allowLaunchApplications", defaultSettings.m_allowLaunchApplications).toBool(); m_settings.m_allowLaunchApplications = settings.value("allowLaunchApplications", defaultSettings.m_allowLaunchApplications).toBool();
m_settings.m_allowLaunchURI = settings.value("allowLaunchURI", defaultSettings.m_allowLaunchURI).toBool(); m_settings.m_allowLaunchURI = settings.value("allowLaunchURI", defaultSettings.m_allowLaunchURI).toBool();
m_settings.m_allowDeveloperMode = settings.value("allowDeveloperMode", defaultSettings.m_allowDeveloperMode).toBool();
m_settings.m_multithreadingStrategy = static_cast<pdf::PDFExecutionPolicy::Strategy>(settings.value("multithreadingStrategy", static_cast<int>(defaultSettings.m_multithreadingStrategy)).toInt()); m_settings.m_multithreadingStrategy = static_cast<pdf::PDFExecutionPolicy::Strategy>(settings.value("multithreadingStrategy", static_cast<int>(defaultSettings.m_multithreadingStrategy)).toInt());
m_settings.m_magnifierSize = settings.value("magnifierSize", defaultSettings.m_magnifierSize).toInt(); m_settings.m_magnifierSize = settings.value("magnifierSize", defaultSettings.m_magnifierSize).toInt();
m_settings.m_magnifierZoom = settings.value("magnifierZoom", defaultSettings.m_magnifierZoom).toDouble(); m_settings.m_magnifierZoom = settings.value("magnifierZoom", defaultSettings.m_magnifierZoom).toDouble();
@ -118,6 +119,7 @@ void PDFViewerSettings::writeSettings(QSettings& settings)
settings.setValue("instancedFontCacheLimit", m_settings.m_instancedFontCacheLimit); settings.setValue("instancedFontCacheLimit", m_settings.m_instancedFontCacheLimit);
settings.setValue("allowLaunchApplications", m_settings.m_allowLaunchApplications); settings.setValue("allowLaunchApplications", m_settings.m_allowLaunchApplications);
settings.setValue("allowLaunchURI", m_settings.m_allowLaunchURI); settings.setValue("allowLaunchURI", m_settings.m_allowLaunchURI);
settings.setValue("allowDeveloperMode", m_settings.m_allowDeveloperMode);
settings.setValue("multithreadingStrategy", static_cast<int>(m_settings.m_multithreadingStrategy)); settings.setValue("multithreadingStrategy", static_cast<int>(m_settings.m_multithreadingStrategy));
settings.setValue("magnifierSize", m_settings.m_magnifierSize); settings.setValue("magnifierSize", m_settings.m_magnifierSize);
settings.setValue("magnifierZoom", m_settings.m_magnifierZoom); settings.setValue("magnifierZoom", m_settings.m_magnifierZoom);
@ -257,6 +259,7 @@ PDFViewerSettings::Settings::Settings() :
m_colorTolerance(0.01), m_colorTolerance(0.01),
m_allowLaunchApplications(true), m_allowLaunchApplications(true),
m_allowLaunchURI(true), m_allowLaunchURI(true),
m_allowDeveloperMode(false),
m_compiledPageCacheLimit(128 * 1024), m_compiledPageCacheLimit(128 * 1024),
m_thumbnailsCacheLimit(PIXMAP_CACHE_LIMIT), m_thumbnailsCacheLimit(PIXMAP_CACHE_LIMIT),
m_fontCacheLimit(pdf::DEFAULT_FONT_CACHE_LIMIT), m_fontCacheLimit(pdf::DEFAULT_FONT_CACHE_LIMIT),

View File

@ -57,6 +57,7 @@ public:
pdf::PDFReal m_colorTolerance; pdf::PDFReal m_colorTolerance;
bool m_allowLaunchApplications; bool m_allowLaunchApplications;
bool m_allowLaunchURI; bool m_allowLaunchURI;
bool m_allowDeveloperMode;
pdf::PDFExecutionPolicy::Strategy m_multithreadingStrategy; pdf::PDFExecutionPolicy::Strategy m_multithreadingStrategy;
// Cache settings // Cache settings

View File

@ -294,6 +294,7 @@ void PDFViewerSettingsDialog::loadData()
ui->magnifierZoomEdit->setValue(m_settings.m_magnifierZoom); ui->magnifierZoomEdit->setValue(m_settings.m_magnifierZoom);
ui->maximumUndoStepsEdit->setValue(m_settings.m_maximumUndoSteps); ui->maximumUndoStepsEdit->setValue(m_settings.m_maximumUndoSteps);
ui->maximumRedoStepsEdit->setValue(m_settings.m_maximumRedoSteps); ui->maximumRedoStepsEdit->setValue(m_settings.m_maximumRedoSteps);
ui->developerModeCheckBox->setChecked(m_settings.m_allowDeveloperMode);
// CMS // CMS
ui->cmsTypeComboBox->setCurrentIndex(ui->cmsTypeComboBox->findData(int(m_cmsSettings.system))); ui->cmsTypeComboBox->setCurrentIndex(ui->cmsTypeComboBox->findData(int(m_cmsSettings.system)));
@ -440,6 +441,10 @@ void PDFViewerSettingsDialog::saveData()
{ {
m_settings.m_allowLaunchURI = ui->allowRunURICheckBox->isChecked(); m_settings.m_allowLaunchURI = ui->allowRunURICheckBox->isChecked();
} }
else if (sender == ui->developerModeCheckBox)
{
m_settings.m_allowDeveloperMode = ui->developerModeCheckBox->isChecked();
}
else if (sender == ui->compiledPageCacheSizeEdit) else if (sender == ui->compiledPageCacheSizeEdit)
{ {
m_settings.m_compiledPageCacheLimit = ui->compiledPageCacheSizeEdit->value(); m_settings.m_compiledPageCacheLimit = ui->compiledPageCacheSizeEdit->value();

View File

@ -26,7 +26,7 @@
<item> <item>
<widget class="QStackedWidget" name="stackedWidget"> <widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>5</number> <number>7</number>
</property> </property>
<widget class="QWidget" name="enginePage"> <widget class="QWidget" name="enginePage">
<layout class="QVBoxLayout" name="enginePageLayout"> <layout class="QVBoxLayout" name="enginePageLayout">
@ -882,20 +882,31 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="4" column="1">
<widget class="QDoubleSpinBox" name="magnifierZoomEdit"> <widget class="QSpinBox" name="maximumRedoStepsEdit">
<property name="minimum">
<double>1.000000000000000</double>
</property>
<property name="maximum"> <property name="maximum">
<double>10.000000000000000</double> <number>20</number>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="4" column="0">
<widget class="QLabel" name="maximumUndoStepsLabel"> <widget class="QLabel" name="maximumRedoStepsLabel">
<property name="text"> <property name="text">
<string>Maximum undo steps</string> <string>Maximum redo steps</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="magnifierSizeLabel">
<property name="text">
<string>Magnifier size</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="maximumUndoStepsEdit">
<property name="maximum">
<number>20</number>
</property> </property>
</widget> </widget>
</item> </item>
@ -912,9 +923,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1">
<widget class="QSpinBox" name="maximumRecentFileCountEdit"/>
</item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="magnifierZoomLabel"> <widget class="QLabel" name="magnifierZoomLabel">
<property name="text"> <property name="text">
@ -922,31 +930,37 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="0" column="1">
<widget class="QLabel" name="magnifierSizeLabel"> <widget class="QSpinBox" name="maximumRecentFileCountEdit"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="maximumUndoStepsLabel">
<property name="text"> <property name="text">
<string>Magnifier size</string> <string>Maximum undo steps</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="2" column="1">
<widget class="QLabel" name="maximumRedoStepsLabel"> <widget class="QDoubleSpinBox" name="magnifierZoomEdit">
<property name="minimum">
<double>1.000000000000000</double>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="developerModeCheckBox">
<property name="text"> <property name="text">
<string>Maximum redo steps</string> <string>Enable</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="5" column="0">
<widget class="QSpinBox" name="maximumUndoStepsEdit"> <widget class="QLabel" name="developerModeLabel">
<property name="maximum"> <property name="text">
<number>20</number> <string>Developer mode</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="maximumRedoStepsEdit">
<property name="maximum">
<number>20</number>
</property> </property>
</widget> </widget>
</item> </item>