casa
$Rev:20696$
|
00001 //# Preferences.qo.h: dialog which allows user to set and reset viewer preferences 00002 //# Copyright (C) 2012 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 00028 #ifndef QTVIEWER_PREFERENCES_H_ 00029 #define QTVIEWER_PREFERENCES_H_ 00030 00031 #include <set> 00032 #include <string> 00033 #include <QSignalMapper> 00034 #include <QtGui/QDialog> 00035 #include <display/QtViewer/Preferences.ui.h> 00036 #include <display/Utilities/Lowlevel.h> 00037 00038 namespace casa { 00039 namespace viewer { 00040 00041 class Preferences : public QDialog, protected Ui::Preferences { 00042 Q_OBJECT 00043 public: 00044 Preferences( QWidget *parent=0 ); 00045 ~Preferences( ); 00046 00047 protected slots: 00048 void reset_edits( ); 00049 void cancel_edits( ); 00050 void apply_edits( ); 00051 00052 protected: 00053 void showEvent( QShowEvent* ); 00054 00055 private: 00056 typedef std::map<std::string,std::vector<std::string> > tokenized_type; 00057 typedef std::map<std::string,std::set<std::string> > branch_count_type; 00058 00059 void init( ); 00060 00061 // returns the number of configuration options... 00062 int tokenize( tokenized_type & ); 00063 // returns the number of root nodes... 00064 int countbranches( const tokenized_type &, branch_count_type & ); 00065 // calculate tree depth... 00066 int find_tree_depth( bool, const tokenized_type &, const branch_count_type & ); 00067 static const char *init_state[]; 00068 00069 QSignalMapper *sigmap; 00070 typedef std::map<std::string,QValidator*> validate_map_type; 00071 validate_map_type validate_map; 00072 00073 typedef std::map<std::string,std::string> rcvalues_type; 00074 typedef std::map<std::string,std::string> tooltips_type; 00075 typedef std::map<std::string,QLineEdit*> rcedits_type; 00076 // tool tips for leaves & nodes... 00077 tooltips_type tips; 00078 // initial viewer default values... 00079 rcvalues_type defaults; 00080 // rc values to edit boxes... 00081 rcedits_type edits; 00082 00083 const int init_fields; 00084 const int tip_offset; 00085 const int role_offset; 00086 const int default_offset; 00087 const int validate_offset; 00088 00089 // connection to rc file 00090 Casarc &rc; 00091 }; 00092 00093 } 00094 } 00095 00096 #endif 00097