ApplicationDatabaseController.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 "../gui/applicationdatabasemodel.h"
29 #include "../gui/filterabletreemodelsortfilterproxymodel.h"
30 #include "../gui/treeitem.h"
33 
34 #include <QObject>
35 
36 #include <memory>
37 #include <vector>
38 
40 {
41  /**
42  * @class ApplicationDatabaseController
43  * @ingroup controller
44  * @brief This Controller manages the signals and model of the ApplicationDatabaseView.
45  * Item click signals in the ApplicationDatabaseView need to be connected to the on_itemClicked() slot.
46  * When an item gets clicked, this controller finds out whether an Application or a Package was clicked and
47  * specifically which Application or Package it was. It then sends a signal with a pointer to the clicked object.
48  */
49  class ApplicationDatabaseController : public QObject
50  {
51  Q_OBJECT
52  public:
53  /**
54  * Constructor that takes the data structure this controller operates on and optionally the parent object.
55  * @param packages list of packages. Need to contain the Packages and Applications displayed in the ApplicationDatabaseView.
56  * @param executor executor used to start, stop and update status of the Applications and Scenarios.
57  * @param parent standard QT option to specify a parent
58  */
61 
62  /**
63  * Returns the model used by the ApplicationDatabaseView and managed by this controller.
64  * @return managed model
65  */
67 
68  signals:
69  /**
70  * Gets emitted after an Application has been clicked in the ApplicationDatabaseView.
71  * @param app clicked Application
72  */
74 
75  /**
76  * Gets emitted after a Package gets clicked in the ApplicationDatabaseView.
77  * @param package clicked Package
78  */
80 
81 
83 
84  public slots:
85 
86  /**
87  * Finds out whether an Application or a Scenario has been clicked and sends a signal with
88  * the corresponding object.
89  * @param index model-index of the clicked object
90  */
91  void on_itemClicked(const QModelIndex& index);
92 
93  /**
94  * Updates the packages displayed in the ApplicationDatabaseView by reloading all packages
95  * and applications into the model.
96  */
97  void updatePackages();
98 
99  private:
100  ApplicationDatabaseModel treemodel;
103  Exec::ExecutorPtr executor;
104  };
105 }
106 
107 
ScenarioManager::Controller::ApplicationDatabaseController::modelUpdated
void modelUpdated(FilterableTreeModelSortFilterProxyModelPtr model)
index
uint8_t index
Definition: EtherCATFrame.h:59
ScenarioManager::Controller::ApplicationDatabaseController::updatePackages
void updatePackages()
Updates the packages displayed in the ApplicationDatabaseView by reloading all packages and applicati...
Definition: ApplicationDatabaseController.cpp:65
ScenarioManager::Data_Structure::ApplicationPtr
std::shared_ptr< Application > ApplicationPtr
Definition: Application.h:119
ScenarioManager::Controller
Definition: ApplicationDatabaseController.h:39
ScenarioManager::Controller::ApplicationDatabaseController::getModel
FilterableTreeModelSortFilterProxyModelPtr getModel()
Returns the model used by the ApplicationDatabaseView and managed by this controller.
Definition: ApplicationDatabaseController.cpp:60
ScenarioManager::Exec::ExecutorPtr
std::shared_ptr< Executor > ExecutorPtr
Definition: Executor.h:164
ScenarioManager::Data_Structure::PackageVectorPtr
std::shared_ptr< std::vector< ScenarioManager::Data_Structure::PackagePtr > > PackageVectorPtr
Definition: Package.h:122
ScenarioManager::Controller::ApplicationDatabaseController::packageClicked
void packageClicked(Data_Structure::PackagePtr package)
Gets emitted after a Package gets clicked in the ApplicationDatabaseView.
ScenarioManager::Controller::ApplicationDatabaseController::~ApplicationDatabaseController
~ApplicationDatabaseController() override
Definition: ApplicationDatabaseController.cpp:55
Package.h
ScenarioManager::Data_Structure::PackagePtr
std::shared_ptr< Package > PackagePtr
Definition: Package.h:121
ScenarioManager::Controller::ApplicationDatabaseController::on_itemClicked
void on_itemClicked(const QModelIndex &index)
Finds out whether an Application or a Scenario has been clicked and sends a signal with the correspon...
Definition: ApplicationDatabaseController.cpp:98
Executor.h
ScenarioManager::Controller::ApplicationDatabaseController
This Controller manages the signals and model of the ApplicationDatabaseView. Item click signals in t...
Definition: ApplicationDatabaseController.h:49
FilterableTreeModelSortFilterProxyModelPtr
std::shared_ptr< FilterableTreeModelSortFilterProxyModel > FilterableTreeModelSortFilterProxyModelPtr
Definition: filterabletreemodelsortfilterproxymodel.h:65
ScenarioManager::Controller::ApplicationDatabaseController::ApplicationDatabaseController
ApplicationDatabaseController(Data_Structure::PackageVectorPtr packages, Exec::ExecutorPtr executor, QObject *parent=0)
Constructor that takes the data structure this controller operates on and optionally the parent objec...
Definition: ApplicationDatabaseController.cpp:40
ApplicationDatabaseModel
Model underlying the ApplicationDatabaseView.
Definition: applicationdatabasemodel.h:37
ScenarioManager::Controller::ApplicationDatabaseController::applicationClicked
void applicationClicked(Data_Structure::ApplicationPtr app)
Gets emitted after an Application has been clicked in the ApplicationDatabaseView.