casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TBMain.qo.h
Go to the documentation of this file.
1 //# TBMain.qo.h: Main window which is mainly responsible for menu actions.
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 TBMAIN_H_
28 #define TBMAIN_H_
29 
30 #include <casaqt/QtBrowser/TBMain.ui.h>
32 
33 #include <QtGui>
34 
35 #include <casa/BasicSL/String.h>
36 
37 namespace casa {
38 
39 //# Forward Declarations
40 class TBBrowser;
41 class TBAction;
42 class DriverParams;
43 class TBOptions;
44 
45 // <summary>
46 // Main window which is mainly responsible for menu actions.
47 // <summary>
48 //
49 // <synopsis>
50 // TBMain is a QMainWindow subclass that wraps about a TBBrowser object. Its
51 // main responsibility is to provide menu commands and interact with the
52 // TBBrowser.
53 // </synopsis>
54 
55 class TBMain : public QMainWindow, Ui::MainWindow {
56  Q_OBJECT
57 
58 public:
59  // Default Constructor.
60  TBMain();
61 
62  ~TBMain();
63 
64 
65  // Opens a table with the given file name and driver parameters. If the
66  // driver parameters are NULL, the defaults are used. If a start and num
67  // are provided, those rows are loaded into the new table; otherwise
68  // the default number of rows are loaded.
69  void openTable(casacore::String filename, DriverParams* dp = NULL, int start = 0,
71 
72 signals:
73  // This signal is emitted when a close menu command is given with
74  // a table name.
76 
77 protected:
78  // Catches a close event for the window. If a background task is running,
79  // a confirmation dialog is presented to the user. If the "save view on
80  // close" option is turned on, the current view is saved to the default
81  // location.
82  void closeEvent(QCloseEvent* event);
83 
84 private:
85  // Browser object.
87 
88  // The window's status bar.
89  QStatusBar* statusBar;
90 
91  // Close menu that lists all currently opened tables.
92  QMenu* closeMenu;
93 
94  // Columns menu that lists the table fields in the currently selected
95  // table.
96  QMenu* columnsMenu;
97 
98  // Edit menu that lists all currently opened tables.
100 
101  // Indicates whether the main window is waiting for some other task to
102  // complete or not. If the window is waiting, menu commands will not
103  // respond.
104  bool waiting;
105 
106  // Separator added in the Edit menu before the Options command.
107  QAction* separator;
108 
109  // casacore::Format menu that lists the table fields in the currently selected
110  // table.
111  QMenu* formatMenu;
112 
113  // Toolbar holding "file"-related menu commands.
114  QToolBar* fileBar;
115 
116  // Toolbar holding "edit"-related menu commands.
117  QToolBar* editBar;
118 
119  // Toolbar holding "view"-related menu commands.
120  QToolBar* viewBar;
121 
122  // Toolbar holding "tool"-related menu commands.
123  QToolBar* toolBar;
124 
125  // Indicates whether the TBMain should save the current view on close or
126  // not.
127  bool saveView;
128 
129 
130  // Sets up GUI components and signal/slot connections.
131  void setup();
132 
133  // Sets up the keyboard shortcuts.
134  void setupKeyboardShortcuts();
135 
136  // Calls setEnabled() on all menus with the given parameter.
137  void enableMenus(bool en);
138 
139  // Turns on/off editing, if write lock is available, on the given table.
140  void editTable(TBTableTabs* table, bool edit);
141 
142 private slots:
143  // Opens a filechooser dialog to allow the user to open a table.
144  void openTable();
145 
146  // Opens a TBTaQL dialog to allow the user to open a table using a TaQL
147  // command.
148  void openTaQL();
149 
150  // Connects with TBBrowser::tableOpened() signal. Updates dynamic menus
151  // as necessary.
152  void tableOpened(casacore::String name, casacore::String fullpath);
153 
154  //void openTableWithOptions();
155 
156  // Closes the currently selected table.
157  void closeTable();
158 
159  // Closes the table corresponding to the given action's name.
160  void closeTable(QAction* which);
161 
162  // Closes all opened tables.
163  void closeAll();
164 
165  // Closes all currently opened tables and closes the window.
166  void closeAllAndExit();
167 
168  void showVersion();
169 
170  // Connects with TBBrowser::tableClosed() signal. Updates dynamic menus
171  // as necessary.
172  void tableClosed(casacore::String name);
173 
174  // Slot for when the tab is changed in the browser. Updates all necessary
175  // menus.
176  void tabChanged(int tableIndex);
177 
178  // Shows or hides the column on the current table that corresponds to
179  // the name of the given action.
180  void viewColumn(QAction* which);
181 
182  // Updates the column menu to indicate that the given column has been
183  // shown/hidden.
184  void columnHidden(int index, bool hidden);
185 
186  // Updates display to indicate the last action performed.
187  void actionPerformed(TBAction* action);
188 
189  // Updates display to indicate that the last action was undone.
190  void actionUndone();
191 
192  // Update display to indicate that the last undone action was redone.
193  void actionRedone();
194 
195  // Undoes the last performed action. See TBBrowser::undoAction().
196  void undoAction();
197 
198  // Redoes the last undone action. See TBBrowser::redoAction().
199  void redoAction();
200 
201  // Enters the currently selected table into editing mode.
202  void editCurrentTable();
203 
204  // Enters the table corresponding to the given edit action into editing
205  // mode.
206  void editTable(QAction* action);
207 
208  // Exports the current table to VOTable format. See
209  // TBBrowser::exportVOTable().
210  void exportVOTable();
211 
212  // Reenables menus after a task thread has completed.
213  void threadFinished();
214 
215  // Opens a new TBValidityChecker widget.
216  void checkValidity();
217 
218  // Opens a new TBPlotter window.
219  void plot2D();
220 
221  // Shows all the columns in the currently selected table.
222  void showAllColumns();
223 
224  // Hides all the columns in the currently selected table.
225  void hideAllColumns();
226 
227  // Opens widget to enter filter rules for the current table. See
228  // TBBrowser::filterOnFields().
229  void filterOnFields();
230 
231  // Clears the current filter on the current table. See
232  // TBBrowser::clearFilterOnFields().
233  void clearFilterOnFields();
234 
235  // Enables the "clear filter" action.
236  void filterRuleAvailable(int i);
237 
238  // Disables the "clear filter" action.
239  void filterRuleCleared(int i);
240 
241  // Opens widget to enter search rules for the current table. See
242  // TBBrowser::find().
243  void find();
244 
245  // Searches for the next row matching the search rule for the current
246  // table. See TBBrowser::findNext().
247  void findNext();
248 
249  // Searches for the previous row matching the search rule for the current
250  // table. See TBBrowser::findPrev().
251  void findPrev();
252 
253  // Slot for when the current table has a find rule associated with it.
254  void findRuleAvailable();
255 
256  // Slot for when a sort has been entered for the current table.
257  void sortEntered();
258 
259  // Slot for when a sort has been cleared for the current table.
260  void sortCleared();
261 
262  // Displays table information for the currently selected table.
263  void viewTableInfo();
264 
265  // Formats the field with the name in the given QAction.
266  void formatDisplay(QAction* which);
267 
268  // Opens the help window. See TBHelp.
269  void openHelp();
270 
271  // Shows an insert rows dialog.
272  void insertRows();
273 
274  // Shows a delete rows dialog.
275  void deleteRows();
276 
277  // Shows a sort dialog. See TBSorter.
278  void sort();
279 
280  // Clears the current sort.
281  void clearSort();
282 
283  // casacore::Sort the current table with the given order. See TBBrowser::sort().
284  void sort(std::vector<std::pair<casacore::String, bool> >& sort);
285 
286  // Allows the user to edit table options. See TBOptions.
287  void options();
288 
289  // Applies the user-provided options and deletes the TBOptions widget.
290  void saveOptions(TBOptions* opt);
291 };
292 
293 }
294 
295 #endif /* TBMAIN_H_ */
static const unsigned int DEFAULT_SELECT_NUM
The default number of rows to load from the table at a time.
Definition: TBConstants.h:168
void find()
Opens widget to enter search rules for the current table.
TBBrowser browser
Browser object.
Definition: TBMain.qo.h:86
void tableOpened(casacore::String name, casacore::String fullpath)
Connects with TBBrowser::tableOpened() signal.
Widget to edit the browsing options.
Definition: TBOptions.qo.h:50
void redoAction()
Redoes the last undone action.
void editCurrentTable()
Enters the currently selected table into editing mode.
void sort()
Shows a sort dialog.
void clearFilterOnFields()
Clears the current filter on the current table.
void plot2D()
Opens a new TBPlotter window.
void tabChanged(int tableIndex)
Slot for when the tab is changed in the browser.
void openTable()
Opens a filechooser dialog to allow the user to open a table.
void showVersion()
void findNext()
Searches for the next row matching the search rule for the current table.
void closeEvent(QCloseEvent *event)
Catches a close event for the window.
void findRuleAvailable()
Slot for when the current table has a find rule associated with it.
QAction * separator
Separator added in the Edit menu before the Options command.
Definition: TBMain.qo.h:107
Browser widget for managing opened tables.
Definition: TBBrowser.qo.h:63
Main window which is mainly responsible for menu actions.
Definition: TBMain.qo.h:55
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
void undoAction()
Undoes the last performed action.
void filterOnFields()
Opens widget to enter filter rules for the current table.
void showAllColumns()
Shows all the columns in the currently selected table.
void enableMenus(bool en)
Calls setEnabled() on all menus with the given parameter.
void closeAllAndExit()
Closes all currently opened tables and closes the window.
void actionPerformed(TBAction *action)
Updates display to indicate the last action performed.
void saveOptions(TBOptions *opt)
Applies the user-provided options and deletes the TBOptions widget.
QMenu * editTablesMenu
Edit menu that lists all currently opened tables.
Definition: TBMain.qo.h:99
void hideAllColumns()
Hides all the columns in the currently selected table.
void closeTable()
void openTableWithOptions();
QToolBar * viewBar
Toolbar holding &quot;view&quot;-related menu commands.
Definition: TBMain.qo.h:120
void sortEntered()
Slot for when a sort has been entered for the current table.
void filterRuleAvailable(int i)
Enables the &quot;clear filter&quot; action.
bool saveView
Indicates whether the TBMain should save the current view on close or not.
Definition: TBMain.qo.h:127
QToolBar * fileBar
Toolbar holding &quot;file&quot;-related menu commands.
Definition: TBMain.qo.h:114
bool waiting
Indicates whether the main window is waiting for some other task to complete or not.
Definition: TBMain.qo.h:104
void columnHidden(int index, bool hidden)
Updates the column menu to indicate that the given column has been shown/hidden.
QToolBar * editBar
Toolbar holding &quot;edit&quot;-related menu commands.
Definition: TBMain.qo.h:117
void exportVOTable()
Exports the current table to VOTable format.
void formatDisplay(QAction *which)
Formats the field with the name in the given QAction.
void options()
Allows the user to edit table options.
void insertRows()
Shows an insert rows dialog.
QMenu * columnsMenu
Columns menu that lists the table fields in the currently selected table.
Definition: TBMain.qo.h:96
void findPrev()
Searches for the previous row matching the search rule for the current table.
TBMain()
Default Constructor.
void deleteRows()
Shows a delete rows dialog.
void filterRuleCleared(int i)
Disables the &quot;clear filter&quot; action.
void setupKeyboardShortcuts()
Sets up the keyboard shortcuts.
void clearSort()
Clears the current sort.
Collection of table backend and display tabs.
void openHelp()
Opens the help window.
void actionRedone()
Update display to indicate that the last undone action was redone.
void viewColumn(QAction *which)
Shows or hides the column on the current table that corresponds to the name of the given action...
QMenu * closeMenu
Close menu that lists all currently opened tables.
Definition: TBMain.qo.h:92
void sortCleared()
Slot for when a sort has been cleared for the current table.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
void closeAll()
Closes all opened tables.
void actionUndone()
Updates display to indicate that the last action was undone.
void tableClosed(casacore::String name)
Connects with TBBrowser::tableClosed() signal.
void threadFinished()
Reenables menus after a task thread has completed.
void setup()
Sets up GUI components and signal/slot connections.
void openTaQL()
Opens a TBTaQL dialog to allow the user to open a table using a TaQL command.
void viewTableInfo()
Displays table information for the currently selected table.
void editTable(TBTableTabs *table, bool edit)
Turns on/off editing, if write lock is available, on the given table.
QToolBar * toolBar
Toolbar holding &quot;tool&quot;-related menu commands.
Definition: TBMain.qo.h:123
QMenu * formatMenu
casacore::Format menu that lists the table fields in the currently selected table.
Definition: TBMain.qo.h:111
Parameters to indicate what driver should be used for the table backend.
Definition: TBTable.h:62
Abstract parent class of any action that can be performed.
Definition: TBAction.h:54
void checkValidity()
Opens a new TBValidityChecker widget.
void closeTableTriggered(casacore::String name)
This signal is emitted when a close menu command is given with a table name.
QStatusBar * statusBar
The window&#39;s status bar.
Definition: TBMain.qo.h:89