extended_panels.hpp 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. /*****************************************************************************
  2. * extended_panels.hpp : Exentended Panels
  3. ****************************************************************************
  4. * Copyright (C) 2006 the VideoLAN team
  5. * $Id$
  6. *
  7. * Authors: Clément Stenac <zorglub@videolan.org>
  8. * Antoine Cellerier <dionoea at videolan dot org>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  23. *****************************************************************************/
  24. #ifndef VLC_QT_EXTENDED_PANELS_HPP_
  25. #define VLC_QT_EXTENDED_PANELS_HPP_
  26. #ifdef HAVE_CONFIG_H
  27. # include "config.h"
  28. #endif
  29. #include <vlc_common.h>
  30. #include "qt.hpp"
  31. #include "ui/equalizer.h"
  32. #include "ui/video_effects.h"
  33. #include <QTabWidget>
  34. #define BANDS 10
  35. class QSignalMapper;
  36. class ExtVideo: public QObject
  37. {
  38. Q_OBJECT
  39. friend class ExtendedDialog;
  40. public:
  41. ExtVideo( struct intf_thread_t *, QTabWidget * );
  42. static void setPostprocessing( struct intf_thread_t *, int q);
  43. static int getPostprocessing( struct intf_thread_t *p_intf);
  44. private:
  45. Ui::ExtVideoWidget ui;
  46. QSignalMapper* filterMapper;
  47. intf_thread_t *p_intf;
  48. void initComboBoxItems( QObject* );
  49. void setWidgetValue( QObject* );
  50. void clean();
  51. static void setFilterOption( struct intf_thread_t *, const char *psz_module, const char *psz_option, int, double, QString );
  52. private slots:
  53. void updateFilters();
  54. void updateFilterOptions();
  55. void cropChange();
  56. void browseLogo();
  57. void browseEraseFile();
  58. };
  59. class ExtV4l2 : public QWidget
  60. {
  61. Q_OBJECT
  62. public:
  63. ExtV4l2( intf_thread_t *, QWidget * );
  64. void showEvent( QShowEvent *event ) Q_DECL_OVERRIDE;
  65. private:
  66. intf_thread_t *p_intf;
  67. QGroupBox *box;
  68. QLabel *help;
  69. private slots:
  70. void Refresh( void );
  71. void ValueChange( int value );
  72. void ValueChange( bool value );
  73. };
  74. class FilterSliderData : public QObject
  75. {
  76. Q_OBJECT
  77. public:
  78. typedef struct
  79. {
  80. QString name;
  81. QString descs;
  82. QString units;
  83. float f_min; // min
  84. float f_max; // max
  85. float f_value; // value
  86. float f_resolution; // resolution
  87. float f_visual_multiplier; // only for display (f_value *)
  88. } slider_data_t;
  89. FilterSliderData( QObject *parent, intf_thread_t *p_intf,
  90. QSlider *slider,
  91. QLabel *valueLabel, QLabel *nameLabel,
  92. const slider_data_t *p_data );
  93. void setValue( float f );
  94. protected:
  95. FilterSliderData( QObject *parent, QSlider *slider );
  96. virtual float initialValue();
  97. QSlider *slider;
  98. QLabel *valueLabel;
  99. QLabel *nameLabel;
  100. const slider_data_t *p_data;
  101. intf_thread_t *p_intf;
  102. bool b_save_to_config;
  103. public slots:
  104. virtual void onValueChanged( int i ) const;
  105. virtual void updateText( int i );
  106. virtual void writeToConfig() const;
  107. void setSaveToConfig( bool );
  108. };
  109. class AudioFilterControlWidget : public QWidget
  110. {
  111. Q_OBJECT
  112. public:
  113. AudioFilterControlWidget( intf_thread_t *, QWidget *, const char *name );
  114. virtual ~AudioFilterControlWidget();
  115. protected:
  116. virtual void build();
  117. QVector<FilterSliderData::slider_data_t> controls;
  118. QVector<FilterSliderData *> sliderDatas;
  119. QGroupBox *slidersBox;
  120. intf_thread_t *p_intf;
  121. QString name; // filter's module name
  122. int i_smallfont;
  123. protected slots:
  124. void enable( bool ) const;
  125. virtual void setSaveToConfig( bool );
  126. };
  127. class EqualizerSliderData : public FilterSliderData
  128. {
  129. Q_OBJECT
  130. public:
  131. EqualizerSliderData( QObject *parent, intf_thread_t *p_intf,
  132. QSlider *slider,
  133. QLabel *valueLabel, QLabel *nameLabel,
  134. const slider_data_t *p_data, int index );
  135. protected:
  136. float initialValue() Q_DECL_OVERRIDE;
  137. int index;
  138. QStringList getBandsFromAout() const;
  139. public slots:
  140. void onValueChanged( int i ) const Q_DECL_OVERRIDE;
  141. void writeToConfig() const Q_DECL_OVERRIDE;
  142. };
  143. class Equalizer: public AudioFilterControlWidget
  144. {
  145. Q_OBJECT
  146. public:
  147. Equalizer( intf_thread_t *, QWidget * );
  148. protected:
  149. void build() Q_DECL_OVERRIDE;
  150. protected slots:
  151. void setSaveToConfig( bool ) Q_DECL_OVERRIDE;
  152. private:
  153. FilterSliderData *preamp;
  154. FilterSliderData::slider_data_t preamp_values;
  155. private slots:
  156. void setCorePreset( int );
  157. void enable2Pass( bool ) const;
  158. };
  159. class Compressor: public AudioFilterControlWidget
  160. {
  161. Q_OBJECT
  162. public:
  163. Compressor( intf_thread_t *, QWidget * );
  164. };
  165. class Spatializer: public AudioFilterControlWidget
  166. {
  167. Q_OBJECT
  168. public:
  169. Spatializer( intf_thread_t *, QWidget * );
  170. };
  171. class SyncWidget : public QWidget
  172. {
  173. Q_OBJECT
  174. public:
  175. SyncWidget( QWidget * );
  176. void setValue( double d );
  177. signals:
  178. void valueChanged( double );
  179. private slots:
  180. void valueChangedHandler( double d );
  181. private:
  182. QDoubleSpinBox spinBox;
  183. QLabel spinLabel;
  184. };
  185. class SyncControls : public QWidget
  186. {
  187. Q_OBJECT
  188. friend class ExtendedDialog;
  189. public:
  190. SyncControls( intf_thread_t *, QWidget * );
  191. virtual ~SyncControls();
  192. private:
  193. intf_thread_t *p_intf;
  194. SyncWidget *AVSpin;
  195. SyncWidget *subsSpin;
  196. QDoubleSpinBox *subSpeedSpin;
  197. QDoubleSpinBox *subDurationSpin;
  198. bool b_userAction;
  199. void clean();
  200. void initSubsDuration();
  201. void subsdelayClean();
  202. void subsdelaySetFactor( double );
  203. public slots:
  204. void update();
  205. private slots:
  206. void advanceAudio( double );
  207. void advanceSubs( double );
  208. void adjustSubsSpeed( double );
  209. void adjustSubsDuration( double );
  210. };
  211. #endif