diff --git a/src/Gui/CMakeLists.txt b/src/Gui/CMakeLists.txt index b9f19393f..947aa0d95 100644 --- a/src/Gui/CMakeLists.txt +++ b/src/Gui/CMakeLists.txt @@ -129,6 +129,7 @@ set(Gui_MOC_HDRS DownloadManager.h DlgActionsImp.h DlgActivateWindowImp.h + DlgUnitsCalculatorImp.h DlgCommandsImp.h DlgCustomizeImp.h DlgCustomizeSpaceball.h @@ -219,6 +220,7 @@ SET(Gui_UIC_SRCS DemoMode.ui DlgActions.ui DlgActivateWindow.ui + DlgUnitsCalculator.ui DlgAuthorization.ui DlgChooseIcon.ui DlgCommands.ui @@ -295,6 +297,7 @@ SET(Dialog_CPP_SRCS Clipping.cpp DemoMode.cpp DlgActivateWindowImp.cpp + DlgUnitsCalculatorImp.cpp DlgDisplayPropertiesImp.cpp DlgInputDialogImp.cpp DlgMacroExecuteImp.cpp @@ -323,6 +326,7 @@ SET(Dialog_HPP_SRCS Clipping.h DemoMode.h DlgActivateWindowImp.h + DlgUnitsCalculatorImp.h DlgDisplayPropertiesImp.h DlgInputDialogImp.h DlgMacroExecuteImp.h @@ -354,6 +358,7 @@ SET(Dialog_SRCS Clipping.ui DemoMode.ui DlgActivateWindow.ui + DlgUnitsCalculator.ui DlgAuthorization.ui DlgDisplayProperties.ui DlgInputDialog.ui diff --git a/src/Gui/CommandStd.cpp b/src/Gui/CommandStd.cpp index 5ba4beddd..7a04d1df1 100644 --- a/src/Gui/CommandStd.cpp +++ b/src/Gui/CommandStd.cpp @@ -61,6 +61,7 @@ #include "WorkbenchManager.h" #include "Workbench.h" #include "Selection.h" +#include "DlgUnitsCalculatorImp.h" using Base::Console; using Base::Sequencer; @@ -647,6 +648,28 @@ void StdCmdMeasurementSimple::activated(int iMsg) updateActive(); commitCommand(); } +//=========================================================================== +// Std_UnitsCalculater +//=========================================================================== +DEF_STD_CMD(StdCmdUnitsCalculator); + +StdCmdUnitsCalculator::StdCmdUnitsCalculator() + : Command("Std_UnitsCalculater") +{ + sGroup = QT_TR_NOOP("Tools"); + sMenuText = QT_TR_NOOP("&Units calculator..."); + sToolTipText = QT_TR_NOOP("Start the units calculator"); + sWhatsThis = QT_TR_NOOP("Start the units calculator"); + sStatusTip = QT_TR_NOOP("Start the units calculator"); + //sPixmap = ""; + eType = 0; +} + +void StdCmdUnitsCalculator::activated(int iMsg) +{ + Gui::Dialog::DlgUnitsCalculator *dlg = new Gui::Dialog::DlgUnitsCalculator( getMainWindow() ); + dlg->show(); +} namespace Gui { @@ -673,6 +696,7 @@ void CreateStdCommands(void) rcCmdMgr.addCommand(new StdCmdFreeCADForum()); rcCmdMgr.addCommand(new StdCmdFreeCADFAQ()); rcCmdMgr.addCommand(new StdCmdPythonWebsite()); + rcCmdMgr.addCommand(new StdCmdUnitsCalculator()); //rcCmdMgr.addCommand(new StdCmdMeasurementSimple()); //rcCmdMgr.addCommand(new StdCmdDownloadOnlineHelp()); //rcCmdMgr.addCommand(new StdCmdDescription()); diff --git a/src/Gui/DlgUnitsCalculator.ui b/src/Gui/DlgUnitsCalculator.ui new file mode 100644 index 000000000..723b2a82c --- /dev/null +++ b/src/Gui/DlgUnitsCalculator.ui @@ -0,0 +1,117 @@ + + + DlgUnitCalculator + + + + 0 + 0 + 375 + 139 + + + + Units calculater + + + + + + + + + 100 + 0 + + + + + + + + as: + + + + + + + + 100 + 0 + + + + + + + + => + + + + + + + + 100 + 0 + + + + true + + + + + + + + + true + + + + + + + + + Help + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Copy + + + + + + + Close + + + + + + + + + + diff --git a/src/Gui/DlgUnitsCalculatorImp.cpp b/src/Gui/DlgUnitsCalculatorImp.cpp new file mode 100644 index 000000000..d6f892ae3 --- /dev/null +++ b/src/Gui/DlgUnitsCalculatorImp.cpp @@ -0,0 +1,69 @@ +/*************************************************************************** + * Copyright (c) 2013 Jürgen Riegel * + * * + * 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_ +#endif + +#include "DlgUnitsCalculatorImp.h" + +using namespace Gui::Dialog; + +/* TRANSLATOR Gui::Dialog::DlgUnitsCalculator */ + +/** + * Constructs a DlgUnitsCalculator 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. + */ +DlgUnitsCalculator::DlgUnitsCalculator( QWidget* parent, Qt::WFlags fl ) + : QDialog( parent, fl ) +{ + // create widgets + setupUi(this); + +} + +/** Destroys the object and frees any allocated resources */ +DlgUnitsCalculator::~DlgUnitsCalculator() +{ +} + + +void DlgUnitsCalculator::accept() +{ + + QDialog::accept(); + delete this; +} + +void DlgUnitsCalculator::reject() +{ + + QDialog::reject(); + delete this; +} + +#include "moc_DlgUnitsCalculatorImp.cpp" diff --git a/src/Gui/DlgUnitsCalculatorImp.h b/src/Gui/DlgUnitsCalculatorImp.h new file mode 100644 index 000000000..e74309af2 --- /dev/null +++ b/src/Gui/DlgUnitsCalculatorImp.h @@ -0,0 +1,54 @@ +/*************************************************************************** + * Copyright (c) 2013 Jürgen Riegel * + * * + * 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_DlgActivateWindowImp_H +#define GUI_DIALOG_DlgActivateWindowImp_H + +#include "ui_DlgUnitsCalculator.h" + +namespace Gui { +namespace Dialog { + +/** + * The DlgUnitsCalculator class provides a dialog to activate the MDI window + * of the main window you wish. Since there could be a lot of MDI windows in + * an application you cannot put all of them into the "Windows" popup menu. + * \author Werner Mayer + */ +class DlgUnitsCalculator : public QDialog, public Ui_DlgUnitCalculator +{ + Q_OBJECT + +public: + DlgUnitsCalculator( QWidget* parent = 0, Qt::WFlags fl = 0 ); + ~DlgUnitsCalculator(); + +protected: + void accept(); + void reject(); +}; + +} // namespace Dialog +} // namespace Gui + +#endif // GUI_DIALOG_DlgActivateWindowImp_H diff --git a/src/Gui/Workbench.cpp b/src/Gui/Workbench.cpp index 13ee7d523..8a40656cb 100644 --- a/src/Gui/Workbench.cpp +++ b/src/Gui/Workbench.cpp @@ -492,7 +492,7 @@ MenuItem* StdWorkbench::setupMenuBar() const *tool << "Std_DlgParameter" << "Separator" << "Std_ViewScreenShot" << "Std_SceneInspector" << "Std_ExportGraphviz" << "Std_ProjectUtil" - << "Std_DemoMode" << "Separator" << "Std_DlgCustomize"; + << "Std_DemoMode" << "Std_UnitsCalculater" << "Separator" << "Std_DlgCustomize"; // Macro MenuItem* macro = new MenuItem( menuBar );