Add UnitsCalculator

This commit is contained in:
jriegel 2013-11-07 16:16:17 +01:00
parent 2fb6e75899
commit 1f96611b76
6 changed files with 270 additions and 1 deletions

View File

@ -129,6 +129,7 @@ set(Gui_MOC_HDRS
DownloadManager.h DownloadManager.h
DlgActionsImp.h DlgActionsImp.h
DlgActivateWindowImp.h DlgActivateWindowImp.h
DlgUnitsCalculatorImp.h
DlgCommandsImp.h DlgCommandsImp.h
DlgCustomizeImp.h DlgCustomizeImp.h
DlgCustomizeSpaceball.h DlgCustomizeSpaceball.h
@ -219,6 +220,7 @@ SET(Gui_UIC_SRCS
DemoMode.ui DemoMode.ui
DlgActions.ui DlgActions.ui
DlgActivateWindow.ui DlgActivateWindow.ui
DlgUnitsCalculator.ui
DlgAuthorization.ui DlgAuthorization.ui
DlgChooseIcon.ui DlgChooseIcon.ui
DlgCommands.ui DlgCommands.ui
@ -295,6 +297,7 @@ SET(Dialog_CPP_SRCS
Clipping.cpp Clipping.cpp
DemoMode.cpp DemoMode.cpp
DlgActivateWindowImp.cpp DlgActivateWindowImp.cpp
DlgUnitsCalculatorImp.cpp
DlgDisplayPropertiesImp.cpp DlgDisplayPropertiesImp.cpp
DlgInputDialogImp.cpp DlgInputDialogImp.cpp
DlgMacroExecuteImp.cpp DlgMacroExecuteImp.cpp
@ -323,6 +326,7 @@ SET(Dialog_HPP_SRCS
Clipping.h Clipping.h
DemoMode.h DemoMode.h
DlgActivateWindowImp.h DlgActivateWindowImp.h
DlgUnitsCalculatorImp.h
DlgDisplayPropertiesImp.h DlgDisplayPropertiesImp.h
DlgInputDialogImp.h DlgInputDialogImp.h
DlgMacroExecuteImp.h DlgMacroExecuteImp.h
@ -354,6 +358,7 @@ SET(Dialog_SRCS
Clipping.ui Clipping.ui
DemoMode.ui DemoMode.ui
DlgActivateWindow.ui DlgActivateWindow.ui
DlgUnitsCalculator.ui
DlgAuthorization.ui DlgAuthorization.ui
DlgDisplayProperties.ui DlgDisplayProperties.ui
DlgInputDialog.ui DlgInputDialog.ui

View File

@ -61,6 +61,7 @@
#include "WorkbenchManager.h" #include "WorkbenchManager.h"
#include "Workbench.h" #include "Workbench.h"
#include "Selection.h" #include "Selection.h"
#include "DlgUnitsCalculatorImp.h"
using Base::Console; using Base::Console;
using Base::Sequencer; using Base::Sequencer;
@ -647,6 +648,28 @@ void StdCmdMeasurementSimple::activated(int iMsg)
updateActive(); updateActive();
commitCommand(); 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 { namespace Gui {
@ -673,6 +696,7 @@ void CreateStdCommands(void)
rcCmdMgr.addCommand(new StdCmdFreeCADForum()); rcCmdMgr.addCommand(new StdCmdFreeCADForum());
rcCmdMgr.addCommand(new StdCmdFreeCADFAQ()); rcCmdMgr.addCommand(new StdCmdFreeCADFAQ());
rcCmdMgr.addCommand(new StdCmdPythonWebsite()); rcCmdMgr.addCommand(new StdCmdPythonWebsite());
rcCmdMgr.addCommand(new StdCmdUnitsCalculator());
//rcCmdMgr.addCommand(new StdCmdMeasurementSimple()); //rcCmdMgr.addCommand(new StdCmdMeasurementSimple());
//rcCmdMgr.addCommand(new StdCmdDownloadOnlineHelp()); //rcCmdMgr.addCommand(new StdCmdDownloadOnlineHelp());
//rcCmdMgr.addCommand(new StdCmdDescription()); //rcCmdMgr.addCommand(new StdCmdDescription());

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DlgUnitCalculator</class>
<widget class="QWidget" name="DlgUnitCalculator">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>375</width>
<height>139</height>
</rect>
</property>
<property name="windowTitle">
<string>Units calculater</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="lineEdit">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>as:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_2">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>=&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_3">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTextEdit" name="textEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="pushButton_3">
<property name="text">
<string>Help</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Copy</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,69 @@
/***************************************************************************
* Copyright (c) 2013 Jürgen Riegel <juergen.riegel@web.de> *
* *
* 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"

View File

@ -0,0 +1,54 @@
/***************************************************************************
* Copyright (c) 2013 Jürgen Riegel <juergen.riegel@web.de> *
* *
* 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

View File

@ -492,7 +492,7 @@ MenuItem* StdWorkbench::setupMenuBar() const
*tool << "Std_DlgParameter" << "Separator" *tool << "Std_DlgParameter" << "Separator"
<< "Std_ViewScreenShot" << "Std_SceneInspector" << "Std_ViewScreenShot" << "Std_SceneInspector"
<< "Std_ExportGraphviz" << "Std_ProjectUtil" << "Std_ExportGraphviz" << "Std_ProjectUtil"
<< "Std_DemoMode" << "Separator" << "Std_DlgCustomize"; << "Std_DemoMode" << "Std_UnitsCalculater" << "Separator" << "Std_DlgCustomize";
// Macro // Macro
MenuItem* macro = new MenuItem( menuBar ); MenuItem* macro = new MenuItem( menuBar );