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 
44 /**
45 * @class ScenarioListView
46 * @brief View that shows a list of Scenarios.
47 * Allows to start, stop, restart Applications and Scenarios. Also allows to open Scenarios and remove/add items.
48 */
49 class ScenarioListView : public QWidget
50 {
51  Q_OBJECT
52 
53 public:
54  /**
55  * Constructor that sets up the ui and behaviour of this view.
56  * @param parent parent widget
57  */
58  explicit ScenarioListView(QWidget* parent = 0);
59 
60  /**
61  * Destructor.
62  */
63  ~ScenarioListView() override;
64 
65 signals:
66  void startApplication(int row, int column, QModelIndex parent);
67  void stopApplication(int row, int column, QModelIndex parent);
68  void restartApplication(int row, int column, QModelIndex parent);
69  void createScenario();
70  void showOpenDialog();
71  void removeItem(QModelIndex index);
72  void itemClicked(const QModelIndex& index);
73 
74 public slots:
75  /**
76  * Sets the model of this view.
77  * @param model the underlying model
78  */
80 
81 private slots:
82  void on_searchBar_textEdited(const QString& text);
83  void startButtonClicked(int row, int column, QModelIndex parent);
84  void stopButtonClicked(int row, int column, QModelIndex parent);
85 
86  void restartButtonClicked(int row, int column, QModelIndex parent);
87 
88  void on_newButton_clicked();
89 
90  void on_openButton_clicked();
91  void removeItemTriggered();
92 
93  void onCustomContextMenu(const QPoint& point);
94 
95  void on_treeView_clicked(const QModelIndex& index);
96 private:
97  Ui::ScenarioListView* ui;
99  ButtonDelegate startButtonDelegate;
100  ButtonDelegate stopButtonDelegate;
101  ButtonDelegate restartButtonDelegate;
102  QMenu contextMenu;
103  QAction removeAction;
104 };
105 
buttondelegate.h
ScenarioListView::setModel
void setModel(FilterableTreeModelSortFilterProxyModelPtr model)
Sets the model of this view.
Definition: scenariolistview.cpp:87
Scenario.h
ScenarioListView::ScenarioListView
ScenarioListView(QWidget *parent=0)
Constructor that sets up the ui and behaviour of this view.
Definition: scenariolistview.cpp:40
index
uint8_t index
Definition: EtherCATFrame.h:59
namelocationview.h
filterabletreemodelsortfilterproxymodel.h
ScenarioListView::showOpenDialog
void showOpenDialog()
ScenarioListView::startApplication
void startApplication(int row, int column, QModelIndex parent)
ScenarioListView::createScenario
void createScenario()
ScenarioListView::stopApplication
void stopApplication(int row, int column, QModelIndex parent)
Ui
ArmarX Headers.
Definition: ArmarXMainWindow.h:54
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::~ScenarioListView
~ScenarioListView() override
Destructor.
Definition: scenariolistview.cpp:82
ScenarioListView
View that shows a list of Scenarios. Allows to start, stop, restart Applications and Scenarios....
Definition: scenariolistview.h:49
ScenarioListView::itemClicked
void itemClicked(const QModelIndex &index)
ScenarioListView::restartApplication
void restartApplication(int row, int column, QModelIndex parent)