Skip to content

Commit

Permalink
- Added GUI for fetch interface data.
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Jun 8, 2015
1 parent 1c72bdb commit 336d21a
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 0 deletions.
3 changes: 3 additions & 0 deletions OMEdit/OMEditGUI/MainWindow.cpp
Expand Up @@ -42,6 +42,7 @@
#include "VariablesWidget.h"
#include "Helper.h"
#include "SimulationOutputWidget.h"
#include "FetchInterfaceDataDialog.h"
#include "TLMCoSimulationOutputWidget.h"

MainWindow::MainWindow(QSplashScreen *pSplashScreen, QWidget *parent)
Expand Down Expand Up @@ -2898,6 +2899,8 @@ void MainWindow::tileSubWindows(QMdiArea *pMdiArea, bool horizontally)
*/
void MainWindow::fetchInterfaceDataHelper(LibraryTreeNode *pLibraryTreeNode)
{
// FetchInterfaceDataDialog *pFetchInterfaceDataDialog = new FetchInterfaceDataDialog(pLibraryTreeNode, this);
// pFetchInterfaceDataDialog->exec();
QProcess *pManagerProcess = new QProcess;
QFileInfo fileInfo(pLibraryTreeNode->getFileName());
pManagerProcess->setWorkingDirectory(fileInfo.absoluteDir().absolutePath());
Expand Down
3 changes: 3 additions & 0 deletions OMEdit/OMEditGUI/OMEditGUI.pro
Expand Up @@ -121,6 +121,7 @@ SOURCES += main.cpp \
Simulation/SimulationOutputWidget.cpp \
Simulation/SimulationProcessThread.cpp \
Simulation/SimulationOutputHandler.cpp \
TLM/FetchInterfaceDataDialog.cpp \
Simulation/TLMCoSimulationDialog.cpp \
Simulation/TLMCoSimulationOutputWidget.cpp \
Simulation/TLMCoSimulationThread.cpp \
Expand Down Expand Up @@ -183,6 +184,7 @@ HEADERS += Util/Helper.h \
Simulation/SimulationOutputWidget.h \
Simulation/SimulationProcessThread.h \
Simulation/SimulationOutputHandler.h \
TLM/FetchInterfaceDataDialog.h \
Simulation/TLMCoSimulationOptions.h \
Simulation/TLMCoSimulationDialog.h \
Simulation/TLMCoSimulationOutputWidget.h \
Expand Down Expand Up @@ -231,6 +233,7 @@ INCLUDEPATH += . \
Options \
Plotting \
Simulation \
TLM \
TransformationalDebugger \
Util \
$$OPENMODELICAHOME/include/omc/scripting-API
Expand Down
67 changes: 67 additions & 0 deletions OMEdit/OMEditGUI/TLM/FetchInterfaceDataDialog.cpp
@@ -0,0 +1,67 @@
/*
* This file is part of OpenModelica.
*
* Copyright (c) 1998-CurrentYear, Open Source Modelica Consortium (OSMC),
* c/o Linköpings universitet, Department of Computer and Information Science,
* SE-58183 Linköping, Sweden.
*
* All rights reserved.
*
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3 LICENSE OR
* THIS OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.2.
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
* OF THE OSMC PUBLIC LICENSE OR THE GPL VERSION 3, ACCORDING TO RECIPIENTS CHOICE.
*
* The OpenModelica software and the Open Source Modelica
* Consortium (OSMC) Public License (OSMC-PL) are obtained
* from OSMC, 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.
* GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html.
*
* This program is distributed WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH
* IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF OSMC-PL.
*
* See the full OSMC Public License conditions for more details.
*
*/

#include "FetchInterfaceDataDialog.h"

FetchInterfaceDataDialog::FetchInterfaceDataDialog(LibraryTreeNode *pLibraryTreeNode, MainWindow *pMainWindow)
: QDialog(pMainWindow, Qt::WindowTitleHint), mpMainWindow(pMainWindow), mpLibraryTreeNode(pLibraryTreeNode)
{
setWindowTitle(QString(Helper::applicationName).append(" - ").append(tr("Fetch Interface Data")).append(" - ")
.append(mpLibraryTreeNode->getNameStructure()));
setAttribute(Qt::WA_DeleteOnClose);
setMinimumWidth(550);
mpLibraryTreeNode = pLibraryTreeNode;
// progress
mpProgressLabel = new Label(tr("Fetching interface data for <b>%1</b>...").arg(mpLibraryTreeNode->getNameStructure()));
mpProgressLabel->setTextFormat(Qt::RichText);
mpProgressBar = new QProgressBar;
mpProgressBar->setAlignment(Qt::AlignHCenter);
// cancel button
mpCancelButton = new QPushButton(Helper::cancel);
connect(mpCancelButton, SIGNAL(clicked()), SLOT(cancelFetchingInterfaceData()));
// try again button
mpFetchAgainButton = new QPushButton(tr("Fetch Again"));
mpFetchAgainButton->setEnabled(false);
connect(mpFetchAgainButton, SIGNAL(clicked()), SLOT(fetchAgainInterfaceData()));
// output
mpOutputLabel = new Label(Helper::output);
mpOutputTextBox = new QPlainTextEdit;
// main Layout
QGridLayout *pMainGridLayout = new QGridLayout;
pMainGridLayout->setContentsMargins(5, 5, 5, 5);
pMainGridLayout->addWidget(mpProgressLabel, 0, 0, 1, 3);
pMainGridLayout->addWidget(mpProgressBar, 1, 0);
pMainGridLayout->addWidget(mpCancelButton, 1, 1);
pMainGridLayout->addWidget(mpFetchAgainButton, 1, 2);
pMainGridLayout->addWidget(mpOutputLabel, 2, 0, 1, 3);
pMainGridLayout->addWidget(mpOutputTextBox, 3, 0, 1, 3);
setLayout(pMainGridLayout);
}

51 changes: 51 additions & 0 deletions OMEdit/OMEditGUI/TLM/FetchInterfaceDataDialog.h
@@ -0,0 +1,51 @@
/*
* This file is part of OpenModelica.
*
* Copyright (c) 1998-CurrentYear, Open Source Modelica Consortium (OSMC),
* c/o Linköpings universitet, Department of Computer and Information Science,
* SE-58183 Linköping, Sweden.
*
* All rights reserved.
*
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF GPL VERSION 3 LICENSE OR
* THIS OSMC PUBLIC LICENSE (OSMC-PL) VERSION 1.2.
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
* OF THE OSMC PUBLIC LICENSE OR THE GPL VERSION 3, ACCORDING TO RECIPIENTS CHOICE.
*
* The OpenModelica software and the Open Source Modelica
* Consortium (OSMC) Public License (OSMC-PL) are obtained
* from OSMC, 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.
* GNU version 3 is obtained from: http://www.gnu.org/copyleft/gpl.html.
*
* This program is distributed WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH
* IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS OF OSMC-PL.
*
* See the full OSMC Public License conditions for more details.
*
*/

#ifndef FETCHINTERFACEDATADIALOG_H
#define FETCHINTERFACEDATADIALOG_H

#include "MainWindow.h"

class FetchInterfaceDataDialog : public QDialog
{
public:
FetchInterfaceDataDialog(LibraryTreeNode *pLibraryTreeNode, MainWindow *pMainWindow);
private:
MainWindow *mpMainWindow;
LibraryTreeNode *mpLibraryTreeNode;
Label *mpProgressLabel;
QProgressBar *mpProgressBar;
QPushButton *mpCancelButton;
QPushButton *mpFetchAgainButton;
Label *mpOutputLabel;
QPlainTextEdit *mpOutputTextBox;
};

#endif // FETCHINTERFACEDATADIALOG_H

0 comments on commit 336d21a

Please sign in to comment.