00001 /*********************************************************************** 00002 * * 00003 * MuViNo - ViTooKi Video Annotation Tool * 00004 * * 00005 * title: SegmentSlider.hpp * 00006 * * 00007 * $Id: SegmentSlider_8hpp-source.html,v 1.1 2004/09/27 07:24:51 mtaschwer Exp $ 00008 * * 00009 * ITEC institute of the University of Klagenfurt (Austria) * 00010 * http://www.itec.uni-klu.ac.at * 00011 * * 00012 * * 00013 * For more information visit the ViTooKi homepage: * 00014 * http://ViTooKi.sourceforge.net * 00015 * vitooki-user@lists.sourceforge.net * 00016 * vitooki-devel@lists.sourceforge.net * 00017 * * 00018 * This file is part of ViTooKi, a free video toolkit. * 00019 * ViTooKi is free software; you can redistribute it and/or * 00020 * modify it under the terms of the GNU General Public License * 00021 * as published by the Free Software Foundation; either version 2 * 00022 * of the License, or (at your option) any later version. * 00023 * * 00024 * This program is distributed in the hope that it will be useful, * 00025 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00026 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00027 * GNU General Public License for more details. * 00028 * * 00029 * You should have received a copy of the GNU General Public License * 00030 * along with this program; if not, write to the Free Software * 00031 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * 00032 * MA 02111-1307, USA. * 00033 * * 00034 ***********************************************************************/ 00035 00036 #ifndef _SEGMENT_SLIDER_HPP_ 00037 #define _SEGMENT_SLIDER_HPP_ 00038 00043 #include <list> 00044 #include <qslider.h> 00045 00046 #include "MP7Time.hpp" 00047 #include "MP7VideoSegment.hpp" 00048 00049 class QButton; 00050 class QFrame; 00051 class QSpinBox; 00052 00058 class SegmentSlider : public QSlider 00059 { 00060 Q_OBJECT 00061 00062 public: 00066 SegmentSlider(QWidget *parent, const char *name = NULL); 00067 00069 ~SegmentSlider(); 00070 00078 void setSegment(const MP7VideoSegment &segment, bool emitSignal = true); 00079 00081 MP7VideoSegment getSegment() const { return segment; } 00082 00084 void setTitleLabel(QLabel *label); 00085 00087 void setStartTimeLabel(QLabel *label); 00088 00090 void setEndTimeLabel(QLabel *label); 00091 00093 void setLevelSpinBox(QSpinBox *spinbox); 00094 00096 void setPrevSiblingButton(QButton *button); 00097 00099 void setNextSiblingButton(QButton *button); 00100 00105 void enableSegmentZooming(bool on); 00106 00107 public slots: 00113 void editSegment(); 00114 00119 void removeSegment(); 00120 00126 void segmentLevelChange(int level); 00127 00129 void setSliderFromMediaTime(const MP7Time &time); 00130 00134 void updateSegmentDisplay(); 00135 00140 void gotoPrevSibling(); 00141 00146 void gotoNextSibling(); 00147 00148 signals: 00152 void segmentChanged(MP7ListViewItem *segmentRoot); 00153 00157 void sliderMoved(const MP7Time &time); 00158 00159 protected: 00166 void setMarker(const MP7VideoSegment &subsegment); 00167 00169 void removeMarker(int value); 00170 00172 void removeMarker(const MP7Time &time); 00173 00177 void repositionMarkers(); 00178 00180 int timeToValue(const MP7Time &time) const; 00181 00183 MP7Time valueToTime(int value) const; 00184 00186 int durationToValue(const MP7Time &time) const; 00187 00189 virtual void resizeEvent(QResizeEvent *e); 00190 00197 virtual void mouseDoubleClickEvent (QMouseEvent *e); 00198 00199 protected slots: 00202 void emitSliderMovedSignal(); 00203 00204 private: 00216 struct marker { 00217 int value; 00218 int length; 00219 QFrame *qframe; 00220 QString segmentTip; 00221 QRect rect; 00222 MP7VideoSegment segment; 00223 }; 00224 00226 std::list<marker> markers; 00227 00229 MP7VideoSegment segment; 00230 00234 MP7Time mediaTime; 00235 00237 QLabel *titleLabel; 00238 00240 QLabel *startTimeLabel; 00241 00243 QLabel *endTimeLabel; 00244 00246 QSpinBox *levelSpinBox; 00247 00249 QButton *prevSiblingButton; 00250 00252 QButton *nextSiblingButton; 00253 00255 bool segmentZooming; 00256 }; 00257 00258 #endif /* _SEGMENT_SLIDER_HPP_ */