Skip to content

Commit

Permalink
Add a drop down button for system libraries on the start page (#8665)
Browse files Browse the repository at this point in the history
* Add a drop down button for system libraries on the start page

* Install library button on the welcome screen.
  • Loading branch information
adeas31 committed Mar 10, 2022
1 parent 9fb3a7d commit 1347ed8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion OMEdit/OMEditLIB/MainWindow.cpp
Expand Up @@ -3470,7 +3470,7 @@ void MainWindow::createActions()
mpExportToOMNotebookAction->setEnabled(false);
connect(mpExportToOMNotebookAction, SIGNAL(triggered()), SLOT(exportModelToOMNotebook()));
// install library action
mpInstallLibraryAction = new QAction(tr("Install Library"), this);
mpInstallLibraryAction = new QAction(Helper::installLibrary, this);
mpInstallLibraryAction->setStatusTip(tr("Opens the install library window"));
connect(mpInstallLibraryAction, SIGNAL(triggered()), SLOT(openInstallLibraryDialog()));
// upgrade installed libraries action
Expand Down
1 change: 1 addition & 0 deletions OMEdit/OMEditLIB/MainWindow.h
Expand Up @@ -210,6 +210,7 @@ class MainWindow : public QMainWindow
QAction* getRevertCommitAction() {return mpRevertCommitAction;}
QAction* getCleanWorkingDirectoryAction() {return mpCleanWorkingDirectoryAction;}
QMenu* getNewModelMenu() const {return mpNewModelMenu;}
QMenu* getLibrariesMenu() const {return mpLibrariesMenu;}
QToolBar* getShapesToolBar() const {return mpShapesToolBar;}
QToolBar* getCheckToolBar() const {return mpCheckToolBar;}
QToolBar* getSimulationToolBar() const {return mpSimulationToolBar;}
Expand Down
22 changes: 16 additions & 6 deletions OMEdit/OMEditLIB/Modeling/ModelWidgetContainer.cpp
Expand Up @@ -4224,17 +4224,27 @@ WelcomePageWidget::WelcomePageWidget(QWidget *pParent)
mpBottomFrame = new QFrame;
mpBottomFrame->setStyleSheet("QFrame{background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #828282, stop: 1 #5e5e5e);}");
// bottom frame create and open buttons buttons
const QString buttonStyleSheet = "QPushButton{padding: 5px 15px 5px 15px;}";
mpCreateModelButton = new QPushButton(Helper::createNewModelicaClass);
mpCreateModelButton->setStyleSheet("QPushButton{padding: 5px 15px 5px 15px;}");
mpCreateModelButton->setStyleSheet(buttonStyleSheet);
connect(mpCreateModelButton, SIGNAL(clicked()), MainWindow::instance(), SLOT(createNewModelicaClass()));
mpOpenModelButton = new QPushButton(Helper::openModelicaFiles);
mpOpenModelButton->setStyleSheet("QPushButton{padding: 5px 15px 5px 15px;}");
mpOpenModelButton->setStyleSheet(buttonStyleSheet);
connect(mpOpenModelButton, SIGNAL(clicked()), MainWindow::instance(), SLOT(openModelicaFile()));
mpSystemLibrariesButton = new QPushButton(tr("System Libraries"));
mpSystemLibrariesButton->setStyleSheet(buttonStyleSheet);
mpSystemLibrariesButton->setMenu(MainWindow::instance()->getLibrariesMenu());
mpInstallLibraryButton = new QPushButton(Helper::installLibrary);
mpInstallLibraryButton->setStyleSheet(buttonStyleSheet);
connect(mpInstallLibraryButton, SIGNAL(clicked()), MainWindow::instance(), SLOT(openInstallLibraryDialog()));
// bottom frame layout
QHBoxLayout *bottomFrameLayout = new QHBoxLayout;
bottomFrameLayout->addWidget(mpCreateModelButton, 0, Qt::AlignLeft);
bottomFrameLayout->addWidget(mpOpenModelButton, 0, Qt::AlignRight);
mpBottomFrame->setLayout(bottomFrameLayout);
QHBoxLayout *pBottomFrameLayout = new QHBoxLayout;
pBottomFrameLayout->setAlignment(Qt::AlignLeft);
pBottomFrameLayout->addWidget(mpCreateModelButton);
pBottomFrameLayout->addWidget(mpOpenModelButton);
pBottomFrameLayout->addWidget(mpSystemLibrariesButton);
pBottomFrameLayout->addWidget(mpInstallLibraryButton);
mpBottomFrame->setLayout(pBottomFrameLayout);
// vertical layout for frames
QVBoxLayout *verticalLayout = new QVBoxLayout;
verticalLayout->setSpacing(4);
Expand Down
2 changes: 2 additions & 0 deletions OMEdit/OMEditLIB/Modeling/ModelWidgetContainer.h
Expand Up @@ -443,6 +443,8 @@ class WelcomePageWidget : public QWidget
QSplitter *mpSplitter;
QFrame *mpBottomFrame;
QPushButton *mpCreateModelButton;
QPushButton *mpSystemLibrariesButton;
QPushButton *mpInstallLibraryButton;
QPushButton *mpOpenModelButton;
public slots:
void addLatestNewsListItems();
Expand Down

0 comments on commit 1347ed8

Please sign in to comment.