casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QtViewer.qo.h
Go to the documentation of this file.
1 //# QtViewer.qo.h: Qt implementation of main viewer supervisory object
2 //# -- Gui level.
3 //# Copyright (C) 2005
4 //# Associated Universities, Inc. Washington DC, USA.
5 //#
6 //# This library is free software; you can redistribute it and/or modify it
7 //# under the terms of the GNU Library General Public License as published by
8 //# the Free Software Foundation; either version 2 of the License, or (at your
9 //# option) any later version.
10 //#
11 //# This library is distributed in the hope that it will be useful, but WITHOUT
12 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14 //# License for more details.
15 //#
16 //# You should have received a copy of the GNU Library General Public License
17 //# along with this library; if not, write to the Free Software Foundation,
18 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
19 //#
20 //# Correspondence concerning AIPS++ should be addressed as follows:
21 //# Internet email: aips2-request@nrao.edu.
22 //# Postal address: AIPS++ Project Office
23 //# National Radio Astronomy Observatory
24 //# 520 Edgemont Road
25 //# Charlottesville, VA 22903-2475 USA
26 //#
27 //# $Id$
28 
29 #ifndef QTVIEWER_H
30 #define QTVIEWER_H
31 #include <list>
32 #include <string>
33 #if defined(WITHOUT_DBUS)
34 #include <queue>
35 #include <mutex>
36 #endif
38 
39 #include <graphics/X11/X_enter.h>
40 # include <QObject>
41 #include <graphics/X11/X_exit.h>
42 
43 namespace casa { //# NAMESPACE CASA - BEGIN
44 
45  class QtDBusViewerAdaptor;
46  class QtDisplayPanelGui;
47  class QtCleanPanelGui;
48  class QtCleanPanelGui2;
49 
50 #if defined(WITHOUT_DBUS)
51  class grpcViewerState;
52 #endif
53 
54 // <summary>
55 // Qt implementation of main viewer supervisory object -- Gui level.
56 // </summary>
57 
58 // <synopsis>
59 // A QtViewer app should use just one QtViewer object, in all
60 // Probability; the rest of the objects will coordinate through it.
61 //
62 // The viewer is structured with a functional layer and a gui layer.
63 // In principle the former can operate without the latter.
64 // This class contains and manages various _gui_ objects associated with
65 // the viewer. Its base manages the corresponding functional objects.
66 //
67 // casacore::Functional objects Related Gui objects
68 // ------------------ -------------------
69 // QtViewerBase QtViewer, QtDataManager, print dialog
70 // QtDisplayData QtDataOptionsPanel
71 // QtDisplayPanel QtDisplayPanelGui, panel options dialog
72 //
73 // QtDisplayPanel _is_ also a display widget, but minimal,
74 // without surrounding graphical interface (animator, menus, etc.)
75 // to operate it.
76 //
77 // </synopsis>
78 
79  class QtViewer : public QtViewerBase {
80 
81  Q_OBJECT //# Allows slot/signal definition. Must only occur in
82  //# implement/.../*.h files; also, makefile must include
83  //# name of this file in 'mocs' section.
84 
85  public:
86 
87  // When DBus is used "server_string" is the DBus name for the viewer on the message bus, but
88  // when gRPC is used "server_string" is the gRPC URL which should be used to register the
89  // viewer server.
90  QtViewer( const std::list<std::string> &args, bool is_server=false, const char *server_string=0 );
91  ~QtViewer();
92 
93  // Called from casaviewer.cc, true indicates that this application has been activated,
94  // false indicates that it has been deactivated. The application (with OSX anyway)
95  // becomes deactivated when it looses application focus, e.g. when the user moves
96  // to "mission control" etc. This is useful for signaling that the mouse has left
97  // the display window... (in these cases where it leaves without dragging out)
98  void activate( bool );
99 
100  // name used to initialize connection to dbus
101  static const QString &name( );
102 
103  public slots:
104 
105  // create a main display panel Gui
106  virtual QtDisplayPanelGui *createDPG();
110 
111  // Exits Qt loop. (Note that the loop can be restarted (and is, in
112  // interactive clean, e.g.), with existing widgets intact. This
113  // does not in itself delete objects or exit the process, although
114  // the driver program might do that). Also, some of the panels may
115  // have WA_DeleteOnClose set, which would cause their deletion (see,
116  // e.g., createDPG()).
117  virtual void quit();
118 
119 #if defined(WITHOUT_DBUS)
120 
121  void grpc_handle_op( );
122 
123  signals:
124  void grpc_panel_result( QtDisplayPanelGui*, int );
125 
126  public:
127  std::mutex grpc_queue_mutex;
128  std::queue<std::function<void()>> grpc_queue;
129 
130 #endif
131 
132  private:
133  friend class QtDisplayPanelGui;
135 
136  protected:
137 
138 #if ! defined(WITHOUT_DBUS)
140 #else
141  std::shared_ptr<grpcViewerState> grpc_;
142 #endif
143  std::list<std::string> args_;
144 
145  private:
146  static QString name_;
147  QString server_string_;
149  typedef std::vector<QtDisplayPanelGui*> panel_list_t;
151 
152  };
153 
154 
155 
156 } //# NAMESPACE CASA - END
157 
158 #endif
QString server_string_
Definition: QtViewer.qo.h:147
virtual QtDisplayPanelGui * createDPG()
create a main display panel Gui
Qt implementation of main viewer supervisory object – Gui level.
Definition: QtViewer.qo.h:79
static QString name_
Definition: QtViewer.qo.h:146
std::list< std::string > args_
Definition: QtViewer.qo.h:143
virtual void quit()
Exits Qt loop.
std::vector< QtDisplayPanelGui * > panel_list_t
Definition: QtViewer.qo.h:149
virtual QtCleanPanelGui * createInteractiveCleanGui()
QtViewer(const std::list< std::string > &args, bool is_server=false, const char *server_string=0)
When DBus is used &quot;server_string&quot; is the DBus name for the viewer on the message bus, but when gRPC is used &quot;server_string&quot; is the gRPC URL which should be used to register the viewer server.
panel_list_t panels
Definition: QtViewer.qo.h:150
QtDBusViewerAdaptor * dbus_
Definition: QtViewer.qo.h:139
virtual QtCleanPanelGui2 * createInteractiveCleanGui2()
The main display window for the Qt version of the viewer.
void dpgDeleted(QtDisplayPanelGui *)
void activate(bool)
Called from casaviewer.cc, true indicates that this application has been activated, false indicates that it has been deactivated.
static const QString & name()
name used to initialize connection to dbus