TBKeywordsTab.qo.h

Go to the documentation of this file.
00001 //# TBKeywordsTab.qo.h: Widgets used to display table and field keywords.
00002 //# Copyright (C) 2005
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id: $
00027 #ifndef TBKEYWORDSTAB_H_
00028 #define TBKEYWORDSTAB_H_
00029 
00030 #include <casaqt/QtBrowser/TBTableKeywordsTab.ui.h>
00031 #include <casaqt/QtBrowser/TBFieldKeywordsTab.ui.h>
00032 #include <casaqt/QtBrowser/TBNewKeyword.ui.h>
00033 
00034 #include <QtGui>
00035 
00036 #include <casa/BasicSL/String.h>
00037 
00038 namespace casa {
00039 
00040 //# Forward Declarations
00041 class TBTable;
00042 class TBTableTabs;
00043 class QCloseableWidget;
00044 class ProgressHelper;
00045 class TBTypes;
00046 class TBArrayPanel;
00047 
00048 class TBNewKeyword : public QDialog, Ui::NewKeyword {
00049     Q_OBJECT
00050 
00051 // <summary>
00052 // GUI for entering a new keyword.
00053 // <summary>
00054 //
00055 // <synopsis>
00056 // (Not Completed.)  A TBNewKeyword is a dialog that allows the user to enter a
00057 // new keyword.  The parent/caller is responsible for connecting the signal and
00058 // actually adding the new keyword.
00059 // </synopsis>
00060     
00061 public:
00062     // Constructor that takes an optional vector of fields for entering a new
00063         // field keyword.  If this vector is null, a table keyword is entered.
00064     TBNewKeyword(std::vector<String>* fields = NULL, QWidget* parent = NULL);
00065 
00066     ~TBNewKeyword();
00067 
00068 signals:
00069     // newKeyword is emitted when the user has entered a new keyword.  The
00070         // field index is -1 for a table keyword; otherwise it holds the index of
00071         // the field to which the keyword should be added.
00072     void newKeyword(int field, String name, String type, void* value);
00073 
00074 private:
00075     // Displayed data types.
00076     std::vector<String>* types;
00077 
00078     // Widget to enter the value based on the type.
00079     TBTypes* typesWidget;
00080 
00081 private slots:
00082     // Catches when the user changes the type and changes the types widget
00083         // accordingly.
00084     void typeChanged(int index);
00085 };
00086 
00087 // <summary>
00088 // Widget used to display table keywords.
00089 // <summary>
00090 //
00091 // <synopsis>
00092 // Table keywords are displayed in a QTableWidget which cannot be edited.
00093 // Double-clicking certain types of keywords has certain effects:
00094 // double-clicking a table keyword will open that subtable while
00095 // double-clicking an array will open the array in a side panel.
00096 // </synopsis>
00097 
00098 class TBTableKeywordsTab : public QWidget, Ui::TableKeywordsTab {
00099     Q_OBJECT
00100 
00101 public:
00102     // Constructor which takes pointers to the table backend.
00103     TBTableKeywordsTab(TBTableTabs* tt, TBTable* t);
00104 
00105     ~TBTableKeywordsTab();
00106 
00107     
00108     // Returns the table widget used to display the keywords.
00109     QTableWidget* getTableWidget();
00110 
00111     
00112     // Updates the QTableWidget with the new data that has been loaded into the
00113     // table backend.  If a ProgressHelper is provided, it will be updated
00114     // periodically with progress information.
00115     void updateTable(ProgressHelper* pp = NULL);
00116 
00117 public slots:
00118     // Clears whatever widget (if any) is currently being displayed in the side
00119         // panel.
00120     void clearWidgetInSplitter();
00121 
00122     // Show the given widget on the right side of the splitter.
00123     void showWidgetInSplitter(QWidget* widget);
00124     
00125 signals:
00126     // This signal is emitted when the right widget is closed.  The QWidget
00127         // points to the widget that was just closed.
00128     void rightWidgetClosed(QWidget* widget);
00129 
00130 private:
00131     // Useful pointers to table backend.
00132     TBTableTabs* ttabs;
00133     TBTable* table;
00134 
00135     // Flag on whether events generated by the QTableWidget are "genuine."
00136     bool update;
00137 
00138     // Side panel.
00139     QCloseableWidget* rightWidget;
00140     
00141     // Array panel.
00142     TBArrayPanel* arrayPanel;
00143 
00144 private slots:
00145     // Slot for when a keyword is double-clicked.
00146     void doubleClicked(int row, int col);
00147 
00148     // Slot for "Add Keyword" button.  (Not currently implemented.)
00149     void addKeyword();
00150 
00151     // Slot for "Edit Keyword" button.  (Not currently implemented.)
00152     void editKeyword();
00153 
00154     // Slot for "Remove Keyword" button.  (Not currently implemented.)
00155     void removeKeyword();
00156 
00157     // Slot for when a keyword is selected in the table.
00158     void cellSelected(int row);
00159 };
00160 
00161 // <summary>
00162 // Widget used to display field keywords.
00163 // <summary>
00164 //
00165 // <synopsis>
00166 // Field keywords are displayed in a QTreeWidget which cannot be edited.
00167 // Double-clicking certain types of keywords has certain effects:
00168 // double-clicking a table keyword will open that subtable while
00169 // double-clicking an array will open the array in a side panel.
00170 // </synopsis>
00171 
00172 class TBFieldKeywordsTab : public QWidget, Ui::FieldKeywordsTab {
00173     Q_OBJECT
00174 
00175 public:
00176     // Constructor which takes pointers to the table backend.
00177     TBFieldKeywordsTab(TBTableTabs* tt, TBTable* t);
00178 
00179     ~TBFieldKeywordsTab();
00180 
00181     
00182     // Returns the QTreeWidget in which the field keywords are displayed.
00183     QTreeWidget* getTreeWidget();
00184 
00185     
00186     // Updates the QTreeWidget with the new data that has been loaded into the
00187     // table backend.  If a ProgressHelper is provided, it will be updated
00188     // periodically with progress information.
00189     void updateTable(ProgressHelper* pp = NULL);
00190 
00191 public slots:
00192     // Clears whatever widget (if any) is currently being displayed in the side
00193         // panel.
00194     void clearWidgetInSplitter();
00195 
00196     // Show the given widget on the right side of the splitter.
00197     void showWidgetInSplitter(QWidget* widget);
00198     
00199 signals:
00200     // This signal is emitted when the right widget is closed.  The QWidget
00201         // points to the widget that was just closed.
00202     void rightWidgetClosed(QWidget* widget);
00203 
00204 private:
00205     // Useful pointers to the table backend.
00206     TBTableTabs* ttabs;
00207     TBTable* table;
00208 
00209     // Flag on whether events generated by the QTableWidget are "genuine."
00210     bool update;
00211 
00212     // Side panel.
00213     QCloseableWidget* rightWidget;
00214     
00215     // Array panel.
00216     TBArrayPanel* arrayPanel;
00217     
00218 private slots:
00219     // Slot for when a field keyword is double-clicked.
00220     void doubleClicked(QTreeWidgetItem* item, int col);
00221 };
00222 
00223 }
00224 
00225 #endif /* TBKEYWORDSTAB_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1