Skip to content

Commit

Permalink
- Some changes in the toolTip functionality.
Browse files Browse the repository at this point in the history
- Changed the size of mainwindow to 800*600.
- Changed the solver runge-kutta to rungekutta.
- Added the variable filter option in simulation process.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@9238 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adeas31 committed Jun 2, 2011
1 parent b69944f commit 812605f
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 37 deletions.
2 changes: 1 addition & 1 deletion OMEdit/OMEditGUI/Helper.cpp
Expand Up @@ -132,7 +132,7 @@ QString Helper::sphereBrushIcon = QString(":/Resources/icons/sphere.png");
QString Helper::sphereBrush = QString("Sphere");
Qt::BrushStyle Helper::sphereBrushStyle = Qt::RadialGradientPattern;

QString Helper::ModelicaSimulationMethods = "DASSL,DASSL2,Euler,Runge-Kutta";
QString Helper::ModelicaSimulationMethods = "DASSL,DASSL2,Euler,RungeKutta";
QString Helper::ModelicaSimulationOutputFormats = "mat,plt,csv,empty";

QString GUIMessages::getMessage(int type)
Expand Down
22 changes: 7 additions & 15 deletions OMEdit/OMEditGUI/LibraryWidget.cpp
Expand Up @@ -185,19 +185,16 @@ void ModelicaTree::removeChildNodes(ModelicaTreeNode *item)
void ModelicaTree::addNode(QString name, int type, QString parentName, QString parentStructure)
{
ModelicaTreeNode *newTreePost;
QStringList info = mpParentLibraryWidget->mpParentMainWindow->mpOMCProxy->getClassInformation(parentStructure + name);

if (parentName.isEmpty())
{
QStringList info = mpParentLibraryWidget->mpParentMainWindow->mpOMCProxy->getClassInformation(parentStructure + name);
QString toolt = "Name: " + name + "\n" + "Description: " + info[1] + "\n" + "Location: " + info[2] + "\n" + "Path: " + parentStructure + name + "\n" + "Type: " + info[0] ;
newTreePost = new ModelicaTreeNode(name, parentName, parentStructure + name, toolt , type, this);
newTreePost = new ModelicaTreeNode(name, parentName, parentStructure + name, StringHandler::createTooltip(info, name, parentStructure + name), type, this);
insertTopLevelItem(0, newTreePost);
}
else
{
QStringList info = mpParentLibraryWidget->mpParentMainWindow->mpOMCProxy->getClassInformation(parentStructure + name);
QString toolt = "Name: " + name + "\n" + "Description: " + info[1] + "\n" + "Location: " + info[2] + "\n" + "Path: " + parentStructure + name + "\n" + "Type: " + info[0] ;
newTreePost = new ModelicaTreeNode(name, parentName, parentStructure + name,toolt, type);
newTreePost = new ModelicaTreeNode(name, parentName, parentStructure + name, StringHandler::createTooltip(info, name, parentStructure + name), type);
ModelicaTreeNode *treeNode = getNode(StringHandler::removeLastDot(parentStructure));
treeNode->addChild(newTreePost);
}
Expand Down Expand Up @@ -516,8 +513,7 @@ void LibraryTree::addModelicaStandardLibrary()
{
foreach (QString lib, libs) {
QStringList info = mpParentLibraryWidget->mpParentMainWindow->mpOMCProxy->getClassInformation(lib);
QString toolt = "Name: " + lib + "\n" + "Description: " + info[1] + "\n" + "Location: " + info[2] + "\n" + "Path: " + lib + "\n" + "Type: " + info[0] ;
LibraryTreeNode *newTreePost = new LibraryTreeNode(lib, QString(""),lib , toolt, this);
LibraryTreeNode *newTreePost = new LibraryTreeNode(lib, QString(""),lib , StringHandler::createTooltip(info, lib, lib), this);
int classType = mpParentLibraryWidget->mpParentMainWindow->mpOMCProxy->getClassRestriction(lib);
newTreePost->mType = classType;
newTreePost->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
Expand Down Expand Up @@ -624,9 +620,8 @@ void LibraryTree::addClass(QList<LibraryTreeNode *> *tempPackageNodesList,
.append(parentStructure + className));
QString lib = QString(parentStructure + className);
QStringList info = mpParentLibraryWidget->mpParentMainWindow->mpOMCProxy->getClassInformation(lib);
QString toolt = "Name: " + className + "\n" + "Description: " + info[1] + "\n" + "Location: " + info[2] + "\n" + "Path: " + lib + "\n" + "Type: " + info[0] ;
LibraryTreeNode *newTreePost = new LibraryTreeNode(className, parentClassName,
lib,toolt,(QTreeWidget*)0);
lib, StringHandler::createTooltip(info, className, lib), (QTreeWidget*)0);

// If Loaded class is package show treewidgetitem expand indicator
// Remove if using load once library feature
Expand Down Expand Up @@ -1150,8 +1145,7 @@ void SearchMSLWidget::searchMSL()
foreach (QString foundedItem, foundedItemsList)
{
QStringList info = mpParentMainWindow->mpOMCProxy->getClassInformation(foundedItem);
QString toolt = "Name: " + foundedItem + "\n" + "Description: " + info[1] + "\n" + "Location: " + info[2] + "\n" + "Path: " + foundedItem + "\n" + "Type: " + info[0] ;
LibraryTreeNode *newTreePost = new LibraryTreeNode(foundedItem, QString(""), foundedItem,toolt, mpSearchedItemsTree);
LibraryTreeNode *newTreePost = new LibraryTreeNode(foundedItem, QString(""), foundedItem, StringHandler::createTooltip(info, StringHandler::getLastWordAfterDot(foundedItem), foundedItem), mpSearchedItemsTree);
newTreePost->mType = mpParentMainWindow->mpOMCProxy->getClassRestriction(foundedItem);
mpSearchedItemsTree->insertTopLevelItem(0, newTreePost);

Expand Down Expand Up @@ -1311,9 +1305,7 @@ void LibraryWidget::updateNodeText(QString text, QString textStructure, Modelica
treeNode->mNameStructure = textStructure;
treeNode->setText(0, text);
QStringList info = mpParentMainWindow->mpOMCProxy->getClassInformation(textStructure);
QString toolt = "Name: " + text + "\n" + "Description: " + info[1] + "\n" + "Location: " + info[2] + "\n" + "Path: " + textStructure + "\n" + "Type: " + info[0] ;

treeNode->setToolTip(0, toolt);
treeNode->setToolTip(0, StringHandler::createTooltip(info, text, textStructure));

// if the node has childs
int count = treeNode->childCount();
Expand Down
9 changes: 1 addition & 8 deletions OMEdit/OMEditGUI/OMCProxy.cpp
Expand Up @@ -149,7 +149,7 @@ bool OMCProxy::startServer()
QString omcPath;
#ifdef WIN32
if (!omhome)
throw std::runtime_error(GUIMessages::getMessage(GUIMessages::OPEN_MODELICA_HOME_NOT_FOUND).toLocal8Bit());
throw std::runtime_error(GUIMessages::getMessage(GUIMessages::OPEN_MODELICA_HOME_NOT_FOUND).toStdString());
omcPath = QString( omhome ) + "/bin/omc.exe";
#else /* unix */
omcPath = (omhome ? QString(omhome)+"/bin/omc" : QString(CONFIG_DEFAULT_OPENMODELICAHOME) + "/bin/omc");
Expand Down Expand Up @@ -518,15 +518,8 @@ QStringList OMCProxy::getClassInformation(QString modelName)
{
sendCommand("getClassInformation(" + modelName + ")");
QString result = getResult();
QStringList emp;
emp << "" << "" << "" << "" << "";
if(result=="")
{ return emp;}
else
{
QStringList list = StringHandler::unparseStrings(result);
return list;
}
}


Expand Down
7 changes: 1 addition & 6 deletions OMEdit/OMEditGUI/ProjectTabWidget.cpp
Expand Up @@ -2303,9 +2303,6 @@ void ProjectTabWidget::saveProjectTab(int index, bool saveAs)

QString tabName = tabText(index);




if (saveAs)
{
if (saveModel(saveAs))
Expand Down Expand Up @@ -2355,9 +2352,7 @@ void ProjectTabWidget::saveProjectTab(int index, bool saveAs)
QString oldModelName = pCurrentTab->mModelName;
QString oldModelNameStructure = pCurrentTab->mModelNameStructure;
ModelicaTreeNode *node = pCurrentTab->mpParentProjectTabWidget->mpParentMainWindow->mpLibrary->mpModelicaTree->getNode(pCurrentTab->mModelNameStructure);
pCurrentTab->mpParentProjectTabWidget->mpParentMainWindow->mpLibrary->updateNodeText(oldModelName, oldModelNameStructure, node);


pCurrentTab->mpParentProjectTabWidget->mpParentMainWindow->mpLibrary->updateNodeText(oldModelName, oldModelNameStructure, node);
}

//! Saves the model in the active project tab to a model file.
Expand Down
13 changes: 10 additions & 3 deletions OMEdit/OMEditGUI/SimulationWidget.cpp
Expand Up @@ -97,7 +97,9 @@ void SimulationWidget::setUpForm()
mpOutputFormatComboBox->addItems(Helper::ModelicaSimulationOutputFormats.toLower().split(","));
mpFileNameLabel = new QLabel(tr("File Name (Optional):"));
mpFileNameTextBox = new QLineEdit(tr(""));
mpCflagsLabel = new QLabel(tr("Compiler Flags:"));
mpVariableFilterLabel = new QLabel(tr("Variable Filter (Optional):"));
mpVariableFilterTextBox = new QLineEdit(tr(""));
mpCflagsLabel = new QLabel(tr("Compiler Flags (Optional):"));
mpCflagsTextBox = new QLineEdit(tr(""));

gridIntegrationLayout->addWidget(mpMethodLabel, 0, 0);
Expand All @@ -108,8 +110,10 @@ void SimulationWidget::setUpForm()
gridIntegrationLayout->addWidget(mpOutputFormatComboBox, 2, 1);
gridIntegrationLayout->addWidget(mpFileNameLabel, 3, 0);
gridIntegrationLayout->addWidget(mpFileNameTextBox, 3, 1);
gridIntegrationLayout->addWidget(mpCflagsLabel, 4, 0);
gridIntegrationLayout->addWidget(mpCflagsTextBox, 4, 1);
gridIntegrationLayout->addWidget(mpVariableFilterLabel, 4, 0);
gridIntegrationLayout->addWidget(mpVariableFilterTextBox, 4, 1);
gridIntegrationLayout->addWidget(mpCflagsLabel, 5, 0);
gridIntegrationLayout->addWidget(mpCflagsTextBox, 5, 1);
mpIntegrationGroup->setLayout(gridIntegrationLayout);

// save simulations options
Expand Down Expand Up @@ -253,6 +257,9 @@ void SimulationWidget::simulate()
if (!mpFileNameTextBox->text().isEmpty())
simualtionParameters.append(tr(", fileNamePrefix=")).append("\"")
.append(mpFileNameTextBox->text()).append("\"");
if (!mpVariableFilterTextBox->text().isEmpty())
simualtionParameters.append(tr(", variableFilter=")).append("\"")
.append(mpVariableFilterTextBox->text()).append("\"");
if (!mpCflagsTextBox->text().isEmpty())
simualtionParameters.append(tr(", cflags=")).append("\"")
.append(mpCflagsTextBox->text()).append("\"");
Expand Down
2 changes: 2 additions & 0 deletions OMEdit/OMEditGUI/SimulationWidget.h
Expand Up @@ -74,6 +74,8 @@ class SimulationWidget : public QDialog
QComboBox *mpOutputFormatComboBox;
QLabel *mpFileNameLabel;
QLineEdit *mpFileNameTextBox;
QLabel *mpVariableFilterLabel;
QLineEdit *mpVariableFilterTextBox;
QLabel *mpCflagsLabel;
QLineEdit *mpCflagsTextBox;
QGroupBox *mpSaveSimulationGroup;
Expand Down
22 changes: 18 additions & 4 deletions OMEdit/OMEditGUI/StringHandler.cpp
Expand Up @@ -157,10 +157,6 @@ QString StringHandler::getSubStringFromDots(QString value)
return list.at(list.count() - 1);
}





//! Removes the last dot from the string.
//! @param value is the string which is parsed.
QString StringHandler::removeLastDot(QString value)
Expand Down Expand Up @@ -500,3 +496,21 @@ QString StringHandler::getOpenFileName(QWidget* parent, const QString &caption,
}
return QString();
}

QString StringHandler::createTooltip(QStringList info, QString name, QString path)
{
if (info.size() < 3)
return path;
else
{
QString tooltip = QString("Type: ").append(info[0]).append("\n")
.append("Name: ").append(name).append("\n")
.append("Description: ").append(info[1]).append("\n");
if (QString(info[2]).compare("<interactive>") == 0)
tooltip.append("Location: ").append("\n");
else
tooltip.append("Location: ").append(info[2]).append("\n");
tooltip.append("Path: ").append(path);
return tooltip;
}
}
1 change: 1 addition & 0 deletions OMEdit/OMEditGUI/StringHandler.h
Expand Up @@ -69,6 +69,7 @@ class StringHandler
static bool unparseBool(QString value);
static QString getSaveFileName(QWidget* parent = 0, const QString &caption = QString(), QString * dir = 0, const QString & filter = QString(), QString * selectedFilter = 0, const QString &defaultSuffix = QString());
static QString getOpenFileName(QWidget* parent = 0, const QString &caption = QString(), QString * dir = 0, const QString & filter = QString(), QString * selectedFilter = 0);
static QString createTooltip(QStringList info, QString name, QString path);

protected:
static QString mLastOpenDir;
Expand Down
1 change: 1 addition & 0 deletions OMEdit/OMEditGUI/mainwindow.cpp
Expand Up @@ -60,6 +60,7 @@ MainWindow::MainWindow(SplashScreen *splashScreen, QWidget *parent)
setWindowTitle(Helper::applicationName + " - " + Helper::applicationIntroText);
setWindowIcon(QIcon(":/Resources/icons/omeditor.png"));
setMinimumSize(400, 300);
resize(800, 600);
setContentsMargins(1, 1, 1, 1);

//Create a centralwidget for the main window
Expand Down

0 comments on commit 812605f

Please sign in to comment.