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