scenariolistview.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package ArmarXCore::core
19  * @author Cedric Seehausen (usdnr at kit dot edu)
20  * @date 2016
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 
25 
26 #pragma once
27 
29 #include "buttondelegate.h"
30 #include "namelocationview.h"
33 #include <QMenu>
34 #include <QAction>
35 #include <QWidget>
36 #include <QAbstractItemModel>
37 #include <memory>
38 
39 namespace Ui
40 {
41  class ScenarioListView;
42 }
43 
45 {
46  LocalStart = 1, //Start the Scenario Local
47 };
48 
49 /**
50 * @class ScenarioListView
51 * @brief View that shows a list of Scenarios.
52 * Allows to start, stop, restart Applications and Scenarios. Also allows to open Scenarios and remove/add items.
53 */
54 class ScenarioListView : public QWidget
55 {
56  Q_OBJECT
57 
58 public:
59  /**
60  * Constructor that sets up the ui and behaviour of this view.
61  * @param parent parent widget
62  */
63  explicit ScenarioListView(QWidget* parent = 0);
64 
65  /**
66  * Destructor.
67  */
68  ~ScenarioListView() override;
69 
70 signals:
71  void startApplication(int row, int column, QModelIndex parent, ScenarioStartModes startMode);
72  void stopApplication(int row, int column, QModelIndex parent);
73  void restartApplication(int row, int column, QModelIndex parent);
74  void createScenario();
75  void showOpenDialog();
76  void removeItem(QModelIndex index);
77  void itemClicked(const QModelIndex& index);
78 
79 public slots:
80  /**
81  * Sets the model of this view.
82  * @param model the underlying model
83  */
85 
86 private slots:
87  void on_searchBar_textEdited(const QString& text);
88  void startComboBoxClicked(int row, int column, QModelIndex parent, QString text);
89  void startButtonClicked(int row, int column, QModelIndex parent);
90  void stopButtonClicked(int row, int column, QModelIndex parent);
91 
92  void restartButtonClicked(int row, int column, QModelIndex parent);
93 
94  void on_newButton_clicked();
95 
96  void on_openButton_clicked();
97  void removeItemTriggered();
98 
99  void onCustomContextMenu(const QPoint& point);
100 
101  void on_treeView_clicked(const QModelIndex& index);
102  void onModelDataChange(QModelIndex start, QModelIndex end);
103 private:
104  Ui::ScenarioListView* ui;
106  ButtonDelegate startButtonDelegate;
107  ButtonDelegate stopButtonDelegate;
108  ButtonDelegate restartButtonDelegate;
109  QMenu contextMenu;
110  QAction removeAction;
111  void updateScenarioIndices();
112 };
113 
buttondelegate.h
ScenarioListView::setModel
void setModel(FilterableTreeModelSortFilterProxyModelPtr model)
Sets the model of this view.
Definition: scenariolistview.cpp:90
Scenario.h
ScenarioListView::ScenarioListView
ScenarioListView(QWidget *parent=0)
Constructor that sets up the ui and behaviour of this view.
Definition: scenariolistview.cpp:41
index
uint8_t index
Definition: EtherCATFrame.h:59
namelocationview.h
LocalStart
@ LocalStart
Definition: scenariolistview.h:46
filterabletreemodelsortfilterproxymodel.h
ScenarioListView::showOpenDialog
void showOpenDialog()
ScenarioListView::createScenario
void createScenario()
ScenarioListView::stopApplication
void stopApplication(int row, int column, QModelIndex parent)
ScenarioStartModes
ScenarioStartModes
Definition: scenariolistview.h:44
Ui
ArmarX Headers.
Definition: ArmarXMainWindow.h:58
ScenarioListView::removeItem
void removeItem(QModelIndex index)
ButtonDelegate
Manages a button.
Definition: buttondelegate.h:40
FilterableTreeModelSortFilterProxyModelPtr
std::shared_ptr< FilterableTreeModelSortFilterProxyModel > FilterableTreeModelSortFilterProxyModelPtr
Definition: filterabletreemodelsortfilterproxymodel.h:65
ApplicationInstance.h
ScenarioListView::startApplication
void startApplication(int row, int column, QModelIndex parent, ScenarioStartModes startMode)
ScenarioListView::~ScenarioListView
~ScenarioListView() override
Destructor.
Definition: scenariolistview.cpp:85
ScenarioListView
View that shows a list of Scenarios. Allows to start, stop, restart Applications and Scenarios....
Definition: scenariolistview.h:54
ScenarioListView::itemClicked
void itemClicked(const QModelIndex &index)
ScenarioListView::restartApplication
void restartApplication(int row, int column, QModelIndex parent)