~ubuntu-branches/ubuntu/lucid/vlc/lucid

1.1.17 by Reinhard Tartler
Import upstream version 0.9.2
1
/*****************************************************************************
2
 * playlist.cpp : Playlist dialog
3
 ****************************************************************************
4
 * Copyright (C) 2006 the VideoLAN team
1.1.26 by Christophe Mutricy
Import upstream version 1.0.3
5
 * $Id$
1.1.17 by Reinhard Tartler
Import upstream version 0.9.2
6
 *
7
 * Authors: Clément Stenac <zorglub@videolan.org>
8
 *
9
 * This program is free software; you can redistribute it and/or modify
10
 * it under the terms of the GNU General Public License as published by
11
 * the Free Software Foundation; either version 2 of the License, or
12
 * (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program; if not, write to the Free Software
21
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22
 ******************************************************************************/
23
#ifdef HAVE_CONFIG_H
24
# include "config.h"
25
#endif
26
27
#include "dialogs/playlist.hpp"
28
29
#include "components/playlist/playlist.hpp"
1.1.22 by Reinhard Tartler
Import upstream version 1.0.0~rc2
30
31
#include "util/qt_dirs.hpp"
1.1.17 by Reinhard Tartler
Import upstream version 0.9.2
32
33
#include <QUrl>
34
#include <QHBoxLayout>
35
36
PlaylistDialog *PlaylistDialog::instance = NULL;
37
38
PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf )
39
                : QVLCMW( _p_intf )
40
{
41
    QWidget *main = new QWidget( this );
42
    setCentralWidget( main );
43
    setWindowTitle( qtr( "Playlist" ) );
44
    setWindowOpacity( config_GetFloat( p_intf, "qt-opacity" ) );
45
46
    QHBoxLayout *l = new QHBoxLayout( centralWidget() );
47
48
    getSettings()->beginGroup("playlistdialog");
49
1.1.19 by Reinhard Tartler
Import upstream version 0.9.4
50
    playlistWidget = new PlaylistWidget( p_intf );
1.1.17 by Reinhard Tartler
Import upstream version 0.9.2
51
    l->addWidget( playlistWidget );
52
53
    readSettings( getSettings(), QSize( 600,700 ) );
54
55
    getSettings()->endGroup();
56
}
57
58
PlaylistDialog::~PlaylistDialog()
59
{
60
    getSettings()->beginGroup("playlistdialog");
61
    writeSettings( getSettings() );
62
    getSettings()->endGroup();
63
}
64
65
void PlaylistDialog::dropEvent( QDropEvent *event )
66
{
67
     const QMimeData *mimeData = event->mimeData();
1.1.22 by Reinhard Tartler
Import upstream version 1.0.0~rc2
68
     foreach( const QUrl &url, mimeData->urls() ) {
1.1.17 by Reinhard Tartler
Import upstream version 0.9.2
69
        QString s = toNativeSeparators( url.toString() );
70
        if( s.length() > 0 ) {
71
            playlist_Add( THEPL, qtu(s), NULL,
72
                          PLAYLIST_APPEND, PLAYLIST_END, true, false );
73
        }
74
     }
75
     event->acceptProposedAction();
76
}
77
void PlaylistDialog::dragEnterEvent( QDragEnterEvent *event )
78
{
79
     event->acceptProposedAction();
80
}
81
void PlaylistDialog::dragMoveEvent( QDragMoveEvent *event )
82
{
83
     event->acceptProposedAction();
84
}
85
void PlaylistDialog::dragLeaveEvent( QDragLeaveEvent *event )
86
{
87
     event->accept();
88
}
89