Skip to content

Commit

Permalink
- on macos allow to open a new instance from the file menu
Browse files Browse the repository at this point in the history
  • Loading branch information
fbergmann committed Dec 4, 2024
1 parent 5721276 commit b61441b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions copasi/UI/copasiui3window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
#include <QtCore/QThread>
#include <QFontDialog>
#include <QtCore/QDateTime>
#include <QProcess>


#include <QByteArray>
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
Expand Down Expand Up @@ -748,6 +750,12 @@ void CopasiUI3Window::createMenuBar()
{
QMenu *pFileMenu = menuBar()->addMenu("&File");
pFileMenu->addAction(mpaNew);
#ifdef Q_OS_MACOS
QAction *pOpenNewWindow = new QAction("New Window", this);
pOpenNewWindow->setToolTip("Open a new COPASI instance");
QObject::connect(pOpenNewWindow, SIGNAL(triggered()), this, SLOT(slotStartNewInstance()));
pFileMenu->addAction(pOpenNewWindow);
#endif
pFileMenu->addAction(mpaOpen);
pFileMenu->addAction(mpaOpenFromUrl);
mpMenuExamples = pFileMenu->addMenu("Examples");
Expand Down Expand Up @@ -4208,6 +4216,11 @@ void CopasiUI3Window::slotHandleCopasiScheme(const QUrl& url)
#endif
}

void CopasiUI3Window::slotStartNewInstance()
{
QProcess::startDetached(qApp->applicationFilePath());
}

void CopasiUI3Window::slotCheckForUpdate()
{
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
Expand Down
2 changes: 2 additions & 0 deletions copasi/UI/copasiui3window.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ public slots:

void slotHandleCopasiScheme(const QUrl& url);

void slotStartNewInstance();

public:
/**
* performs the next action from the action stack
Expand Down

0 comments on commit b61441b

Please sign in to comment.