Changeset 2e6b21143cb6747ed2cb62ec5a1f025dbd6ebb0b
- Timestamp:
- 23/09/06 15:16:33 (2 years ago)
- git-parent:
- Files:
-
- modules/gui/qt4/Modules.am (modified) (4 diffs)
- modules/gui/qt4/components/equalizer.cpp (deleted)
- modules/gui/qt4/components/equalizer.hpp (deleted)
- modules/gui/qt4/components/extended_panels.cpp (added)
- modules/gui/qt4/components/extended_panels.hpp (added)
- modules/gui/qt4/components/interface_widgets.cpp (modified) (3 diffs)
- modules/gui/qt4/components/interface_widgets.hpp (modified) (1 diff)
- modules/gui/qt4/dialogs/extended.cpp (modified) (1 diff)
- modules/gui/qt4/input_manager.cpp (modified) (3 diffs)
- modules/gui/qt4/input_manager.hpp (modified) (3 diffs)
- modules/gui/qt4/main_interface.cpp (modified) (18 diffs)
- modules/gui/qt4/main_interface.hpp (modified) (4 diffs)
- modules/gui/qt4/menus.cpp (modified) (5 diffs)
- modules/gui/qt4/menus.hpp (modified) (2 diffs)
- modules/gui/qt4/qt4.hpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/gui/qt4/Modules.am
r3dda115 r2e6b211 31 31 dialogs/extended \ 32 32 dialogs/interaction \ 33 components/e qualizer\33 components/extended_panels \ 34 34 components/infopanels \ 35 35 components/preferences_widgets \ … … 57 57 dialogs/prefs_dialog.moc.cpp \ 58 58 dialogs/interaction.moc.cpp \ 59 components/e qualizer.moc.cpp \59 components/extended_panels.moc.cpp \ 60 60 components/infopanels.moc.cpp \ 61 61 components/preferences_widgets.moc.cpp \ … … 103 103 dialogs/errors.cpp \ 104 104 dialogs/interaction.cpp \ 105 components/e qualizer.cpp \105 components/extended_panels.cpp \ 106 106 components/infopanels.cpp \ 107 107 components/preferences_widgets.cpp \ … … 131 131 dialogs/prefs_dialog.hpp \ 132 132 dialogs/interaction.hpp \ 133 components/e qualizer.hpp \133 components/extended_panels.hpp \ 134 134 components/infopanels.hpp \ 135 135 components/preferences_widgets.hpp \ modules/gui/qt4/components/interface_widgets.cpp
rd3a4dc8 r2e6b211 31 31 #include <vlc/vout.h> 32 32 33 #include <QLabel> 34 #include <QSpacerItem> 33 35 #include <QCursor> 34 36 #include <QPushButton> … … 155 157 layout->addWidget( prevButton ); 156 158 layout->addWidget( nextButton ); 159 160 layout->addItem( new QSpacerItem( 40,20, 161 QSizePolicy::Expanding, QSizePolicy::Minimum) ); 162 layout->addWidget( new QLabel( qtr("Current visualization:") ) ); 163 164 current = new QLabel( qtr( "None" ) ); 165 layout->addWidget( current ); 166 167 BUTTONACT( prevButton, prev() ); 168 BUTTONACT( nextButton, next() ); 169 157 170 setLayout( layout ); 158 171 setMaximumHeight( 35 ); … … 160 173 161 174 VisualSelector::~VisualSelector() 175 { 176 } 177 178 void VisualSelector::prev() 179 { 180 char *psz_new = aout_VisualPrev( p_intf ); 181 if( psz_new ) 182 { 183 current->setText( qfu( psz_new ) ); 184 free( psz_new ); 185 } 186 } 187 188 void VisualSelector::next() 189 { 190 char *psz_new = aout_VisualNext( p_intf ); 191 if( psz_new ) 192 { 193 current->setText( qfu( psz_new ) ); 194 free( psz_new ); 195 } 196 } 197 198 /********************************************************************** 199 * More controls 200 **********************************************************************/ 201 ControlsWidget::ControlsWidget( intf_thread_t *_p_i ) : 202 QFrame( NULL ), p_intf( _p_i ) 203 { 204 QHBoxLayout *layout = new QHBoxLayout( this ); 205 layout->setMargin( 0 ); 206 207 slowerButton = new QPushButton( "S" ); 208 BUTTON_SET_ACT( slowerButton, "S", qtr("Slower" ), slower() ); 209 layout->addWidget( slowerButton ); 210 slowerButton->setMaximumWidth( 35 ); 211 212 normalButton = new QPushButton( "N" ); 213 BUTTON_SET_ACT( normalButton, "N", qtr("Normal rate"), normal() ); 214 layout->addWidget( normalButton ); 215 normalButton->setMaximumWidth( 35 ); 216 217 fasterButton = new QPushButton( "F" ); 218 BUTTON_SET_ACT( fasterButton, "F", qtr("Faster" ), faster() ); 219 layout->addWidget( fasterButton ); 220 fasterButton->setMaximumWidth( 35 ); 221 222 layout->addItem( new QSpacerItem( 100,20, 223 QSizePolicy::Expanding, QSizePolicy::Minimum) ); 224 225 snapshotButton = new QPushButton( "S" ); 226 BUTTON_SET_ACT( snapshotButton, "S", qtr("Take a snapshot"), snapshot() ); 227 layout->addWidget( snapshotButton ); 228 snapshotButton->setMaximumWidth( 35 ); 229 230 fullscreenButton = new QPushButton( "F" ); 231 BUTTON_SET_ACT( fullscreenButton, "F", qtr("Fullscreen"), fullscreen() ); 232 layout->addWidget( fullscreenButton ); 233 fullscreenButton->setMaximumWidth( 35 ); 234 } 235 236 ControlsWidget::~ControlsWidget() 237 { 238 } 239 240 void ControlsWidget::enableInput( bool enable ) 241 { 242 slowerButton->setEnabled( enable ); 243 normalButton->setEnabled( enable ); 244 fasterButton->setEnabled( enable ); 245 } 246 void ControlsWidget::enableVideo( bool enable ) 247 { 248 snapshotButton->setEnabled( enable ); 249 fullscreenButton->setEnabled( enable ); 250 } 251 252 void ControlsWidget::slower() 253 { 254 THEMIM->getIM()->slower(); 255 } 256 257 void ControlsWidget::faster() 258 { 259 THEMIM->getIM()->faster(); 260 } 261 262 void ControlsWidget::normal() 263 { 264 THEMIM->getIM()->normalRate(); 265 } 266 267 void ControlsWidget::snapshot() 268 { 269 } 270 271 void ControlsWidget::fullscreen() 162 272 { 163 273 } modules/gui/qt4/components/interface_widgets.hpp
ra01c61f r2e6b211 90 90 private: 91 91 intf_thread_t *p_intf; 92 QLabel *current; 93 private slots: 94 void prev(); 95 void next(); 92 96 }; 97 98 class QPushButton; 99 class ControlsWidget : public QFrame 100 { 101 Q_OBJECT 102 public: 103 ControlsWidget( intf_thread_t *); 104 virtual ~ControlsWidget(); 105 void enableInput( bool ); 106 void enableVideo( bool ); 107 private: 108 intf_thread_t *p_intf; 109 QPushButton *slowerButton, *normalButton, *fasterButton; 110 QPushButton *fullscreenButton, *snapshotButton; 111 private slots: 112 void faster(); 113 void slower(); 114 void normal(); 115 void snapshot(); 116 void fullscreen(); 117 }; 118 93 119 94 120 /******************** Playlist Widgets ****************/ modules/gui/qt4/dialogs/extended.cpp
re69979b r2e6b211 27 27 #include "dialogs_provider.hpp" 28 28 #include "util/qvlcframe.hpp" 29 #include "components/e qualizer.hpp"29 #include "components/extended_panels.hpp" 30 30 #include "qt4.hpp" 31 31 modules/gui/qt4/input_manager.cpp
re69979b r2e6b211 56 56 if( p_input ) 57 57 { 58 vlc_value_t val; 59 var_Change( p_input, "video-es", VLC_VAR_CHOICESCOUNT, &val, NULL ); 60 b_has_video = val.i_int > 0; 61 var_Change( p_input, "audio-es", VLC_VAR_CHOICESCOUNT, &val, NULL ); 62 b_has_audio = val.i_int > 0; 58 63 var_AddCallback( p_input, "audio-es", ChangeAudio, this ); 59 64 var_AddCallback( p_input, "video-es", ChangeVideo, this ); … … 140 145 void InputManager::sliderUpdate( float new_pos ) 141 146 { 142 if( p_input && !p_input->b_die && !p_input->b_dead)147 if( hasInput() ) 143 148 var_SetFloat( p_input, "position", new_pos ); 144 149 } … … 160 165 var_Set( p_input, "state", state ); 161 166 emit statusChanged( state.i_int ); 167 } 168 169 void InputManager::slower() 170 { 171 if( hasInput() ) 172 var_SetVoid( p_input, "rate-slower" ); 173 } 174 175 void InputManager::faster() 176 { 177 if( hasInput() ) 178 var_SetVoid( p_input, "rate-faster" ); 179 } 180 181 void InputManager::normalRate() 182 { 183 if( hasInput() ) 184 var_SetInteger( p_input, "rate", INPUT_RATE_DEFAULT ); 162 185 } 163 186 modules/gui/qt4/input_manager.hpp
re45f26d r2e6b211 27 27 #include <QObject> 28 28 #include <vlc/vlc.h> 29 #include <vlc/input.h> 29 30 30 31 class InputManager : public QObject … … 36 37 37 38 void delInput(); 39 bool hasInput() { return p_input && !p_input->b_dead && !p_input->b_die; } 38 40 bool hasAudio() { return b_has_audio; } 39 41 bool hasVideo() { return b_has_video; } … … 49 51 void setInput( input_thread_t * ); ///< Our controlled input changed 50 52 void sliderUpdate( float ); ///< User dragged the slider. We get new pos 53 void slower(); 54 void faster(); 55 void normalRate(); 51 56 signals: 52 57 /// Send new position, new time and new length modules/gui/qt4/main_interface.cpp
ra01c61f r2e6b211 40 40 #include <vlc_keys.h> 41 41 #include <vlc/vout.h> 42 #include <aout_internal.h> 42 43 43 44 #ifdef WIN32 … … 49 50 #endif 50 51 51 #define BUTTON_SET( button, image, tooltip ) ui.button##Button->setText(""); \52 ui.button##Button->setIcon( QIcon( ":/pixmaps/"#image ) ); \53 ui.button##Button->setToolTip( tooltip );54 55 52 #define VISIBLE(i) (i && i->isVisible()) 56 53 … … 91 88 embeddedPlaylistWasActive = videoIsActive = false; 92 89 90 /* Fetch configuration from settings and vlc config */ 91 videoEmbeddedFlag = false; 92 if( config_GetInt( p_intf, "embedded-video" ) ) 93 videoEmbeddedFlag = true; 94 95 alwaysVideoFlag = false; 96 if( videoEmbeddedFlag && config_GetInt( p_intf, "qt-always-video" )) 97 alwaysVideoFlag = true; 98 99 playlistEmbeddedFlag = settings->value( "playlist-embedded", true ). 100 toBool(); 101 advControlsEnabled= settings->value( "adv-controls", false ).toBool(); 102 93 103 setWindowTitle( QString::fromUtf8( _("VLC media player") ) ); 94 104 handleMainUi( settings ); 95 105 96 QVLCMenu::createMenuBar( this, p_intf, playlistEmbeddedFlag ); 106 QVLCMenu::createMenuBar( this, p_intf, playlistEmbeddedFlag, 107 advControlsEnabled ); 97 108 98 109 /* Status bar */ … … 127 138 MainInterface::~MainInterface() 128 139 { 129 /// \todo Save everything 140 settings->setValue( "playlist-embedded", playlistEmbeddedFlag ); 141 settings->setValue( "adv-controls", advControlsEnabled ); 142 settings->setValue( "pos", pos() ); 143 settings->endGroup(); 144 delete settings; 130 145 p_intf->b_interaction = VLC_FALSE; 131 146 var_DelCallback( p_intf, "interaction", InteractCallback, this ); … … 145 160 ui.hboxLayout->insertWidget( 0, slider ); 146 161 147 BUTTON_SET( prev, previous.png, qtr( "Previous" ) ); 148 BUTTONACT( ui.prevButton, prev() ); 149 BUTTON_SET( next, next.png , qtr( "Next" ) ); 150 BUTTONACT( ui.nextButton, next() ); 151 BUTTON_SET( play, play.png , qtr( "Play" ) ); 152 BUTTONACT( ui.playButton, play() ); 153 BUTTON_SET( stop, stop.png , qtr( "Stop" ) ); 154 BUTTONACT( ui.stopButton, stop() ); 155 156 BUTTON_SET( visual, stop.png, qtr( "Audio visualizations" ) ); 157 BUTTONACT( ui.visualButton, visual() ); 162 BUTTON_SET_ACT_I( ui.prevButton, "" , previous.png, 163 qtr("Previous"), prev() ); 164 BUTTON_SET_ACT_I( ui.nextButton, "", next.png, qtr("Next"), next() ); 165 BUTTON_SET_ACT_I( ui.playButton, "", play.png, qtr("Play"), play() ); 166 BUTTON_SET_ACT_I( ui.stopButton, "", stop.png, qtr("Stop"), stop() ); 167 BUTTON_SET_ACT_I( ui.visualButton, "", stop.png, 168 qtr( "Audio visualizations" ), visual() ); 158 169 159 170 /* Volume */ … … 165 176 ui.volumeSlider->setFocusPolicy( Qt::NoFocus ); 166 177 167 /* Fetch configuration from settings and vlc config */ 168 videoEmbeddedFlag = false; 169 if( config_GetInt( p_intf, "embedded-video" ) ) 170 videoEmbeddedFlag = true; 171 172 alwaysVideoFlag = false; 173 if( videoEmbeddedFlag && config_GetInt( p_intf, "qt-always-video" )) 174 alwaysVideoFlag = true; 175 176 playlistEmbeddedFlag = true; 177 /// \todo fetch playlist settings 178 179 BUTTON_SET( playlist, volume-low.png, playlistEmbeddedFlag ? 180 qtr( "Show playlist" ) : 178 BUTTON_SET_IMG( ui.playlistButton, "" ,volume-low.png, 179 playlistEmbeddedFlag ? qtr( "Show playlist" ) : 181 180 qtr( "Open playlist" ) ); 182 181 BUTTONACT( ui.playlistButton, playlist() ); … … 186 185 187 186 addSize = QSize( ui.vboxLayout->margin() * 2, PREF_H ); 187 188 advControls = new ControlsWidget( p_intf ); 189 ui.vboxLayout->insertWidget( 0, advControls ); 190 advControls->updateGeometry(); 191 if( !advControlsEnabled ) advControls->hide(); 192 need_components_update = true; 188 193 189 194 visualSelector = new VisualSelector( p_intf ); … … 212 217 p_intf->pf_control_window = ::DoControl; 213 218 } 214 215 calculateInterfaceSize();216 resize( mainSize );217 218 219 setMinimumSize( PREF_W, addSize.height() ); 219 220 } … … 250 251 if( VISIBLE( visualSelector ) ) 251 252 height += visualSelector->height(); 252 253 fprintf( stderr, "Adv %p - visible %i\n", advControls, advControls->isVisible() ); 254 if( VISIBLE( advControls) ) 255 { 256 fprintf( stderr, "visible\n" ); 257 height += advControls->sizeHint().height(); 258 } 259 260 fprintf( stderr, "Adv height %i\n", advControls->sizeHint().height() ); 253 261 fprintf( stderr, "Setting to %ix%i\n", 254 262 width + addSize.width() , height + addSize.height() ); … … 266 274 e->size().height() - addSize.height() ); 267 275 videoWidget->updateGeometry(); 268 fprintf( stderr, "Video set to %ix%i\n", DS( videoWidget->widgetSize) );269 276 } 270 277 if( VISIBLE( playlistWidget ) ) … … 273 280 e->size().height() - addSize.height() ); 274 281 playlistWidget->updateGeometry(); 275 fprintf( stderr, "PL set to %ix%i\n",DS(playlistWidget->widgetSize ) );276 282 } 277 283 } … … 362 368 } 363 369 370 void MainInterface::advanced() 371 { 372 if( !VISIBLE( advControls ) ) 373 { 374 advControls->show(); 375 advControlsEnabled = true; 376 } 377 else 378 { 379 advControls->hide(); 380 advControlsEnabled = false; 381 } 382 doComponentsUpdate(); 383 } 384 364 385 void MainInterface::visual() 365 386 { … … 405 426 if( VISIBLE( playlistWidget) ) 406 427 { 407 fprintf( stderr, "hiding playlist\n" );408 428 playlistWidget->hide(); 409 429 if( videoIsActive ) … … 416 436 else 417 437 { 418 fprintf( stderr, "showing playlist\n" );419 438 playlistWidget->show(); 420 439 if( videoIsActive ) … … 449 468 450 469 menuBar()->clear(); 451 QVLCMenu::createMenuBar( this, p_intf, false );470 QVLCMenu::createMenuBar( this, p_intf, false, advControlsEnabled ); 452 471 453 472 if( videoIsActive ) … … 470 489 playlistEmbeddedFlag = true; 471 490 menuBar()->clear(); 472 QVLCMenu::createMenuBar(this, p_intf, true );491 QVLCMenu::createMenuBar(this, p_intf, true, advControlsEnabled ); 473 492 playlist(); 474 493 } … … 588 607 void MainInterface::updateOnTimer() 589 608 { 609 aout_instance_t *p_aout = (aout_instance_t *)vlc_object_find( p_intf, 610 VLC_OBJECT_AOUT, FIND_ANYWHERE ); 611 /* Todo: make this event-driven */ 612 if( p_aout ) 613 { 614 ui.visualButton->setEnabled( true ); 615 vlc_object_release( p_aout ); 616 } 617 else 618 ui.visualButton->setEnabled( false ); 619 620 /* And this too */ 621 advControls->enableInput( THEMIM->getIM()->hasInput() ); 622 advControls->enableVideo( THEMIM->getIM()->hasVideo() ); 623 590 624 if( p_intf->b_die ) 591 625 { … … 635 669 intf_dialog_args_t *p_arg = new intf_dialog_args_t; 636 670 p_arg->p_dialog = (interaction_dialog_t *)(new_val.p_address); 637 638 MainInterface *p_interface = (MainInterface*)param;639 671 DialogEvent *event = new DialogEvent( INTF_DIALOG_INTERACTION, 0, p_arg ); 640 672 QApplication::postEvent( THEDP, static_cast<QEvent*>(event) ); modules/gui/qt4/main_interface.hpp
ra01c61f r2e6b211 43 43 class VolumeClickHandler; 44 44 class VisualSelector; 45 class ControlsWidget; 45 46 46 47 class MainInterface : public QVLCMW … … 75 76 BackgroundWidget *bgWidget; 76 77 VisualSelector *visualSelector; 78 ControlsWidget *advControls; 77 79 PlaylistWidget *playlistWidget; 78 80 … … 80 82 bool videoEmbeddedFlag; 81 83 bool alwaysVideoFlag; 84 bool advControlsEnabled; 82 85 83 86 InputManager *main_input_manager; … … 102 105 void playlist(); 103 106 void visual(); 107 void advanced(); 104 108 void updateVolume( int sliderVolume ); 105 109 }; modules/gui/qt4/menus.cpp
ra01c61f r2e6b211 121 121 122 122 void QVLCMenu::createMenuBar( MainInterface *mi, intf_thread_t *p_intf, 123 bool playlist )123 bool playlist, bool adv_controls_enabled ) 124 124 { 125 125 QMenuBar *bar = mi->menuBar(); 126 BAR_ADD( FileMenu(), qtr(" File") );126 BAR_ADD( FileMenu(), qtr("Media") ); 127 127 if( playlist ) 128 128 { 129 129 BAR_ADD( PlaylistMenu( mi,p_intf ), qtr("Playlist" ) ); 130 130 } 131 BAR_ADD( ToolsMenu( p_intf ), qtr("Tools") );131 BAR_ADD( ToolsMenu( p_intf, mi, adv_controls_enabled ), qtr("Tools") ); 132 132 BAR_DADD( VideoMenu( p_intf, NULL ), qtr("Video"), 1 ); 133 133 BAR_DADD( AudioMenu( p_intf, NULL ), qtr("Audio"), 2 ); … … 162 162 } 163 163 164 QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf, bool with_intf ) 164 QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf, MainInterface *mi, 165 bool adv_controls_enabled, bool with_intf ) 165 166 { 166 167 QMenu *menu = new QMenu(); … … 170 171 intfmenu->setTitle( qtr("Interfaces" ) ); 171 172 menu->addMenu( intfmenu ); 172 /** \todo ADD EXT GUI HERE */173 173 menu->addSeparator(); 174 174 } … … 176 176 DP_SADD( qtr("Information") , "", "", streaminfoDialog() ); 177 177 DP_SADD( qtr("Bookmarks"), "", "", bookmarksDialog() ); 178 DP_SADD( qtr("Extended settings"), "","",extendedDialog() ); 179 if( mi ) 180 { 181 menu->addSeparator(); 182 QAction *adv = menu->addAction( qtr("Advanced controls" ), 183 mi, SLOT( advanced() ) ); 184 adv->setCheckable( true ); 185 if( adv_controls_enabled ) adv->setChecked( true ); 186 } 178 187 menu->addSeparator(); 179 188 DP_SADD( qtr("Preferences"), "", "", prefsDialog() ); 180 DP_SADD( qtr("Extended"), "","",extendedDialog() );181 189 return menu; 182 190 } … … 341 349 menu->addMenu( intfmenu ); \ 342 350 \ 343 QMenu *toolsmenu = ToolsMenu( p_intf, false ); \351 QMenu *toolsmenu = ToolsMenu( p_intf, NULL, false, false ); \ 344 352 toolsmenu->setTitle( qtr("Tools" ) ); \ 345 353 menu->addMenu( toolsmenu ); \ modules/gui/qt4/menus.hpp
ra01c61f r2e6b211 59 59 Q_OBJECT; 60 60 public: 61 static void createMenuBar( MainInterface *mi, intf_thread_t *, bool );61 static void createMenuBar( MainInterface *mi, intf_thread_t *, bool, bool ); 62 62 63 63 /* Menus */ … … 65 65 static QMenu *SDMenu( intf_thread_t * ); 66 66 static QMenu *PlaylistMenu( MainInterface *, intf_thread_t *); 67 static QMenu *ToolsMenu( intf_thread_t *, bool with_intf = true ); 67 static QMenu *ToolsMenu( intf_thread_t *, MainInterface *, bool, 68 bool with = true ); 68 69 static QMenu *NavigMenu( intf_thread_t * , QMenu * ); 69 70 static QMenu *VideoMenu( intf_thread_t * , QMenu * ); modules/gui/qt4/qt4.hpp
ra01c61f r2e6b211 63 63 #define ON_TIMEOUT( act ) CONNECT( THEDP->fixed_timer, timeout(), this, act ) 64 64 65 #define BUTTON_SET( button, text, tooltip ) \ 66 button->setText( text ); \ 67 button->setToolTip( tooltip ); 68 69 #define BUTTON_SET_ACT( button, text, tooltip, thisslot ) \ 70 BUTTON_SET( button, text, tooltip ); \ 71 BUTTONACT( button, thisslot ); 72 73 #define BUTTON_SET_IMG( button, text, image, tooltip ) \ 74 BUTTON_SET( button, text, tooltip ); \ 75 button->setIcon( QIcon( ":/pixmaps/"#image ) ); 76 77 #define BUTTON_SET_ACT_I( button, text, image, tooltip, thisslot ) \ 78 BUTTON_SET_IMG( button, text, image, tooltip ); \ 79 BUTTONACT( button, thisslot ); 80 65 81 static int DialogEvent_Type = QEvent::User + 1; 66 82 static int PLUndockEvent_Type = QEvent::User + 2;
