casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TBKeywordsTab.qo.h
Go to the documentation of this file.
1 //# TBKeywordsTab.qo.h: Widgets used to display table and field keywords.
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 TBKEYWORDSTAB_H_
28 #define TBKEYWORDSTAB_H_
29 
30 #include <casaqt/QtBrowser/TBTableKeywordsTab.ui.h>
31 #include <casaqt/QtBrowser/TBFieldKeywordsTab.ui.h>
32 #include <casaqt/QtBrowser/TBNewKeyword.ui.h>
33 
34 #include <QtGui>
35 
36 #include <casa/BasicSL/String.h>
37 
38 namespace casa {
39 
40 //# Forward Declarations
41 class TBTable;
42 class TBTableTabs;
43 class QCloseableWidget;
44 class ProgressHelper;
45 class TBTypes;
46 class TBArrayPanel;
47 
48 class TBNewKeyword : public QDialog, Ui::NewKeyword {
49  Q_OBJECT
50 
51 // <summary>
52 // GUI for entering a new keyword.
53 // <summary>
54 //
55 // <synopsis>
56 // (Not Completed.) A TBNewKeyword is a dialog that allows the user to enter a
57 // new keyword. The parent/caller is responsible for connecting the signal and
58 // actually adding the new keyword.
59 // </synopsis>
60 
61 public:
62  // Constructor that takes an optional vector of fields for entering a new
63  // field keyword. If this vector is null, a table keyword is entered.
64  TBNewKeyword(std::vector<casacore::String>* fields = NULL, QWidget* parent = NULL);
65 
66  ~TBNewKeyword();
67 
68 signals:
69  // newKeyword is emitted when the user has entered a new keyword. The
70  // field index is -1 for a table keyword; otherwise it holds the index of
71  // the field to which the keyword should be added.
72  void newKeyword(int field, casacore::String name, casacore::String type, void* value);
73 
74 private:
75  // Displayed data types.
76  std::vector<casacore::String>* types;
77 
78  // Widget to enter the value based on the type.
80 
81 private slots:
82  // Catches when the user changes the type and changes the types widget
83  // accordingly.
84  void typeChanged(int index);
85 };
86 
87 // <summary>
88 // Widget used to display table keywords.
89 // <summary>
90 //
91 // <synopsis>
92 // casacore::Table keywords are displayed in a QTableWidget which cannot be edited.
93 // double-clicking certain types of keywords has certain effects:
94 // double-clicking a table keyword will open that subtable while
95 // double-clicking an array will open the array in a side panel.
96 // </synopsis>
97 
98 class TBTableKeywordsTab : public QWidget, Ui::TableKeywordsTab {
99  Q_OBJECT
100 
101 public:
102  // Constructor which takes pointers to the table backend.
104 
106 
107 
108  // Returns the table widget used to display the keywords.
109  QTableWidget* getTableWidget();
110 
111 
112  // Updates the QTableWidget with the new data that has been loaded into the
113  // table backend. If a ProgressHelper is provided, it will be updated
114  // periodically with progress information.
115  void updateTable(ProgressHelper* pp = NULL);
116 
117 public slots:
118  // Clears whatever widget (if any) is currently being displayed in the side
119  // panel.
120  void clearWidgetInSplitter();
121 
122  // Show the given widget on the right side of the splitter.
123  void showWidgetInSplitter(QWidget* widget);
124 
125 signals:
126  // This signal is emitted when the right widget is closed. The QWidget
127  // points to the widget that was just closed.
128  void rightWidgetClosed(QWidget* widget);
129 
130 private:
131  // Useful pointers to table backend.
134 
135  // Flag on whether events generated by the QTableWidget are "genuine."
136  bool update;
137 
138  // Side panel.
140 
141  // casacore::Array panel.
143 
144 private slots:
145  // Slot for when a keyword is double-clicked.
146  void doubleClicked(int row, int col);
147 
148  // Slot for "Add Keyword" button. (Not currently implemented.)
149  void addKeyword();
150 
151  // Slot for "Edit Keyword" button. (Not currently implemented.)
152  void editKeyword();
153 
154  // Slot for "Remove Keyword" button. (Not currently implemented.)
155  void removeKeyword();
156 
157  // Slot for when a keyword is selected in the table.
158  void cellSelected(int row);
159 };
160 
161 // <summary>
162 // Widget used to display field keywords.
163 // <summary>
164 //
165 // <synopsis>
166 // Field keywords are displayed in a QTreeWidget which cannot be edited.
167 // double-clicking certain types of keywords has certain effects:
168 // double-clicking a table keyword will open that subtable while
169 // double-clicking an array will open the array in a side panel.
170 // </synopsis>
171 
172 class TBFieldKeywordsTab : public QWidget, Ui::FieldKeywordsTab {
173  Q_OBJECT
174 
175 public:
176  // Constructor which takes pointers to the table backend.
178 
180 
181 
182  // Returns the QTreeWidget in which the field keywords are displayed.
183  QTreeWidget* getTreeWidget();
184 
185 
186  // Updates the QTreeWidget with the new data that has been loaded into the
187  // table backend. If a ProgressHelper is provided, it will be updated
188  // periodically with progress information.
189  void updateTable(ProgressHelper* pp = NULL);
190 
191 public slots:
192  // Clears whatever widget (if any) is currently being displayed in the side
193  // panel.
194  void clearWidgetInSplitter();
195 
196  // Show the given widget on the right side of the splitter.
197  void showWidgetInSplitter(QWidget* widget);
198 
199 signals:
200  // This signal is emitted when the right widget is closed. The QWidget
201  // points to the widget that was just closed.
202  void rightWidgetClosed(QWidget* widget);
203 
204 private:
205  // Useful pointers to the table backend.
208 
209  // Flag on whether events generated by the QTableWidget are "genuine."
210  bool update;
211 
212  // Side panel.
214 
215  // casacore::Array panel.
217 
218 private slots:
219  // Slot for when a field keyword is double-clicked.
220  void doubleClicked(QTreeWidgetItem* item, int col);
221 };
222 
223 }
224 
225 #endif /* TBKEYWORDSTAB_H_ */
void rightWidgetClosed(QWidget *widget)
This signal is emitted when the right widget is closed.
void typeChanged(int index)
Catches when the user changes the type and changes the types widget accordingly.
void editKeyword()
Slot for &quot;Edit Keyword&quot; button.
TBArrayPanel * arrayPanel
casacore::Array panel.
void cellSelected(int row)
Slot for when a keyword is selected in the table.
TBFieldKeywordsTab(TBTableTabs *tt, TBTable *t)
Constructor which takes pointers to the table backend.
(Not finished) Widget for entering a value based on its type.
Definition: TBTypes.qo.h:51
TBTypes * typesWidget
Widget to enter the value based on the type.
virtual Type type()
Return the type enum.
std::vector< casacore::String > * types
Displayed data types.
QCloseableWidget * rightWidget
Side panel.
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the if a human readable name(i.e."black").In many places throughout the plotter
TBNewKeyword(std::vector< casacore::String > *fields=NULL, QWidget *parent=NULL)
GUI for entering a new keyword.
TBTableTabs * ttabs
Useful pointers to the table backend.
void addKeyword()
Slot for &quot;Add Keyword&quot; button.
Wrapper around a QProgressPanel or other QLabel/QProgressBar pairing.
Widget used to display table keywords.
void clearWidgetInSplitter()
Clears whatever widget (if any) is currently being displayed in the side panel.
bool update
Flag on whether events generated by the QTableWidget are &quot;genuine.&quot;.
Primary interface for the rest of the browser to a table.
Definition: TBTable.h:152
Widget used to display field keywords.
void rightWidgetClosed(QWidget *widget)
This signal is emitted when the right widget is closed.
void updateTable(ProgressHelper *pp=NULL)
Updates the QTreeWidget with the new data that has been loaded into the table backend.
void doubleClicked(int row, int col)
Slot for when a keyword is double-clicked.
TBTableTabs * ttabs
Useful pointers to table backend.
void newKeyword(int field, casacore::String name, casacore::String type, void *value)
newKeyword is emitted when the user has entered a new keyword.
QCloseableWidget * rightWidget
Side panel.
bool update
Flag on whether events generated by the QTableWidget are &quot;genuine.&quot;.
QTreeWidget * getTreeWidget()
Returns the QTreeWidget in which the field keywords are displayed.
Collection of table backend and display tabs.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
Wrapper around a QWidget with a &quot;Close&quot; button.
QTableWidget * getTableWidget()
Returns the table widget used to display the keywords.
void showWidgetInSplitter(QWidget *widget)
Show the given widget on the right side of the splitter.
void removeKeyword()
Slot for &quot;Remove Keyword&quot; button.
void clearWidgetInSplitter()
Clears whatever widget (if any) is currently being displayed in the side panel.
TBArrayPanel * arrayPanel
casacore::Array panel.
void showWidgetInSplitter(QWidget *widget)
Show the given widget on the right side of the splitter.
void doubleClicked(QTreeWidgetItem *item, int col)
Slot for when a field keyword is double-clicked.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
Panel that can hold multiple TBViewArray widgets.
void updateTable(ProgressHelper *pp=NULL)
Updates the QTableWidget with the new data that has been loaded into the table backend.
TBTableKeywordsTab(TBTableTabs *tt, TBTable *t)
Constructor which takes pointers to the table backend.