BookmarksDialog::BookmarksDialog( intf_thread_t *_p_intf ):QVLCFrame( _p_intf ) { setWindowFlags( Qt::Tool ); setWindowOpacity( config_GetFloat( p_intf, "qt-opacity" ) ); setWindowTitle( qtr( "Edit Bookmarks" ) ); setWindowRole( "vlc-bookmarks" ); QGridLayout *layout = new QGridLayout( this ); QPushButton *addButton = new QPushButton( qtr( "Create" ) ); addButton->setToolTip( qtr( "Create a new bookmark" ) ); QPushButton *delButton = new QPushButton( qtr( "Delete" ) ); delButton->setToolTip( qtr( "Delete the selected item" ) ); QPushButton *clearButton = new QPushButton( qtr( "Clear" ) ); clearButton->setToolTip( qtr( "Delete all the bookmarks" ) ); #if 0 QPushButton *extractButton = new QPushButton( qtr( "Extract" ) ); extractButton->setToolTip( qtr() ); #endif QPushButton *closeButton = new QPushButton( qtr( "&Close" ) ); bookmarksList = new QTreeWidget( this ); bookmarksList->setRootIsDecorated( false ); bookmarksList->setAlternatingRowColors( true ); bookmarksList->setSelectionMode( QAbstractItemView::ExtendedSelection ); bookmarksList->setSelectionBehavior( QAbstractItemView::SelectRows ); bookmarksList->setEditTriggers( QAbstractItemView::SelectedClicked ); bookmarksList->setColumnCount( 3 ); bookmarksList->resize( sizeHint() ); QStringList headerLabels; headerLabels << qtr( "Description" ); headerLabels << qtr( "Bytes" ); headerLabels << qtr( "Time" ); bookmarksList->setHeaderLabels( headerLabels ); layout->addWidget( addButton, 0, 0 ); layout->addWidget( delButton, 1, 0 ); layout->addWidget( clearButton, 2, 0 ); layout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding ), 4, 0 ); #if 0 layout->addWidget( extractButton, 5, 0 ); #endif layout->addWidget( bookmarksList, 0, 1, 6, 2); layout->setColumnStretch( 1, 1 ); layout->addWidget( closeButton, 7, 2 ); CONNECT( THEMIM->getIM(), bookmarksChanged(), this, update() ); CONNECT( bookmarksList, activated( QModelIndex ), this, activateItem( QModelIndex ) ); CONNECT( bookmarksList, itemChanged( QTreeWidgetItem*, int ), this, edit( QTreeWidgetItem*, int ) ); BUTTONACT( addButton, add() ); BUTTONACT( delButton, del() ); BUTTONACT( clearButton, clear() ); #if 0 BUTTONACT( extractButton, extract() ); #endif BUTTONACT( closeButton, close() ); readSettings( "Bookmarks", QSize( 435, 280 ) ); updateGeometry(); }
/** * Fourth Panel - Stats * Displays the Statistics for reading/streaming/encoding/displaying in a tree */ InputStatsPanel::InputStatsPanel( QWidget *parent ): QWidget( parent ) { QVBoxLayout *layout = new QVBoxLayout(this); QLabel *topLabel = new QLabel( qtr( "Current" " media / stream " "statistics") ); topLabel->setWordWrap( true ); layout->addWidget( topLabel, 0, 0 ); StatsTree = new QTreeWidget(this); StatsTree->setColumnCount( 3 ); StatsTree->setHeaderHidden( true ); #define CREATE_TREE_ITEM( itemName, itemText, itemValue, unit ) { \ itemName = \ new QTreeWidgetItem((QStringList () << itemText << itemValue << unit )); \ itemName->setTextAlignment( 1 , Qt::AlignRight ) ; } #define CREATE_CATEGORY( catName, itemText ) { \ CREATE_TREE_ITEM( catName, itemText , "", "" ); \ catName->setExpanded( true ); \ StatsTree->addTopLevelItem( catName ); } #define CREATE_AND_ADD_TO_CAT( itemName, itemText, itemValue, catName, unit ){ \ CREATE_TREE_ITEM( itemName, itemText, itemValue, unit ); \ catName->addChild( itemName ); } /* Create the main categories */ CREATE_CATEGORY( audio, qtr("Audio") ); CREATE_CATEGORY( video, qtr("Video") ); CREATE_CATEGORY( input, qtr("Input/Read") ); CREATE_CATEGORY( streaming, qtr("Output/Written/Sent") ); CREATE_AND_ADD_TO_CAT( read_media_stat, qtr("Media data size"), "0", input , "KiB" ); CREATE_AND_ADD_TO_CAT( input_bitrate_stat, qtr("Input bitrate"), "0", input, "kb/s" ); input_bitrate_graph = new QTreeWidgetItem(); input_bitrate_stat->addChild( input_bitrate_graph ); CREATE_AND_ADD_TO_CAT( demuxed_stat, qtr("Demuxed data size"), "0", input, "KiB") ; CREATE_AND_ADD_TO_CAT( stream_bitrate_stat, qtr("Content bitrate"), "0", input, "kb/s" ); CREATE_AND_ADD_TO_CAT( corrupted_stat, qtr("Discarded (corrupted)"), "0", input, "" ); CREATE_AND_ADD_TO_CAT( discontinuity_stat, qtr("Dropped (discontinued)"), "0", input, "" ); CREATE_AND_ADD_TO_CAT( vdecoded_stat, qtr("Decoded"), "0", video, qtr("blocks") ); CREATE_AND_ADD_TO_CAT( vdisplayed_stat, qtr("Displayed"), "0", video, qtr("frames") ); CREATE_AND_ADD_TO_CAT( vlost_frames_stat, qtr("Lost"), "0", video, qtr("frames") ); CREATE_AND_ADD_TO_CAT( send_stat, qtr("Sent"), "0", streaming, qtr("packets") ); CREATE_AND_ADD_TO_CAT( send_bytes_stat, qtr("Sent"), "0", streaming, "KiB" ); CREATE_AND_ADD_TO_CAT( send_bitrate_stat, qtr("Upstream rate"), "0", streaming, "kb/s" ); CREATE_AND_ADD_TO_CAT( adecoded_stat, qtr("Decoded"), "0", audio, qtr("blocks") ); CREATE_AND_ADD_TO_CAT( aplayed_stat, qtr("Played"), "0", audio, qtr("buffers") ); CREATE_AND_ADD_TO_CAT( alost_stat, qtr("Lost"), "0", audio, qtr("buffers") ); #undef CREATE_AND_ADD_TO_CAT #undef CREATE_CATEGORY #undef CREATE_TREE_ITEM input->setExpanded( true ); video->setExpanded( true ); streaming->setExpanded( true ); audio->setExpanded( true ); StatsTree->resizeColumnToContents( 0 ); StatsTree->setColumnWidth( 1 , 200 ); layout->addWidget(StatsTree, 4, 0 ); statsView = new VLCStatsView( this ); statsView->setFrameStyle( QFrame::NoFrame ); statsView->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ); input_bitrate_graph->setSizeHint( 1, QSize(0, 100) ); QString graphlabel = QString( "<font style=\"color:#ff8c00\">%1</font><br/>%2" ) .arg( qtr("Last 60 seconds") ) .arg( qtr("Overall") ); StatsTree->setItemWidget( input_bitrate_graph, 0, new QLabel( graphlabel ) ); StatsTree->setItemWidget( input_bitrate_graph, 1, statsView ); }
/** * Play Button **/ void PlayButton::updateButtonIcons( bool b_playing ) { setIcon( b_playing ? QIcon( ":/toolbar/pause_b" ) : QIcon( ":/toolbar/play_b" ) ); setToolTip( b_playing ? qtr( "Pause the playback" ) : qtr( I_PLAY_TOOLTIP ) ); }
VLMDialog::VLMDialog( intf_thread_t *_p_intf ) : QVLCDialog( (QWidget*)_p_intf->p_sys->p_mi, _p_intf ) { p_vlm = vlm_New( p_intf ); if( !p_vlm ) { msg_Warn( p_intf, "Couldn't build VLM object "); return; } vlmWrapper = new VLMWrapper( p_vlm ); // UI stuff ui.setupUi( this ); ui.saveButton->hide(); #define ADDMEDIATYPES( str, type ) ui.mediaType->addItem( qtr( str ), QVariant( type ) ); ADDMEDIATYPES( N_("Broadcast"), QVLM_Broadcast ); ADDMEDIATYPES( N_("Schedule"), QVLM_Schedule ); ADDMEDIATYPES( N_("Video On Demand ( VOD )"), QVLM_VOD ); #undef ADDMEDIATYPES /* Schedule Stuffs */ QGridLayout *schetimelayout = new QGridLayout( ui.schedBox ); QLabel *schetimelabel = new QLabel( qtr( "Hours / Minutes / Seconds:" ) ); schetimelayout->addWidget( schetimelabel, 0, 0 ); QLabel *schedatelabel = new QLabel( qtr( "Day / Month / Year:" ) ); schetimelayout->addWidget( schedatelabel, 1, 0 ); QLabel *scherepeatLabel = new QLabel( qtr( "Repeat:" ) ); schetimelayout->addWidget( scherepeatLabel, 2, 0 ); QLabel *scherepeatTimeLabel = new QLabel( qtr( "Repeat delay:" ) ); schetimelayout->addWidget( scherepeatTimeLabel, 3, 0 ); time = new QDateTimeEdit( QTime::currentTime() ); time->setAlignment( Qt::AlignRight ); time->setDisplayFormat( "hh:mm:ss" ); schetimelayout->addWidget( time, 0, 1, 1, 3 ); date = new QDateTimeEdit( QDate::currentDate() ); date->setAlignment( Qt::AlignRight ); date->setCalendarPopup( true ); #ifdef WIN32 date->setDisplayFormat( "dd MM yyyy" ); #else date->setDisplayFormat( "dd MMMM yyyy" ); #endif schetimelayout->addWidget( date, 1, 1, 1, 3 ); scherepeatnumber = new QSpinBox; scherepeatnumber->setAlignment( Qt::AlignRight ); schetimelayout->addWidget( scherepeatnumber, 2, 1, 1, 3 ); repeatDays = new QSpinBox; repeatDays->setAlignment( Qt::AlignRight ); schetimelayout->addWidget( repeatDays, 3, 1, 1, 1 ); repeatDays->setSuffix( qtr(" days") ); repeatTime = new QDateTimeEdit; repeatTime->setAlignment( Qt::AlignRight ); schetimelayout->addWidget( repeatTime, 3, 2, 1, 2 ); repeatTime->setDisplayFormat( "hh:mm:ss" ); /* scrollArea */ ui.vlmItemScroll->setFrameStyle( QFrame::NoFrame ); ui.vlmItemScroll->setWidgetResizable( true ); vlmItemWidget = new QWidget; vlmItemLayout = new QVBoxLayout( vlmItemWidget ); vlmItemWidget->setLayout( vlmItemLayout ); ui.vlmItemScroll->setWidget( vlmItemWidget ); QSpacerItem *spacer = new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Expanding); vlmItemLayout->addItem( spacer ); QPushButton *importButton = new QPushButton( qtr( "I&mport" ) ); ui.buttonBox->addButton( importButton, QDialogButtonBox::ActionRole ); QPushButton *exportButton = new QPushButton( qtr( "E&xport" ) ); ui.buttonBox->addButton( exportButton, QDialogButtonBox::ActionRole ); QPushButton *closeButton = new QPushButton( qtr( "&Close" ) ); ui.buttonBox->addButton( closeButton, QDialogButtonBox::RejectRole ); showScheduleWidget( QVLM_Broadcast ); /* Connect the comboBox to show the right Widgets */ CONNECT( ui.mediaType, currentIndexChanged( int ), this, showScheduleWidget( int ) ); /* Connect the leftList to show the good VLMItem */ CONNECT( ui.vlmListItem, currentRowChanged( int ), this, selectVLMItem( int ) ); BUTTONACT( closeButton, close() ); BUTTONACT( exportButton, exportVLMConf() ); BUTTONACT( importButton, importVLMConf() ); BUTTONACT( ui.addButton, addVLMItem() ); BUTTONACT( ui.clearButton, clearWidgets() ); BUTTONACT( ui.saveButton, saveModifications() ); BUTTONACT( ui.inputButton, selectInput() ); BUTTONACT( ui.outputButton, selectOutput() ); if( !restoreGeometry( getSettings()->value("VLM/geometry").toByteArray() ) ) { resize( QSize( 700, 500 ) ); } }
/********************************************************************** * Speed control widget **********************************************************************/ SpeedControlWidget::SpeedControlWidget( intf_thread_t *_p_i, QWidget *_parent ) : QFrame( _parent ), p_intf( _p_i ) { QSizePolicy sizePolicy( QSizePolicy::Fixed, QSizePolicy::Maximum ); sizePolicy.setHorizontalStretch( 0 ); sizePolicy.setVerticalStretch( 0 ); speedSlider = new QSlider( this ); speedSlider->setSizePolicy( sizePolicy ); speedSlider->setMinimumSize( QSize( 140, 20 ) ); speedSlider->setOrientation( Qt::Horizontal ); speedSlider->setTickPosition( QSlider::TicksBelow ); speedSlider->setRange( -34, 34 ); speedSlider->setSingleStep( 1 ); speedSlider->setPageStep( 1 ); speedSlider->setTickInterval( 17 ); CONNECT( speedSlider, valueChanged( int ), this, updateRate( int ) ); QToolButton *normalSpeedButton = new QToolButton( this ); normalSpeedButton->setMaximumSize( QSize( 26, 16 ) ); normalSpeedButton->setAutoRaise( true ); normalSpeedButton->setText( "1x" ); normalSpeedButton->setToolTip( qtr( "Revert to normal play speed" ) ); CONNECT( normalSpeedButton, clicked(), this, resetRate() ); QToolButton *slowerButton = new QToolButton( this ); slowerButton->setMaximumSize( QSize( 26, 16 ) ); slowerButton->setAutoRaise( true ); slowerButton->setToolTip( tooltipL[SLOWER_BUTTON] ); slowerButton->setIcon( QIcon( iconL[SLOWER_BUTTON] ) ); CONNECT( slowerButton, clicked(), THEMIM->getIM(), slower() ); QToolButton *fasterButton = new QToolButton( this ); fasterButton->setMaximumSize( QSize( 26, 16 ) ); fasterButton->setAutoRaise( true ); fasterButton->setToolTip( tooltipL[FASTER_BUTTON] ); fasterButton->setIcon( QIcon( iconL[FASTER_BUTTON] ) ); CONNECT( fasterButton, clicked(), THEMIM->getIM(), faster() ); /* spinBox = new QDoubleSpinBox(); spinBox->setDecimals( 2 ); spinBox->setMaximum( 32 ); spinBox->setMinimum( 0.03F ); spinBox->setSingleStep( 0.10F ); spinBox->setAlignment( Qt::AlignRight ); CONNECT( spinBox, valueChanged( double ), this, updateSpinBoxRate( double ) ); */ QGridLayout* speedControlLayout = new QGridLayout( this ); speedControlLayout->addWidget( speedSlider, 0, 0, 1, 3 ); speedControlLayout->addWidget( slowerButton, 1, 0 ); speedControlLayout->addWidget( normalSpeedButton, 1, 1, 1, 1, Qt::AlignRight ); speedControlLayout->addWidget( fasterButton, 1, 2, 1, 1, Qt::AlignRight ); //speedControlLayout->addWidget( spinBox ); speedControlLayout->setContentsMargins( 0, 0, 0, 0 ); speedControlLayout->setSpacing( 0 ); lastValue = 0; activateOnState(); }
/********************************************************************* * The Panels *********************************************************************/ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, int _number, bool small ) : QWidget( _parent ), p_intf( _p_intf ) { module_config_t *p_config; ConfigControl *control; number = _number; #define CONFIG_GENERIC( option, type, label, qcontrol ) \ p_config = config_FindConfig( VLC_OBJECT(p_intf), option ); \ if( p_config ) \ { \ control = new type ## ConfigControl( VLC_OBJECT(p_intf), \ p_config, label, ui.qcontrol, false ); \ controls.append( control ); \ } \ else { \ ui.qcontrol->setEnabled( false ); \ if( label ) label->setEnabled( false ); \ } #define CONFIG_BOOL( option, qcontrol ) \ p_config = config_FindConfig( VLC_OBJECT(p_intf), option ); \ if( p_config ) \ { \ control = new BoolConfigControl( VLC_OBJECT(p_intf), \ p_config, NULL, ui.qcontrol, false ); \ controls.append( control ); \ } \ else { ui.qcontrol->setEnabled( false ); } #define CONFIG_GENERIC_NO_UI( option, type, label, qcontrol ) \ p_config = config_FindConfig( VLC_OBJECT(p_intf), option ); \ if( p_config ) \ { \ control = new type ## ConfigControl( VLC_OBJECT(p_intf), \ p_config, label, qcontrol, false ); \ controls.append( control ); \ } \ else { \ QWidget *widget = label; \ qcontrol->setVisible( false ); \ if( widget ) widget->setEnabled( false ); \ } #define CONFIG_GENERIC_NO_BOOL( option, type, label, qcontrol ) \ p_config = config_FindConfig( VLC_OBJECT(p_intf), option ); \ if( p_config ) \ { \ control = new type ## ConfigControl( VLC_OBJECT(p_intf), \ p_config, label, ui.qcontrol ); \ controls.append( control ); \ } #define CONFIG_GENERIC_FILE( option, type, label, qcontrol, qbutton ) \ p_config = config_FindConfig( VLC_OBJECT(p_intf), option ); \ if( p_config ) \ { \ control = new type ## ConfigControl( VLC_OBJECT(p_intf), \ p_config, label, qcontrol, qbutton ); \ controls.append( control ); \ } #define START_SPREFS_CAT( name , label ) \ case SPrefs ## name: \ { \ Ui::SPrefs ## name ui; \ ui.setupUi( panel ); \ panel_label->setText( label ); #define END_SPREFS_CAT \ break; \ } QVBoxLayout *panel_layout = new QVBoxLayout(); QWidget *panel = new QWidget(); panel_layout->setMargin( 3 ); // Title Label QLabel *panel_label = new QLabel; QFont labelFont = QApplication::font( static_cast<QWidget*>(0) ); labelFont.setPointSize( labelFont.pointSize() + 6 ); labelFont.setFamily( "Verdana" ); panel_label->setFont( labelFont ); // Title <hr> QFrame *title_line = new QFrame; title_line->setFrameShape(QFrame::HLine); title_line->setFrameShadow(QFrame::Sunken); QFont italicFont = QApplication::font( static_cast<QWidget*>(0) ); italicFont.setItalic( true ); switch( number ) { /****************************** * VIDEO Panel Implementation * ******************************/ START_SPREFS_CAT( Video , qtr("Video Settings") ); CONFIG_BOOL( "video", enableVideo ); CONFIG_BOOL( "fullscreen", fullscreen ); CONFIG_BOOL( "overlay", overlay ); CONFIG_BOOL( "video-on-top", alwaysOnTop ); CONFIG_BOOL( "video-deco", windowDecorations ); CONFIG_BOOL( "skip-frames", skipFrames ); CONFIG_GENERIC( "vout", Module, ui.voutLabel, outputModule ); CONFIG_BOOL( "video-wallpaper", wallpaperMode ); #ifdef WIN32 CONFIG_GENERIC( "directx-device", StringList, ui.dxDeviceLabel, dXdisplayDevice ); CONFIG_BOOL( "directx-hw-yuv", hwYUVBox ); #else ui.directXBox->setVisible( false ); ui.hwYUVBox->setVisible( false ); #endif CONFIG_GENERIC( "deinterlace", IntegerList, ui.deinterLabel, deinterlaceBox ); CONFIG_GENERIC( "deinterlace-mode", StringList, ui.deinterModeLabel, deinterlaceModeBox ); CONFIG_GENERIC( "aspect-ratio", String, ui.arLabel, arLine ); CONFIG_GENERIC_FILE( "snapshot-path", Directory, ui.dirLabel, ui.snapshotsDirectory, ui.snapshotsDirectoryBrowse ); CONFIG_GENERIC( "snapshot-prefix", String, ui.prefixLabel, snapshotsPrefix ); CONFIG_BOOL( "snapshot-sequential", snapshotsSequentialNumbering ); CONFIG_GENERIC( "snapshot-format", StringList, ui.arLabel, snapshotsFormat ); END_SPREFS_CAT; /****************************** * AUDIO Panel Implementation * ******************************/ START_SPREFS_CAT( Audio, qtr("Audio Settings") ); CONFIG_BOOL( "audio", enableAudio ); ui.SPrefsAudio_zone->setEnabled( ui.enableAudio->isChecked() ); CONNECT( ui.enableAudio, toggled( bool ), ui.SPrefsAudio_zone, setEnabled( bool ) ); #define audioCommon( name ) \ QWidget * name ## Control = new QWidget( ui.outputAudioBox ); \ QHBoxLayout * name ## Layout = new QHBoxLayout( name ## Control); \ name ## Layout->setMargin( 0 ); \ name ## Layout->setSpacing( 0 ); \ QLabel * name ## Label = new QLabel( qtr( "Device:" ), name ## Control ); \ name ## Label->setMinimumSize(QSize(250, 0)); \ name ## Layout->addWidget( name ## Label ); \ #define audioControl( name) \ audioCommon( name ) \ QComboBox * name ## Device = new QComboBox( name ## Control ); \ name ## Layout->addWidget( name ## Device ); \ name ## Label->setBuddy( name ## Device ); \ outputAudioLayout->addWidget( name ## Control, outputAudioLayout->rowCount(), 0, 1, -1 ); #define audioControl2( name) \ audioCommon( name ) \ QLineEdit * name ## Device = new QLineEdit( name ## Control ); \ name ## Layout->addWidget( name ## Device ); \ name ## Label->setBuddy( name ## Device ); \ QPushButton * name ## Browse = new QPushButton( qtr( "Browse..." ), name ## Control); \ name ## Layout->addWidget( name ## Browse ); \ outputAudioLayout->addWidget( name ## Control, outputAudioLayout->rowCount(), 0, 1, -1 ); /* Build if necessary */ QGridLayout * outputAudioLayout = qobject_cast<QGridLayout *>(ui.outputAudioBox->layout()); #ifdef WIN32 audioControl( DirectX ); optionWidgets.append( DirectXControl ); CONFIG_GENERIC_NO_UI( "directx-audio-device-name", StringList, DirectXLabel, DirectXDevice ); #else if( module_exists( "alsa" ) ) { audioControl( alsa ); optionWidgets.append( alsaControl ); CONFIG_GENERIC_NO_UI( "alsa-audio-device" , StringList, alsaLabel, alsaDevice ); } else optionWidgets.append( NULL ); if( module_exists( "oss" ) ) { audioControl2( OSS ); optionWidgets.append( OSSControl ); CONFIG_GENERIC_FILE( "oss-audio-device" , File, NULL, OSSDevice, OSSBrowse ); } else optionWidgets.append( NULL ); #endif #undef audioControl2 #undef audioControl #undef audioCommon /* Audio Options */ CONFIG_GENERIC_NO_BOOL( "volume" , IntegerRangeSlider, NULL, defaultVolume ); CONNECT( ui.defaultVolume, valueChanged( int ), this, updateAudioVolume( int ) ); CONFIG_BOOL( "qt-autosave-volume", keepVolumeRadio ); ui.defaultVolume_zone->setEnabled( ui.resetVolumeRadio->isChecked() ); CONNECT( ui.resetVolumeRadio, toggled( bool ), ui.defaultVolume_zone, setEnabled( bool ) ); CONFIG_GENERIC( "audio-language" , String , ui.langLabel, preferredAudioLanguage ); CONFIG_BOOL( "spdif", spdifBox ); CONFIG_GENERIC( "force-dolby-surround", IntegerList, ui.dolbyLabel, detectionDolby ); CONFIG_GENERIC_NO_BOOL( "norm-max-level" , Float, NULL, volNormSpin ); CONFIG_GENERIC( "audio-replay-gain-mode", StringList, ui.replayLabel, replayCombo ); CONFIG_GENERIC( "audio-visual" , Module , ui.visuLabel, visualisation); CONFIG_BOOL( "audio-time-stretch", autoscaleBox ); /* Audio Output Specifics */ CONFIG_GENERIC( "aout", Module, ui.outputLabel, outputModule ); CONNECT( ui.outputModule, currentIndexChanged( int ), this, updateAudioOptions( int ) ); /* File output exists on all platforms */ CONFIG_GENERIC_FILE( "audiofile-file", File, ui.fileLabel, ui.fileName, ui.fileBrowseButton ); optionWidgets.append( ui.fileControl ); optionWidgets.append( ui.outputModule ); optionWidgets.append( ui.volNormBox ); /*Little mofification of ui.volumeValue to compile with Qt < 4.3 */ ui.volumeValue->setButtonSymbols(QAbstractSpinBox::NoButtons); optionWidgets.append( ui.volumeValue ); optionWidgets.append( ui.headphoneEffect ); optionWidgets.append( ui.spdifBox ); updateAudioOptions( ui.outputModule->currentIndex() ); /* LastFM */ if( module_exists( "audioscrobbler" ) ) { CONFIG_GENERIC( "lastfm-username", String, ui.lastfm_user_label, lastfm_user_edit ); CONFIG_GENERIC( "lastfm-password", String, ui.lastfm_pass_label, lastfm_pass_edit ); if( config_ExistIntf( VLC_OBJECT( p_intf ), "audioscrobbler" ) ) ui.lastfm->setChecked( true ); else ui.lastfm->setChecked( false ); ui.lastfm_zone->setVisible( ui.lastfm->isChecked() ); CONNECT( ui.lastfm, toggled( bool ), ui.lastfm_zone, setVisible( bool ) ); CONNECT( ui.lastfm, stateChanged( int ), this, lastfm_Changed( int ) ); } else {
/** * Media ( File ) Menu * Opening, streaming and quit **/ QMenu *QVLCMenu::FileMenu( intf_thread_t *p_intf, QWidget *parent, MainInterface *mi ) { QMenu *menu = new QMenu( parent ); QAction *action; addDPStaticEntry( menu, qtr( "Open &File..." ), ":/type/file-asym", SLOT( simpleOpenDialog() ), "Ctrl+O" ); addDPStaticEntry( menu, qtr( I_OP_OPDIR ), ":/type/folder-grey", SLOT( PLOpenDir() ), "Ctrl+F" ); addDPStaticEntry( menu, qtr( "Open &Disc..." ), ":/type/disc", SLOT( openDiscDialog() ), "Ctrl+D" ); addDPStaticEntry( menu, qtr( "Open &Network Stream..." ), ":/type/network", SLOT( openNetDialog() ), "Ctrl+N" ); addDPStaticEntry( menu, qtr( "Open &Capture Device..." ), ":/type/capture-card", SLOT( openCaptureDialog() ), "Ctrl+C" ); menu->addSeparator(); addDPStaticEntry( menu, qtr( "&Open (advanced)..." ), ":/type/file-asym", SLOT( openFileDialog() ), "Ctrl+Shift+O" ); menu->addSeparator(); addDPStaticEntry( menu, qtr( "Open &Location from clipboard" ), NULL, SLOT( openUrlDialog() ), "Ctrl+V" ); if( var_InheritBool( p_intf, "qt-recentplay" ) ) { recentsMenu = new QMenu( qtr( "Open &Recent Media" ), menu ); updateRecents( p_intf ); menu->addMenu( recentsMenu ); } menu->addSeparator(); addDPStaticEntry( menu, qtr( I_PL_SAVE ), "", SLOT( saveAPlaylist() ), "Ctrl+Y" ); menu->addSeparator(); #ifdef ENABLE_SOUT addDPStaticEntry( menu, qtr( "Conve&rt / Save..." ), "", SLOT( openAndTranscodingDialogs() ), "Ctrl+R" ); addDPStaticEntry( menu, qtr( "&Stream..." ), ":/menu/stream", SLOT( openAndStreamingDialogs() ), "Ctrl+S" ); menu->addSeparator(); #endif action = addMIMStaticEntry( p_intf, menu, qtr( "Quit at the end of playlist" ), "", SLOT( activatePlayQuit( bool ) ) ); action->setCheckable( true ); action->setChecked( THEMIM->getPlayExitState() ); if( mi->getSysTray() ) { action = menu->addAction( qtr( "Close to systray"), mi, SLOT( toggleUpdateSystrayMenu() ) ); } addDPStaticEntry( menu, qtr( "&Quit" ) , ":/menu/quit", SLOT( quit() ), "Ctrl+Q" ); return menu; }
//HACK menu->clear() does not delete submenus QList<QAction*> actions = menu->actions(); foreach( QAction *a, actions ) { QMenu *m = a->menu(); if( a->parent() == menu ) delete a; else menu->removeAction( a ); if( m && m->parent() == menu ) delete m; } } menu->addAction( #ifndef __APPLE__ QIcon( ":/menu/playlist_menu" ), #endif qtr( "Play&list" ), mi, SLOT( togglePlaylist() ), qtr( "Ctrl+L" ) ); menu->addSeparator(); /* Minimal View */ action = menu->addAction( qtr( "Mi&nimal Interface" ) ); action->setShortcut( qtr( "Ctrl+H" ) ); action->setCheckable( true ); action->setChecked( (mi->getControlsVisibilityStatus() & CONTROLS_HIDDEN ) ); CONNECT( action, triggered( bool ), mi, toggleMinimalView( bool ) ); CONNECT( mi, minimalViewToggled( bool ), action, setChecked( bool ) ); /* FullScreen View */ action = menu->addAction( qtr( "&Fullscreen Interface" ), mi,
/** * First Panel - Meta Info * All the usual MetaData are displayed and can be changed. **/ MetaPanel::MetaPanel( QWidget *parent, intf_thread_t *_p_intf ) : QWidget( parent ), p_intf( _p_intf ) { QGridLayout *metaLayout = new QGridLayout( this ); metaLayout->setVerticalSpacing( 0 ); QFont smallFont = QApplication::font(); smallFont.setPointSize( smallFont.pointSize() - 1 ); smallFont.setBold( true ); int line = 0; /* Counter for GridLayout */ p_input = NULL; QLabel *label; #define ADD_META( string, widget, col, colspan ) { \ label = new QLabel( qtr( string ) ); label->setFont( smallFont ); \ label->setContentsMargins( 3, 2, 0, 0 ); \ metaLayout->addWidget( label, line++, col, 1, colspan ); \ widget = new QLineEdit; \ metaLayout->addWidget( widget, line, col, 1, colspan ); \ CONNECT( widget, textEdited( QString ), this, enterEditMode() ); \ } /* Title, artist and album*/ ADD_META( VLC_META_TITLE, title_text, 0, 10 ); line++; ADD_META( VLC_META_ARTIST, artist_text, 0, 10 ); line++; ADD_META( VLC_META_ALBUM, collection_text, 0, 7 ); /* Date */ label = new QLabel( qtr( VLC_META_DATE ) ); label->setFont( smallFont ); label->setContentsMargins( 3, 2, 0, 0 ); metaLayout->addWidget( label, line - 1, 7, 1, 2 ); /* Date (Should be in years) */ date_text = new QLineEdit; date_text->setAlignment( Qt::AlignRight ); date_text->setInputMask("0000"); date_text->setMaximumWidth( 140 ); metaLayout->addWidget( date_text, line, 7, 1, -1 ); line++; /* Genre Name */ /* TODO List id3genres.h is not includable yet ? */ ADD_META( VLC_META_GENRE, genre_text, 0, 7 ); /* Number - on the same line */ label = new QLabel( qtr( VLC_META_TRACK_NUMBER ) ); label->setFont( smallFont ); label->setContentsMargins( 3, 2, 0, 0 ); metaLayout->addWidget( label, line - 1, 7, 1, 3 ); seqnum_text = new QLineEdit; seqnum_text->setMaximumWidth( 64 ); seqnum_text->setAlignment( Qt::AlignRight ); metaLayout->addWidget( seqnum_text, line, 7, 1, 1 ); label = new QLabel( "/" ); label->setFont( smallFont ); metaLayout->addWidget( label, line, 8, 1, 1 ); seqtot_text = new QLineEdit; seqtot_text->setMaximumWidth( 64 ); seqtot_text->setAlignment( Qt::AlignRight ); metaLayout->addWidget( seqtot_text, line, 9, 1, 1 ); line++; /* Rating - on the same line */ /* metaLayout->addWidget( new QLabel( qtr( VLC_META_RATING ) ), line, 4, 1, 2 ); rating_text = new QSpinBox; setSpinBounds( rating_text ); metaLayout->addWidget( rating_text, line, 6, 1, 1 ); */ /* Now Playing - Useful for live feeds (HTTP, DVB, ETC...) */ ADD_META( VLC_META_NOW_PLAYING, nowplaying_text, 0, 7 ); nowplaying_text->setReadOnly( true ); line--; /* Language on the same line */ ADD_META( VLC_META_LANGUAGE, language_text, 7, -1 ); line++; ADD_META( VLC_META_PUBLISHER, publisher_text, 0, 7 ); fingerprintButton = new QPushButton( qtr("&Fingerprint") ); fingerprintButton->setToolTip( qtr( "Find meta data using audio fingerprinting" ) ); fingerprintButton->setVisible( false ); metaLayout->addWidget( fingerprintButton, line, 7 , 3, -1 ); CONNECT( fingerprintButton, clicked(), this, fingerprint() ); line++; lblURL = new QLabel; lblURL->setOpenExternalLinks( true ); lblURL->setTextFormat( Qt::RichText ); lblURL->setMaximumWidth( 128 ); metaLayout->addWidget( lblURL, line -1, 7, 1, -1 ); ADD_META( VLC_META_COPYRIGHT, copyright_text, 0, 7 ); line++; /* ART_URL */ art_cover = new CoverArtLabel( this, p_intf ); metaLayout->addWidget( art_cover, line, 7, 6, 3, Qt::AlignLeft ); ADD_META( VLC_META_ENCODED_BY, encodedby_text, 0, 7 ); line++; label = new QLabel( qtr( N_("Comments") ) ); label->setFont( smallFont ); label->setContentsMargins( 3, 2, 0, 0 ); metaLayout->addWidget( label, line++, 0, 1, 7 ); description_text = new QTextEdit; description_text->setAcceptRichText( false ); metaLayout->addWidget( description_text, line, 0, 1, 7 ); CONNECT( description_text, textChanged(), this, enterEditMode() ); line++; /* VLC_META_SETTING: Useless */ /* ADD_META( TRACKID ) Useless ? */ /* ADD_URI - Do not show it, done outside */ metaLayout->setColumnStretch( 1, 20 ); metaLayout->setColumnMinimumWidth ( 1, 80 ); metaLayout->setRowStretch( line, 10 ); #undef ADD_META CONNECT( seqnum_text, textEdited( QString ), this, enterEditMode() ); CONNECT( seqtot_text, textEdited( QString ), this, enterEditMode() ); CONNECT( date_text, textEdited( QString ), this, enterEditMode() ); // CONNECT( THEMIM->getIM(), artChanged( QString ), this, enterEditMode() ); /* CONNECT( rating_text, valueChanged( QString ), this, enterEditMode( QString ) );*/ /* We are not yet in Edit Mode */ b_inEditMode = false; }