open.cpp 4.45 KB
Newer Older
Clément Stenac's avatar
Clément Stenac committed
1 2 3
/*****************************************************************************
 * open.cpp : Panels for the open dialogs
 ****************************************************************************
4 5
 * Copyright (C) 2006 the VideoLAN team
 * $Id$
Clément Stenac's avatar
Clément Stenac committed
6 7
 *
 * Authors: Clément Stenac <zorglub@videolan.org>
8
 *          Jean-Baptiste Kempf <jb@videolan.org> 
Clément Stenac's avatar
Clément Stenac committed
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
25 26

#include "qt4.hpp"
Clément Stenac's avatar
Clément Stenac committed
27 28
#include "components/open.hpp"

29
#include <QFileDialog>
30 31 32 33 34 35 36
/**************************************************************************
 * Open panel
 ***************************************************************************/

OpenPanel::~OpenPanel()
{}

Clément Stenac's avatar
Clément Stenac committed
37 38 39 40 41 42 43
/**************************************************************************
 * File open
 **************************************************************************/
FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
                                OpenPanel( _parent, _p_intf )
{
    ui.setupUi( this );
44 45 46 47 48

    BUTTONACT( ui.fileBrowseButton, browseFile() );
    BUTTONACT( ui.subBrowseButton, browseFileSub() );
    BUTTONACT( ui.audioBrowseButton, browseFileAudio() );
    CONNECT( ui.fileInput, editTextChanged(QString ), this, updateMRL());
Clément Stenac's avatar
Clément Stenac committed
49 50 51 52 53
}

FileOpenPanel::~FileOpenPanel()
{}

54 55 56
void FileOpenPanel::sendUpdate()
{}

57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
QStringList FileOpenPanel::browse()
{
    return QFileDialog::getOpenFileNames( this, qtr("Open File"), "", "" );
}

void FileOpenPanel::browseFile()
{
    //FIXME ! files with spaces
    QString files = browse().join(" ");
    ui.fileInput->setEditText( files );
    ui.fileInput->addItem( files );

    if ( ui.fileInput->count() > 8 ) ui.fileInput->removeItem(0);

    updateMRL();
}

void FileOpenPanel::browseFileSub()
{
    ui.subInput->setEditText( browse().join(" ") );

    updateSubsMRL();
}

void FileOpenPanel::browseFileAudio()
{
    ui.audioFileInput->setEditText( browse().join(" ") );
}

void FileOpenPanel::updateSubsMRL()
{
    QStringList* subsMRL = new QStringList("sub-file=");
    subsMRL->append( ui.subInput->currentText() );
    //FIXME !!
    subsMRL->append( "subsdec-align=" + ui.alignSubComboBox->currentText() );
    subsMRL->append( "sub-rel-fontsize=" + ui.sizeSubComboBox->currentText() );

    subsMRL->join(" ");
}

void FileOpenPanel::updateMRL()
{
    QString MRL = ui.fileInput->currentText();

    emit(mrlUpdated(MRL));
}

Clément Stenac's avatar
Clément Stenac committed
104 105
QString FileOpenPanel::getUpdatedMRL()
{
106
    return ui.fileInput->currentText();
Clément Stenac's avatar
Clément Stenac committed
107 108
}

109 110 111 112 113 114 115 116
void FileOpenPanel::clear()
{
    ui.fileInput->setEditText( "");
    ui.subInput->setEditText( "");
    ui.audioFileInput->setEditText( "");
}


117

Clément Stenac's avatar
Clément Stenac committed
118
/**************************************************************************
119
 * Disk open
Clément Stenac's avatar
Clément Stenac committed
120
 **************************************************************************/
121
DiskOpenPanel::DiskOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
Clément Stenac's avatar
Clément Stenac committed
122 123 124 125 126
                                OpenPanel( _parent, _p_intf )
{
    ui.setupUi( this );
}

127 128 129 130
DiskOpenPanel::~DiskOpenPanel()
{}

void DiskOpenPanel::sendUpdate()
Clément Stenac's avatar
Clément Stenac committed
131 132
{}

133
QString DiskOpenPanel::getUpdatedMRL()
Clément Stenac's avatar
Clément Stenac committed
134
{
135

136 137 138 139 140
    //return ui.DiskInput->currentText();
    return NULL;
}


Clément Stenac's avatar
Clément Stenac committed
141

142 143 144 145 146 147 148
/**************************************************************************
 * Net open
 **************************************************************************/
NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
                                OpenPanel( _parent, _p_intf )
{
    ui.setupUi( this );
Clément Stenac's avatar
Clément Stenac committed
149 150
}

151 152 153 154 155 156
NetOpenPanel::~NetOpenPanel()
{}

void NetOpenPanel::sendUpdate()
{}
/*
Clément Stenac's avatar
Clément Stenac committed
157 158 159 160 161 162
void NetOpenPanel::sendUpdate()
{
    QString *mrl = new QString();
    QString *cache = new QString();
    getUpdatedMRL( mrl, cache );,
    emit dataUpdated( mrl, cache );
163 164 165 166 167 168
}*/

QString NetOpenPanel::getUpdatedMRL()
{
//  return ui.NetInput->currentText();
    return NULL;
Clément Stenac's avatar
Clément Stenac committed
169
}
170