casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
ColorSummaryWidget.qo.h
Go to the documentation of this file.
00001 //# Copyright (C) 2005
00002 //# Associated Universities, Inc. Washington DC, USA.
00003 //#
00004 //# This library is free software; you can redistribute it and/or modify it
00005 //# under the terms of the GNU Library General Public License as published by
00006 //# the Free Software Foundation; either version 2 of the License, or (at your
00007 //# option) any later version.
00008 //#
00009 //# This library is distributed in the hope that it will be useful, but WITHOUT
00010 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00012 //# License for more details.
00013 //#
00014 //# You should have received a copy of the GNU Library General Public License
00015 //# along with this library; if not, write to the Free Software Foundation,
00016 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00017 //#
00018 //# Correspondence concerning AIPS++ should be addressed as follows:
00019 //#        Internet email: aips2-request@nrao.edu.
00020 //#        Postal address: AIPS++ Project Office
00021 //#                        National Radio Astronomy Observatory
00022 //#                        520 Edgemont Road
00023 //#                        Charlottesville, VA 22903-2475 USA
00024 //#
00025 
00026 #ifndef COLOR_SUMMARYWIDGET_QO_H
00027 #define COLOR_SUMMARYWIDGET_QO_H
00028 
00029 #include <QtGui/QWidget>
00030 #include <QSettings>
00031 #include <display/QtPlotter/ColorSummaryWidget.ui.h>
00032 
00033 namespace casa {
00034 
00035 class QtCanvas;
00036 
00037 class ColorSummaryWidget : public QDialog
00038 {
00039     Q_OBJECT
00040 
00041 public:
00042     ColorSummaryWidget(QWidget *parent = 0);
00043     ~ColorSummaryWidget();
00044     void setColorCanvas( QtCanvas* colorCanvas );
00045 
00046 private slots:
00047 
00048         //Methods to add colors in various categories
00049         void addColorProfile();
00050         void addColorFit();
00051         void addColorFitSummary();
00052         void channelLineColorChanged();
00053         void molecularLineColorChanged();
00054         void zoomRectColorChanged();
00055         void initialGaussianEstimateColorChanged();
00056 
00057         //Methods to remove colors in various categories
00058         void removeColorProfile();
00059         void removeColorFit();
00060         void removeColorFitSummary();
00061 
00062         //User changed to a different color scheme (traditional,
00063         //alternative, custom, etc)
00064         void colorSchemeChanged();
00065 
00066         //Stores any changes to the colors used by the application
00067         //before closing the dialog.
00068         void reject();
00069         void accept();
00070 
00071 private:
00072         void addColor( QListWidget* list );
00073         void removeColor( QListWidget* list );
00074         void initializeColors();
00075         void addColorListItem( QListWidget* list, const QColor& listColor );
00076         void readCustomColor( QSettings& settings, const QString& countKey,
00077                         const QString& baseLookup, QList<QString>& list );
00078         void populateColorList( const QList<QString>& colors, QListWidget* list );
00079         void copyViewList(QListWidget* listWidget, QList<QString>& canvasList);
00080         void copyViewLists();
00081         void initializePresetColors();
00082         void initializeUserColors();
00083         void populateColorLists();
00084         void clearColorLists();
00085         void registerColorChange();
00086         void clearColorChange();
00087         void pixelCanvasColorChange();
00088         void persistColorList( QSettings& settings, QListWidget* list,
00089                         const QString& baseStr, const QString& countStr );
00090         void persist();
00091         void setLabelColor( QLabel* label, QString colorName  );
00092 
00093     Ui::ColorSummaryWidget ui;
00094     QtCanvas* pixelCanvas;
00095     QList<QString> mainCurveColorList;
00096     QList<QString> fitCurveColorList;
00097     QList<QString> fitSummaryCurveColorList;
00098     QList<QString>  traditionalCurveColorList;
00099     QList<QString> customMainList;
00100     QList<QString> customFitList;
00101     QList<QString> customFitSummaryList;
00102     QColor channelLineColor;
00103     QColor zoomRectColor;
00104     QColor molecularLineColor;
00105     QColor initialGaussianEstimateColor;
00106     enum ColorCategory {MAIN_COLOR, FIT_COLOR, SUMMARY_FIT_COLOR, END_COLOR_CATEGORY };
00107     enum SchemeCategory {TRADITIONAL,ALTERNATIVE, CUSTOM };
00108 
00109     static const QString CUSTOM_PROFILE_COLOR;
00110     static const QString CUSTOM_FIT_COLOR;
00111     static const QString CUSTOM_SUMMARY_COLOR;
00112     static const QString CUSTOM_PROFILE_COLOR_COUNT;
00113     static const QString CUSTOM_FIT_COLOR_COUNT;
00114     static const QString CUSTOM_SUMMARY_COLOR_COUNT;
00115     static const QString COLOR_SCHEME_PREFERENCE;
00116     static const QString CHANNEL_LINE_COLOR;
00117     static const QString INITIAL_GAUSSIAN_ESTIMATE_COLOR;
00118     static const QString MOLECULAR_LINE_COLOR;
00119     static const QString ZOOM_RECT_COLOR;
00120 
00121     bool traditionalChange;
00122     bool alternativeChange;
00123 };
00124 }
00125 
00126 #endif // COLORSUMMARYWIDGET_Q0_H