openscenariocontroller.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 <string>
29#include <vector>
30
31#include <QObject>
32#include <QSet>
33#include <QStringList>
34
37
41#include "../gui/treemodel.h"
42
44{
45 /**
46 * @class OpenScenarioController
47 * @ingroup controller
48 * @brief Manages the signals and model of the OpenScenarioView.
49 * This Controller manages opening and loading in a scenario.
50 */
51 class OpenScenarioController : public QObject
52 {
53 Q_OBJECT
54 public:
55 /**
56 * Constructor that sets the data structure and optionally the parent object.
57 * @param packages list of packages
58 * @param parent standard optional QT parent object
59 */
62 QObject* parent = 0);
63 ~OpenScenarioController() override;
64
65
66 signals:
67 /**
68 * This signal gets emitted if the data structure has changed.
69 */
70 void updated();
72
73 public slots:
74 /**
75 * Shows the OpenScenarioView which allows the User to open and load in a Scenario.
76 */
79
80 /**
81 * Finds a scenario in the model, based on the given data and
82 * updates the current model and data structure to include the given scenario.
83 * @param row row the scenario is in
84 * @param column column the scenario is in
85 * @param parent parent index of the scenario
86 */
87 void on_openScenario(int row, int column, QModelIndex parent);
88
89 /**
90 * Reloads the packages into the model.
91 */
92 void updateModel();
93
94 private:
95 QStringList getAllClosedScenarios();
96 QStringList getFavouriteScenarios(QStringList allClosedScenarios);
97
98
99 private:
100 const std::size_t favlistSize;
101
103 Exec::ExecutorPtr executor;
104 OpenScenarioModelPtr treemodel;
106 OpenScenarioView openScenarioView;
107 };
108} // namespace ScenarioManager::Controller
View that allows to open a previously saved scenario.
OpenScenarioController(Data_Structure::PackageVectorPtr packages, Exec::ExecutorPtr exec, QObject *parent=0)
Constructor that sets the data structure and optionally the parent object.
void updated()
This signal gets emitted if the data structure has changed.
void showOpenScenarioView()
Shows the OpenScenarioView which allows the User to open and load in a Scenario.
void updateModel()
Reloads the packages into the model.
void on_openScenario(int row, int column, QModelIndex parent)
Finds a scenario in the model, based on the given data and updates the current model and data structu...
std::shared_ptr< FilterableTreeModelSortFilterProxyModel > FilterableTreeModelSortFilterProxyModelPtr
std::shared_ptr< std::vector< ScenarioManager::Data_Structure::PackagePtr > > PackageVectorPtr
Definition Package.h:123
std::shared_ptr< Executor > ExecutorPtr
Definition Executor.h:175
std::shared_ptr< OpenScenarioModel > OpenScenarioModelPtr