detailedapplicationview.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 <QFileSystemWatcher>
31 #include <QTimer>
32 #include <QWidget>
33 
35 
37 
39 #include "scenarioitem.h"
40 
41 namespace Ui
42 {
44 }
45 
46 /**
47 * @class DetailedApplicationView
48 * @brief View that shows detailed information about a Scenario, Package or Application.
49 * Shows status and parameters of the object.
50 * Also allows starting, stopping and restarting of Scenarios and Applications.
51 */
52 class DetailedApplicationView : public QWidget
53 {
54  Q_OBJECT
55 
56 public:
57  /**
58  * Constructor that sets up the ui.
59  * @param parent parent widget
60  */
61  explicit DetailedApplicationView(QWidget* parent = 0);
62 
63  /**
64  * Destructor.
65  */
66  ~DetailedApplicationView() override;
67 
68 public:
69  /**
70  * Show an Application.
71  * @param application Application to show
72  */
74 
75  /**
76  * Show an ApplicationInstance.
77  * @param appInstance ApplicationInstance to show
78  */
79  void
81  ScenarioItem* item);
82 
83  /**
84  * Show a Scenario.
85  * @param scenario Scenario to show
86  */
88 
89  /**
90  * Show a Package.
91  * @param package Package to show
92  */
94 
95 
96 signals:
97  void startButtonClicked();
98  void stopButtonClicked();
99  void restartButtonClicked();
101  void toolButtonClicked();
102  void makeLocalButtonClicked();
105 
106 public slots:
107  /**
108  * Updates the status of the displayed item.
109  */
110  void updateStatus();
111 
112 private slots:
113  void on_searchBar_textEdited(const QString& text);
114 
115  void on_showInactiveProperties_stateChanged(int state);
116 
117  void on_startButton_clicked();
118 
119  void on_stopButton_clicked();
120 
121  void on_restartButton_clicked();
122 
123  void on_addParameterButton_clicked();
124 
125  void on_toolButton_clicked();
126 
127  void itemChanged(QtProperty* property, const QVariant& value);
128  void itemAttributeChanged(QtProperty* property, const QString& attribute, const QVariant& val);
129 
130  void on_reloadButton_clicked();
131 
132  void on_fileUpdate();
133 
134  void on_makeLocalButton_clicked();
135 
136  void on_fileWatcherUpdate(const QString& path);
137 
138 private:
139  void init();
140  void show_or_hide_property(QtProperty*, bool);
141  bool show_or_hide_subproperties(QtProperty*, const QString&);
142 
143 private:
144  Ui::DetailedApplicationView* ui;
145 
146  std::shared_ptr<QtVariantPropertyManager> variantManager;
147  std::shared_ptr<QtVariantEditorFactory> variantFactory;
148 
149  bool statusUpdateRelevant;
152  ScenarioItem* lastScenarioItem;
153 
154  bool neadsUpdate;
155  QTimer updateTimer;
156 
157  QFileSystemWatcher fileSystemWatcher;
158  bool ignoreFileChanges = false;
159 };
160 
161 using DetailedApplicationViewPtr = std::shared_ptr<DetailedApplicationView>;
ScenarioItem
TreeItem representing data contained in a Scenario or an Application.
Definition: scenarioitem.h:38
DetailedApplicationView::applicationEnabledChange
void applicationEnabledChange(bool enabled)
ScenarioManager::Data_Structure::ApplicationInstancePtr
std::shared_ptr< ApplicationInstance > ApplicationInstancePtr
Definition: ApplicationInstance.h:33
ScenarioManager::Data_Structure::ScenarioPtr
std::shared_ptr< Scenario > ScenarioPtr
Definition: Scenario.h:36
DetailedApplicationView::saveScenario
void saveScenario(ScenarioManager::Data_Structure::ApplicationInstancePtr application)
ScenarioManager::Data_Structure::ApplicationPtr
std::shared_ptr< Application > ApplicationPtr
Definition: Application.h:119
DetailedApplicationView::showApplication
void showApplication(ScenarioManager::Data_Structure::ApplicationPtr application)
Show an Application.
Definition: detailedapplicationview.cpp:140
DetailedApplicationView::startButtonClicked
void startButtonClicked()
scenarioitem.h
OptionalPropertyFactory.h
DetailedApplicationView::restartButtonClicked
void restartButtonClicked()
DetailedApplicationViewPtr
std::shared_ptr< DetailedApplicationView > DetailedApplicationViewPtr
Definition: detailedapplicationview.h:161
DetailedApplicationView::toolButtonClicked
void toolButtonClicked()
QtProperty
The QtProperty class encapsulates an instance of a property.
Definition: qtpropertybrowser.h:71
Package.h
DetailedApplicationView::updateStatus
void updateStatus()
Updates the status of the displayed item.
Definition: detailedapplicationview.cpp:844
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:926
Ui
ArmarX Headers.
Definition: ArmarXMainWindow.h:54
ScenarioManager::Data_Structure::PackagePtr
std::shared_ptr< Package > PackagePtr
Definition: Package.h:121
DetailedApplicationView::~DetailedApplicationView
~DetailedApplicationView() override
Destructor.
Definition: detailedapplicationview.cpp:102
enabled
std::atomic< bool > * enabled
Definition: RemoteGuiWidgetController.cpp:75
DetailedApplicationView::makeLocalButtonClicked
void makeLocalButtonClicked()
DetailedApplicationView::showScenario
void showScenario(ScenarioManager::Data_Structure::ScenarioPtr scenario)
Show a Scenario.
Definition: detailedapplicationview.cpp:473
DetailedApplicationView::addParameterButtonClicked
void addParameterButtonClicked()
DetailedApplicationView::DetailedApplicationView
DetailedApplicationView(QWidget *parent=0)
Constructor that sets up the ui.
Definition: detailedapplicationview.cpp:83
DetailedApplicationView::showApplicationInstance
void showApplicationInstance(ScenarioManager::Data_Structure::ApplicationInstancePtr appInstance, ScenarioItem *item)
Show an ApplicationInstance.
Definition: detailedapplicationview.cpp:238
DetailedApplicationView::showPackage
void showPackage(ScenarioManager::Data_Structure::PackagePtr package)
Show a Package.
Definition: detailedapplicationview.cpp:664
DetailedApplicationView
View that shows detailed information about a Scenario, Package or Application. Shows status and param...
Definition: detailedapplicationview.h:52
DetailedApplicationView::stopButtonClicked
void stopButtonClicked()
qtpropertymanager.h