Skip to content

Commit

Permalink
disable some UI parts when no interaction with workflow is possible
Browse files Browse the repository at this point in the history
  • Loading branch information
aumuell authored and MDjur committed Feb 17, 2023
1 parent 6773400 commit d88de9f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app/gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,20 @@ MainWindow::~MainWindow()
/// scene; QDrag; mimeData;
}

void MainWindow::setInteractionEnabled(bool enable)
{
#ifdef HAVE_PYTHON
ui->actionSaveOnGui->setEnabled(enable);
ui->actionOpenOnGui->setEnabled(enable);
#endif
ui->actionNew->setEnabled(enable);
ui->actionQuit->setEnabled(enable);
ui->actionOpen->setEnabled(enable);
ui->actionOpenOnHub->setEnabled(enable);
ui->actionSave->setEnabled(enable);
ui->actionSaveOnHub->setEnabled(enable);
}

QToolBar *MainWindow::toolBar() const
{
return ui->toolBar;
Expand Down
1 change: 1 addition & 0 deletions app/gui/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class MainWindow: public QMainWindow {
ModuleBrowser *moduleBrowser() const;
void setQuitOnExit(bool qoe);
bool isSnapToGrid() const;
void setInteractionEnabled(bool enable);

public slots:
void setFilename(const QString &filename);
Expand Down
5 changes: 5 additions & 0 deletions app/gui/uicontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ UiController::UiController(int argc, char *argv[], QObject *parent): QObject(par
QDesktopServices::openUrl(link);
}
});
connect(&m_observer, &VistleObserver::uiLock_s, [this](bool locked) {
m_mainWindow->m_moduleBrowser->setEnabled(!locked);
m_mainWindow->moduleView()->setEnabled(!locked);
m_mainWindow->setInteractionEnabled(!locked);
});

connect(m_mainWindow->m_moduleBrowser, &ModuleBrowser::requestRemoveHub, [this](int id) {
vistle::message::Quit quit(id);
Expand Down

0 comments on commit d88de9f

Please sign in to comment.