casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TBTaQL.qo.h
Go to the documentation of this file.
1 //# TBTaQL.qo.h: GUI for entering a TaQL command.
2 //# Copyright (C) 2005
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id: $
27 #ifndef TBTAQL_H_
28 #define TBTAQL_H_
29 
30 #include <casaqt/QtBrowser/TBTaQL.ui.h>
31 
32 #include <QtGui>
33 
34 #include <casa/BasicSL/String.h>
35 
36 namespace casa {
37 
38 // <summary>
39 // GUI for entering a TaQL command.
40 // </summary>
41 //
42 // <synopsis>
43 // A TBTaQL widget contains two basic parts: the builder and the command text
44 // edit. The builder contains GUI components that allow the user to visually
45 // put together a TaQL command; once the command is built, the actual comamnd
46 // can be generated. The command can also be manually edited. When the
47 // command is accepted, a signal is emitted with the command in casacore::String format;
48 // it is the parent/caller's responsibility to collect the command.
49 // NOTE: at this time, only the builder for the SELECT command has been
50 // implemented (and not a very advanced implementation, at that).
51 // </synopsis>
52 
53 class TBTaQL : public QDialog, Ui::TaQL {
54  Q_OBJECT
55 
56 public:
57  // Available commands. Makes use of the QFlags for easy combining of
58  // multiple Command enums into one Command enum.
59  // <group>
60  enum Command {
61  SELECT = 0x1,
62  UPDATE = 0x2,
63  INSERT = 0x4,
64  DELETE = 0x8,
65  CALC = 0x16,
66  CREATE = 0x32
67  };
68  Q_DECLARE_FLAGS(Commands, Command);
69  // </group>
70 
71  // Returns the casacore::String representation of the given command.
73  switch(c) {
74  case SELECT: return "SELECT";
75  case UPDATE: return "UPDATE";
76  case INSERT: return "INSERT";
77  case DELETE: return "DELETE";
78  case CALC: return "CALC";
79  case CREATE: return "CREATE";
80  default: return "";
81  }
82  }
83 
84  // Constructor which optionally takes the parent and the commands to show
85  // in the builder command chooser. If parent is NULL, the TBTaQL is
86  // presented as a QDialog.
87  TBTaQL(QWidget* parent = NULL, Commands commands = SELECT);
88 
89  ~TBTaQL();
90 
91 signals:
92  // This signal is emitted whenever the user has accepted the entered TaQL
93  // command.
95 
96  // This signal is emitted whenever the user presses the "Close" button.
97  // NOTE: if this TBTaQL is in dialog mode, it will close itself; if it is
98  // in widget mode, the parent is responsible for closing it. This signal
99  // is not emitted if in dialog mode.
100  void closeRequested();
101 
102 private slots:
103  // Slot for the "browse" button. Opens a file browser and puts the result
104  // in the location text edit.
105  void doBrowse();
106 
107  // Slot for the "generate" button. Generates the TaQL command from the
108  // state of the builder widgets.
109  void doGenerate();
110 
111  // Slot for the "accept" button. Emits the command() signal and, if the
112  // TBTaQL is in dialog mode, closes the dialog.
113  void doAccept();
114 
115  // Slot for the "close" button. If the TBTaQL is in dialog mode, closes
116  // the dialog; otherwise, emits the closeRequested() signal.
117  void doClose();
118 };
119 
120 Q_DECLARE_OPERATORS_FOR_FLAGS(TBTaQL::Commands)
121 
122 }
123 
124 #endif /*TBTAQL_H_*/
GUI for entering a TaQL command.
Definition: TBTaQL.qo.h:53
void doBrowse()
Slot for the &quot;browse&quot; button.
void doGenerate()
Slot for the &quot;generate&quot; button.
static casacore::String command(Command c)
Returns the casacore::String representation of the given command.
Definition: TBTaQL.qo.h:72
void doClose()
Slot for the &quot;close&quot; button.
Q_DECLARE_FLAGS(Commands, Command)
void closeRequested()
This signal is emitted whenever the user presses the &quot;Close&quot; button.
void doAccept()
Slot for the &quot;accept&quot; button.
Command
Available commands.
Definition: TBTaQL.qo.h:60
const Double c
Fundamental physical constants (SI units):
String: the storage and methods of handling collections of characters.
Definition: String.h:223
TBTaQL(QWidget *parent=NULL, Commands commands=SELECT)
Constructor which optionally takes the parent and the commands to show in the builder command chooser...