Skip to content

Commit

Permalink
- Interface for adding libraries
Browse files Browse the repository at this point in the history
- Some documentation of the code.
- Changed all buttons pressed signal to clicked. Pressed signal is bit weird.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@10109 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adeas31 committed Oct 13, 2011
1 parent 1e34940 commit e7880c3
Show file tree
Hide file tree
Showing 19 changed files with 502 additions and 93 deletions.
6 changes: 3 additions & 3 deletions OMEdit/OMEditGUI/BitmapAnnotation.cpp
Expand Up @@ -287,17 +287,17 @@ void BitmapWidget::setUpForm()

mpBrowseButton = new QPushButton(tr("Browse"));
mpBrowseButton->setAutoDefault(true);
connect(mpBrowseButton, SIGNAL(pressed()), this, SLOT(browse()));
connect(mpBrowseButton, SIGNAL(clicked()), this, SLOT(browse()));

mpCheckBox = new QCheckBox("Store picture in model", this);

mpOkButton = new QPushButton(tr("OK"));
mpOkButton->setAutoDefault(false);
connect(mpOkButton, SIGNAL(pressed()), this, SLOT(edit()));
connect(mpOkButton, SIGNAL(clicked()), this, SLOT(edit()));

mpCancelButton = new QPushButton(tr("Cancel"));
mpCancelButton->setAutoDefault(false);
connect(mpCancelButton, SIGNAL(pressed()), this, SLOT(reject()));
connect(mpCancelButton, SIGNAL(clicked()), this, SLOT(reject()));

mpButtonBox = new QDialogButtonBox(Qt::Horizontal);
mpButtonBox->addButton(mpOkButton, QDialogButtonBox::ActionRole);
Expand Down
35 changes: 16 additions & 19 deletions OMEdit/OMEditGUI/ComponentsProperties.cpp
Expand Up @@ -7,16 +7,16 @@
*
* All rights reserved.
*
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3
* AND THIS OSMC PUBLIC LICENSE (OSMC-PL).
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3
* AND THIS OSMC PUBLIC LICENSE (OSMC-PL).
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S
* ACCEPTANCE OF THE OSMC PUBLIC LICENSE.
*
* The OpenModelica software and the Open Source Modelica
* Consortium (OSMC) Public License (OSMC-PL) are obtained
* from Linkoping University, either from the above address,
* from the URLs: http://www.ida.liu.se/projects/OpenModelica or
* http://www.openmodelica.org, and in the OpenModelica distribution.
* from the URLs: http://www.ida.liu.se/projects/OpenModelica or
* http://www.openmodelica.org, and in the OpenModelica distribution.
* GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html.
*
* This program is distributed WITHOUT ANY WARRANTY; without
Expand Down Expand Up @@ -59,30 +59,27 @@ ComponentsProperties::ComponentsProperties(QString value)
this->mCasualityMap.insert("unspecified", "none");
this->mCasuality.clear();

this->mIndex="";
this->mIndexValue=0;
this->mIndex = "";
this->mIndexValue = 0;
parseString(value);
}

void ComponentsProperties::parseString(QString value)
{
if (value.isEmpty())
return;
// retrieving the index value in case the connecting port is an array type
// retrieving the index value in case the connecting port is an array type
int index = 0;
QStringList list = StringHandler::getStrings(value);
mIndex = StringHandler::removeFirstLastCurlBrackets(list.at(list.size()-1));


bool ok;
if(mIndex.isEmpty())
mIndexValue=-1;
else if(mIndex=="n")
mIndexValue=-2;
else
mIndexValue=mIndex.toInt(&ok,10);

mIndex = StringHandler::removeFirstLastCurlBrackets(list.at(list.size()-1));

bool ok;
if (mIndex.isEmpty())
mIndexValue = -1;
else if (mIndex == "n")
mIndexValue = -2;
else
mIndexValue = mIndex.toInt(&ok,10);

if (list.size() > 0)
this->mClassName = list.at(0);
Expand Down
4 changes: 2 additions & 2 deletions OMEdit/OMEditGUI/ConnectorWidget.cpp
Expand Up @@ -749,10 +749,10 @@ ConnectorArrayMenu::ConnectorArrayMenu(Connector *pConnector,QWidget *pParent)
// Create the buttons
mpOkButton = new QPushButton(tr("OK"));
mpOkButton->setAutoDefault(true);
connect(mpOkButton, SIGNAL(pressed()), SLOT(addIndex()));
connect(mpOkButton, SIGNAL(clicked()), SLOT(addIndex()));
mpCancelButton = new QPushButton(tr("Cancel"));
mpCancelButton->setAutoDefault(false);
connect(mpCancelButton, SIGNAL(pressed()), SLOT(reject()));
connect(mpCancelButton, SIGNAL(clicked()), SLOT(reject()));

mpButtonBox = new QDialogButtonBox(Qt::Horizontal);
mpButtonBox->addButton(mpOkButton, QDialogButtonBox::ActionRole);
Expand Down
4 changes: 2 additions & 2 deletions OMEdit/OMEditGUI/DocumentationWidget.cpp
Expand Up @@ -53,11 +53,11 @@ DocumentationWidget::DocumentationWidget(MainWindow *pParent)
mpEditButton = new QPushButton(tr("Edit"));
mpEditButton->setAutoDefault(true);
mpEditButton->setMaximumSize(QSize(100,20));
connect(mpEditButton, SIGNAL(pressed()), SLOT(editDocumentation()));
connect(mpEditButton, SIGNAL(clicked()), SLOT(editDocumentation()));
mpSaveButton = new QPushButton(tr("Save"));
mpSaveButton->setAutoDefault(false);
mpSaveButton->setMaximumSize(QSize(100,20));
connect(mpSaveButton, SIGNAL(pressed()), SLOT(saveChanges()));
connect(mpSaveButton, SIGNAL(clicked()), SLOT(saveChanges()));
QHBoxLayout *horizontalLayout = new QHBoxLayout;
horizontalLayout->addWidget(mpPixmapLabel);
horizontalLayout->addWidget(mpHeadingLabel);
Expand Down
2 changes: 2 additions & 0 deletions OMEdit/OMEditGUI/Helper.cpp
Expand Up @@ -141,6 +141,8 @@ QString Helper::right = QString("Right");
/* FMI Messages */
QString Helper::exportingModelFMU = QString("Exporting model as FMI");

QString Helper::librariesAddNote = QString("* The libraries changes will take effect after restart.");

QString GUIMessages::getMessage(int type)
{
switch (type)
Expand Down
1 change: 1 addition & 0 deletions OMEdit/OMEditGUI/Helper.h
Expand Up @@ -142,6 +142,7 @@ class Helper
static QString center;
static QString right;
static QString exportingModelFMU;
static QString librariesAddNote;
};

class GUIMessages
Expand Down
8 changes: 4 additions & 4 deletions OMEdit/OMEditGUI/IconProperties.cpp
Expand Up @@ -147,10 +147,10 @@ void IconProperties::setUpDialog()
// Create the buttons
mpOkButton = new QPushButton(tr("OK"));
mpOkButton->setAutoDefault(true);
connect(mpOkButton, SIGNAL(pressed()), this, SLOT(updateIconProperties()));
connect(mpOkButton, SIGNAL(clicked()), this, SLOT(updateIconProperties()));
mpCancelButton = new QPushButton(tr("Cancel"));
mpCancelButton->setAutoDefault(false);
connect(mpCancelButton, SIGNAL(pressed()), this, SLOT(reject()));
connect(mpCancelButton, SIGNAL(clicked()), this, SLOT(reject()));

mpButtonBox = new QDialogButtonBox(Qt::Horizontal);
mpButtonBox->addButton(mpOkButton, QDialogButtonBox::ActionRole);
Expand Down Expand Up @@ -339,10 +339,10 @@ void IconAttributes::setUpDialog()
// Create the buttons
mpOkButton = new QPushButton(tr("OK"));
mpOkButton->setAutoDefault(true);
connect(mpOkButton, SIGNAL(pressed()), this, SLOT(updateIconAttributes()));
connect(mpOkButton, SIGNAL(clicked()), this, SLOT(updateIconAttributes()));
mpCancelButton = new QPushButton(tr("Cancel"));
mpCancelButton->setAutoDefault(false);
connect(mpCancelButton, SIGNAL(pressed()), this, SLOT(reject()));
connect(mpCancelButton, SIGNAL(clicked()), this, SLOT(reject()));

mpButtonBox = new QDialogButtonBox(Qt::Horizontal);
mpButtonBox->addButton(mpOkButton, QDialogButtonBox::ActionRole);
Expand Down
2 changes: 1 addition & 1 deletion OMEdit/OMEditGUI/LibraryWidget.cpp
Expand Up @@ -1166,7 +1166,7 @@ SearchMSLWidget::SearchMSLWidget(MainWindow *pParent)
mpSearchTextBox = new MSLSearchBox(this);
connect(mpSearchTextBox, SIGNAL(returnPressed()), SLOT(searchMSL()));
mpSearchButton = new QPushButton(tr("Search"));
connect(mpSearchButton, SIGNAL(pressed()), SLOT(searchMSL()));
connect(mpSearchButton, SIGNAL(clicked()), SLOT(searchMSL()));
mpSearchedItemsTree = new LibraryTree(mpParentMainWindow->mpLibrary);
mpSearchedItemsTree->setFrameShape(QFrame::StyledPanel);
mpSearchedItemsTree->setHeaderLabel(tr("Searched Items"));
Expand Down
12 changes: 6 additions & 6 deletions OMEdit/OMEditGUI/ModelWidget.cpp
Expand Up @@ -53,10 +53,10 @@ ModelCreator::ModelCreator(MainWindow *parent)
// Create the buttons
mpOkButton = new QPushButton(tr("OK"));
mpOkButton->setAutoDefault(true);
connect(mpOkButton, SIGNAL(pressed()), SLOT(create()));
connect(mpOkButton, SIGNAL(clicked()), SLOT(create()));
mpCancelButton = new QPushButton(tr("Cancel"));
mpCancelButton->setAutoDefault(false);
connect(mpCancelButton, SIGNAL(pressed()), SLOT(reject()));
connect(mpCancelButton, SIGNAL(clicked()), SLOT(reject()));

mpButtonBox = new QDialogButtonBox(Qt::Horizontal);
mpButtonBox->addButton(mpOkButton, QDialogButtonBox::ActionRole);
Expand Down Expand Up @@ -194,10 +194,10 @@ RenameClassWidget::RenameClassWidget(QString name, QString nameStructure, MainWi
// Create the buttons
this->mpOkButton = new QPushButton(tr("Rename"));
this->mpOkButton->setAutoDefault(true);
connect(this->mpOkButton, SIGNAL(pressed()), this, SLOT(renameClass()));
connect(this->mpOkButton, SIGNAL(clicked()), this, SLOT(renameClass()));
this->mpCancelButton = new QPushButton(tr("&Cancel"));
this->mpCancelButton->setAutoDefault(false);
connect(this->mpCancelButton, SIGNAL(pressed()), this, SLOT(reject()));
connect(this->mpCancelButton, SIGNAL(clicked()), this, SLOT(reject()));

this->mpButtonBox = new QDialogButtonBox(Qt::Horizontal);
this->mpButtonBox->addButton(this->mpOkButton, QDialogButtonBox::ActionRole);
Expand Down Expand Up @@ -277,7 +277,7 @@ CheckModelWidget::CheckModelWidget(QString name, QString nameStructure, MainWind
mpParentMainWindow->mpOMCProxy->checkModel(mNameStructure)));
// Create the button
mpOkButton = new QPushButton(tr("OK"));
connect(mpOkButton, SIGNAL(pressed()), SLOT(close()));
connect(mpOkButton, SIGNAL(clicked()), SLOT(close()));

// Create a layout
QHBoxLayout *buttonLayout = new QHBoxLayout;
Expand Down Expand Up @@ -313,7 +313,7 @@ FlatModelWidget::FlatModelWidget(QString name, QString nameStructure, MainWindow

// Create the button
mpOkButton = new QPushButton(tr("OK"));
connect(mpOkButton, SIGNAL(pressed()), SLOT(close()));
connect(mpOkButton, SIGNAL(clicked()), SLOT(close()));

// Create a layout
QHBoxLayout *buttonLayout = new QHBoxLayout;
Expand Down
4 changes: 2 additions & 2 deletions OMEdit/OMEditGUI/OMCProxy.cpp
Expand Up @@ -77,7 +77,7 @@ OMCProxy::OMCProxy(MainWindow *pParent, bool displayErrors)
horizontallayout->setContentsMargins(0, 0, 0, 0);
mpExpressionTextBox = new CustomExpressionBox(this);
mpSendButton = new QPushButton("Send");
connect(mpSendButton, SIGNAL(pressed()), SLOT(sendCustomExpression()));
connect(mpSendButton, SIGNAL(clicked()), SLOT(sendCustomExpression()));
horizontallayout->addWidget(mpExpressionTextBox);
horizontallayout->addWidget(mpSendButton);
QVBoxLayout *verticalallayout = new QVBoxLayout;
Expand Down Expand Up @@ -545,7 +545,7 @@ void OMCProxy::loadStandardLibrary(QStringList &failed)
} else {
if (version < 2) sendCommand("setAnnotationVersion(\"1.x\")");
else if (version < 3) sendCommand("setAnnotationVersion(\"2.x\")");
QMessageBox::warning(mpParentMainWindow, Helper::applicationName + " requires Modelica 3 annotations",
QMessageBox::warning(mpParentMainWindow, Helper::applicationName + " requires Modelica 3 annotations",
"Modelica Standard Library version " + versionStr + " is unsupported", "OK");
}
}
Expand Down

0 comments on commit e7880c3

Please sign in to comment.