[graphics/kgraphviewer] /: Brush up menu & action terms a bit

Friedrich W. H. Kossebau null at kde.org
Thu Apr 18 17:50:20 BST 2024


Git commit da419a464502543748916afbc6d43cbcf4a23e26 by Friedrich W. H. Kossebau.
Committed on 18/04/2024 at 16:50.
Pushed by kossebau into branch 'master'.

Brush up menu & action terms a bit

M  +12   -12   doc/en_US/index.docbook
M  +22   -18   src/part/dotgraphview.cpp
M  +1    -1    src/part/kgraphviewer_part.cpp

https://invent.kde.org/graphics/kgraphviewer/-/commit/da419a464502543748916afbc6d43cbcf4a23e26

diff --git a/doc/en_US/index.docbook b/doc/en_US/index.docbook
index 37f279b..62467f4 100644
--- a/doc/en_US/index.docbook
+++ b/doc/en_US/index.docbook
@@ -495,12 +495,12 @@ or the internal library for parsing &graphviz; ˙ files.</para>
 	</varlistentry>
 
 	<varlistentry>
-	<term><guimenuitem>Specify layout command</guimenuitem></term>
+	<term><guimenuitem>Specify Layout Command…</guimenuitem></term>
 	<listitem><para>Opens a dialog allowing you to specify a layout command executed by the shell. This command should accept one parameter, the graph file name, and write its layout on stdout in the xdot language. This way, you can give specific options to one of the previous commands, or apply a filter modifying your graph before running it through ˙.</para></listitem>
 	</varlistentry>
 
 	<varlistentry>
-	<term><guimenuitem>Reset layout command to default</guimenuitem></term>
+	<term><guimenuitem>Reset Layout Command to Default</guimenuitem></term>
 	<listitem><para>Determine the graph type (directed or not) and apply the default algorithm to it, currently ˙ and &neato; respectively.</para></listitem>
 	</varlistentry>
 	</variablelist>
@@ -512,7 +512,7 @@ or the internal library for parsing &graphviz; ˙ files.</para>
 <listitem><para>
 	<variablelist>
 	<varlistentry>
-	<term><guimenuitem>As Image...</guimenuitem></term>
+	<term><guimenuitem>As Image…</guimenuitem></term>
 	<listitem><para>Allows to export the full graph to all supported image formats.</para></listitem>
 	</varlistentry>
 	</variablelist>
@@ -520,12 +520,12 @@ or the internal library for parsing &graphviz; ˙ files.</para>
 </varlistentry>
 
 <varlistentry>
-<term><guimenu>Enable Bird's-eye View</guimenu></term>
+<term><guimenu>Enable Bird's-Eye View</guimenu></term>
 <listitem><para>When checked, the Bird's-eye view is displayed when necessary. Otherwise, it is hidden and its positioning menu is disabled.</para></listitem>
 </varlistentry>
 
 <varlistentry>
-<term><guisubmenu>Bird's-eye View</guisubmenu></term>
+<term><guisubmenu>Bird's-Eye View Position</guisubmenu></term>
 <listitem><para>Configure where to place the bird's-eye view in the graph view. The possible choices are:
 	<variablelist>
 	<varlistentry>
@@ -588,7 +588,7 @@ or the internal library for parsing &graphviz; ˙ files.</para>
 	</varlistentry>
 
 	<varlistentry>
-	<term><menuchoice><guimenu>File</guimenu><guisubmenu>Export Graph</guisubmenu><guimenuitem>As Image...</guimenuitem></menuchoice></term>
+	<term><menuchoice><guimenu>File</guimenu><guisubmenu>Export Graph</guisubmenu><guimenuitem>As Image…</guimenuitem></menuchoice></term>
 	<listitem><para>Allows to <action>export</action> the full graph to all supported image formats.</para></listitem>
 	</varlistentry>
 
@@ -603,7 +603,7 @@ or the internal library for parsing &graphviz; ˙ files.</para>
 	</varlistentry>
 
 	<varlistentry>
-	<term><menuchoice><guimenu>File</guimenu><guimenuitem>Page Setup</guimenuitem></menuchoice></term>
+	<term><menuchoice><guimenu>File</guimenu><guimenuitem>Page Setup…</guimenuitem></menuchoice></term>
 	<listitem><para><action>Opens</action> the <guilabel>Page Setup</guilabel> dialog for the current graph.</para></listitem>
 	</varlistentry>
 
@@ -629,23 +629,23 @@ or the internal library for parsing &graphviz; ˙ files.</para>
 	</varlistentry>
 
 	<varlistentry>
-	<term><menuchoice><guimenu>View</guimenu><guimenuitem>Redisplay</guimenuitem></menuchoice></term>
+	<term><menuchoice><guimenu>View</guimenu><guimenuitem>Refresh</guimenuitem></menuchoice></term>
 	<listitem><para><action>Reloads</action> the current graph.</para></listitem>
 	</varlistentry>
 
 	<varlistentry>
-	<term><menuchoice><guimenu>View</guimenu><guisubmenu>Select Layout Algo</guisubmenu></menuchoice></term>
+	<term><menuchoice><guimenu>View</guimenu><guisubmenu>Layout Algorithm</guisubmenu></menuchoice></term>
 	<listitem><para>Opens a submenu with various &graphviz; layout algorithms for the current graph.</para></listitem>
 	</varlistentry>
 
 	<varlistentry>
-	<term><menuchoice><shortcut><keycombo action="simul">&Ctrl;<keycap>B</keycap></keycombo></shortcut><guimenu>View</guimenu><guimenuitem>Enable Bird's-eye View</guimenuitem></menuchoice></term>
+	<term><menuchoice><shortcut><keycombo action="simul">&Ctrl;<keycap>B</keycap></keycombo></shortcut><guimenu>View</guimenu><guimenuitem>Enable Bird's-Eye View</guimenuitem></menuchoice></term>
 	<listitem><para>When checked, the Bird's-eye view is displayed when necessary. Otherwise, it is hidden and its positioning menu is disabled.</para></listitem>
 	</varlistentry>
 
 	<varlistentry>
-	<term><menuchoice><guimenu>View</guimenu><guimenuitem>Birds-eye View</guimenuitem></menuchoice></term>
-	<listitem><para>Configure where to place the bird-eye view in the graph view. Choices are:
+	<term><menuchoice><guimenu>View</guimenu><guimenuitem>Bird's-Eye View Position</guimenuitem></menuchoice></term>
+	<listitem><para>Configure where to place the Bird's-eye view in the graph view. Choices are:
 	<variablelist>
 		<varlistentry>
 		<term><guimenuitem>Top Left</guimenuitem></term>
diff --git a/src/part/dotgraphview.cpp b/src/part/dotgraphview.cpp
index 9a8b5e1..a2d3adf 100644
--- a/src/part/dotgraphview.cpp
+++ b/src/part/dotgraphview.cpp
@@ -403,30 +403,31 @@ void DotGraphViewPrivate::setupActions()
 {
     Q_Q(DotGraphView);
 
-    m_layoutAlgoSelectAction = new KSelectAction(QIcon::fromTheme(QStringLiteral("configure")), i18n("Select Layout Algo"), actionCollection());
+    m_layoutAlgoSelectAction = new KSelectAction(QIcon::fromTheme(QStringLiteral("configure")),
+                                                 i18nc("@title:menu", "Layout Algorithm"), actionCollection());
     actionCollection()->addAction(QStringLiteral("view_layout_algo"), m_layoutAlgoSelectAction);
 
-    auto *lda = new QAction(i18n("Dot"), m_layoutAlgoSelectAction);
+    auto *lda = new QAction(i18nc("@item:inmenu algorithm program", "Dot"), m_layoutAlgoSelectAction);
     lda->setWhatsThis(i18n("Layout the graph using the dot program."));
     lda->setCheckable(true);
     actionCollection()->addAction(QStringLiteral("layout_dot"), lda);
 
-    auto *lna = new QAction(i18n("Neato"), m_layoutAlgoSelectAction);
+    auto *lna = new QAction(i18nc("@item:inmenu algorithm program", "Neato"), m_layoutAlgoSelectAction);
     lna->setWhatsThis(i18n("Layout the graph using the neato program."));
     lna->setCheckable(true);
     actionCollection()->addAction(QStringLiteral("layout_neato"), lna);
 
-    auto *lta = new QAction(i18n("Twopi"), m_layoutAlgoSelectAction);
+    auto *lta = new QAction(i18nc("@item:inmenu algorithm program", "Twopi"), m_layoutAlgoSelectAction);
     lta->setWhatsThis(i18n("Layout the graph using the twopi program."));
     lta->setCheckable(true);
     actionCollection()->addAction(QStringLiteral("layout_twopi"), lta);
 
-    auto *lfa = new QAction(i18n("Fdp"), m_layoutAlgoSelectAction);
+    auto *lfa = new QAction(i18nc("@item:inmenu algorithm program", "Fdp"), m_layoutAlgoSelectAction);
     lfa->setWhatsThis(i18n("Layout the graph using the fdp program."));
     lfa->setCheckable(true);
     actionCollection()->addAction(QStringLiteral("layout_fdp"), lfa);
 
-    auto *lca = new QAction(i18n("Circo"), m_layoutAlgoSelectAction);
+    auto *lca = new QAction(i18nc("@item:inmenu algorithm program", "Circo"), m_layoutAlgoSelectAction);
     lca->setWhatsThis(i18n("Layout the graph using the circo program."));
     lca->setCheckable(true);
     actionCollection()->addAction(QStringLiteral("layout_c"), lca);
@@ -448,13 +449,14 @@ void DotGraphViewPrivate::setupActions()
     QObject::connect(m_layoutAlgoSelectAction, &KSelectAction::textTriggered,
                      q, &DotGraphView::slotSelectLayoutAlgo);
 
-    auto *file_exportMenu = new KActionMenu(QIcon::fromTheme(QStringLiteral("document-export")), i18n("Export Graph"), actionCollection());
+    auto *file_exportMenu = new KActionMenu(QIcon::fromTheme(QStringLiteral("document-export")),
+                                            i18nc("@title:menu", "Export Graph"), actionCollection());
     file_exportMenu->setToolTip(i18n("Allows the graph to be exported in another format."));
     file_exportMenu->setWhatsThis(
         i18n("Use the Export Graph menu to export the graph in another format. "
              "There is currently only one export format supported: as a PNG image."));
 
-    auto *exportToImageAction = new QAction(i18n("As Image..."), q);
+    auto *exportToImageAction = new QAction(i18nc("@action:inmenu", "As Image…"), q);
     exportToImageAction->setWhatsThis(i18n("Export the graph to an image file."));
     QObject::connect(exportToImageAction, &QAction::triggered, q, &DotGraphView::slotExportImage);
     actionCollection()->addAction(QStringLiteral("export_image"), exportToImageAction);
@@ -471,40 +473,42 @@ void DotGraphViewPrivate::setupActions()
     // xgettext: no-c-format
     zoomOutAct->setWhatsThis(i18n("Zoom out by 10% from the currently viewed graph"));
 
-    m_bevEnabledAction = new KToggleAction(QIcon(QStringLiteral(":/kgraphviewerpart/pics/bev.png")), i18n("Enable Bird's-eye View"), actionCollection());
+    m_bevEnabledAction = new KToggleAction(QIcon(QStringLiteral(":/kgraphviewerpart/pics/bev.png")),
+                                           i18nc("@option:check", "Enable Bird's-Eye View"), actionCollection());
     m_bevEnabledAction->setWhatsThis(i18n("Enables or disables the Bird's-eye View"));
     KActionCollection::setDefaultShortcut(m_bevEnabledAction, Qt::CTRL | Qt::Key_B);
     QObject::connect(m_bevEnabledAction, &QAction::triggered, q, &DotGraphView::slotBevToggled);
     actionCollection()->addAction(QStringLiteral("view_bev_enabled"), m_bevEnabledAction);
 
-    m_bevPopup = new KSelectAction(QIcon::fromTheme(QStringLiteral("configure")), i18n("Birds-eye View"), actionCollection());
+    m_bevPopup = new KSelectAction(QIcon::fromTheme(QStringLiteral("configure")),
+                                   i18nc("@title:menu", "Bird's-Eye View Position"), actionCollection());
     m_bevPopup->setWhatsThis(i18n("Allows the Bird's-eye View to be setup."));
 
-    auto *btla = new QAction(i18n("Top Left"), m_bevPopup);
+    auto *btla = new QAction(i18nc("@item:inmenu bev position", "Top Left"), m_bevPopup);
     btla->setWhatsThis(i18n("Puts the Bird's-eye View in the top-left corner."));
     btla->setCheckable(true);
     QObject::connect(btla, &QAction::triggered, q, &DotGraphView::slotBevTopLeft);
     actionCollection()->addAction(QStringLiteral("bev_top_left"), btla);
 
-    auto *btra = new QAction(i18n("Top Right"), m_bevPopup);
+    auto *btra = new QAction(i18nc("@item:inmenu bev position", "Top Right"), m_bevPopup);
     btra->setWhatsThis(i18n("Puts the Bird's-eye View in the top-right corner."));
     btra->setCheckable(true);
     QObject::connect(btra, &QAction::triggered, q, &DotGraphView::slotBevTopRight);
     actionCollection()->addAction(QStringLiteral("bev_top_right"), btra);
 
-    auto *bbla = new QAction(i18n("Bottom Left"), m_bevPopup);
+    auto *bbla = new QAction(i18nc("@item:inmenu bev position", "Bottom Left"), m_bevPopup);
     bbla->setWhatsThis(i18n("Puts the Bird's-eye View in the bottom-left corner."));
     bbla->setCheckable(true);
     QObject::connect(bbla, &QAction::triggered, q, &DotGraphView::slotBevBottomLeft);
     actionCollection()->addAction(QStringLiteral("bev_bottom_left"), bbla);
 
-    auto *bbra = new QAction(i18n("Bottom Right"), m_bevPopup);
+    auto *bbra = new QAction(i18nc("@item:inmenu bev position", "Bottom Right"), m_bevPopup);
     bbra->setWhatsThis(i18n("Puts the Bird's-eye View in the bottom-right corner."));
     bbra->setCheckable(true);
     QObject::connect(bbra, &QAction::triggered, q, &DotGraphView::slotBevBottomRight);
     actionCollection()->addAction(QStringLiteral("bev_bottom_right"), bbra);
 
-    auto *bba = new QAction(i18n("Automatic"), m_bevPopup);
+    auto *bba = new QAction(i18nc("@item:inmenu bev position", "Automatic"), m_bevPopup);
     bba->setWhatsThis(i18n("Let KGraphViewer automatically choose the position of the Bird's-eye View."));
     bba->setCheckable(true);
     QObject::connect(bba, &QAction::triggered, q, &DotGraphView::slotBevAutomatic);
@@ -550,14 +554,14 @@ void DotGraphViewPrivate::setupPopup()
     qCDebug(KGRAPHVIEWERLIB_LOG) << "DotGraphView::setupPopup";
     m_popup = new QMenu(q);
 
-    QMenu *layoutPopup = m_popup->addMenu(QIcon::fromTheme(QStringLiteral("distribute-graph")), i18n("Layout"));
+    QMenu *layoutPopup = m_popup->addMenu(QIcon::fromTheme(QStringLiteral("distribute-graph")), i18nc("@title:menu", "Layout"));
     layoutPopup->addAction(m_layoutAlgoSelectAction);
     QAction *slc = layoutPopup->addAction(QIcon::fromTheme(QStringLiteral("edit-rename")),
-                                          i18n("Specify layout command"),
+                                          i18nc("@action:inmenu", "Specify Layout Command…"),
                                           q, &DotGraphView::slotLayoutSpecify);
     slc->setWhatsThis(i18n("Specify yourself the layout command to use. Given a dot file, it should produce an xdot file on its standard output."));
     QAction *rlc = layoutPopup->addAction(QIcon::fromTheme(QStringLiteral("edit-reset")),
-                                          i18n("Reset layout command to default"),
+                                          i18nc("@action:inmenu", "Reset Layout Command to Default"),
                                           q, &DotGraphView::slotLayoutReset);
     rlc->setWhatsThis(i18n("Resets the layout command to use to the default depending on the graph type (directed or not)."));
 
diff --git a/src/part/kgraphviewer_part.cpp b/src/part/kgraphviewer_part.cpp
index 62733b0..ec896a6 100644
--- a/src/part/kgraphviewer_part.cpp
+++ b/src/part/kgraphviewer_part.cpp
@@ -89,7 +89,7 @@ KGraphViewerPart::KGraphViewerPart(QWidget *parentWidget, QObject *parent, const
     //   KAction* pagesetupAct = new KAction(i18n("&Page setup"), this); //actionCollection(), "file_page_setup");
     QAction *pagesetupAct = actionCollection()->addAction(QStringLiteral("file_page_setup"), d->m_widget, &DotGraphView::pageSetup);
     pagesetupAct->setIcon(QIcon::fromTheme(QStringLiteral("document-properties")));
-    pagesetupAct->setText(i18n("Page setup"));
+    pagesetupAct->setText(i18nc("@action:inmenu", "Page Setup…"));
     pagesetupAct->setWhatsThis(i18n("Opens the Page Setup dialog to allow graph printing to be setup"));
 
     QAction *redisplayAct = KStandardAction::redisplay(d->m_widget, &DotGraphView::reload, actionCollection());


More information about the kde-doc-english mailing list