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