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