From 8b832ccab9f5cd5ac5f1ec4dd6beb2b40ff93995 Mon Sep 17 00:00:00 2001 From: Jakub Melka Date: Thu, 21 Mar 2024 13:16:52 +0100 Subject: [PATCH] Issue #172: access keys are missing from most menu items/action text strings --- Pdf4QtDiff/differencesdockwidget.cpp | 2 + Pdf4QtDiff/mainwindow.cpp | 10 +- Pdf4QtDiff/mainwindow.ui | 62 +-- Pdf4QtDiff/settingsdockwidget.cpp | 2 + .../AudioBookPlugin/audiobookplugin.cpp | 35 +- .../AudioBookPlugin/audiobookplugin.h | 1 + .../DimensionsPlugin/dimensionsplugin.cpp | 26 +- .../DimensionsPlugin/dimensionsplugin.h | 1 + .../objectinspectorplugin.cpp | 9 +- .../objectinspectorplugin.h | 1 + .../outputpreviewplugin.cpp | 9 +- .../OutputPreviewPlugin/outputpreviewplugin.h | 1 + .../RedactPlugin/redactplugin.cpp | 15 +- .../RedactPlugin/redactplugin.h | 1 + .../SignaturePlugin/signatureplugin.cpp | 37 +- .../SignaturePlugin/signatureplugin.h | 1 + .../SoftProofingPlugin/softproofingplugin.cpp | 11 +- .../SoftProofingPlugin/softproofingplugin.h | 1 + Pdf4QtLibCore/sources/pdfannotation.cpp | 46 ++- Pdf4QtLibCore/sources/pdfannotation.h | 2 +- .../sources/pdfobjecteditormodel.cpp | 2 +- Pdf4QtLibCore/sources/pdfplugin.h | 1 + Pdf4QtLibGui/pdfeditormainwindow.cpp | 11 +- Pdf4QtLibGui/pdfeditormainwindow.ui | 352 ++++++++++-------- Pdf4QtLibGui/pdfprogramcontroller.cpp | 4 +- Pdf4QtLibGui/pdfrecentfilemanager.cpp | 4 +- Pdf4QtLibGui/pdfviewermainwindow.cpp | 6 +- Pdf4QtLibGui/pdfviewermainwindow.ui | 191 +++++----- Pdf4QtLibWidgets/sources/pdfwidgetutils.cpp | 75 ++++ Pdf4QtLibWidgets/sources/pdfwidgetutils.h | 8 + Pdf4QtPageMaster/mainwindow.cpp | 16 +- Pdf4QtPageMaster/mainwindow.ui | 96 ++--- RELEASES.txt | 1 + 33 files changed, 613 insertions(+), 427 deletions(-) diff --git a/Pdf4QtDiff/differencesdockwidget.cpp b/Pdf4QtDiff/differencesdockwidget.cpp index 8974336..6f05183 100644 --- a/Pdf4QtDiff/differencesdockwidget.cpp +++ b/Pdf4QtDiff/differencesdockwidget.cpp @@ -95,6 +95,8 @@ DifferencesDockWidget::DifferencesDockWidget(QWidget* parent, connect(diffNavigator, &pdf::PDFDiffResultNavigator::selectionChanged, this, &DifferencesDockWidget::onSelectionChanged); connect(ui->differencesTreeWidget, &QTreeWidget::currentItemChanged, this, &DifferencesDockWidget::onCurrentItemChanged); + toggleViewAction()->setText(tr("Differen&ces")); + setMinimumWidth(pdf::PDFWidgetUtils::scaleDPI_x(this, 120)); } diff --git a/Pdf4QtDiff/mainwindow.cpp b/Pdf4QtDiff/mainwindow.cpp index f3183be..41b3517 100644 --- a/Pdf4QtDiff/mainwindow.cpp +++ b/Pdf4QtDiff/mainwindow.cpp @@ -125,7 +125,7 @@ MainWindow::MainWindow(QWidget* parent) : actionGroup->addAction(ui->actionView_Overlay); ui->actionView_Differences->setChecked(true); - QToolBar* mainToolbar = addToolBar(tr("Main")); + QToolBar* mainToolbar = addToolBar(tr("&Main")); mainToolbar->setObjectName("main_toolbar"); mainToolbar->addActions({ ui->actionOpen_Left, ui->actionOpen_Right }); mainToolbar->addSeparator(); @@ -133,11 +133,11 @@ MainWindow::MainWindow(QWidget* parent) : mainToolbar->addAction(ui->actionCreate_Compare_Report); mainToolbar->addAction(ui->actionSave_Differences_to_XML); - QToolBar* differencesToolbar = addToolBar(tr("Differences")); + QToolBar* differencesToolbar = addToolBar(tr("&Differences")); differencesToolbar->setObjectName("differences_toolbar"); differencesToolbar->addActions({ ui->actionPrevious_Difference, ui->actionNext_Difference }); - QToolBar* viewToolbar = addToolBar(tr("View")); + QToolBar* viewToolbar = addToolBar(tr("&View")); viewToolbar->setObjectName("view_toolbar"); viewToolbar->addActions({ ui->actionView_Differences, ui->actionView_Left, ui->actionView_Right, ui->actionView_Overlay }); viewToolbar->addSeparator(); @@ -188,6 +188,10 @@ MainWindow::MainWindow(QWidget* parent) : loadSettings(); updateAll(false); updateOverlayTransparency(); + +#ifndef NDEBUG + pdf::PDFWidgetUtils::checkMenuAccessibility(this); +#endif } MainWindow::~MainWindow() diff --git a/Pdf4QtDiff/mainwindow.ui b/Pdf4QtDiff/mainwindow.ui index e7637e8..66b6d6f 100644 --- a/Pdf4QtDiff/mainwindow.ui +++ b/Pdf4QtDiff/mainwindow.ui @@ -31,7 +31,7 @@ - File + &File @@ -39,7 +39,7 @@ - Help + &Help @@ -47,12 +47,12 @@ - Toolbars + &Toolbars - Compare + &Compare @@ -60,11 +60,11 @@ - View + &View - View + &View @@ -73,7 +73,7 @@ - Filter + &Filter @@ -105,7 +105,7 @@ :/pdfdiff/resources/get-source.svg:/pdfdiff/resources/get-source.svg - Get Source + &Get Source @@ -114,7 +114,7 @@ :/pdfdiff/resources/about.svg:/pdfdiff/resources/about.svg - About... + &About... F1 @@ -126,7 +126,7 @@ :/pdfdiff/resources/open-left.svg:/pdfdiff/resources/open-left.svg - Open Left... + Open &Left... @@ -135,7 +135,7 @@ :/pdfdiff/resources/open-right.svg:/pdfdiff/resources/open-right.svg - Open Right... + Open &Right... @@ -144,7 +144,7 @@ :/pdfdiff/resources/compare.svg:/pdfdiff/resources/compare.svg - Compare + &Compare F5 @@ -156,7 +156,7 @@ :/pdfdiff/resources/close.svg:/pdfdiff/resources/close.svg - Close + &Close Ctrl+F4 @@ -168,7 +168,7 @@ :/pdfdiff/resources/prev-diff.svg:/pdfdiff/resources/prev-diff.svg - Previous Difference + &Previous Difference Shift+F6 @@ -180,7 +180,7 @@ :/pdfdiff/resources/next-diff.svg:/pdfdiff/resources/next-diff.svg - Next Difference + &Next Difference F6 @@ -192,7 +192,7 @@ :/pdfdiff/resources/create-compare-report.svg:/pdfdiff/resources/create-compare-report.svg - Create Compare Report... + Create Compare &Report... @@ -204,7 +204,7 @@ :/pdfdiff/resources/filter-text.svg:/pdfdiff/resources/filter-text.svg - Filter Text + Filter &Text @@ -216,7 +216,7 @@ :/pdfdiff/resources/filter-vector-graphics.svg:/pdfdiff/resources/filter-vector-graphics.svg - Filter Vector Graphics + Filter &Vector Graphics @@ -228,7 +228,7 @@ :/pdfdiff/resources/filter-images.svg:/pdfdiff/resources/filter-images.svg - Filter Images + Filter &Images @@ -240,7 +240,7 @@ :/pdfdiff/resources/filter-shading.svg:/pdfdiff/resources/filter-shading.svg - Filter Shading + Filter &Shading @@ -252,7 +252,7 @@ :/pdfdiff/resources/filter-page-movement.svg:/pdfdiff/resources/filter-page-movement.svg - Filter Page Movement + Filter &Page Movement @@ -264,7 +264,7 @@ :/pdfdiff/resources/view-differences.svg:/pdfdiff/resources/view-differences.svg - View Differences + View &Differences @@ -276,7 +276,7 @@ :/pdfdiff/resources/view-left.svg:/pdfdiff/resources/view-left.svg - View Left + View &Left @@ -288,7 +288,7 @@ :/pdfdiff/resources/view-right.svg:/pdfdiff/resources/view-right.svg - View Right + View &Right @@ -300,7 +300,7 @@ :/pdfdiff/resources/view-overlay.svg:/pdfdiff/resources/view-overlay.svg - View Overlay + View &Overlay @@ -312,7 +312,7 @@ :/pdfdiff/resources/show-p-with-diff.svg:/pdfdiff/resources/show-p-with-diff.svg - Show Pages with Differences + &Show Pages with Differences Show Pages with Differences @@ -324,7 +324,7 @@ :/pdfdiff/resources/save-diff-to-xml.svg:/pdfdiff/resources/save-diff-to-xml.svg - Save Differences to XML... + Save Differences to &XML... @@ -336,7 +336,7 @@ :/pdfdiff/resources/synchronize-view.svg:/pdfdiff/resources/synchronize-view.svg - Synchronize View with Differences + S&ynchronize View with Differences @@ -348,7 +348,7 @@ :/pdfdiff/resources/display-differences.svg:/pdfdiff/resources/display-differences.svg - Display Differences + Display &Differences @@ -360,7 +360,7 @@ :/pdfdiff/resources/display-markers.svg:/pdfdiff/resources/display-markers.svg - Display Markers + Display &Markers @@ -369,7 +369,7 @@ :/pdfdiff/resources/wallet.svg:/pdfdiff/resources/wallet.svg - Become a Sponsor + Become a &Sponsor diff --git a/Pdf4QtDiff/settingsdockwidget.cpp b/Pdf4QtDiff/settingsdockwidget.cpp index 7218717..6785049 100644 --- a/Pdf4QtDiff/settingsdockwidget.cpp +++ b/Pdf4QtDiff/settingsdockwidget.cpp @@ -45,6 +45,8 @@ SettingsDockWidget::SettingsDockWidget(Settings* settings, QWidget* parent) : } connect(ui->transparencySlider, &QSlider::valueChanged, this, &SettingsDockWidget::transparencySliderChanged); + + toggleViewAction()->setText(tr("S&ettings")); } SettingsDockWidget::~SettingsDockWidget() diff --git a/Pdf4QtEditorPlugins/AudioBookPlugin/audiobookplugin.cpp b/Pdf4QtEditorPlugins/AudioBookPlugin/audiobookplugin.cpp index 3a40ecc..9eb5776 100644 --- a/Pdf4QtEditorPlugins/AudioBookPlugin/audiobookplugin.cpp +++ b/Pdf4QtEditorPlugins/AudioBookPlugin/audiobookplugin.cpp @@ -67,61 +67,61 @@ void AudioBookPlugin::setWidget(pdf::PDFWidget* widget) BaseClass::setWidget(widget); - m_actionCreateTextStream = new QAction(QIcon(":/pdfplugins/audiobook/create-text-stream.svg"), tr("Create Text Stream for Audio Book"), this); + m_actionCreateTextStream = new QAction(QIcon(":/pdfplugins/audiobook/create-text-stream.svg"), tr("&Create Text Stream for Audio Book"), this); m_actionCreateTextStream->setObjectName("actionAudioBook_CreateTextStream"); connect(m_actionCreateTextStream, &QAction::triggered, this, &AudioBookPlugin::onCreateTextStreamTriggered); - m_actionSynchronizeFromTableToGraphics = new QAction(QIcon(":/pdfplugins/audiobook/synchronize-from-table-to-graphics.svg"), tr("Synchronize Selection from Table to Graphics"), this); + m_actionSynchronizeFromTableToGraphics = new QAction(QIcon(":/pdfplugins/audiobook/synchronize-from-table-to-graphics.svg"), tr("Synchronize Selection from &Table to Graphics"), this); m_actionSynchronizeFromTableToGraphics->setObjectName("actionAudioBook_SynchronizeFromTableToGraphics"); m_actionSynchronizeFromTableToGraphics->setCheckable(true); m_actionSynchronizeFromTableToGraphics->setChecked(true); - m_actionSynchronizeFromGraphicsToTable = new QAction(QIcon(":/pdfplugins/audiobook/synchronize-from-graphics-to-table.svg"), tr("Synchronize Selection from Graphics to Table"), this); + m_actionSynchronizeFromGraphicsToTable = new QAction(QIcon(":/pdfplugins/audiobook/synchronize-from-graphics-to-table.svg"), tr("Synchronize Selection from &Graphics to Table"), this); m_actionSynchronizeFromGraphicsToTable->setObjectName("actionAudioBook_SynchronizeFromGraphicsToTable"); m_actionSynchronizeFromGraphicsToTable->setCheckable(true); m_actionSynchronizeFromGraphicsToTable->setChecked(true); - m_actionActivateSelection = new QAction(QIcon(":/pdfplugins/audiobook/activate-selection.svg"), tr("Activate Selection"), this); + m_actionActivateSelection = new QAction(QIcon(":/pdfplugins/audiobook/activate-selection.svg"), tr("&Activate Selection"), this); m_actionActivateSelection->setObjectName("actionAudioBook_ActivateSelection"); connect(m_actionActivateSelection, &QAction::triggered, this, &AudioBookPlugin::onActivateSelection); - m_actionDeactivateSelection = new QAction(QIcon(":/pdfplugins/audiobook/deactivate-selection.svg"), tr("Deactivate Selection"), this); + m_actionDeactivateSelection = new QAction(QIcon(":/pdfplugins/audiobook/deactivate-selection.svg"), tr("&Deactivate Selection"), this); m_actionDeactivateSelection->setObjectName("actionAudioBook_DeactivateSelection"); connect(m_actionDeactivateSelection, &QAction::triggered, this, &AudioBookPlugin::onDeactivateSelection); - m_actionSelectByRectangle = new QAction(QIcon(":/pdfplugins/audiobook/select-by-rectangle.svg"), tr("Select by Rectangle"), this); + m_actionSelectByRectangle = new QAction(QIcon(":/pdfplugins/audiobook/select-by-rectangle.svg"), tr("Select by &Rectangle"), this); m_actionSelectByRectangle->setObjectName("actionAudioBook_SelectByRectangle"); connect(m_actionSelectByRectangle, &QAction::triggered, this, &AudioBookPlugin::onSelectByRectangle); - m_actionSelectByContainedText = new QAction(QIcon(":/pdfplugins/audiobook/select-by-contained-text.svg"), tr("Select by Contained Text"), this); + m_actionSelectByContainedText = new QAction(QIcon(":/pdfplugins/audiobook/select-by-contained-text.svg"), tr("Select by Contained &Text"), this); m_actionSelectByContainedText->setObjectName("actionAudioBook_SelectByContainedText"); connect(m_actionSelectByContainedText, &QAction::triggered, this, &AudioBookPlugin::onSelectByContainedText); - m_actionSelectByRegularExpression = new QAction(QIcon(":/pdfplugins/audiobook/select-by-regular-expression.svg"), tr("Select by Regular Expression"), this); + m_actionSelectByRegularExpression = new QAction(QIcon(":/pdfplugins/audiobook/select-by-regular-expression.svg"), tr("Select by Regular &Expression"), this); m_actionSelectByRegularExpression->setObjectName("actionAudioBook_SelectByRegularExpression"); connect(m_actionSelectByRegularExpression, &QAction::triggered, this, &AudioBookPlugin::onSelectByRegularExpression); - m_actionSelectByPageList = new QAction(QIcon(":/pdfplugins/audiobook/select-by-page-list.svg"), tr("Select by Page List"), this); + m_actionSelectByPageList = new QAction(QIcon(":/pdfplugins/audiobook/select-by-page-list.svg"), tr("Select by Page &List"), this); m_actionSelectByPageList->setObjectName("actionAudioBook_SelectByPageList"); connect(m_actionSelectByPageList, &QAction::triggered, this, &AudioBookPlugin::onSelectByPageList); - m_actionRestoreOriginalText = new QAction(QIcon(":/pdfplugins/audiobook/restore-original-text.svg"), tr("Restore Original Text"), this); + m_actionRestoreOriginalText = new QAction(QIcon(":/pdfplugins/audiobook/restore-original-text.svg"), tr("Restore &Original Text"), this); m_actionRestoreOriginalText->setObjectName("actionAudioBook_RestoreOriginalText"); connect(m_actionRestoreOriginalText, &QAction::triggered, this, &AudioBookPlugin::onRestoreOriginalText); - m_actionMoveSelectionUp = new QAction(QIcon(":/pdfplugins/audiobook/move-selection-up.svg"), tr("Move Selection Up"), this); + m_actionMoveSelectionUp = new QAction(QIcon(":/pdfplugins/audiobook/move-selection-up.svg"), tr("Move Selection &Up"), this); m_actionMoveSelectionUp->setObjectName("actionAudioBook_MoveSelectionUp"); connect(m_actionMoveSelectionUp, &QAction::triggered, this, &AudioBookPlugin::onMoveSelectionUp); - m_actionMoveSelectionDown = new QAction(QIcon(":/pdfplugins/audiobook/move-selection-down.svg"), tr("Move Selection Down"), this); + m_actionMoveSelectionDown = new QAction(QIcon(":/pdfplugins/audiobook/move-selection-down.svg"), tr("Move Selection &Down"), this); m_actionMoveSelectionDown->setObjectName("actionAudioBook_MoveSelectionDown"); connect(m_actionMoveSelectionDown, &QAction::triggered, this, &AudioBookPlugin::onMoveSelectionDown); - m_actionCreateAudioBook = new QAction(QIcon(":/pdfplugins/audiobook/create-audio-book.svg"), tr("Create Audio Book"), this); + m_actionCreateAudioBook = new QAction(QIcon(":/pdfplugins/audiobook/create-audio-book.svg"), tr("Create Audio &Book"), this); m_actionCreateAudioBook->setObjectName("actionAudioBook_CreateAudioBook"); connect(m_actionCreateAudioBook, &QAction::triggered, this, &AudioBookPlugin::onCreateAudioBook); - m_actionClear = new QAction(QIcon(":/pdfplugins/audiobook/clear.svg"), tr("Clear Text Stream"), this); + m_actionClear = new QAction(QIcon(":/pdfplugins/audiobook/clear.svg"), tr("Clear Te&xt Stream"), this); m_actionClear->setObjectName("actionAudioBook_Clear"); connect(m_actionClear, &QAction::triggered, this, &AudioBookPlugin::onClear); @@ -157,7 +157,12 @@ std::vector AudioBookPlugin::getActions() const m_actionSynchronizeFromTableToGraphics, m_actionSynchronizeFromGraphicsToTable, m_actionCreateAudioBook, - m_actionClear }; + m_actionClear }; +} + +QString AudioBookPlugin::getPluginMenuName() const +{ + return tr("&Audio Book"); } void AudioBookPlugin::drawPage(QPainter* painter, diff --git a/Pdf4QtEditorPlugins/AudioBookPlugin/audiobookplugin.h b/Pdf4QtEditorPlugins/AudioBookPlugin/audiobookplugin.h index b4b50a7..1f54752 100644 --- a/Pdf4QtEditorPlugins/AudioBookPlugin/audiobookplugin.h +++ b/Pdf4QtEditorPlugins/AudioBookPlugin/audiobookplugin.h @@ -46,6 +46,7 @@ public: virtual void setWidget(pdf::PDFWidget* widget) override; virtual void setDocument(const pdf::PDFModifiedDocument& document) override; virtual std::vector getActions() const override; + virtual QString getPluginMenuName() const override; virtual void drawPage(QPainter* painter, pdf::PDFInteger pageIndex, diff --git a/Pdf4QtEditorPlugins/DimensionsPlugin/dimensionsplugin.cpp b/Pdf4QtEditorPlugins/DimensionsPlugin/dimensionsplugin.cpp index 5e3d1a2..43a3be2 100644 --- a/Pdf4QtEditorPlugins/DimensionsPlugin/dimensionsplugin.cpp +++ b/Pdf4QtEditorPlugins/DimensionsPlugin/dimensionsplugin.cpp @@ -42,14 +42,14 @@ void DimensionsPlugin::setWidget(pdf::PDFWidget* widget) BaseClass::setWidget(widget); - QAction* horizontalDimensionAction = new QAction(QIcon(":/pdfplugins/dimensiontool/linear-horizontal.svg"), tr("Horizontal Dimension"), this); - QAction* verticalDimensionAction = new QAction(QIcon(":/pdfplugins/dimensiontool/linear-vertical.svg"), tr("Vertical Dimension"), this); - QAction* linearDimensionAction = new QAction(QIcon(":/pdfplugins/dimensiontool/linear.svg"), tr("Linear Dimension"), this); - QAction* perimeterDimensionAction = new QAction(QIcon(":/pdfplugins/dimensiontool/perimeter.svg"), tr("Perimeter"), this); - QAction* rectanglePerimeterDimensionAction = new QAction(QIcon(":/pdfplugins/dimensiontool/rectangle-perimeter.svg"), tr("Rectangle Perimeter"), this); - QAction* areaDimensionAction = new QAction(QIcon(":/pdfplugins/dimensiontool/area.svg"), tr("Area"), this); - QAction* rectangleAreaDimensionAction = new QAction(QIcon(":/pdfplugins/dimensiontool/rectangle-area.svg"), tr("Rectangle Area"), this); - QAction* angleAction = new QAction(QIcon(":/pdfplugins/dimensiontool/angle.svg"), tr("Angle"), this); + QAction* horizontalDimensionAction = new QAction(QIcon(":/pdfplugins/dimensiontool/linear-horizontal.svg"), tr("&Horizontal Dimension"), this); + QAction* verticalDimensionAction = new QAction(QIcon(":/pdfplugins/dimensiontool/linear-vertical.svg"), tr("&Vertical Dimension"), this); + QAction* linearDimensionAction = new QAction(QIcon(":/pdfplugins/dimensiontool/linear.svg"), tr("&Linear Dimension"), this); + QAction* perimeterDimensionAction = new QAction(QIcon(":/pdfplugins/dimensiontool/perimeter.svg"), tr("&Perimeter"), this); + QAction* rectanglePerimeterDimensionAction = new QAction(QIcon(":/pdfplugins/dimensiontool/rectangle-perimeter.svg"), tr("&Rectangle Perimeter"), this); + QAction* areaDimensionAction = new QAction(QIcon(":/pdfplugins/dimensiontool/area.svg"), tr("&Area"), this); + QAction* rectangleAreaDimensionAction = new QAction(QIcon(":/pdfplugins/dimensiontool/rectangle-area.svg"), tr("R&ectangle Area"), this); + QAction* angleAction = new QAction(QIcon(":/pdfplugins/dimensiontool/angle.svg"), tr("An&gle"), this); horizontalDimensionAction->setObjectName("dimensiontool_LinearHorizontalAction"); verticalDimensionAction->setObjectName("dimensiontool_LinearVerticalAction"); @@ -85,9 +85,9 @@ void DimensionsPlugin::setWidget(pdf::PDFWidget* widget) connect(tool, &DimensionTool::dimensionCreated, this, &DimensionsPlugin::onDimensionCreated); } - m_showDimensionsAction = new QAction(QIcon(":/pdfplugins/dimensiontool/show-dimensions.svg"), tr("Show Dimensions"), this); - m_clearDimensionsAction = new QAction(QIcon(":/pdfplugins/dimensiontool/clear-dimensions.svg"), tr("Clear Dimensions"), this); - m_settingsAction = new QAction(QIcon(":/pdfplugins/dimensiontool/settings.svg"), tr("Settings"), this); + m_showDimensionsAction = new QAction(QIcon(":/pdfplugins/dimensiontool/show-dimensions.svg"), tr("&Show Dimensions"), this); + m_clearDimensionsAction = new QAction(QIcon(":/pdfplugins/dimensiontool/clear-dimensions.svg"), tr("&Clear Dimensions"), this); + m_settingsAction = new QAction(QIcon(":/pdfplugins/dimensiontool/settings.svg"), tr("Se&ttings"), this); m_showDimensionsAction->setCheckable(true); m_showDimensionsAction->setChecked(true); @@ -139,6 +139,10 @@ std::vector DimensionsPlugin::getActions() const return result; } +QString DimensionsPlugin::getPluginMenuName() const +{ + return tr("&Dimensions"); +} void DimensionsPlugin::drawPage(QPainter* painter, pdf::PDFInteger pageIndex, diff --git a/Pdf4QtEditorPlugins/DimensionsPlugin/dimensionsplugin.h b/Pdf4QtEditorPlugins/DimensionsPlugin/dimensionsplugin.h index 6f2c1e1..7d5c238 100644 --- a/Pdf4QtEditorPlugins/DimensionsPlugin/dimensionsplugin.h +++ b/Pdf4QtEditorPlugins/DimensionsPlugin/dimensionsplugin.h @@ -40,6 +40,7 @@ public: virtual void setWidget(pdf::PDFWidget* widget) override; virtual void setDocument(const pdf::PDFModifiedDocument& document) override; virtual std::vector getActions() const override; + virtual QString getPluginMenuName() const override; virtual void drawPage(QPainter* painter, pdf::PDFInteger pageIndex, diff --git a/Pdf4QtEditorPlugins/ObjectInspectorPlugin/objectinspectorplugin.cpp b/Pdf4QtEditorPlugins/ObjectInspectorPlugin/objectinspectorplugin.cpp index 9f6ac15..e9da905 100644 --- a/Pdf4QtEditorPlugins/ObjectInspectorPlugin/objectinspectorplugin.cpp +++ b/Pdf4QtEditorPlugins/ObjectInspectorPlugin/objectinspectorplugin.cpp @@ -43,13 +43,13 @@ void ObjectInspectorPlugin::setWidget(pdf::PDFWidget* widget) BaseClass::setWidget(widget); - m_objectInspectorAction = new QAction(QIcon(":/pdfplugins/objectinspector/object-inspector.svg"), tr("Object Inspector"), this); + m_objectInspectorAction = new QAction(QIcon(":/pdfplugins/objectinspector/object-inspector.svg"), tr("Object &Inspector"), this); m_objectInspectorAction->setCheckable(false); m_objectInspectorAction->setObjectName("actionObjectInspector_ObjectInspector"); connect(m_objectInspectorAction, &QAction::triggered, this, &ObjectInspectorPlugin::onObjectInspectorTriggered); - m_objectStatisticsAction = new QAction(QIcon(":/pdfplugins/objectinspector/object-statistics.svg"), tr("Object Statistics"), this); + m_objectStatisticsAction = new QAction(QIcon(":/pdfplugins/objectinspector/object-statistics.svg"), tr("Object &Statistics"), this); m_objectStatisticsAction->setCheckable(false); m_objectStatisticsAction->setObjectName("actionObjectInspector_ObjectStatistics"); @@ -78,6 +78,11 @@ std::vector ObjectInspectorPlugin::getActions() const return { m_objectInspectorAction, m_objectStatisticsAction }; } +QString ObjectInspectorPlugin::getPluginMenuName() const +{ + return tr("Object &Inspector"); +} + void ObjectInspectorPlugin::onObjectInspectorTriggered() { pdf::PDFCMSPointer cms = m_cmsManager->getCurrentCMS(); diff --git a/Pdf4QtEditorPlugins/ObjectInspectorPlugin/objectinspectorplugin.h b/Pdf4QtEditorPlugins/ObjectInspectorPlugin/objectinspectorplugin.h index b7a5553..4858203 100644 --- a/Pdf4QtEditorPlugins/ObjectInspectorPlugin/objectinspectorplugin.h +++ b/Pdf4QtEditorPlugins/ObjectInspectorPlugin/objectinspectorplugin.h @@ -40,6 +40,7 @@ public: virtual void setCMSManager(pdf::PDFCMSManager* manager) override; virtual void setDocument(const pdf::PDFModifiedDocument& document) override; virtual std::vector getActions() const override; + virtual QString getPluginMenuName() const override; private: void onObjectInspectorTriggered(); diff --git a/Pdf4QtEditorPlugins/OutputPreviewPlugin/outputpreviewplugin.cpp b/Pdf4QtEditorPlugins/OutputPreviewPlugin/outputpreviewplugin.cpp index f3a8358..ebc85f1 100644 --- a/Pdf4QtEditorPlugins/OutputPreviewPlugin/outputpreviewplugin.cpp +++ b/Pdf4QtEditorPlugins/OutputPreviewPlugin/outputpreviewplugin.cpp @@ -39,9 +39,9 @@ void OutputPreviewPlugin::setWidget(pdf::PDFWidget* widget) BaseClass::setWidget(widget); - m_outputPreviewAction = new QAction(QIcon(":/pdfplugins/outputpreview/preview.svg"), tr("Output Preview"), this); + m_outputPreviewAction = new QAction(QIcon(":/pdfplugins/outputpreview/preview.svg"), tr("&Output Preview"), this); m_outputPreviewAction->setObjectName("actionOutputPreview_OutputPreview"); - m_inkCoverageAction = new QAction(QIcon(":/pdfplugins/outputpreview/ink-coverage.svg"), tr("Ink Coverage"), this); + m_inkCoverageAction = new QAction(QIcon(":/pdfplugins/outputpreview/ink-coverage.svg"), tr("&Ink Coverage"), this); m_inkCoverageAction->setObjectName("actionOutputPreview_InkCoverage"); connect(m_outputPreviewAction, &QAction::triggered, this, &OutputPreviewPlugin::onOutputPreviewTriggered); @@ -65,6 +65,11 @@ std::vector OutputPreviewPlugin::getActions() const return { m_outputPreviewAction, m_inkCoverageAction }; } +QString OutputPreviewPlugin::getPluginMenuName() const +{ + return tr("Output Previe&w"); +} + void OutputPreviewPlugin::onOutputPreviewTriggered() { OutputPreviewDialog dialog(m_document, m_widget, m_widget); diff --git a/Pdf4QtEditorPlugins/OutputPreviewPlugin/outputpreviewplugin.h b/Pdf4QtEditorPlugins/OutputPreviewPlugin/outputpreviewplugin.h index 227a818..4028c5b 100644 --- a/Pdf4QtEditorPlugins/OutputPreviewPlugin/outputpreviewplugin.h +++ b/Pdf4QtEditorPlugins/OutputPreviewPlugin/outputpreviewplugin.h @@ -39,6 +39,7 @@ public: virtual void setWidget(pdf::PDFWidget* widget) override; virtual void setDocument(const pdf::PDFModifiedDocument& document) override; virtual std::vector getActions() const override; + virtual QString getPluginMenuName() const override; private: void onOutputPreviewTriggered(); diff --git a/Pdf4QtEditorPlugins/RedactPlugin/redactplugin.cpp b/Pdf4QtEditorPlugins/RedactPlugin/redactplugin.cpp index f328aea..19473e6 100644 --- a/Pdf4QtEditorPlugins/RedactPlugin/redactplugin.cpp +++ b/Pdf4QtEditorPlugins/RedactPlugin/redactplugin.cpp @@ -50,11 +50,11 @@ void RedactPlugin::setWidget(pdf::PDFWidget* widget) BaseClass::setWidget(widget); - m_actionRedactRectangle = new QAction(QIcon(":/pdfplugins/redactplugin/redact-rectangle.svg"), tr("Redact Rectangle"), this); - m_actionRedactText = new QAction(QIcon(":/pdfplugins/redactplugin/redact-text.svg"), tr("Redact Text"), this); - m_actionRedactTextSelection = new QAction(QIcon(":/pdfplugins/redactplugin/redact-text-selection.svg"), tr("Redact Text Selection"), this); - m_actionRedactPage = new QAction(QIcon(":/pdfplugins/redactplugin/redact-page.svg"), tr("Redact Page(s)"), this); - m_actionCreateRedactedDocument = new QAction(QIcon(":/pdfplugins/redactplugin/redact-create-document.svg"), tr("Create Redacted Document"), this); + m_actionRedactRectangle = new QAction(QIcon(":/pdfplugins/redactplugin/redact-rectangle.svg"), tr("Redact &Rectangle"), this); + m_actionRedactText = new QAction(QIcon(":/pdfplugins/redactplugin/redact-text.svg"), tr("Redact &Text"), this); + m_actionRedactTextSelection = new QAction(QIcon(":/pdfplugins/redactplugin/redact-text-selection.svg"), tr("Redact Text &Selection"), this); + m_actionRedactPage = new QAction(QIcon(":/pdfplugins/redactplugin/redact-page.svg"), tr("Redact &Page(s)"), this); + m_actionCreateRedactedDocument = new QAction(QIcon(":/pdfplugins/redactplugin/redact-create-document.svg"), tr("Create Redacted &Document"), this); m_actionRedactRectangle->setObjectName("redactplugin_RedactRectangle"); m_actionRedactText->setObjectName("redactplugin_RedactText"); @@ -94,6 +94,11 @@ std::vector RedactPlugin::getActions() const return { m_actionRedactRectangle, m_actionRedactText, m_actionRedactTextSelection, m_actionRedactPage, m_actionCreateRedactedDocument }; } +QString RedactPlugin::getPluginMenuName() const +{ + return tr("Redac&t"); +} + void RedactPlugin::updateActions() { m_actionRedactTextSelection->setEnabled(m_document); diff --git a/Pdf4QtEditorPlugins/RedactPlugin/redactplugin.h b/Pdf4QtEditorPlugins/RedactPlugin/redactplugin.h index 6457fe6..87b34a3 100644 --- a/Pdf4QtEditorPlugins/RedactPlugin/redactplugin.h +++ b/Pdf4QtEditorPlugins/RedactPlugin/redactplugin.h @@ -39,6 +39,7 @@ public: virtual void setWidget(pdf::PDFWidget* widget) override; virtual void setDocument(const pdf::PDFModifiedDocument& document) override; virtual std::vector getActions() const override; + virtual QString getPluginMenuName() const override; private: void updateActions(); diff --git a/Pdf4QtEditorPlugins/SignaturePlugin/signatureplugin.cpp b/Pdf4QtEditorPlugins/SignaturePlugin/signatureplugin.cpp index 86e7e94..8745e83 100644 --- a/Pdf4QtEditorPlugins/SignaturePlugin/signatureplugin.cpp +++ b/Pdf4QtEditorPlugins/SignaturePlugin/signatureplugin.cpp @@ -52,22 +52,22 @@ void SignaturePlugin::setWidget(pdf::PDFWidget* widget) BaseClass::setWidget(widget); - QAction* activateAction = new QAction(QIcon(":/pdfplugins/signatureplugin/activate.svg"), tr("Activate signature creator"), this); - QAction* createTextAction = new QAction(QIcon(":/pdfplugins/signatureplugin/create-text.svg"), tr("Create Text Label"), this); - QAction* createFreehandCurveAction = new QAction(QIcon(":/pdfplugins/signatureplugin/create-freehand-curve.svg"), tr("Create Freehand Curve"), this); - QAction* createAcceptMarkAction = new QAction(QIcon(":/pdfplugins/signatureplugin/create-yes-mark.svg"), tr("Create Accept Mark"), this); - QAction* createRejectMarkAction = new QAction(QIcon(":/pdfplugins/signatureplugin/create-no-mark.svg"), tr("Create Reject Mark"), this); - QAction* createRectangleAction = new QAction(QIcon(":/pdfplugins/signatureplugin/create-rectangle.svg"), tr("Create Rectangle"), this); - QAction* createRoundedRectangleAction = new QAction(QIcon(":/pdfplugins/signatureplugin/create-rounded-rectangle.svg"), tr("Create Rounded Rectangle"), this); - QAction* createHorizontalLineAction = new QAction(QIcon(":/pdfplugins/signatureplugin/create-horizontal-line.svg"), tr("Create Horizontal Line"), this); - QAction* createVerticalLineAction = new QAction(QIcon(":/pdfplugins/signatureplugin/create-vertical-line.svg"), tr("Create Vertical Line"), this); - QAction* createLineAction = new QAction(QIcon(":/pdfplugins/signatureplugin/create-line.svg"), tr("Create Line"), this); - QAction* createDotAction = new QAction(QIcon(":/pdfplugins/signatureplugin/create-dot.svg"), tr("Create Dot"), this); - QAction* createSvgImageAction = new QAction(QIcon(":/pdfplugins/signatureplugin/create-svg-image.svg"), tr("Create SVG Image"), this); - QAction* clearAction = new QAction(QIcon(":/pdfplugins/signatureplugin/clear.svg"), tr("Clear All Graphics"), this); - QAction* signElectronicallyAction = new QAction(QIcon(":/pdfplugins/signatureplugin/sign-electronically.svg"), tr("Sign Electronically"), this); - QAction* signDigitallyAction = new QAction(QIcon(":/pdfplugins/signatureplugin/sign-digitally.svg"), tr("Sign Digitally With Certificate"), this); - QAction* certificatesAction = new QAction(QIcon(":/pdfplugins/signatureplugin/certificates.svg"), tr("Certificates Manager"), this); + QAction* activateAction = new QAction(QIcon(":/pdfplugins/signatureplugin/activate.svg"), tr("&Activate signature creator"), this); + QAction* createTextAction = new QAction(QIcon(":/pdfplugins/signatureplugin/create-text.svg"), tr("Create &Text Label"), this); + QAction* createFreehandCurveAction = new QAction(QIcon(":/pdfplugins/signatureplugin/create-freehand-curve.svg"), tr("Create &Freehand Curve"), this); + QAction* createAcceptMarkAction = new QAction(QIcon(":/pdfplugins/signatureplugin/create-yes-mark.svg"), tr("Create &Accept Mark"), this); + QAction* createRejectMarkAction = new QAction(QIcon(":/pdfplugins/signatureplugin/create-no-mark.svg"), tr("Create Reject &Mark"), this); + QAction* createRectangleAction = new QAction(QIcon(":/pdfplugins/signatureplugin/create-rectangle.svg"), tr("Create &Rectangle"), this); + QAction* createRoundedRectangleAction = new QAction(QIcon(":/pdfplugins/signatureplugin/create-rounded-rectangle.svg"), tr("Create R&ounded Rectangle"), this); + QAction* createHorizontalLineAction = new QAction(QIcon(":/pdfplugins/signatureplugin/create-horizontal-line.svg"), tr("Create &Horizontal Line"), this); + QAction* createVerticalLineAction = new QAction(QIcon(":/pdfplugins/signatureplugin/create-vertical-line.svg"), tr("Create &Vertical Line"), this); + QAction* createLineAction = new QAction(QIcon(":/pdfplugins/signatureplugin/create-line.svg"), tr("Create &Line"), this); + QAction* createDotAction = new QAction(QIcon(":/pdfplugins/signatureplugin/create-dot.svg"), tr("Create &Dot"), this); + QAction* createSvgImageAction = new QAction(QIcon(":/pdfplugins/signatureplugin/create-svg-image.svg"), tr("Create SVG &Image"), this); + QAction* clearAction = new QAction(QIcon(":/pdfplugins/signatureplugin/clear.svg"), tr("Clear All &Graphics"), this); + QAction* signElectronicallyAction = new QAction(QIcon(":/pdfplugins/signatureplugin/sign-electronically.svg"), tr("Sign &Electronically"), this); + QAction* signDigitallyAction = new QAction(QIcon(":/pdfplugins/signatureplugin/sign-digitally.svg"), tr("Sign Digitally &With Certificate"), this); + QAction* certificatesAction = new QAction(QIcon(":/pdfplugins/signatureplugin/certificates.svg"), tr("Certificates &Manager"), this); activateAction->setObjectName("signaturetool_activateAction"); createTextAction->setObjectName("signaturetool_createTextAction"); @@ -189,6 +189,11 @@ std::vector SignaturePlugin::getActions() const return result; } +QString SignaturePlugin::getPluginMenuName() const +{ + return tr("Si&gnature"); +} + void SignaturePlugin::onSceneChanged(bool graphicsOnly) { if (!graphicsOnly) diff --git a/Pdf4QtEditorPlugins/SignaturePlugin/signatureplugin.h b/Pdf4QtEditorPlugins/SignaturePlugin/signatureplugin.h index 2f6d3c4..ab9d225 100644 --- a/Pdf4QtEditorPlugins/SignaturePlugin/signatureplugin.h +++ b/Pdf4QtEditorPlugins/SignaturePlugin/signatureplugin.h @@ -46,6 +46,7 @@ public: virtual void setWidget(pdf::PDFWidget* widget) override; virtual void setDocument(const pdf::PDFModifiedDocument& document) override; virtual std::vector getActions() const override; + virtual QString getPluginMenuName() const override; private: void onSceneChanged(bool graphicsOnly); diff --git a/Pdf4QtEditorPlugins/SoftProofingPlugin/softproofingplugin.cpp b/Pdf4QtEditorPlugins/SoftProofingPlugin/softproofingplugin.cpp index ba161db..1b53765 100644 --- a/Pdf4QtEditorPlugins/SoftProofingPlugin/softproofingplugin.cpp +++ b/Pdf4QtEditorPlugins/SoftProofingPlugin/softproofingplugin.cpp @@ -43,9 +43,9 @@ void SoftProofingPlugin::setWidget(pdf::PDFWidget* widget) BaseClass::setWidget(widget); - m_enableSoftProofingAction = new QAction(QIcon(":/pdfplugins/softproofing/soft-proofing.svg"), tr("Soft Proofing"), this); - m_enableGamutCheckingAction = new QAction(QIcon(":/pdfplugins/softproofing/gamut-checking.svg"), tr("Gamut Checking"), this); - m_showSettingsAction = new QAction(QIcon(":/pdfplugins/softproofing/settings.svg"), tr("Soft Proofing Settings"), this); + m_enableSoftProofingAction = new QAction(QIcon(":/pdfplugins/softproofing/soft-proofing.svg"), tr("&Soft Proofing"), this); + m_enableGamutCheckingAction = new QAction(QIcon(":/pdfplugins/softproofing/gamut-checking.svg"), tr("&Gamut Checking"), this); + m_showSettingsAction = new QAction(QIcon(":/pdfplugins/softproofing/settings.svg"), tr("Soft &Proofing Settings"), this); m_enableSoftProofingAction->setCheckable(true); m_enableGamutCheckingAction->setCheckable(true); @@ -83,6 +83,11 @@ std::vector SoftProofingPlugin::getActions() const return { m_enableSoftProofingAction, m_enableGamutCheckingAction, m_showSettingsAction }; } +QString SoftProofingPlugin::getPluginMenuName() const +{ + return tr("Soft &Proofing"); +} + void SoftProofingPlugin::onSoftProofingTriggered() { if (m_isLoadingGUI) diff --git a/Pdf4QtEditorPlugins/SoftProofingPlugin/softproofingplugin.h b/Pdf4QtEditorPlugins/SoftProofingPlugin/softproofingplugin.h index 1456dbf..692a2a7 100644 --- a/Pdf4QtEditorPlugins/SoftProofingPlugin/softproofingplugin.h +++ b/Pdf4QtEditorPlugins/SoftProofingPlugin/softproofingplugin.h @@ -40,6 +40,7 @@ public: virtual void setCMSManager(pdf::PDFCMSManager* manager) override; virtual void setDocument(const pdf::PDFModifiedDocument& document) override; virtual std::vector getActions() const override; + virtual QString getPluginMenuName() const override; private: void onSoftProofingTriggered(); diff --git a/Pdf4QtLibCore/sources/pdfannotation.cpp b/Pdf4QtLibCore/sources/pdfannotation.cpp index 0cfb66f..28aa926 100644 --- a/Pdf4QtLibCore/sources/pdfannotation.cpp +++ b/Pdf4QtLibCore/sources/pdfannotation.cpp @@ -2921,7 +2921,7 @@ void PDFStampAnnotation::draw(AnnotationDrawParameters& parameters) const QPainter& painter = *parameters.painter; painter.setCompositionMode(getCompositionMode()); - QString text = getText(m_stamp); + QString text = getText(m_stamp, false); QColor color(Qt::red); switch (m_stamp) @@ -3009,66 +3009,80 @@ void PDFStampAnnotation::draw(AnnotationDrawParameters& parameters) const parameters.boundingRectangle.adjust(-penWidth, -penWidth, penWidth, penWidth); } -QString PDFStampAnnotation::getText(Stamp stamp) +QString PDFStampAnnotation::getText(Stamp stamp, bool isActionText) { QString text; switch (stamp) { case Stamp::Approved: - text = PDFTranslationContext::tr("APPROVED"); + text = isActionText ? PDFTranslationContext::tr("&Approved") + : PDFTranslationContext::tr("APPROVED"); break; case Stamp::AsIs: - text = PDFTranslationContext::tr("AS IS"); + text = isActionText ? PDFTranslationContext::tr("As &Is") + : PDFTranslationContext::tr("AS IS"); break; case Stamp::Confidential: - text = PDFTranslationContext::tr("CONFIDENTIAL"); + text = isActionText ? PDFTranslationContext::tr("&Confidential") + : PDFTranslationContext::tr("CONFIDENTIAL"); break; case Stamp::Departmental: - text = PDFTranslationContext::tr("DEPARTMENTAL"); + text = isActionText ? PDFTranslationContext::tr("&Departmental") + : PDFTranslationContext::tr("DEPARTMENTAL"); break; case Stamp::Draft: - text = PDFTranslationContext::tr("DRAFT"); + text = isActionText ? PDFTranslationContext::tr("Dra&ft") + : PDFTranslationContext::tr("DRAFT"); break; case Stamp::Experimental: - text = PDFTranslationContext::tr("EXPERIMENTAL"); + text = isActionText ? PDFTranslationContext::tr("&Experimental") + : PDFTranslationContext::tr("EXPERIMENTAL"); break; case Stamp::Expired: - text = PDFTranslationContext::tr("EXPIRED"); + text = isActionText ? PDFTranslationContext::tr("E&xpired") + : PDFTranslationContext::tr("EXPIRED"); break; case Stamp::Final: - text = PDFTranslationContext::tr("FINAL"); + text = isActionText ? PDFTranslationContext::tr("Fina&l") + : PDFTranslationContext::tr("FINAL"); break; case Stamp::ForComment: - text = PDFTranslationContext::tr("FOR COMMENT"); + text = isActionText ? PDFTranslationContext::tr("For Co&mment") + : PDFTranslationContext::tr("FOR COMMENT"); break; case Stamp::ForPublicRelease: - text = PDFTranslationContext::tr("FOR PUBLIC RELEASE"); + text = isActionText ? PDFTranslationContext::tr("For P&ublic Release") + : PDFTranslationContext::tr("FOR PUBLIC RELEASE"); break; case Stamp::NotApproved: - text = PDFTranslationContext::tr("NOT APPROVED"); + text = isActionText ? PDFTranslationContext::tr("Not A&pproved") + : PDFTranslationContext::tr("NOT APPROVED"); break; case Stamp::NotForPublicRelease: - text = PDFTranslationContext::tr("NOT FOR PUBLIC RELEASE"); + text = isActionText ? PDFTranslationContext::tr("N&ot For Public Release") + : PDFTranslationContext::tr("NOT FOR PUBLIC RELEASE"); break; case Stamp::Sold: - text = PDFTranslationContext::tr("SOLD"); + text = isActionText ? PDFTranslationContext::tr("&Sold") + : PDFTranslationContext::tr("SOLD"); break; case Stamp::TopSecret: - text = PDFTranslationContext::tr("TOP SECRET"); + text = isActionText ? PDFTranslationContext::tr("&Top Secret") + : PDFTranslationContext::tr("TOP SECRET"); break; default: diff --git a/Pdf4QtLibCore/sources/pdfannotation.h b/Pdf4QtLibCore/sources/pdfannotation.h index 1391089..5740821 100644 --- a/Pdf4QtLibCore/sources/pdfannotation.h +++ b/Pdf4QtLibCore/sources/pdfannotation.h @@ -1119,7 +1119,7 @@ public: void setStamp(const Stamp& stamp); void setIntent(const StampIntent& intent); - static QString getText(Stamp stamp); + static QString getText(Stamp stamp, bool isActionText); private: friend PDFAnnotationPtr PDFAnnotation::parse(const PDFObjectStorage* storage, PDFObjectReference reference); diff --git a/Pdf4QtLibCore/sources/pdfobjecteditormodel.cpp b/Pdf4QtLibCore/sources/pdfobjecteditormodel.cpp index f8d054a..8c572e3 100644 --- a/Pdf4QtLibCore/sources/pdfobjecteditormodel.cpp +++ b/Pdf4QtLibCore/sources/pdfobjecteditormodel.cpp @@ -658,7 +658,7 @@ PDFObjectEditorAnnotationsModel::PDFObjectEditorAnnotationsModel(QObject* parent PDFObjectFactory factory; factory << stampType; - stampNameEnumItems.emplace_back(PDFStampAnnotation::getText(stampType), stampIndex++, factory.takeObject()); + stampNameEnumItems.emplace_back(PDFStampAnnotation::getText(stampType, false), stampIndex++, factory.takeObject()); } m_attributes.back().enumItems = qMove(stampNameEnumItems); diff --git a/Pdf4QtLibCore/sources/pdfplugin.h b/Pdf4QtLibCore/sources/pdfplugin.h index 857d95a..c90a8a8 100644 --- a/Pdf4QtLibCore/sources/pdfplugin.h +++ b/Pdf4QtLibCore/sources/pdfplugin.h @@ -81,6 +81,7 @@ public: virtual void setCMSManager(PDFCMSManager* manager); virtual void setDocument(const PDFModifiedDocument& document); virtual std::vector getActions() const; + virtual QString getPluginMenuName() const = 0; protected: IPluginDataExchange* m_dataExchangeInterface; diff --git a/Pdf4QtLibGui/pdfeditormainwindow.cpp b/Pdf4QtLibGui/pdfeditormainwindow.cpp index 3ad40ed..475e69b 100644 --- a/Pdf4QtLibGui/pdfeditormainwindow.cpp +++ b/Pdf4QtLibGui/pdfeditormainwindow.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2019-2022 Jakub Melka +// Copyright (C) 2019-2024 Jakub Melka // // This file is part of PDF4QT. // @@ -63,7 +63,6 @@ #include #include #include -#include #include #include @@ -278,7 +277,7 @@ PDFEditorMainWindow::PDFEditorMainWindow(QWidget* parent) : setFocusProxy(m_programController->getPdfWidget()); m_sidebarWidget = new PDFSidebarWidget(m_programController->getPdfWidget()->getDrawWidgetProxy(), m_programController->getTextToSpeech(), m_programController->getCertificateStore(), m_programController->getBookmarkManager(), m_programController->getSettings(), true, this); - m_sidebarDockWidget = new QDockWidget(tr("Sidebar"), this); + m_sidebarDockWidget = new QDockWidget(tr("&Sidebar"), this); m_sidebarDockWidget->setObjectName("SidebarDockWidget"); m_sidebarDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); m_sidebarDockWidget->setWidget(m_sidebarWidget); @@ -296,7 +295,7 @@ PDFEditorMainWindow::PDFEditorMainWindow(QWidget* parent) : m_advancedFindDockWidget->hide(); QAction* toggleAdvancedFindAction = m_advancedFindDockWidget->toggleViewAction(); toggleAdvancedFindAction->setObjectName("actionAdvancedFind"); - toggleAdvancedFindAction->setText(tr("Advanced Find...")); + toggleAdvancedFindAction->setText(tr("Ad&vanced Find...")); toggleAdvancedFindAction->setShortcut(QKeySequence("Ctrl+Shift+F")); toggleAdvancedFindAction->setIcon(QIcon(":/resources/find-advanced.svg")); ui->menuEdit->insertAction(nullptr, toggleAdvancedFindAction); @@ -324,6 +323,10 @@ PDFEditorMainWindow::PDFEditorMainWindow(QWidget* parent) : m_actionManager->styleActions(); m_programController->initActionComboBox(actionComboBox); + +#ifndef NDEBUG + pdf::PDFWidgetUtils::checkMenuAccessibility(this); +#endif } PDFEditorMainWindow::~PDFEditorMainWindow() diff --git a/Pdf4QtLibGui/pdfeditormainwindow.ui b/Pdf4QtLibGui/pdfeditormainwindow.ui index db3f73f..2fdb36c 100644 --- a/Pdf4QtLibGui/pdfeditormainwindow.ui +++ b/Pdf4QtLibGui/pdfeditormainwindow.ui @@ -25,7 +25,7 @@ - File + &File @@ -44,11 +44,11 @@ - Go To + &Go To - Bookmark Settings + Book&mark Settings @@ -68,11 +68,11 @@ - View + &View - Page Layout + Page La&yout @@ -83,7 +83,7 @@ - Rendering Options + Re&ndering Options @@ -113,7 +113,7 @@ - Tools + &Tools @@ -128,7 +128,7 @@ - Help + &Help @@ -136,14 +136,14 @@ - Developer + &Developer - Edit + &Edit @@ -167,11 +167,11 @@ - Insert + &Insert - Sticky Note + Sticky &Note @@ -183,12 +183,12 @@ - Stamp + &Stamp - Text Higlight + Text Hi&ghlight @@ -230,29 +230,29 @@ - + :/resources/open.svg:/resources/open.svg - Open... + &Open... - + :/resources/close.svg:/resources/close.svg - Close + &Close - + :/resources/quit.svg:/resources/quit.svg - Quit + &Quit @@ -260,6 +260,9 @@ true + &Single Page + + Single Page @@ -271,6 +274,9 @@ true + &Continuous + + Continuous @@ -282,6 +288,9 @@ true + Two &Pages + + Two Pages @@ -293,6 +302,9 @@ true + &Two columns + + Two columns @@ -304,7 +316,7 @@ true - First page on right side + &First page on right side First page on right side @@ -315,11 +327,11 @@ - + :/resources/rendering-errors.svg:/resources/rendering-errors.svg - Rendering Errors... + &Rendering Errors... Ctrl+E @@ -330,6 +342,9 @@ true + &Antialiasing + + Antialiasing @@ -338,6 +353,9 @@ true + &Text Antialiasing + + Text Antialiasing @@ -346,6 +364,9 @@ true + &Smooth Pictures + + Smooth Pictures @@ -354,16 +375,19 @@ true + &Ignore Optional Content Settings + + Ignore Optional Content Settings - + :/resources/settings.svg:/resources/settings.svg - Options... + &Options... Ctrl+K @@ -371,52 +395,52 @@ - Reset to Factory Settings + Reset to &Factory Settings - + :/resources/zoom-in.svg:/resources/zoom-in.svg - Zoom In + &Zoom In - + :/resources/zoom-out.svg:/resources/zoom-out.svg - Zoom Out + Zoom &Out - + :/resources/book.svg:/resources/book.svg - About... + &About... - + :/resources/zoom-fit.svg:/resources/zoom-fit.svg - Fit Page + Fit &Page - + :/resources/zoom-fit-horizontal.svg:/resources/zoom-fit-horizontal.svg - Fit Width + Fit &Width W @@ -424,11 +448,11 @@ - + :/resources/zoom-fit-vertical.svg:/resources/zoom-fit-vertical.svg - Fit Height + &Fit Height H @@ -436,20 +460,20 @@ - + :/resources/info.svg:/resources/info.svg - Properties... + Prope&rties... - + :/resources/send-mail.svg:/resources/send-mail.svg - Send by E-Mail... + Send by &E-Mail... @@ -457,7 +481,7 @@ true - Show Text Blocks + Show Text &Blocks @@ -465,34 +489,34 @@ true - Show Text Lines + Show Text &Lines - + :/resources/find.svg:/resources/find.svg - Find + &Find - + :/resources/find-previous.svg:/resources/find-previous.svg - Find Previous + Fin&d Previous - + :/resources/find-next.svg:/resources/find-next.svg - Find Next + Fi&nd Next @@ -500,11 +524,11 @@ true - + :/resources/select-text.svg:/resources/select-text.svg - Select text + Select te&xt @@ -512,38 +536,38 @@ true - + :/resources/select-table.svg:/resources/select-table.svg - Select table + Select &table - + :/resources/select-all-text.svg:/resources/select-all-text.svg - Select All + Select &All - + :/resources/deselect-text.svg:/resources/deselect-text.svg - Deselect + Dese&lect - + :/resources/copy-text.svg:/resources/copy-text.svg - Copy text + &Copy text @@ -551,11 +575,11 @@ true - + :/resources/invert-colors.svg:/resources/invert-colors.svg - Color | Inverted + Color | &Inverted @@ -563,11 +587,11 @@ true - + :/resources/invert-colors.svg:/resources/invert-colors.svg - Color | Grayscale + Color | &Grayscale @@ -575,11 +599,11 @@ true - + :/resources/invert-colors.svg:/resources/invert-colors.svg - Color | High Contrast + Color | &High Contrast @@ -587,11 +611,11 @@ true - + :/resources/invert-colors.svg:/resources/invert-colors.svg - Color | Monochromatic + Color | &Monochromatic @@ -599,43 +623,43 @@ true - + :/resources/invert-colors.svg:/resources/invert-colors.svg - Color | Custom + Color | &Custom - + :/resources/rotate-right.svg:/resources/rotate-right.svg - Rotate Right + Rotate &Right - + :/resources/rotate-left.svg:/resources/rotate-left.svg - Rotate Left + Rotate &Left - + :/resources/print.svg:/resources/print.svg - Print... + &Print... - Render to Images... + Render to &Images... @@ -643,11 +667,11 @@ true - + :/resources/magnifier.svg:/resources/magnifier.svg - Magnifier + &Magnifier Magnifier Tool @@ -658,11 +682,11 @@ true - + :/resources/screenshot-tool.svg:/resources/screenshot-tool.svg - Screenshot + &Screenshot @@ -670,11 +694,11 @@ true - + :/resources/extract-image.svg:/resources/extract-image.svg - Extract Image + &Extract Image @@ -682,34 +706,37 @@ true + &Display Annotations + + Display Annotations - + :/resources/undo.svg:/resources/undo.svg - Undo + &Undo - + :/resources/redo.svg:/resources/redo.svg - Redo + &Redo - + :/resources/optimize.svg:/resources/optimize.svg - Optimize... + &Optimize... Optimizes document to reduce file size. @@ -717,7 +744,7 @@ - + :/resources/save-as.svg:/resources/save-as.svg @@ -726,11 +753,11 @@ - + :/resources/save.svg:/resources/save.svg - Save + &Save @@ -738,7 +765,7 @@ true - Comment + &Comment @@ -746,7 +773,7 @@ true - Help + &Help @@ -754,7 +781,7 @@ true - Insert + &Insert @@ -762,7 +789,7 @@ true - Key + &Key @@ -770,7 +797,7 @@ true - New Paragraph + &New Paragraph @@ -778,7 +805,7 @@ true - Note + No&te @@ -786,7 +813,7 @@ true - Paragraph + &Paragraph @@ -794,11 +821,11 @@ true - + :/resources/hyperlink.svg:/resources/hyperlink.svg - Hyperlink + &Hyperlink @@ -806,11 +833,11 @@ true - + :/resources/annot-inline-text.svg:/resources/annot-inline-text.svg - Inline text + &Inline text @@ -818,11 +845,11 @@ true - + :/resources/annot-straight-line.svg:/resources/annot-straight-line.svg - Straight Line + Str&aight Line @@ -830,11 +857,11 @@ true - + :/resources/annot-polyline.svg:/resources/annot-polyline.svg - Polyline + Pol&yline @@ -842,11 +869,11 @@ true - + :/resources/annot-rectangle.svg:/resources/annot-rectangle.svg - Rectangle + &Rectangle @@ -854,11 +881,11 @@ true - + :/resources/annot-polygon.svg:/resources/annot-polygon.svg - Polygon + &Polygon @@ -866,11 +893,11 @@ true - + :/resources/annot-ellipse.svg:/resources/annot-ellipse.svg - Ellipse + &Ellipse @@ -878,11 +905,11 @@ true - + :/resources/annot-freehand-curve.svg:/resources/annot-freehand-curve.svg - Freehand Curve + &Freehand Curve @@ -890,11 +917,11 @@ true - + :/resources/highlight.svg:/resources/highlight.svg - Highlight + &Highlight @@ -902,11 +929,11 @@ true - + :/resources/underline.svg:/resources/underline.svg - Underline + &Underline @@ -914,11 +941,11 @@ true - + :/resources/strikeout.svg:/resources/strikeout.svg - Strikeout + Stri&keout @@ -926,101 +953,101 @@ true - + :/resources/squiggly.svg:/resources/squiggly.svg - Squiggly + &Squiggly - + :/resources/previous-start.svg:/resources/previous-start.svg - Go to document start + Go to document &start - + :/resources/next-end.svg:/resources/next-end.svg - Go to document end + Go to document &end - + :/resources/next-page.svg:/resources/next-page.svg - Go to next page + Go to &next page - + :/resources/previous-page.svg:/resources/previous-page.svg - Go to previous page + Go to &previous page - + :/resources/next.svg:/resources/next.svg - Go to next line + Go &to next line - + :/resources/previous.svg:/resources/previous.svg - Go to previous line + Go t&o previous line - + :/resources/web.svg:/resources/web.svg - Get Source + &Get Source - + :/resources/encryption.svg:/resources/encryption.svg - Encryption... + &Encryption... - + :/resources/certificate-manager.svg:/resources/certificate-manager.svg - Certificates... + &Certificates... - + :/resources/sanitize-document.svg:/resources/sanitize-document.svg - Sanitize... + &Sanitize... Sanitize document to remove sensitive information. @@ -1031,7 +1058,7 @@ true - Automatic Document Refresh + Automatic &Document Refresh Automatically reloads the document if a change made by an external program is detected. @@ -1039,20 +1066,20 @@ - + :/resources/wallet.svg:/resources/wallet.svg - Become a Sponsor + Become a &Sponsor - + :/resources/create-bitonal-document.svg:/resources/create-bitonal-document.svg - Create Bitonal Document... + Create &Bitonal Document... Create Bitonal Document @@ -1063,11 +1090,11 @@ - + :/resources/bookmark.svg:/resources/bookmark.svg - Bookmark Page + &Bookmark Page Bookmark Page @@ -1078,11 +1105,11 @@ - + :/resources/bookmark-next.svg:/resources/bookmark-next.svg - Go to Next Bookmark + &Go to Next Bookmark Go to Next Bookmark @@ -1093,11 +1120,11 @@ - + :/resources/bookmark-previous.svg:/resources/bookmark-previous.svg - Go to Previous Bookmark + Go to Previous Boo&kmark Go to Previous Bookmark @@ -1108,11 +1135,11 @@ - + :/resources/bookmark.svg:/resources/bookmark.svg - Export Bookmarks + &Export Bookmarks Export Bookmarks @@ -1123,11 +1150,11 @@ - + :/resources/bookmark.svg:/resources/bookmark.svg - Import Bookmarks + &Import Bookmarks Import Bookmarks @@ -1141,11 +1168,11 @@ true - + :/resources/bookmark.svg:/resources/bookmark.svg - Generate Bookmarks Automatically + &Generate Bookmarks Automatically Generate Bookmarks Automatically @@ -1159,6 +1186,9 @@ true + Display &Render Times + + Display Render Times @@ -1168,7 +1198,7 @@ - + diff --git a/Pdf4QtLibGui/pdfprogramcontroller.cpp b/Pdf4QtLibGui/pdfprogramcontroller.cpp index d7432e1..f981954 100644 --- a/Pdf4QtLibGui/pdfprogramcontroller.cpp +++ b/Pdf4QtLibGui/pdfprogramcontroller.cpp @@ -283,7 +283,7 @@ void PDFActionManager::initActions(QSize iconSize, bool initializeStampActions) auto createCreateStampAction = [this](Action actionType, pdf::Stamp stamp) { - QString text = pdf::PDFStampAnnotation::getText(stamp); + QString text = pdf::PDFStampAnnotation::getText(stamp, true); QAction* action = new QAction(text, this); action->setObjectName(QString("actionCreateStamp_%1").arg(int(stamp))); action->setData(int(stamp)); @@ -2222,7 +2222,7 @@ void PDFProgramController::loadPlugins() QToolBar* toolBar = m_mainWindow->addToolBar(plugin.first.name); toolBar->setObjectName(QString("Plugin_Toolbar_%1").arg(plugin.first.name)); m_mainWindowInterface->adjustToolbar(toolBar); - QMenu* menu = m_mainWindowInterface->addToolMenu(plugin.first.name); + QMenu* menu = m_mainWindowInterface->addToolMenu(plugin.second->getPluginMenuName()); for (QAction* action : actions) { if (!action) diff --git a/Pdf4QtLibGui/pdfrecentfilemanager.cpp b/Pdf4QtLibGui/pdfrecentfilemanager.cpp index 767005b..1ce6312 100644 --- a/Pdf4QtLibGui/pdfrecentfilemanager.cpp +++ b/Pdf4QtLibGui/pdfrecentfilemanager.cpp @@ -79,13 +79,13 @@ void PDFRecentFileManager::update() if (i < m_recentFiles.size()) { recentFileAction->setData(m_recentFiles[i]); - recentFileAction->setText(m_recentFiles[i]); + recentFileAction->setText(tr("(&%1) %2").arg(i + 1).arg(m_recentFiles[i])); recentFileAction->setVisible(true); } else { recentFileAction->setData(QVariant()); - recentFileAction->setText(tr("Recent file dummy %1").arg(i + 1)); + recentFileAction->setText(tr("Recent file dummy &%1").arg(i + 1)); recentFileAction->setVisible(false); } } diff --git a/Pdf4QtLibGui/pdfviewermainwindow.cpp b/Pdf4QtLibGui/pdfviewermainwindow.cpp index e6a0d4f..71b9810 100644 --- a/Pdf4QtLibGui/pdfviewermainwindow.cpp +++ b/Pdf4QtLibGui/pdfviewermainwindow.cpp @@ -212,7 +212,7 @@ PDFViewerMainWindow::PDFViewerMainWindow(QWidget* parent) : setFocusProxy(m_programController->getPdfWidget()); m_sidebarWidget = new PDFSidebarWidget(m_programController->getPdfWidget()->getDrawWidgetProxy(), m_programController->getTextToSpeech(), m_programController->getCertificateStore(), m_programController->getBookmarkManager(), m_programController->getSettings(), false, this); - m_sidebarDockWidget = new QDockWidget(tr("Sidebar"), this); + m_sidebarDockWidget = new QDockWidget(tr("&Sidebar"), this); m_sidebarDockWidget->setObjectName("SidebarDockWidget"); m_sidebarDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); m_sidebarDockWidget->setWidget(m_sidebarWidget); @@ -241,6 +241,10 @@ PDFViewerMainWindow::PDFViewerMainWindow(QWidget* parent) : m_actionManager->styleActions(); m_programController->initActionComboBox(actionComboBox); + +#ifndef NDEBUG + pdf::PDFWidgetUtils::checkMenuAccessibility(this); +#endif } PDFViewerMainWindow::~PDFViewerMainWindow() diff --git a/Pdf4QtLibGui/pdfviewermainwindow.ui b/Pdf4QtLibGui/pdfviewermainwindow.ui index c78906b..244f73c 100644 --- a/Pdf4QtLibGui/pdfviewermainwindow.ui +++ b/Pdf4QtLibGui/pdfviewermainwindow.ui @@ -25,7 +25,7 @@ - File + &File @@ -40,11 +40,11 @@ - Go To + &Go To - Bookmark Settings + Book&mark Settings @@ -64,11 +64,11 @@ - View + &View - Page Layout + Page La&yout @@ -79,7 +79,7 @@ - Rendering Options + Re&ndering Options @@ -109,7 +109,7 @@ - Tools + &Tools @@ -121,7 +121,7 @@ - Help + &Help @@ -145,29 +145,29 @@ - + :/resources/open.svg:/resources/open.svg - Open... + &Open... - + :/resources/close.svg:/resources/close.svg - Close + &Close - + :/resources/quit.svg:/resources/quit.svg - Quit + &Quit @@ -175,7 +175,7 @@ true - Single Page + &Single Page Ctrl+1 @@ -186,7 +186,7 @@ true - Continuous + &Continuous Ctrl+2 @@ -197,7 +197,7 @@ true - Two Pages + Two &Pages Ctrl+3 @@ -208,7 +208,7 @@ true - Two columns + &Two columns Ctrl+4 @@ -219,7 +219,7 @@ true - First page on right side + &First page on right side First page on right side @@ -230,11 +230,11 @@ - + :/resources/rendering-errors.svg:/resources/rendering-errors.svg - Rendering Errors... + Rendering &Errors... Ctrl+E @@ -245,7 +245,7 @@ true - Antialiasing + &Antialiasing @@ -253,7 +253,7 @@ true - Text Antialiasing + &Text Antialiasing @@ -261,7 +261,7 @@ true - Smooth Pictures + &Smooth Pictures @@ -269,16 +269,16 @@ true - Ignore Optional Content Settings + &Ignore Optional Content Settings - + :/resources/settings.svg:/resources/settings.svg - Options... + &Options... Ctrl+K @@ -286,52 +286,52 @@ - Reset to Factory Settings + &Reset to Factory Settings - + :/resources/zoom-in.svg:/resources/zoom-in.svg - Zoom In + &Zoom In - + :/resources/zoom-out.svg:/resources/zoom-out.svg - Zoom Out + Zoom &Out - + :/resources/book.svg:/resources/book.svg - About... + &About... - + :/resources/zoom-fit.svg:/resources/zoom-fit.svg - Fit Page + Fit &Page - + :/resources/zoom-fit-horizontal.svg:/resources/zoom-fit-horizontal.svg - Fit Width + Fit &Width W @@ -339,11 +339,11 @@ - + :/resources/zoom-fit-vertical.svg:/resources/zoom-fit-vertical.svg - Fit Height + &Fit Height H @@ -351,20 +351,20 @@ - + :/resources/info.svg:/resources/info.svg - Properties... + Prope&rties... - + :/resources/send-mail.svg:/resources/send-mail.svg - Send by E-Mail... + Send by &E-Mail... @@ -372,11 +372,11 @@ true - + :/resources/invert-colors.svg:/resources/invert-colors.svg - Color | Inverted + Color | &Inverted @@ -384,11 +384,11 @@ true - + :/resources/invert-colors.svg:/resources/invert-colors.svg - Color | Grayscale + Color | &Grayscale @@ -396,11 +396,11 @@ true - + :/resources/invert-colors.svg:/resources/invert-colors.svg - Color | High Contrast + Color | &High Contrast @@ -408,11 +408,11 @@ true - + :/resources/invert-colors.svg:/resources/invert-colors.svg - Color | Monochromatic + Color | &Monochromatic @@ -420,38 +420,38 @@ true - + :/resources/invert-colors.svg:/resources/invert-colors.svg - Color | Custom + Color | &Custom - + :/resources/rotate-right.svg:/resources/rotate-right.svg - Rotate Right + Rotate &Right - + :/resources/rotate-left.svg:/resources/rotate-left.svg - Rotate Left + Rotate &Left - + :/resources/print.svg:/resources/print.svg - Print... + &Print... @@ -459,79 +459,79 @@ true - Display Annotations + &Display Annotations - + :/resources/previous-start.svg:/resources/previous-start.svg - Go to document start + Go to document &start - + :/resources/next-end.svg:/resources/next-end.svg - Go to document end + Go to document &end - + :/resources/next-page.svg:/resources/next-page.svg - Go to next page + Go to &next page - + :/resources/previous-page.svg:/resources/previous-page.svg - Go to previous page + Go to &previous page - + :/resources/next.svg:/resources/next.svg - Go to next line + Go &to next line - + :/resources/previous.svg:/resources/previous.svg - Go to previous line + Go t&o previous line - + :/resources/web.svg:/resources/web.svg - Get Source + &Get Source - + :/resources/certificate-manager.svg:/resources/certificate-manager.svg - Certificates... + &Certificates... @@ -539,7 +539,7 @@ true - Automatic Document Refresh + Automatic &Document Refresh Automatically reloads the document if a change made by an external program is detected. @@ -547,11 +547,11 @@ - + :/resources/wallet.svg:/resources/wallet.svg - Become a Sponsor + Become a &Sponsor Become a Sponsor @@ -559,11 +559,11 @@ - + :/resources/bookmark.svg:/resources/bookmark.svg - Bookmark Page + &Bookmark Page Bookmark Page @@ -574,11 +574,11 @@ - + :/resources/bookmark-next.svg:/resources/bookmark-next.svg - Go to Next Bookmark + &Go to Next Bookmark Go to Next Bookmark @@ -589,14 +589,11 @@ - + :/resources/bookmark-previous.svg:/resources/bookmark-previous.svg - Go to Previous Bookmark - - - Go to Previous Bookmark + Go to Previous Boo&kmark Navigates to the previous bookmarked page. @@ -604,11 +601,11 @@ - + :/resources/bookmark.svg:/resources/bookmark.svg - Export Bookmarks + &Export Bookmarks Export Bookmarks @@ -619,11 +616,11 @@ - + :/resources/bookmark.svg:/resources/bookmark.svg - Import Bookmarks + &Import Bookmarks Import Bookmarks @@ -637,11 +634,11 @@ true - + :/resources/bookmark.svg:/resources/bookmark.svg - Generate Bookmarks Automatically + &Generate Bookmarks Automatically Generate Bookmarks Automatically @@ -655,7 +652,7 @@ true - Display Render Times + Display &Render Times QAction::NoRole @@ -664,7 +661,7 @@ - + diff --git a/Pdf4QtLibWidgets/sources/pdfwidgetutils.cpp b/Pdf4QtLibWidgets/sources/pdfwidgetutils.cpp index 5dad54b..333b846 100644 --- a/Pdf4QtLibWidgets/sources/pdfwidgetutils.cpp +++ b/Pdf4QtLibWidgets/sources/pdfwidgetutils.cpp @@ -18,11 +18,17 @@ #include "pdfwidgetutils.h" #include "pdfcolorconvertor.h" +#include +#include + +#include +#include #include #include #include #include #include +#include #include #include "pdfdbgheap.h" @@ -210,4 +216,73 @@ QIcon PDFWidgetUtils::convertIconForDarkTheme(QIcon icon, QSize iconSize, qreal return QIcon(pixmap); } +void PDFWidgetUtils::checkMenuAccessibility(QWidget* widget) +{ + QList menus = widget->findChildren(); + + for (QMenu* menu : menus) + { + checkMenuAccessibility(menu); + } +} + +void PDFWidgetUtils::checkMenuAccessibility(QMenu* menu) +{ + QStringList actionsDuplicities; + QStringList actionsWithNoAmpersands; + std::map> actions; + + for (QAction* action : menu->actions()) + { + if (action->isSeparator()) + { + continue; + } + + if (QMenu* submenu = action->menu()) + { + checkMenuAccessibility(submenu); + } + + QString text = action->text(); + int i = text.indexOf(QChar('&')); + + if (i == -1) + { + actionsWithNoAmpersands << text; + } + else + { + QString accesibilityChar = text.mid(i + 1, 1); + if (accesibilityChar.size() == 1) + { + actions[accesibilityChar.front().toUpper()].insert(action); + } + } + } + + for (const auto& actionItem : actions) + { + if (actionItem.second.size() > 1) + { + QStringList actionTexts; + for (QAction* action : actionItem.second) + { + actionTexts << action->text(); + } + + actionsDuplicities << QString("'%1': Duplicities = '%2'").arg(QString(actionItem.first), actionTexts.join("', '")); + } + } + + QStringList errors; + errors.append(std::move(actionsDuplicities)); + errors.append(std::move(actionsWithNoAmpersands)); + + if (!errors.isEmpty()) + { + QMessageBox::warning(nullptr, "Accesibility Check", errors.join("
")); + } +} + } // namespace pdf diff --git a/Pdf4QtLibWidgets/sources/pdfwidgetutils.h b/Pdf4QtLibWidgets/sources/pdfwidgetutils.h index 073a7d1..186cf56 100644 --- a/Pdf4QtLibWidgets/sources/pdfwidgetutils.h +++ b/Pdf4QtLibWidgets/sources/pdfwidgetutils.h @@ -88,6 +88,14 @@ public: convertActionForDarkTheme(action, iconSize, devicePixelRatioF); } } + + /// Checks menu accessibility for all descendants of the specified widget. + /// \param widget The widget whose descendants are to be checked. + static void checkMenuAccessibility(QWidget* widget); + + /// Checks menu accessibility for the specified menu. + /// \param menu The menu to be checked for accessibility. + static void checkMenuAccessibility(QMenu* menu); }; } // namespace pdf diff --git a/Pdf4QtPageMaster/mainwindow.cpp b/Pdf4QtPageMaster/mainwindow.cpp index 78c77ca..b5b9178 100644 --- a/Pdf4QtPageMaster/mainwindow.cpp +++ b/Pdf4QtPageMaster/mainwindow.cpp @@ -145,7 +145,7 @@ MainWindow::MainWindow(QWidget* parent) : m_iconTheme.setPrefix(":/pdfpagemaster/resources/"); m_iconTheme.loadTheme(); - QToolBar* mainToolbar = addToolBar(tr("Main")); + QToolBar* mainToolbar = addToolBar(tr("&Main")); mainToolbar->setObjectName("main_toolbar"); mainToolbar->addAction(ui->actionAddDocuments); mainToolbar->addSeparator(); @@ -156,19 +156,19 @@ MainWindow::MainWindow(QWidget* parent) : mainToolbar->addActions({ ui->actionCut, ui->actionCopy, ui->actionPaste }); mainToolbar->addSeparator(); mainToolbar->addActions({ ui->actionGroup, ui->actionUngroup }); - QToolBar* insertToolbar = addToolBar(tr("Insert")); + QToolBar* insertToolbar = addToolBar(tr("&Insert")); insertToolbar->setObjectName("insert_toolbar"); insertToolbar->addActions({ ui->actionInsert_PDF, ui->actionInsert_Image, ui->actionInsert_Empty_Page }); - QToolBar* selectToolbar = addToolBar(tr("Select")); + QToolBar* selectToolbar = addToolBar(tr("&Select")); selectToolbar->setObjectName("select_toolbar"); selectToolbar->addActions({ ui->actionSelect_None, ui->actionSelect_All, ui->actionSelect_Even, ui->actionSelect_Odd, ui->actionSelect_Portrait, ui->actionSelect_Landscape, ui->actionInvert_Selection }); - QToolBar* regroupToolbar = addToolBar(tr("Regroup")); + QToolBar* regroupToolbar = addToolBar(tr("&Regroup")); regroupToolbar->setObjectName("regroup_toolbar"); regroupToolbar->addActions({ ui->actionRegroup_Even_Odd, ui->actionRegroup_by_Page_Pairs, ui->actionRegroup_by_Outline, ui->actionRegroup_by_Alternating_Pages, ui->actionRegroup_by_Alternating_Pages_Reversed_Order }); - QToolBar* zoomToolbar = addToolBar(tr("Zoom")); + QToolBar* zoomToolbar = addToolBar(tr("&Zoom")); zoomToolbar->setObjectName("zoom_toolbar"); zoomToolbar->addActions({ ui->actionZoom_In, ui->actionZoom_Out }); - QToolBar* makeToolbar = addToolBar(tr("Make")); + QToolBar* makeToolbar = addToolBar(tr("Ma&ke")); makeToolbar->setObjectName("make_toolbar"); makeToolbar->addActions({ ui->actionUnited_Document, ui->actionSeparate_to_Multiple_Documents, ui->actionSeparate_to_Multiple_Documents_Grouped }); @@ -209,6 +209,10 @@ MainWindow::MainWindow(QWidget* parent) : loadSettings(); updateActions(); + +#ifndef NDEBUG + pdf::PDFWidgetUtils::checkMenuAccessibility(this); +#endif } MainWindow::~MainWindow() diff --git a/Pdf4QtPageMaster/mainwindow.ui b/Pdf4QtPageMaster/mainwindow.ui index 5f201d1..466e4ba 100644 --- a/Pdf4QtPageMaster/mainwindow.ui +++ b/Pdf4QtPageMaster/mainwindow.ui @@ -59,7 +59,7 @@ - File + &File @@ -67,7 +67,7 @@ - Edit + &Edit @@ -89,7 +89,7 @@ - Insert + &Insert @@ -97,7 +97,7 @@ - View + &View @@ -112,7 +112,7 @@ - Make + &Make @@ -120,7 +120,7 @@ - Help + &Help @@ -129,12 +129,12 @@ - Toolbars + &Toolbars - Regroup + &Regroup @@ -158,7 +158,7 @@ :/pdfpagemaster/resources/open.svg:/pdfpagemaster/resources/open.svg - Add Documents... + &Add Documents... Add Documents @@ -173,7 +173,7 @@ :/pdfpagemaster/resources/close.svg:/pdfpagemaster/resources/close.svg - Close + C&lose Alt+F4 @@ -185,7 +185,7 @@ :/pdfpagemaster/resources/clone-selection.svg:/pdfpagemaster/resources/clone-selection.svg - Clone Selection + Clone &Selection Ctrl+L @@ -197,7 +197,7 @@ :/pdfpagemaster/resources/remove-selection.svg:/pdfpagemaster/resources/remove-selection.svg - Remove Selection + Re&move Selection Del @@ -209,7 +209,7 @@ :/pdfpagemaster/resources/restore-removed-items.svg:/pdfpagemaster/resources/restore-removed-items.svg - Restore Removed Items + Restore Removed &Items Ctrl+Shift+R @@ -221,7 +221,7 @@ :/pdfpagemaster/resources/insert-page-from-pdf.svg:/pdfpagemaster/resources/insert-page-from-pdf.svg - Insert PDF + Insert &PDF Insert PDF @@ -236,7 +236,7 @@ :/pdfpagemaster/resources/insert-image.svg:/pdfpagemaster/resources/insert-image.svg - Insert Image + &Insert Image Ctrl+Alt+I @@ -248,7 +248,7 @@ :/pdfpagemaster/resources/insert-empty-page.svg:/pdfpagemaster/resources/insert-empty-page.svg - Insert Empty Page + Insert &Empty Page Ctrl+Shift+I @@ -260,7 +260,7 @@ :/pdfpagemaster/resources/cut.svg:/pdfpagemaster/resources/cut.svg - Cut + Cu&t Ctrl+X @@ -272,7 +272,7 @@ :/pdfpagemaster/resources/copy.svg:/pdfpagemaster/resources/copy.svg - Copy + &Copy Ctrl+C @@ -284,7 +284,7 @@ :/pdfpagemaster/resources/paste.svg:/pdfpagemaster/resources/paste.svg - Paste + &Paste Ctrl+V @@ -296,7 +296,7 @@ :/pdfpagemaster/resources/replace-selection.svg:/pdfpagemaster/resources/replace-selection.svg - Replace Selection + Repl&ace Selection Ctrl+Alt+R @@ -308,7 +308,7 @@ :/pdfpagemaster/resources/select-none.svg:/pdfpagemaster/resources/select-none.svg - Select None + Select &None Ctrl+N @@ -320,7 +320,7 @@ :/pdfpagemaster/resources/select-all.svg:/pdfpagemaster/resources/select-all.svg - Select All + Select &All Ctrl+A @@ -332,7 +332,7 @@ :/pdfpagemaster/resources/select-even.svg:/pdfpagemaster/resources/select-even.svg - Select Even + Select &Even F9 @@ -344,7 +344,7 @@ :/pdfpagemaster/resources/select-odd.svg:/pdfpagemaster/resources/select-odd.svg - Select Odd + Select &Odd F10 @@ -356,7 +356,7 @@ :/pdfpagemaster/resources/select-portrait.svg:/pdfpagemaster/resources/select-portrait.svg - Select Portrait + Select &Portrait F11 @@ -368,7 +368,7 @@ :/pdfpagemaster/resources/select-landscape.svg:/pdfpagemaster/resources/select-landscape.svg - Select Landscape + Select &Landscape F12 @@ -380,7 +380,7 @@ :/pdfpagemaster/resources/rotate-right.svg:/pdfpagemaster/resources/rotate-right.svg - Rotate Right + Rotate &Right F4 @@ -392,7 +392,7 @@ :/pdfpagemaster/resources/rotate-left.svg:/pdfpagemaster/resources/rotate-left.svg - Rotate Left + Rotate &Left Shift+F4 @@ -404,7 +404,7 @@ :/pdfpagemaster/resources/zoom-in.svg:/pdfpagemaster/resources/zoom-in.svg - Zoom In + &Zoom In Ctrl++ @@ -416,7 +416,7 @@ :/pdfpagemaster/resources/zoom-out.svg:/pdfpagemaster/resources/zoom-out.svg - Zoom Out + Zoo&m Out Ctrl+- @@ -428,7 +428,7 @@ :/pdfpagemaster/resources/get-source.svg:/pdfpagemaster/resources/get-source.svg - Get Source + &Get Source @@ -437,7 +437,7 @@ :/pdfpagemaster/resources/about.svg:/pdfpagemaster/resources/about.svg - About... + &About... F1 @@ -449,7 +449,7 @@ :/pdfpagemaster/resources/make-united-document.svg:/pdfpagemaster/resources/make-united-document.svg - United Document... + &United Document... F5 @@ -461,7 +461,7 @@ :/pdfpagemaster/resources/make-separated-document.svg:/pdfpagemaster/resources/make-separated-document.svg - Separate to Multiple Documents... + &Separate to Multiple Documents... F6 @@ -473,7 +473,7 @@ :/pdfpagemaster/resources/make-separated-document-from-groups.svg:/pdfpagemaster/resources/make-separated-document-from-groups.svg - Separate to Multiple Documents (Grouped)... + Separate to Multiple Documents (&Grouped)... F7 @@ -485,7 +485,7 @@ :/pdfpagemaster/resources/group.svg:/pdfpagemaster/resources/group.svg - Group + &Group Ctrl+G @@ -497,7 +497,7 @@ :/pdfpagemaster/resources/ungroup.svg:/pdfpagemaster/resources/ungroup.svg - Ungroup + U&ngroup Ctrl+Shift+G @@ -509,7 +509,7 @@ :/pdfpagemaster/resources/clear.svg:/pdfpagemaster/resources/clear.svg - Clear + &Clear Ctrl+W @@ -521,7 +521,7 @@ :/pdfpagemaster/resources/regroup-even-odd.svg:/pdfpagemaster/resources/regroup-even-odd.svg - Regroup by Even/Odd Pages + Regroup by &Even/Odd Pages @@ -530,7 +530,7 @@ :/pdfpagemaster/resources/regroup-pairs.svg:/pdfpagemaster/resources/regroup-pairs.svg - Regroup by Page Pairs + Regroup by &Page Pairs @@ -539,7 +539,7 @@ :/pdfpagemaster/resources/regroup-outline.svg:/pdfpagemaster/resources/regroup-outline.svg - Regroup by Outline + Regroup by &Outline @@ -548,7 +548,7 @@ :/pdfpagemaster/resources/regroup-alternating.svg:/pdfpagemaster/resources/regroup-alternating.svg - Regroup by Alternating Pages + Regroup by &Alternating Pages @@ -557,7 +557,7 @@ :/pdfpagemaster/resources/regroup-alternating-reversed.svg:/pdfpagemaster/resources/regroup-alternating-reversed.svg - Regroup by Alternating Pages (Reversed Order) + Regroup by Alternating Pages (&Reversed Order) @@ -566,7 +566,7 @@ :/pdfpagemaster/resources/invert-selection.svg:/pdfpagemaster/resources/invert-selection.svg - Invert Selection + &Invert Selection @@ -575,7 +575,7 @@ :/pdfpagemaster/resources/undo.svg:/pdfpagemaster/resources/undo.svg - Undo + &Undo Ctrl+Z @@ -587,7 +587,7 @@ :/pdfpagemaster/resources/redo.svg:/pdfpagemaster/resources/redo.svg - Redo + Re&do Ctrl+Y @@ -595,7 +595,7 @@ - Prepare Icon Theme + &Prepare Icon Theme @@ -604,7 +604,7 @@ :/pdfpagemaster/resources/wallet.svg:/pdfpagemaster/resources/wallet.svg - Become a Sponsor + Become a &Sponsor diff --git a/RELEASES.txt b/RELEASES.txt index 13d2715..8eb5bff 100644 --- a/RELEASES.txt +++ b/RELEASES.txt @@ -1,4 +1,5 @@ CURRENT: + - Issue #172: access keys are missing from most menu items/action text strings - Issue #168: When opening a PDF file or merging some PDF files, stamp will disappear. - Issue #164: Taskbar icon not shown in linux mint. - Issue #163: Unable to render probably valid PDF