diff --git a/src/Gui/CMakeLists.txt b/src/Gui/CMakeLists.txt
index 5edf33f0fe..77917c34bd 100644
--- a/src/Gui/CMakeLists.txt
+++ b/src/Gui/CMakeLists.txt
@@ -294,7 +294,6 @@ SET(Gui_UIC_SRCS
DlgUnitsCalculator.ui
DlgAuthorization.ui
DlgChooseIcon.ui
- DlgCommands.ui
DlgCreateNewPreferencePack.ui
DlgCustomizeSpNavSettings.ui
DlgDisplayProperties.ui
@@ -518,7 +517,6 @@ SOURCE_GROUP("Dialog" FILES ${Dialog_SRCS})
# The customize dialog sources
SET(Dialog_Customize_CPP_SRCS
DlgActionsImp.cpp
- DlgCommandsImp.cpp
DlgCustomizeImp.cpp
DlgCustomizeSpaceball.cpp
DlgCustomizeSpNavSettings.cpp
@@ -529,7 +527,6 @@ SET(Dialog_Customize_CPP_SRCS
)
SET(Dialog_Customize_HPP_SRCS
DlgActionsImp.h
- DlgCommandsImp.h
DlgCustomizeImp.h
DlgCustomizeSpaceball.h
DlgCustomizeSpNavSettings.h
@@ -543,7 +540,6 @@ SET(Dialog_Customize_SRCS
${Dialog_Customize_HPP_SRCS}
DlgActions.ui
DlgChooseIcon.ui
- DlgCommands.ui
DlgCustomizeSpNavSettings.ui
DlgKeyboard.ui
DlgToolbars.ui
diff --git a/src/Gui/DlgCommands.ui b/src/Gui/DlgCommands.ui
deleted file mode 100644
index ffd79ba6e0..0000000000
--- a/src/Gui/DlgCommands.ui
+++ /dev/null
@@ -1,84 +0,0 @@
-
-
-
-
-
- Gui::Dialog::DlgCustomCommands
-
-
-
- 0
- 0
- 459
- 286
-
-
-
- Commands
-
-
-
- 9
-
-
- 6
-
- -
-
-
-
- 4
- 7
- 0
- 0
-
-
-
-
- 150
- 16777215
-
-
-
- false
-
-
-
- -
-
-
- false
-
-
- true
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 32767
- 32767
-
-
-
-
-
-
-
-
-
-
-
- textLabel
-
-
-
-
diff --git a/src/Gui/DlgCommandsImp.cpp b/src/Gui/DlgCommandsImp.cpp
deleted file mode 100644
index 537df3512e..0000000000
--- a/src/Gui/DlgCommandsImp.cpp
+++ /dev/null
@@ -1,276 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 Werner Mayer *
- * *
- * This file is part of the FreeCAD CAx development system. *
- * *
- * This library is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Library General Public *
- * License as published by the Free Software Foundation; either *
- * version 2 of the License, or (at your option) any later version. *
- * *
- * This library is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU Library General Public License for more details. *
- * *
- * You should have received a copy of the GNU Library General Public *
- * License along with this library; see the file COPYING.LIB. If not, *
- * write to the Free Software Foundation, Inc., 59 Temple Place, *
- * Suite 330, Boston, MA 02111-1307, USA *
- * *
- ***************************************************************************/
-
-#include "PreCompiled.h"
-
-#ifndef _PreComp_
-# include
-# include
-# include
-# include
-#endif
-
-#include "DlgCommandsImp.h"
-#include "ui_DlgCommands.h"
-#include "Application.h"
-#include "BitmapFactory.h"
-#include "Command.h"
-
-
-using namespace Gui::Dialog;
-
-namespace Gui { namespace Dialog {
-using GroupMap = std::vector< std::pair >;
-
-struct GroupMap_find {
- const QLatin1String& item;
- explicit GroupMap_find(const QLatin1String& item) : item(item) {}
- bool operator () (const std::pair& elem) const
- {
- return elem.first == item;
- }
-};
-}
-}
-
-/* TRANSLATOR Gui::Dialog::DlgCustomCommandsImp */
-
-/**
- * Constructs a DlgCustomCommandsImp which is a child of 'parent', with the
- * name 'name' and widget flags set to 'f'
- *
- * The dialog will by default be modeless, unless you set 'modal' to
- * true to construct a modal dialog.
- */
-DlgCustomCommandsImp::DlgCustomCommandsImp( QWidget* parent )
- : CustomizeActionPage(parent)
- , ui(new Ui_DlgCustomCommands)
-{
- ui->setupUi(this);
-
- // paints for active and inactive the same color
- QPalette pal = ui->categoryTreeWidget->palette();
- pal.setColor(QPalette::Inactive, QPalette::Highlight, pal.color(QPalette::Active, QPalette::Highlight));
- pal.setColor(QPalette::Inactive, QPalette::HighlightedText, pal.color(QPalette::Active, QPalette::HighlightedText));
- ui->categoryTreeWidget->setPalette( pal );
-
- connect(ui->commandTreeWidget, &QTreeWidget::currentItemChanged,
- this, &DlgCustomCommandsImp::onDescription);
- connect(ui->categoryTreeWidget, &QTreeWidget::currentItemChanged,
- this, &DlgCustomCommandsImp::onGroupActivated);
-
- CommandManager & cCmdMgr = Application::Instance->commandManager();
- std::map sCommands = cCmdMgr.getCommands();
-
- GroupMap groupMap;
- groupMap.push_back(std::make_pair(QLatin1String("File"), QString()));
- groupMap.push_back(std::make_pair(QLatin1String("Edit"), QString()));
- groupMap.push_back(std::make_pair(QLatin1String("View"), QString()));
- groupMap.push_back(std::make_pair(QLatin1String("Standard-View"), QString()));
- groupMap.push_back(std::make_pair(QLatin1String("Tools"), QString()));
- groupMap.push_back(std::make_pair(QLatin1String("Window"), QString()));
- groupMap.push_back(std::make_pair(QLatin1String("Help"), QString()));
- groupMap.push_back(std::make_pair(QLatin1String("Macros"), qApp->translate("Gui::MacroCommand", "Macros")));
-
- for (const auto & sCommand : sCommands) {
- QLatin1String group(sCommand.second->getGroupName());
- QString text = sCommand.second->translatedGroupName();
- GroupMap::iterator jt;
- jt = std::find_if(groupMap.begin(), groupMap.end(), GroupMap_find(group));
- if (jt != groupMap.end()) {
- if (jt->second.isEmpty())
- jt->second = text;
- }
- else {
- groupMap.push_back(std::make_pair(group, text));
- }
- }
-
- QStringList labels; labels << tr("Category");
- ui->categoryTreeWidget->setHeaderLabels(labels);
- for (const auto & it : groupMap) {
- auto item = new QTreeWidgetItem(ui->categoryTreeWidget);
- item->setText(0, it.second);
- item->setData(0, Qt::UserRole, QVariant(it.first));
- }
-
- labels.clear();
- labels << tr("Icon") << tr("Command");
- ui->commandTreeWidget->setHeaderLabels(labels);
- ui->commandTreeWidget->header()->hide();
- ui->commandTreeWidget->setIconSize(QSize(32, 32));
- ui->commandTreeWidget->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
-
- ui->categoryTreeWidget->setCurrentItem(ui->categoryTreeWidget->topLevelItem(0));
-}
-
-/** Destroys the object and frees any allocated resources */
-DlgCustomCommandsImp::~DlgCustomCommandsImp()
-{
-}
-
-/** Shows the description for the corresponding command */
-void DlgCustomCommandsImp::onDescription(QTreeWidgetItem *item)
-{
- if (item)
- ui->textLabel->setText(item->toolTip(1));
- else
- ui->textLabel->setText(QString());
-}
-
-/** Shows all commands of this category */
-void DlgCustomCommandsImp::onGroupActivated(QTreeWidgetItem* groupItem)
-{
- if (!groupItem)
- return;
-
- QVariant data = groupItem->data(0, Qt::UserRole);
- QString group = data.toString();
- ui->commandTreeWidget->clear();
-
- CommandManager & cCmdMgr = Application::Instance->commandManager();
- std::vector aCmds = cCmdMgr.getGroupCommands(group.toLatin1());
- if (group == QLatin1String("Macros")) {
- for (const auto & aCmd : aCmds) {
- auto item = new QTreeWidgetItem(ui->commandTreeWidget);
- item->setText(1, QString::fromUtf8(aCmd->getMenuText()));
- item->setToolTip(1, QString::fromUtf8(aCmd->getToolTipText()));
- item->setData(1, Qt::UserRole, QByteArray(aCmd->getName()));
- item->setSizeHint(0, QSize(32, 32));
- if (aCmd->getPixmap())
- item->setIcon(0, BitmapFactory().iconFromTheme(aCmd->getPixmap()));
- }
- }
- else {
- for (const auto & aCmd : aCmds) {
- auto item = new QTreeWidgetItem(ui->commandTreeWidget);
- item->setText(1, qApp->translate(aCmd->className(), aCmd->getMenuText()));
- item->setToolTip(1, qApp->translate(aCmd->className(), aCmd->getToolTipText()));
- item->setData(1, Qt::UserRole, QByteArray(aCmd->getName()));
- item->setSizeHint(0, QSize(32, 32));
- if (aCmd->getPixmap())
- item->setIcon(0, BitmapFactory().iconFromTheme(aCmd->getPixmap()));
- }
- }
-
- ui->textLabel->setText(QString());
-}
-
-void DlgCustomCommandsImp::onAddMacroAction(const QByteArray& macro)
-{
- QTreeWidgetItem* item = ui->categoryTreeWidget->currentItem();
- if (!item)
- return;
-
- QVariant data = item->data(0, Qt::UserRole);
- QString group = data.toString();
- if (group == QLatin1String("Macros"))
- {
- CommandManager & cCmdMgr = Application::Instance->commandManager();
- Command* pCmd = cCmdMgr.getCommandByName(macro);
-
- auto item = new QTreeWidgetItem(ui->commandTreeWidget);
- item->setText(1, QString::fromUtf8(pCmd->getMenuText()));
- item->setToolTip(1, QString::fromUtf8(pCmd->getToolTipText()));
- item->setData(1, Qt::UserRole, macro);
- item->setSizeHint(0, QSize(32, 32));
- if (pCmd->getPixmap())
- item->setIcon(0, BitmapFactory().iconFromTheme(pCmd->getPixmap()));
- }
-}
-
-void DlgCustomCommandsImp::onRemoveMacroAction(const QByteArray& macro)
-{
- QTreeWidgetItem* item = ui->categoryTreeWidget->currentItem();
- if (!item)
- return;
-
- QVariant data = item->data(0, Qt::UserRole);
- QString group = data.toString();
- if (group == QLatin1String("Macros"))
- {
- for (int i=0; icommandTreeWidget->topLevelItemCount(); i++) {
- QTreeWidgetItem* item = ui->commandTreeWidget->topLevelItem(i);
- QByteArray command = item->data(1, Qt::UserRole).toByteArray();
- if (command == macro) {
- ui->commandTreeWidget->takeTopLevelItem(i);
- delete item;
- break;
- }
- }
- }
-}
-
-void DlgCustomCommandsImp::onModifyMacroAction(const QByteArray& macro)
-{
- QTreeWidgetItem* item = ui->categoryTreeWidget->currentItem();
- if (!item)
- return;
-
- QVariant data = item->data(0, Qt::UserRole);
- QString group = data.toString();
- if (group == QLatin1String("Macros"))
- {
- CommandManager & cCmdMgr = Application::Instance->commandManager();
- Command* pCmd = cCmdMgr.getCommandByName(macro);
- for (int i=0; icommandTreeWidget->topLevelItemCount(); i++) {
- QTreeWidgetItem* item = ui->commandTreeWidget->topLevelItem(i);
- QByteArray command = item->data(1, Qt::UserRole).toByteArray();
- if (command == macro) {
- item->setText(1, QString::fromUtf8(pCmd->getMenuText()));
- item->setToolTip(1, QString::fromUtf8(pCmd->getToolTipText()));
- item->setData(1, Qt::UserRole, macro);
- item->setSizeHint(0, QSize(32, 32));
- if (pCmd->getPixmap())
- item->setIcon(0, BitmapFactory().iconFromTheme(pCmd->getPixmap()));
- if (item->isSelected())
- onDescription(item);
- break;
- }
- }
- }
-}
-
-void DlgCustomCommandsImp::changeEvent(QEvent *e)
-{
- if (e->type() == QEvent::LanguageChange) {
- ui->retranslateUi(this);
- QStringList labels; labels << tr("Category");
- ui->categoryTreeWidget->setHeaderLabels(labels);
-
- CommandManager & cCmdMgr = Application::Instance->commandManager();
- QTreeWidgetItemIterator it(ui->categoryTreeWidget);
- while (*it) {
- QVariant data = (*it)->data(0, Qt::UserRole);
- std::vector aCmds = cCmdMgr.getGroupCommands(data.toByteArray());
- if (!aCmds.empty()) {
- QString text = aCmds[0]->translatedGroupName();
- (*it)->setText(0, text);
- }
- ++it;
- }
- onGroupActivated(ui->categoryTreeWidget->topLevelItem(0));
- }
- QWidget::changeEvent(e);
-}
-
-#include "moc_DlgCommandsImp.cpp"
diff --git a/src/Gui/DlgCommandsImp.h b/src/Gui/DlgCommandsImp.h
deleted file mode 100644
index a3b79dfd89..0000000000
--- a/src/Gui/DlgCommandsImp.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/***************************************************************************
- * Copyright (c) 2004 Werner Mayer *
- * *
- * This file is part of the FreeCAD CAx development system. *
- * *
- * This library is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Library General Public *
- * License as published by the Free Software Foundation; either *
- * version 2 of the License, or (at your option) any later version. *
- * *
- * This library is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU Library General Public License for more details. *
- * *
- * You should have received a copy of the GNU Library General Public *
- * License along with this library; see the file COPYING.LIB. If not, *
- * write to the Free Software Foundation, Inc., 59 Temple Place, *
- * Suite 330, Boston, MA 02111-1307, USA *
- * *
- ***************************************************************************/
-
-
-#ifndef GUI_DIALOG_DLGCOMMANDS_IMP_H
-#define GUI_DIALOG_DLGCOMMANDS_IMP_H
-
-#include "PropertyPage.h"
-#include
-
-class QTreeWidgetItem;
-
-namespace Gui {
-class Command;
-namespace Dialog {
-class Ui_DlgCustomCommands;
-
-/** Shows an overview of all available commands of all groups and modules.
- * You can customize your workbenches just by drag&dropping any commands
- * onto the toolbars or commandbars. But you cannot modify any standard toolbars or
- * commandbars such as "File, View, ...". It is only poosible to
- * customize your own toolbars or commandbars.
- * \author Werner Mayer
- */
-class DlgCustomCommandsImp : public CustomizeActionPage
-{
- Q_OBJECT
-
-public:
- explicit DlgCustomCommandsImp(QWidget* parent = nullptr);
- ~DlgCustomCommandsImp() override;
-
-protected Q_SLOTS:
- void onGroupActivated(QTreeWidgetItem *i);
- void onDescription(QTreeWidgetItem *i);
- void onAddMacroAction(const QByteArray&) override;
- void onRemoveMacroAction(const QByteArray&) override;
- void onModifyMacroAction(const QByteArray&) override;
-
-protected:
- void changeEvent(QEvent *e) override;
-
-private:
- std::unique_ptr ui;
-};
-
-} // namespace Dialog
-} // namespace Gui
-
-#endif // GUI_DIALOG_DLGCOMMANDS_IMP_H
diff --git a/src/Gui/resource.cpp b/src/Gui/resource.cpp
index 52a9fc4d93..034450934f 100644
--- a/src/Gui/resource.cpp
+++ b/src/Gui/resource.cpp
@@ -45,7 +45,6 @@
#include "DlgToolbarsImp.h"
#include "DlgActionsImp.h"
-#include "DlgCommandsImp.h"
#include "DlgKeyboardImp.h"
#include "DlgCustomizeSpaceball.h"
#include "DlgCustomizeSpNavSettings.h"
@@ -82,7 +81,6 @@ WidgetFactorySupplier::WidgetFactorySupplier()
// ADD YOUR CUSTOMIZE PAGES HERE
//
//
- new CustomPageProducer;
new CustomPageProducer;
new CustomPageProducer;
new CustomPageProducer;