69 setWindowFlags( windowFlags() | Qt::CustomizeWindowHint |
70 Qt::WindowMinMaxButtonsHint );
74 QFont font( pPref->getApplicationFontFamily(),
getPointSize( pPref->getFontSize() ) );
76 m_pPlaylistTree->setFont( font );
80 installEventFilter(
this );
89 tr(
"Add song to Play&list" ),
this, SLOT(
addSong() ) );
90 pActionAddSong->setShortcut( QKeySequence(
"Ctrl+A" ) );
92 tr(
"Add ¤t song to Playlist" ),
this, SLOT(
addCurrentSong() ) );
93 pActionAddCurrent->setShortcut( QKeySequence(
"Ctrl+Alt+A" ) );
96 tr(
"&Remove selected song from Playlist" ),
this, SLOT(
removeFromList() ) );
97 pActionRemoveSong->setShortcut( QKeySequence::Delete );
100 pActionNew->setShortcut( QKeySequence(
"Ctrl+N" ) );
103 tr(
"&Open Playlist" ),
this, SLOT(
loadList() ) );
104 pActionOpen->setShortcut( QKeySequence(
"Ctrl+O" ) );
107 tr(
"&Save Playlist" ),
this, SLOT(
saveList() ) );
108 pActionSave->setShortcut( QKeySequence(
"Ctrl+S" ) );
110 tr(
"Save Playlist &as" ),
this, SLOT(
saveListAs() ) );
111 pActionSaveAs->setShortcut( QKeySequence(
"Ctrl+Shift+S" ) );
129 QHBoxLayout* pMenuBarLayout =
new QHBoxLayout( menuBarWidget );
130 pMenuBarLayout->setSpacing(0);
131 pMenuBarLayout->setContentsMargins( 0, 0, 0, 0 );
136 pControlsPanel->setFixedSize( 119, 32 );
137 pControlsPanel->
setPixmap(
"/playerControlPanel/playlist_background_Control.png" );
143 std::shared_ptr<Action> pAction = std::make_shared<Action>(
"PLAYLIST_PREV_SONG");
151 pAction = std::make_shared<Action>(
"PLAY/PAUSE_TOGGLE");
158 pAction = std::make_shared<Action>(
"STOP");
165 pAction = std::make_shared<Action>(
"PLAYLIST_NEXT_SONG");
170 headers << tr (
"Song list" );
171 QTreeWidgetItem* header =
new QTreeWidgetItem ( headers );
172 m_pPlaylistTree->setHeaderItem ( header );
173 m_pPlaylistTree->setAlternatingRowColors(
true );
174 for (
int ii = 0; ii < m_pPlaylistTree->headerItem()->columnCount(); ii++ ) {
175 m_pPlaylistTree->headerItem()->setFont( ii, font );
192 headers << tr (
"Song list" ) << tr (
"Script" ) << tr (
"exec Script" );
193 QTreeWidgetItem* header =
new QTreeWidgetItem ( headers );
194 m_pPlaylistTree->setHeaderItem ( header );
196 m_pPlaylistTree->setColumnWidth( 0, 405 );
197 m_pPlaylistTree->setColumnWidth( 1, 405 );
198 m_pPlaylistTree->setColumnWidth( 2, 105 );
200 m_pPlaylistTree->header()->setStretchLastSection(
false );
201 m_pPlaylistTree->header()->setSectionResizeMode( 0, QHeaderView::Stretch );
202 m_pPlaylistTree->header()->setSectionResizeMode( 1, QHeaderView::Stretch );
203 m_pPlaylistTree->header()->setSectionResizeMode( 2, QHeaderView::Fixed );
205 m_pPlaylistTree->setAlternatingRowColors(
true );
206 for (
int ii = 0; ii < m_pPlaylistTree->headerItem()->columnCount(); ii++ ) {
207 m_pPlaylistTree->headerItem()->setFont( ii, font );
211 QVBoxLayout *pSideBarLayout =
new QVBoxLayout(sideBarWidget);
212 pSideBarLayout->setSpacing(0);
213 pSideBarLayout->setContentsMargins( 0, 0, 0, 0 );
217 connect(pUpBtn, SIGNAL( clicked() ),
this, SLOT(
o_upBClicked()) );
218 pSideBarLayout->addWidget(pUpBtn);
222 connect(pDownBtn, SIGNAL( clicked() ),
this, SLOT(
o_downBClicked()));
223 pSideBarLayout->addWidget(pDownBtn);
227 if( pPlaylist->
size() > 0 ){
228 for ( uint i = 0; i < pPlaylist->
size(); ++i ){
229 QTreeWidgetItem* pPlaylistItem =
new QTreeWidgetItem ( m_pPlaylistTree );
231 pPlaylistItem->setText( 0, pPlaylist->
get( i )->
filePath );
232 pPlaylistItem->setText( 1, pPlaylist->
get( i )->
scriptPath );
235 pPlaylistItem->setCheckState( 2, Qt::Checked );
237 pPlaylistItem->setCheckState( 2, Qt::Unchecked );
245 if(! (activeSongNumber == -1 && selectedSongNumber == -1) )
248 if( activeSongNumber == -1 ){
249 aselected = selectedSongNumber;
251 aselected = activeSongNumber ;
254 QTreeWidgetItem* m_pPlaylistItem = m_pPlaylistTree->topLevelItem ( aselected );
255 m_pPlaylistItem->setBackground( 0, QColor( 50, 50, 50) );
256 m_pPlaylistItem->setBackground( 1, QColor( 50, 50, 50) );
257 m_pPlaylistItem->setBackground( 2, QColor( 50, 50, 50) );
414 fd.setAcceptMode( QFileDialog::AcceptOpen );
415 fd.setWindowTitle( tr(
"Load Playlist" ) );
416 fd.setFileMode( QFileDialog::ExistingFile );
417 fd.setDirectory( sPath );
420 if ( fd.exec() != QDialog::Accepted ) {
424 QString filename = fd.selectedFiles().first();
430 _ERRORLOG(
"Error loading the playlist" );
436 if( playlist->
size() > 0 ) {
437 QTreeWidget* m_pPlaylist = m_pPlaylistTree;
438 m_pPlaylist->clear();
440 for ( uint i = 0; i < playlist->
size(); ++i ){
441 QTreeWidgetItem* m_pPlaylistItem =
new QTreeWidgetItem ( m_pPlaylistTree );
444 m_pPlaylistItem->setText( 0, playlist->
get( i )->
filePath );
446 m_pPlaylistItem->setText( 0, tr(
"File not found: ") + playlist->
get( i )->
filePath );
449 m_pPlaylistItem->setText ( 1, playlist->
get( i )->
scriptPath );
452 m_pPlaylistItem->setCheckState( 2, Qt::Checked );
454 m_pPlaylistItem->setCheckState( 2, Qt::Unchecked );
458 QTreeWidgetItem* m_pPlaylistItem = m_pPlaylist->topLevelItem ( 0 );
459 m_pPlaylist->setCurrentItem ( m_pPlaylistItem );
461 setWindowTitle ( tr (
"Playlist Browser" ) + QString(
" - ") + pPlaylist->
getFilename() );
475 fd.setFileMode ( QFileDialog::AnyFile );
477 fd.setAcceptMode ( QFileDialog::AcceptSave );
478 fd.setWindowTitle ( tr (
"New Script" ) );
479 fd.setDirectory( sPath );
481 QString defaultFilename;
483 defaultFilename +=
".sh";
485 fd.selectFile ( defaultFilename );
488 if ( fd.exec() != QDialog::Accepted )
return;
490 filename = fd.selectedFiles().first();
492 if( filename.contains(
" ", Qt::CaseInsensitive)){
493 QMessageBox::information (
this,
"Hydrogen", tr (
"Script name or path to the script contains whitespaces.\nIMPORTANT\nThe path to the script and the scriptname must be without whitespaces.") );
497 QFile chngPerm ( filename );
498 if (!chngPerm.open(QIODevice::WriteOnly | QIODevice::Text)) {
504 QTextStream out(&chngPerm);
505 out <<
"#!/bin/sh\n\n#have phun";
508 if (chngPerm.exists() ) {
509 chngPerm.setPermissions( QFile::ReadOwner|QFile::WriteOwner|QFile::ExeOwner );
510 QMessageBox::information (
this,
"Hydrogen", tr (
"WARNING, the new file is executable by the owner of the file!" ) );
514 QMessageBox::information (
this,
"Hydrogen", tr (
"No Default Editor Set. Please set your Default Editor\nDo not use a console based Editor\nSorry, but this will not work for the moment." ) );
516 static QString lastUsedDir =
"/usr/bin/";
519 fd.setAcceptMode( QFileDialog::AcceptOpen );
520 fd.setFileMode ( QFileDialog::ExistingFile );
521 fd.setDirectory ( lastUsedDir );
523 fd.setWindowTitle ( tr (
"Set your Default Editor" ) );
526 if ( fd.exec() == QDialog::Accepted ){
527 filename = fd.selectedFiles().first();
534 std::system(openfile.toLatin1());
905 if ( !m_pPlaylistTree->topLevelItem( i ) ) {
908 ( m_pPlaylistTree->topLevelItem( i ) )->setBackground( 0, QBrush() );
909 ( m_pPlaylistTree->topLevelItem( i ) )->setBackground( 1, QBrush() );
910 ( m_pPlaylistTree->topLevelItem( i ) )->setBackground( 2, QBrush() );
915 if ( selected == -1 ) {
919 QTreeWidgetItem* pPlaylistItem = m_pPlaylistTree->topLevelItem ( selected );
920 if ( pPlaylistItem !=
nullptr ){
921 pPlaylistItem->setBackground( 0, QColor( 50, 50, 50) );
922 pPlaylistItem->setBackground( 1, QColor( 50, 50, 50) );
923 pPlaylistItem->setBackground( 2, QColor( 50, 50, 50) );