casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
AnimatorHolder.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 #ifndef ANIMATORHOLDER_QO_H
00026 #define ANIMATORHOLDER_QO_H
00027 
00028 #include <QtGui/QWidget>
00029 #include <display/QtViewer/AnimatorHolder.ui.h>
00030 #include <display/QtViewer/AnimatorWidget.qo.h>
00031 namespace casa {
00032 
00037 class AnimatorHolder : public QWidget
00038 {
00039     Q_OBJECT
00040 
00041 public:
00042     const static bool BLINK_MODE;
00043     const static bool NORMAL_MODE;
00044     AnimatorHolder(QWidget *parent = 0);
00045     void setFrameInformation( bool mode, int frm, int len );
00046     void setRateInformation( bool mode, int minr, int maxr, int rate );
00047     void setModeEnabled( int count );
00048     void setChannelModeEnabled( int count);
00049     int getRate( bool mode ) const;
00050     int getLowerBoundChannel() const;
00051     int getUpperBoundChannel() const;
00052     ~AnimatorHolder();
00053 
00054 signals:
00055         void goTo(int frame);
00056         void frameNumberEdited( int frame );
00057         void channelSelect( int channel );
00058         void movieChannels( int currentFrame, bool direction, int stepSize, int frameStart, int frameEnd );
00059         void stopMovie();
00060         void setRate(int frame);
00061         void toStart();
00062         void revStep();
00063         void revPlay();
00064         void stop();
00065         void fwdStep();
00066         void fwdPlay();
00067         void toEnd();
00068         void setMode( bool mode );
00069         void lowerBoundAnimatorImageChanged( int );
00070         void upperBoundAnimatorImageChanged(int);
00071         void stepSizeAnimatorImageChanged(int);
00072         void lowerBoundAnimatorChannelChanged( int );
00073         void upperBoundAnimatorChannelChanged(int);
00074         void stepSizeAnimatorChannelChanged(int);
00075 
00076 private slots:
00077         void goToChannel(int frame);
00078         void setRateChannel(int frame);
00079         void toStartChannel();
00080         void frameNumberEditedChannel( int frame );
00081         void revStepChannel();
00082         void fwdPlayChannel();
00083         void revPlayChannel();
00084         void stopChannel();
00085         void fwdStepChannel();
00086         void toEndChannel();
00087         void upperBoundChangedChannel(int);
00088         void lowerBoundChangedChannel(int);
00089         void stepSizeChangedChannel(int);
00090         void goToImage(int frame);
00091         void setRateImage(int frame);
00092         void toStartImage();
00093         void frameNumberEditedImage( int frame );
00094         void revStepImage();
00095         void revPlayImage();
00096         void stopImage();
00097         void fwdStepImage();
00098         void fwdPlayImage();
00099         void toEndImage();
00100         void lowerBoundChangedImage(int);
00101         void upperBoundChangedImage(int);
00102         void stepSizeChangedImage(int);
00103         void modeChange();
00104 
00105 private:
00106         void initChannel();
00107         void initImage();
00108         bool addChannelGroupBox();
00109         void addImageGroupBox();
00110         void removeChannelGroupBox();
00111         bool removeImageGroupBox();
00112         void setHeightFixed();
00113         int getAnimationCount() const;
00114         void addRemoveChannelAnimatorBasedOnFrameCount();
00115 
00116         enum Mode {CHANNEL_MODE, IMAGE_MODE, CHANNEL_IMAGES_MODE, END_MODE };
00117         void modeChanged(Mode mode );
00118         void changePalette( QGroupBox* box, QColor color );
00119         void emitMovieChannels( bool direction );
00120         void setSelected( bool mode );
00121 
00122         //Because the user can switch between image and channel mode by
00123         //just pressing the play button, there must be a way to turn a previous
00124         //play off if one was running.  The following two methods do that.
00125         void stopImagePlay();
00126         void stopChannelPlay();
00127 
00128         Mode previousMode;
00129     Ui::AnimatorHolder ui;
00130     AnimatorWidget* animatorChannel;
00131     AnimatorWidget* animatorImage;
00132     QColor selectedColor;
00133     QColor backgroundColor;
00134 
00135 };
00136 }
00137 #endif // ANIMATORHOLDER_QO_H