main_window.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * Software License Agreement
4  *
5  * Copyright (c) 2020,
6  * TU Dortmund - Institute of Control Theory and Systems Engineering.
7  * All rights reserved.
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <https://www.gnu.org/licenses/>.
21  *
22  * Authors: Christoph Rösmann
23  *********************************************************************/
24 
25 #ifndef SRC_GUI_INCLUDE_CORBO_GUI_MAIN_WINDOW_H_
26 #define SRC_GUI_INCLUDE_CORBO_GUI_MAIN_WINDOW_H_
27 
34 
35 #include <QAction>
36 #include <QDockWidget>
37 #include <QMainWindow>
38 #include <QMenu>
39 #include <QThread>
40 
41 #include <array>
42 #include <iostream>
43 #include <memory>
44 #include <string>
45 #include <vector>
46 
47 namespace corbo {
48 namespace gui {
49 
50 const QString OrganizationName = "rst";
51 const QString ApplicationName = "control-box-rst";
52 
68 class corboMainWindow : public QMainWindow
69 {
70  Q_OBJECT
71 
72  public:
73  explicit corboMainWindow(QWidget* parent = 0);
74  explicit corboMainWindow(std::shared_ptr<MasterServiceClient> rpc_client, QWidget* parent = 0);
75  virtual ~corboMainWindow();
76 
77  signals:
78  void requestRpcServerAddress(const QString& address);
79 
80  protected:
81  void closeEvent(QCloseEvent* event) override;
82 
83  void createActions();
84  void createMenus();
85  void createStatusBar();
86  void createDockWindows();
87  void addMenuActions();
89 
90  void configureRpcWorker();
91 
92  void readWindowSettings();
93  void writeWindowSettings();
94 
95  protected slots:
96  void setDefaultLayout();
97  void addToRecentFileAction(const QString& filename);
98 
99  private slots:
100  void displayStatus(const QString& status, double duration_ms = 0);
101  void displayStatusReady() { displayStatus(tr("Ready")); }
102  void aboutPopup();
103  void updatedRpcClient(std::shared_ptr<MasterServiceClient> client);
104 
105  private:
107  std::shared_ptr<MasterServiceClient> _rpc_client;
108 
109  QWidget* _central_widget;
110 
119  QAction* _action_about;
120  std::array<QAction*, 6> _action_recent_files; // number of recent files
121 
122  QMenu* _menu_file;
125  QMenu* _menu_scopes;
127  QMenu* _menu_view;
128  QMenu* _menu_help;
129 
130  QDockWidget* _dock_toolbox_widget;
131  QDockWidget* _dock_signal_widget;
132  QDockWidget* _dock_scope_widget;
133 
137 
139  QString _rpc_server_address = "localhost:50051";
140 };
141 
142 } // namespace gui
143 } // namespace corbo
144 
145 #endif // SRC_GUI_INCLUDE_CORBO_GUI_MAIN_WINDOW_H_
ToolboxWidget * _toolbox_widget
Definition: main_window.h:134
QAction * _action_rpc_server_address
Definition: main_window.h:117
QDockWidget * _dock_toolbox_widget
Definition: main_window.h:130
corboMainWindow(QWidget *parent=0)
Definition: main_window.cpp:44
void updatedRpcClient(std::shared_ptr< MasterServiceClient > client)
ScopeCollectionWidget * _scope_collection_widget
Definition: main_window.h:136
SignalHelper::Ptr _signal_helper
Definition: main_window.h:106
const QString OrganizationName
Definition: main_window.h:50
QAction * _action_rescale_scope_axes
Definition: main_window.h:115
QAction * _action_load_parameters_file
Definition: main_window.h:112
std::shared_ptr< SignalHelper > Ptr
Definition: signal_helper.h:45
QDockWidget * _dock_signal_widget
Definition: main_window.h:131
void requestRpcServerAddress(const QString &address)
QAction * _action_save_parameters_file
Definition: main_window.h:111
void addToRecentFileAction(const QString &filename)
void closeEvent(QCloseEvent *event) override
Definition: main_window.cpp:92
QDockWidget * _dock_scope_widget
Definition: main_window.h:132
const QString ApplicationName
Definition: main_window.h:51
SignalCollectionWidget * _signal_collection_widget
Definition: main_window.h:135
void displayStatus(const QString &status, double duration_ms=0)
GUI main window.
Definition: main_window.h:68
std::array< QAction *, 6 > _action_recent_files
Definition: main_window.h:120
std::shared_ptr< MasterServiceClient > _rpc_client
Definition: main_window.h:107


control_box_rst
Author(s): Christoph Rösmann
autogenerated on Mon Feb 28 2022 22:07:00