Skip to content

Commit

Permalink
Add UnitsCalculator
Browse files Browse the repository at this point in the history
  • Loading branch information
jriegel committed Nov 7, 2013
1 parent 2fb6e75 commit 1f96611
Show file tree
Hide file tree
Showing 6 changed files with 270 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/Gui/CMakeLists.txt
Expand Up @@ -129,6 +129,7 @@ set(Gui_MOC_HDRS
DownloadManager.h
DlgActionsImp.h
DlgActivateWindowImp.h
DlgUnitsCalculatorImp.h
DlgCommandsImp.h
DlgCustomizeImp.h
DlgCustomizeSpaceball.h
Expand Down Expand Up @@ -219,6 +220,7 @@ SET(Gui_UIC_SRCS
DemoMode.ui
DlgActions.ui
DlgActivateWindow.ui
DlgUnitsCalculator.ui
DlgAuthorization.ui
DlgChooseIcon.ui
DlgCommands.ui
Expand Down Expand Up @@ -295,6 +297,7 @@ SET(Dialog_CPP_SRCS
Clipping.cpp
DemoMode.cpp
DlgActivateWindowImp.cpp
DlgUnitsCalculatorImp.cpp
DlgDisplayPropertiesImp.cpp
DlgInputDialogImp.cpp
DlgMacroExecuteImp.cpp
Expand Down Expand Up @@ -323,6 +326,7 @@ SET(Dialog_HPP_SRCS
Clipping.h
DemoMode.h
DlgActivateWindowImp.h
DlgUnitsCalculatorImp.h
DlgDisplayPropertiesImp.h
DlgInputDialogImp.h
DlgMacroExecuteImp.h
Expand Down Expand Up @@ -354,6 +358,7 @@ SET(Dialog_SRCS
Clipping.ui
DemoMode.ui
DlgActivateWindow.ui
DlgUnitsCalculator.ui
DlgAuthorization.ui
DlgDisplayProperties.ui
DlgInputDialog.ui
Expand Down
24 changes: 24 additions & 0 deletions src/Gui/CommandStd.cpp
Expand Up @@ -61,6 +61,7 @@
#include "WorkbenchManager.h"
#include "Workbench.h"
#include "Selection.h"
#include "DlgUnitsCalculatorImp.h"

using Base::Console;
using Base::Sequencer;
Expand Down Expand Up @@ -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 {

Expand All @@ -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());
Expand Down
117 changes: 117 additions & 0 deletions src/Gui/DlgUnitsCalculator.ui
@@ -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>
69 changes: 69 additions & 0 deletions src/Gui/DlgUnitsCalculatorImp.cpp
@@ -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"
54 changes: 54 additions & 0 deletions src/Gui/DlgUnitsCalculatorImp.h
@@ -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
2 changes: 1 addition & 1 deletion src/Gui/Workbench.cpp
Expand Up @@ -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 );
Expand Down

0 comments on commit 1f96611

Please sign in to comment.