Skip to content

Commit c3a75a1

Browse files
committed
- Changed copy to duplicate. git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@25386 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 9814518 commit c3a75a1

File tree

7 files changed

+41
-26
lines changed

7 files changed

+41
-26
lines changed

OMEdit/OMEditGUI/Modeling/LibraryTreeWidget.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -549,9 +549,12 @@ void LibraryTreeWidget::createActions()
549549
mpSimulationSetupAction->setStatusTip(Helper::simulationSetupTip);
550550
connect(mpSimulationSetupAction, SIGNAL(triggered()), SLOT(simulationSetup()));
551551
// copy action
552-
mpCopyClassAction = new QAction(QIcon(":/Resources/icons/duplicate.svg"), Helper::copy, this);
553-
mpCopyClassAction->setStatusTip(tr("Creates a copy of the class"));
554-
connect(mpCopyClassAction, SIGNAL(triggered()), SLOT(copyClass()));
552+
/* Ticket #3265
553+
* Changed the name from Copy to Duplicate.
554+
*/
555+
mpDuplicateClassAction = new QAction(QIcon(":/Resources/icons/duplicate.svg"), Helper::duplicate, this);
556+
mpDuplicateClassAction->setStatusTip(Helper::duplicateTip);
557+
connect(mpDuplicateClassAction, SIGNAL(triggered()), SLOT(duplicateClass()));
555558
// unload Action
556559
mpUnloadClassAction = new QAction(QIcon(":/Resources/icons/delete.svg"), Helper::unloadClass, this);
557560
mpUnloadClassAction->setStatusTip(Helper::unloadClassTip);
@@ -1533,7 +1536,7 @@ void LibraryTreeWidget::showContextMenu(QPoint point)
15331536
/* If item is OpenModelica or part of it or is search tree item then don't show the unload for it. */
15341537
if (!((StringHandler::getFirstWordBeforeDot(pLibraryTreeNode->getNameStructure()).compare("OpenModelica") == 0) || isSearchedTree())) {
15351538
menu.addSeparator();
1536-
menu.addAction(mpCopyClassAction);
1539+
menu.addAction(mpDuplicateClassAction);
15371540
menu.addAction(mpUnloadClassAction);
15381541
/* Only used for development testing. */
15391542
/*menu.addAction(mpRefreshAction);*/
@@ -1652,14 +1655,19 @@ void LibraryTreeWidget::checkAllModels()
16521655
mpMainWindow->checkAllModels(pLibraryTreeNode);
16531656
}
16541657

1655-
void LibraryTreeWidget::copyClass()
1658+
/*!
1659+
* \brief LibraryTreeWidget::duplicateClass
1660+
* Opens the DuplicateClassDialog.
1661+
*/
1662+
void LibraryTreeWidget::duplicateClass()
16561663
{
16571664
QList<QTreeWidgetItem*> selectedItemsList = selectedItems();
1658-
if (selectedItemsList.isEmpty())
1665+
if (selectedItemsList.isEmpty()) {
16591666
return;
1667+
}
16601668
LibraryTreeNode *pLibraryTreeNode = dynamic_cast<LibraryTreeNode*>(selectedItemsList.at(0));
16611669
if (pLibraryTreeNode) {
1662-
CopyClassDialog *pCopyClassDialog = new CopyClassDialog(pLibraryTreeNode, mpMainWindow);
1670+
DuplicateClassDialog *pCopyClassDialog = new DuplicateClassDialog(pLibraryTreeNode, mpMainWindow);
16631671
pCopyClassDialog->exec();
16641672
}
16651673
}

OMEdit/OMEditGUI/Modeling/LibraryTreeWidget.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ class LibraryTreeWidget : public QTreeWidget
204204
QAction *mpSimulateWithTransformationalDebuggerAction;
205205
QAction *mpSimulateWithAlgorithmicDebuggerAction;
206206
QAction *mpSimulationSetupAction;
207-
QAction *mpCopyClassAction;
207+
QAction *mpDuplicateClassAction;
208208
QAction *mpUnloadClassAction;
209209
QAction *mpUnloadTextFileAction;
210210
QAction *mpUnloadXMLFileAction;
@@ -235,7 +235,7 @@ public slots:
235235
void instantiateModel();
236236
void checkModel();
237237
void checkAllModels();
238-
void copyClass();
238+
void duplicateClass();
239239
void unloadClass();
240240
void unloadTextFile();
241241
void unloadXMLFile();

OMEdit/OMEditGUI/Modeling/ModelWidgetContainer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -884,8 +884,8 @@ void GraphicsView::createActions()
884884
mpDeleteAction->setShortcut(QKeySequence::Delete);
885885
mpDeleteAction->setDisabled(isSystemLibrary);
886886
// Duplicate Action
887-
mpDuplicateAction = new QAction(QIcon(":/Resources/icons/duplicate.svg"), tr("Duplicate"), this);
888-
mpDuplicateAction->setStatusTip(tr("Duplicates the item"));
887+
mpDuplicateAction = new QAction(QIcon(":/Resources/icons/duplicate.svg"), Helper::duplicate, this);
888+
mpDuplicateAction->setStatusTip(Helper::duplicateTip);
889889
mpDuplicateAction->setShortcut(QKeySequence("Ctrl+d"));
890890
mpDuplicateAction->setDisabled(isSystemLibrary);
891891
// Rotate ClockWise Action

OMEdit/OMEditGUI/Modeling/ModelicaClassDialog.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -776,11 +776,11 @@ void SaveAsClassDialog::showHideSaveContentsInOneFileCheckBox(QString text)
776776
\param nameStructure - qualified name of Modelica class
777777
\param pParent - pointer to MainWindow
778778
*/
779-
CopyClassDialog::CopyClassDialog(LibraryTreeNode *pLibraryTreeNode, MainWindow *pMainWindow)
779+
DuplicateClassDialog::DuplicateClassDialog(LibraryTreeNode *pLibraryTreeNode, MainWindow *pMainWindow)
780780
: QDialog(pMainWindow, Qt::WindowTitleHint), mpLibraryTreeNode(pLibraryTreeNode), mpMainWindow(pMainWindow)
781781
{
782782
setAttribute(Qt::WA_DeleteOnClose);
783-
setWindowTitle(QString(Helper::applicationName).append(" - Copy ").append(mpLibraryTreeNode->getNameStructure()));
783+
setWindowTitle(QString("%1 - %2 %3").arg(Helper::applicationName).arg(Helper::duplicate).arg(mpLibraryTreeNode->getNameStructure()));
784784
mpNameLabel = new Label(Helper::name);
785785
mpNameTextBox = new QLineEdit;
786786
mpPathLabel = new Label(Helper::path);
@@ -791,7 +791,7 @@ CopyClassDialog::CopyClassDialog(LibraryTreeNode *pLibraryTreeNode, MainWindow *
791791
// Create the buttons
792792
mpOkButton = new QPushButton(Helper::ok);
793793
mpOkButton->setAutoDefault(true);
794-
connect(mpOkButton, SIGNAL(clicked()), SLOT(copyClass()));
794+
connect(mpOkButton, SIGNAL(clicked()), SLOT(duplicateClass()));
795795
mpCancelButton = new QPushButton(Helper::cancel);
796796
mpCancelButton->setAutoDefault(false);
797797
connect(mpCancelButton, SIGNAL(clicked()), SLOT(reject()));
@@ -811,25 +811,26 @@ CopyClassDialog::CopyClassDialog(LibraryTreeNode *pLibraryTreeNode, MainWindow *
811811
setLayout(pMainLayout);
812812
}
813813

814-
void CopyClassDialog::browsePath()
814+
void DuplicateClassDialog::browsePath()
815815
{
816816
LibraryBrowseDialog *pLibraryBrowseDialog = new LibraryBrowseDialog(tr("Select Path"), mpPathTextBox, mpMainWindow->getLibraryTreeWidget());
817817
pLibraryBrowseDialog->exec();
818818
}
819819

820-
void CopyClassDialog::copyClass()
820+
/*!
821+
* \brief DuplicateClassDialog::duplicateClass
822+
* Duplicates the class.
823+
*/
824+
void DuplicateClassDialog::duplicateClass()
821825
{
822-
if (mpNameTextBox->text().isEmpty())
823-
{
826+
if (mpNameTextBox->text().isEmpty()) {
824827
QMessageBox::critical(this, QString(Helper::applicationName).append(" - ").append(Helper::error),
825828
GUIMessages::getMessage(GUIMessages::ENTER_NAME).arg("class"), Helper::ok);
826829
return;
827830
}
828831
/* if path class doesn't exist. */
829-
if (!mpPathTextBox->text().isEmpty())
830-
{
831-
if (!mpMainWindow->getOMCProxy()->existClass(mpPathTextBox->text()))
832-
{
832+
if (!mpPathTextBox->text().isEmpty()) {
833+
if (!mpMainWindow->getOMCProxy()->existClass(mpPathTextBox->text())) {
833834
QMessageBox::critical(this, QString(Helper::applicationName).append(" - ").append(Helper::error), GUIMessages::getMessage(
834835
GUIMessages::INSERT_IN_CLASS_NOT_FOUND).arg(mpPathTextBox->text()), Helper::ok);
835836
return;
@@ -843,7 +844,7 @@ void CopyClassDialog::copyClass()
843844
.arg((mpPathTextBox->text().isEmpty() ? "Top Level" : mpPathTextBox->text())), Helper::ok);
844845
return;
845846
}
846-
// if everything is fine then copy the class.
847+
// if everything is fine then duplicate the class.
847848
if (mpMainWindow->getOMCProxy()->copyClass(mpLibraryTreeNode->getNameStructure(), mpNameTextBox->text(), mpPathTextBox->text())) {
848849
LibraryTreeWidget *pLibraryTreeWidget = mpMainWindow->getLibraryTreeWidget();
849850
LibraryTreeNode *pLibraryTreeNode;

OMEdit/OMEditGUI/Modeling/ModelicaClassDialog.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ private slots:
146146
};
147147

148148
class LibraryTreeNode;
149-
class CopyClassDialog : public QDialog
149+
class DuplicateClassDialog : public QDialog
150150
{
151151
Q_OBJECT
152152
public:
153-
CopyClassDialog(LibraryTreeNode *pLibraryTreeNode, MainWindow *pMainWindow);
153+
DuplicateClassDialog(LibraryTreeNode *pLibraryTreeNode, MainWindow *pMainWindow);
154154
private:
155155
LibraryTreeNode *mpLibraryTreeNode;
156156
MainWindow *mpMainWindow;
@@ -164,7 +164,7 @@ class CopyClassDialog : public QDialog
164164
QDialogButtonBox *mpButtonBox;
165165
public slots:
166166
void browsePath();
167-
void copyClass();
167+
void duplicateClass();
168168
};
169169

170170
class RenameClassDialog : public QDialog

OMEdit/OMEditGUI/Util/Helper.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ QString Helper::loading;
186186
QString Helper::question;
187187
QString Helper::search;
188188
QString Helper::unloadClass;
189+
QString Helper::duplicate;
190+
QString Helper::duplicateTip;
189191
QString Helper::unloadClassTip;
190192
QString Helper::unloadXMLTip;
191193
QString Helper::refresh;
@@ -362,6 +364,8 @@ void Helper::initHelperVariables()
362364
Helper::loading = tr("Loading");
363365
Helper::question = tr("Question");
364366
Helper::search = tr("Search");
367+
Helper::duplicate = tr("Duplicate");
368+
Helper::duplicateTip = tr("Duplicates the item");
365369
Helper::unloadClass = tr("Unload");
366370
Helper::unloadClassTip = tr("Unload the Modelica class");
367371
Helper::unloadXMLTip = tr("Unload the XML file");

OMEdit/OMEditGUI/Util/Helper.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@ class Helper : public QObject
187187
static QString loading;
188188
static QString question;
189189
static QString search;
190+
static QString duplicate;
191+
static QString duplicateTip;
190192
static QString unloadClass;
191193
static QString unloadClassTip;
192194
static QString unloadXMLTip;

0 commit comments

Comments
 (0)