Skip to content

Commit

Permalink
Gui: use public methods in Command sub-classes
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Apr 21, 2021
1 parent 2c072c7 commit c4f411a
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 54 deletions.
12 changes: 6 additions & 6 deletions src/Gui/CommandDoc.cpp
Expand Up @@ -1017,10 +1017,10 @@ Action * StdCmdUndo::createAction(void)
Action *pcAction;

pcAction = new UndoAction(this,getMainWindow());
pcAction->setShortcut(QString::fromLatin1(sAccel));
pcAction->setShortcut(QString::fromLatin1(getAccel()));
applyCommandData(this->className(), pcAction);
if (sPixmap)
pcAction->setIcon(Gui::BitmapFactory().iconFromTheme(sPixmap));
if (getPixmap())
pcAction->setIcon(Gui::BitmapFactory().iconFromTheme(getPixmap()));

return pcAction;
}
Expand Down Expand Up @@ -1061,10 +1061,10 @@ Action * StdCmdRedo::createAction(void)
Action *pcAction;

pcAction = new RedoAction(this,getMainWindow());
pcAction->setShortcut(QString::fromLatin1(sAccel));
pcAction->setShortcut(QString::fromLatin1(getAccel()));
applyCommandData(this->className(), pcAction);
if (sPixmap)
pcAction->setIcon(Gui::BitmapFactory().iconFromTheme(sPixmap));
if (getPixmap())
pcAction->setIcon(Gui::BitmapFactory().iconFromTheme(getPixmap()));

return pcAction;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Gui/CommandLink.cpp
Expand Up @@ -98,11 +98,11 @@ Action * StdCmdLinkMakeGroup::createAction(void)
// add the action items
QAction* action = nullptr;
action = pcAction->addAction(QObject::tr("Simple group"));
action->setWhatsThis(QString::fromLatin1(sWhatsThis));
action->setWhatsThis(QString::fromLatin1(getWhatsThis()));
action = pcAction->addAction(QObject::tr("Group with links"));
action->setWhatsThis(QString::fromLatin1(sWhatsThis));
action->setWhatsThis(QString::fromLatin1(getWhatsThis()));
action = pcAction->addAction(QObject::tr("Group with transform links"));
action->setWhatsThis(QString::fromLatin1(sWhatsThis));
action->setWhatsThis(QString::fromLatin1(getWhatsThis()));
return pcAction;
}

Expand Down
24 changes: 12 additions & 12 deletions src/Gui/CommandStd.cpp
Expand Up @@ -122,10 +122,10 @@ Action * StdCmdWorkbench::createAction(void)
Action *pcAction;

pcAction = new WorkbenchGroup(this,getMainWindow());
pcAction->setShortcut(QString::fromLatin1(sAccel));
pcAction->setShortcut(QString::fromLatin1(getAccel()));
applyCommandData(this->className(), pcAction);
if (sPixmap)
pcAction->setIcon(Gui::BitmapFactory().iconFromTheme(sPixmap));
if (getPixmap())
pcAction->setIcon(Gui::BitmapFactory().iconFromTheme(getPixmap()));

return pcAction;
}
Expand Down Expand Up @@ -235,14 +235,14 @@ Action * StdCmdAbout::createAction(void)
QString exe = qApp->applicationName();
pcAction = new Action(this,getMainWindow());
pcAction->setText(QCoreApplication::translate(
this->className(), sMenuText).arg(exe));
this->className(), getMenuText()).arg(exe));
pcAction->setToolTip(QCoreApplication::translate(
this->className(), sToolTipText).arg(exe));
this->className(), getToolTipText()).arg(exe));
pcAction->setStatusTip(QCoreApplication::translate(
this->className(), sStatusTip).arg(exe));
pcAction->setWhatsThis(QLatin1String(sWhatsThis));
this->className(), getStatusTip()).arg(exe));
pcAction->setWhatsThis(QLatin1String(getWhatsThis()));
pcAction->setIcon(QApplication::windowIcon());
pcAction->setShortcut(QString::fromLatin1(sAccel));
pcAction->setShortcut(QString::fromLatin1(getAccel()));
// Needs to have AboutRole set to avoid duplicates if adding the about action more than once on macOS
pcAction->setMenuRole(QAction::AboutRole);
return pcAction;
Expand All @@ -269,12 +269,12 @@ void StdCmdAbout::languageChange()
if (_pcAction) {
QString exe = qApp->applicationName();
_pcAction->setText(QCoreApplication::translate(
this->className(), sMenuText).arg(exe));
this->className(), getMenuText()).arg(exe));
_pcAction->setToolTip(QCoreApplication::translate(
this->className(), sToolTipText).arg(exe));
this->className(), getToolTipText()).arg(exe));
_pcAction->setStatusTip(QCoreApplication::translate(
this->className(), sStatusTip).arg(exe));
_pcAction->setWhatsThis(QLatin1String(sWhatsThis));
this->className(), getStatusTip()).arg(exe));
_pcAction->setWhatsThis(QLatin1String(getWhatsThis()));
}
}

Expand Down
26 changes: 13 additions & 13 deletions src/Gui/CommandView.cpp
Expand Up @@ -315,15 +315,15 @@ Action * StdCmdFreezeViews::createAction(void)

// add the action items
saveView = pcAction->addAction(QObject::tr("Save views..."));
saveView->setWhatsThis(QString::fromLatin1(sWhatsThis));
saveView->setWhatsThis(QString::fromLatin1(getWhatsThis()));
QAction* loadView = pcAction->addAction(QObject::tr("Load views..."));
loadView->setWhatsThis(QString::fromLatin1(sWhatsThis));
loadView->setWhatsThis(QString::fromLatin1(getWhatsThis()));
pcAction->addAction(QString::fromLatin1(""))->setSeparator(true);
freezeView = pcAction->addAction(QObject::tr("Freeze view"));
freezeView->setShortcut(QString::fromLatin1(sAccel));
freezeView->setWhatsThis(QString::fromLatin1(sWhatsThis));
freezeView->setShortcut(QString::fromLatin1(getAccel()));
freezeView->setWhatsThis(QString::fromLatin1(getWhatsThis()));
clearView = pcAction->addAction(QObject::tr("Clear views"));
clearView->setWhatsThis(QString::fromLatin1(sWhatsThis));
clearView->setWhatsThis(QString::fromLatin1(getWhatsThis()));
separator = pcAction->addAction(QString::fromLatin1(""));
separator->setSeparator(true);
offset = pcAction->actions().count();
Expand Down Expand Up @@ -663,43 +663,43 @@ Gui::Action * StdCmdDrawStyle::createAction(void)
a0->setChecked(true);
a0->setObjectName(QString::fromLatin1("Std_DrawStyleAsIs"));
a0->setShortcut(QKeySequence(QString::fromUtf8("V,1")));
a0->setWhatsThis(QString::fromLatin1(sWhatsThis));
a0->setWhatsThis(QString::fromLatin1(getWhatsThis()));
QAction* a1 = pcAction->addAction(QString());
a1->setCheckable(true);
a1->setIcon(BitmapFactory().iconFromTheme("DrawStylePoints"));
a1->setObjectName(QString::fromLatin1("Std_DrawStylePoints"));
a1->setShortcut(QKeySequence(QString::fromUtf8("V,2")));
a1->setWhatsThis(QString::fromLatin1(sWhatsThis));
a1->setWhatsThis(QString::fromLatin1(getWhatsThis()));
QAction* a2 = pcAction->addAction(QString());
a2->setCheckable(true);
a2->setIcon(BitmapFactory().iconFromTheme("DrawStyleWireFrame"));
a2->setObjectName(QString::fromLatin1("Std_DrawStyleWireframe"));
a2->setShortcut(QKeySequence(QString::fromUtf8("V,3")));
a2->setWhatsThis(QString::fromLatin1(sWhatsThis));
a2->setWhatsThis(QString::fromLatin1(getWhatsThis()));
QAction* a3 = pcAction->addAction(QString());
a3->setCheckable(true);
a3->setIcon(BitmapFactory().iconFromTheme("DrawStyleHiddenLine"));
a3->setObjectName(QString::fromLatin1("Std_DrawStyleHiddenLine"));
a3->setShortcut(QKeySequence(QString::fromUtf8("V,4")));
a3->setWhatsThis(QString::fromLatin1(sWhatsThis));
a3->setWhatsThis(QString::fromLatin1(getWhatsThis()));
QAction* a4 = pcAction->addAction(QString());
a4->setCheckable(true);
a4->setIcon(BitmapFactory().iconFromTheme("DrawStyleNoShading"));
a4->setObjectName(QString::fromLatin1("Std_DrawStyleNoShading"));
a4->setShortcut(QKeySequence(QString::fromUtf8("V,5")));
a4->setWhatsThis(QString::fromLatin1(sWhatsThis));
a4->setWhatsThis(QString::fromLatin1(getWhatsThis()));
QAction* a5 = pcAction->addAction(QString());
a5->setCheckable(true);
a5->setIcon(BitmapFactory().iconFromTheme("DrawStyleShaded"));
a5->setObjectName(QString::fromLatin1("Std_DrawStyleShaded"));
a5->setShortcut(QKeySequence(QString::fromUtf8("V,6")));
a5->setWhatsThis(QString::fromLatin1(sWhatsThis));
a5->setWhatsThis(QString::fromLatin1(getWhatsThis()));
QAction* a6 = pcAction->addAction(QString());
a6->setCheckable(true);
a6->setIcon(BitmapFactory().iconFromTheme("DrawStyleFlatLines"));
a6->setObjectName(QString::fromLatin1("Std_DrawStyleFlatLines"));
a6->setShortcut(QKeySequence(QString::fromUtf8("V,7")));
a6->setWhatsThis(QString::fromLatin1(sWhatsThis));
a6->setWhatsThis(QString::fromLatin1(getWhatsThis()));


pcAction->setIcon(a0->icon());
Expand Down Expand Up @@ -1683,7 +1683,7 @@ Action * StdViewDockUndockFullscreen::createAction(void)
ActionGroup* pcAction = new ActionGroup(this, getMainWindow());
pcAction->setDropDownMenu(true);
pcAction->setText(QCoreApplication::translate(
this->className(), sMenuText));
this->className(), getMenuText()));

CommandManager &rcCmdMgr = Application::Instance->commandManager();
Command* cmdD = rcCmdMgr.getCommandByName("Std_ViewDock");
Expand Down
8 changes: 4 additions & 4 deletions src/Gui/CommandWindow.cpp
Expand Up @@ -460,14 +460,14 @@ Action * StdCmdWindowsMenu::createAction(void)
WindowAction *pcAction;
pcAction = new WindowAction(this, getMainWindow());
for ( int i=0; i<10; i++ ) {
QAction* window = pcAction->addAction(QObject::tr(sToolTipText));
QAction* window = pcAction->addAction(QObject::tr(getToolTipText()));
window->setCheckable(true);
window->setToolTip(QCoreApplication::translate(
this->className(), sToolTipText));
this->className(), getToolTipText()));
window->setStatusTip(QCoreApplication::translate(
this->className(), sStatusTip));
this->className(), getStatusTip()));
window->setWhatsThis(QCoreApplication::translate(
this->className(), sWhatsThis));
this->className(), getWhatsThis()));
}

QAction* sep = pcAction->addAction(QLatin1String(""));
Expand Down
22 changes: 11 additions & 11 deletions src/Gui/NetworkRetriever.cpp
Expand Up @@ -421,15 +421,15 @@ Action * StdCmdDownloadOnlineHelp::createAction(void)
QString exe = QString::fromLatin1(App::GetApplication().getExecutableName());
pcAction = new Action(this,getMainWindow());
pcAction->setText(QCoreApplication::translate(
this->className(), sMenuText));
this->className(), getMenuText()));
pcAction->setToolTip(QCoreApplication::translate(
this->className(), sToolTipText).arg(exe));
this->className(), getToolTipText()).arg(exe));
pcAction->setStatusTip(QCoreApplication::translate(
this->className(), sStatusTip).arg(exe));
this->className(), getStatusTip()).arg(exe));
pcAction->setWhatsThis(QCoreApplication::translate(
this->className(), sWhatsThis).arg(exe));
pcAction->setIcon(Gui::BitmapFactory().pixmap(sPixmap));
pcAction->setShortcut(QString::fromLatin1(sAccel));
this->className(), getWhatsThis()).arg(exe));
pcAction->setIcon(Gui::BitmapFactory().pixmap(getPixmap()));
pcAction->setShortcut(QString::fromLatin1(getAccel()));

return pcAction;
}
Expand All @@ -439,13 +439,13 @@ void StdCmdDownloadOnlineHelp::languageChange()
if (_pcAction) {
QString exe = QString::fromLatin1(App::GetApplication().getExecutableName());
_pcAction->setText(QCoreApplication::translate(
this->className(), sMenuText));
this->className(), getMenuText()));
_pcAction->setToolTip(QCoreApplication::translate(
this->className(), sToolTipText).arg(exe));
this->className(), getToolTipText()).arg(exe));
_pcAction->setStatusTip(QCoreApplication::translate(
this->className(), sStatusTip).arg(exe));
this->className(), getStatusTip()).arg(exe));
_pcAction->setWhatsThis(QCoreApplication::translate(
this->className(), sWhatsThis).arg(exe));
this->className(), getWhatsThis()).arg(exe));
}
}

Expand Down Expand Up @@ -550,7 +550,7 @@ void StdCmdDownloadOnlineHelp::wgetFinished()
{
if (_pcAction)
_pcAction->setText(QCoreApplication::translate(
this->className(), sMenuText));
this->className(), getMenuText()));
}

#include "moc_NetworkRetriever.cpp"
Expand Down
4 changes: 2 additions & 2 deletions src/Mod/Sketcher/Gui/CommandConstraints.cpp
Expand Up @@ -898,7 +898,7 @@ class DrawSketchHandlerGenConstraint: public DrawSketchHandler
qreal fullIconWidth = 32 * pixelRatio;
qreal iconWidth = 16 * pixelRatio;
QPixmap cursorPixmap = Gui::BitmapFactory().pixmapFromSvg("Sketcher_Crosshair", QSizeF(fullIconWidth, fullIconWidth), colorMapping),
icon = Gui::BitmapFactory().pixmapFromSvg(cmd->sPixmap, QSizeF(iconWidth, iconWidth));
icon = Gui::BitmapFactory().pixmapFromSvg(cmd->getPixmap(), QSizeF(iconWidth, iconWidth));
QPainter cursorPainter;
cursorPainter.begin(&cursorPixmap);
cursorPainter.drawPixmap(16 * pixelRatio, 16 * pixelRatio, icon);
Expand Down Expand Up @@ -5902,7 +5902,7 @@ Gui::Action * CmdSketcherCompConstrainRadDia::createAction(void)
pcAction->setProperty("defaultAction", QVariant(defaultId));
}

pcAction->setShortcut(QString::fromLatin1(sAccel));
pcAction->setShortcut(QString::fromLatin1(getAccel()));

return pcAction;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Mod/Sketcher/Gui/CommandSketcherTools.cpp
Expand Up @@ -1653,12 +1653,12 @@ void CmdSketcherCompCopy::activated(int iMsg)
if (iMsg == 0){
CmdSketcherClone sc;
sc.activate();
pcAction->setShortcut(QString::fromLatin1(this->sAccel));
pcAction->setShortcut(QString::fromLatin1(this->getAccel()));
}
else if (iMsg == 1) {
CmdSketcherCopy sc;
sc.activate();
pcAction->setShortcut(QString::fromLatin1(this->sAccel));
pcAction->setShortcut(QString::fromLatin1(this->getAccel()));
}
else if (iMsg == 2) {
CmdSketcherMove sc;
Expand Down Expand Up @@ -1687,7 +1687,7 @@ Gui::Action * CmdSketcherCompCopy::createAction(void)
int defaultId = 0;
pcAction->setProperty("defaultAction", QVariant(defaultId));

pcAction->setShortcut(QString::fromLatin1(sAccel));
pcAction->setShortcut(QString::fromLatin1(getAccel()));

return pcAction;
}
Expand Down

0 comments on commit c4f411a

Please sign in to comment.