Commit 3a95e2c1 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

* First implementation of the simpleOpenFile Dialog for Qt4

* Cosmetic fixes in messages.
parent a4697ffa
...@@ -35,19 +35,18 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf, bool _main_input ) : ...@@ -35,19 +35,18 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf, bool _main_input ) :
setWindowTitle( _("Messages" ) ); setWindowTitle( _("Messages" ) );
resize(420, 600); resize(420, 600);
layout = new QGridLayout(this); QGridLayout *layout = new QGridLayout(this);
closeButton = new QPushButton(qtr("&Close")); QPushButton *closeButton = new QPushButton(qtr("&Close"));
clearButton = new QPushButton(qtr("&Clear")); QPushButton *clearButton = new QPushButton(qtr("&Clear"));
saveLogButton = new QPushButton(qtr("&Save as...")); QPushButton *saveLogButton = new QPushButton(qtr("&Save as..."));
verbosityBox = new QSpinBox(); QSpinBox *verbosityBox = new QSpinBox();
verbosityBox->setRange(1, 3); verbosityBox->setRange(1, 3);
verbosityBox->setWrapping(true); verbosityBox->setWrapping(true);
verbosityLabel = new QLabel(qtr("Verbosity Level")); QLabel *verbosityLabel = new QLabel(qtr("Verbosity Level"));
messages = new QTextEdit(); messages = new QTextEdit();
messages->setReadOnly(true); messages->setReadOnly(true);
messages->setGeometry(0, 0, 440, 600); messages->setGeometry(0, 0, 440, 600);
messages->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); messages->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
messagesCursor = new QTextCursor();
layout->addWidget(messages, 0, 0, 1, 0); layout->addWidget(messages, 0, 0, 1, 0);
layout->addWidget(verbosityLabel, 1, 0, 1, 1); layout->addWidget(verbosityLabel, 1, 0, 1, 1);
......
...@@ -32,6 +32,12 @@ ...@@ -32,6 +32,12 @@
#include <QTextStream> #include <QTextStream>
#include <QMessageBox> #include <QMessageBox>
class QPushButton;
class QSpinBox;
class QGridLayout;
class QLabel;
class QTextEdit;
class MessagesDialog : public QVLCFrame class MessagesDialog : public QVLCFrame
{ {
Q_OBJECT; Q_OBJECT;
...@@ -50,15 +56,7 @@ private: ...@@ -50,15 +56,7 @@ private:
bool main_input; bool main_input;
static MessagesDialog *instance; static MessagesDialog *instance;
QPushButton *closeButton;
QPushButton *clearButton;
QPushButton *saveLogButton;
QGridLayout *layout;
QSpinBox *verbosityBox;
QLabel *verbosityLabel;
QTextEdit *messages; QTextEdit *messages;
QTextCursor *messagesCursor;
QFile *saveLogFile;
public slots: public slots:
void updateLog(); void updateLog();
......
...@@ -170,15 +170,57 @@ void DialogsProvider::menuUpdateAction( QObject *data ) ...@@ -170,15 +170,57 @@ void DialogsProvider::menuUpdateAction( QObject *data )
f->doFunc( p_intf ); f->doFunc( p_intf );
} }
void DialogsProvider::simpleAppendDialog()
{
}
void DialogsProvider::simpleOpenDialog() void DialogsProvider::simpleOpenDialog()
{ {
playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
QString FileTypes;
FileTypes = "Sound Files ( ";
FileTypes += EXTENSIONS_AUDIO;
FileTypes += ");; Video Files ( ";
FileTypes += EXTENSIONS_VIDEO;
FileTypes += ");; PlayList Files ( ";
FileTypes += EXTENSIONS_PLAYLIST;
FileTypes += ");; Subtitles Files ( ";
FileTypes += EXTENSIONS_SUBTITLE;
FileTypes += ");; All Files (*.*) " ;
FileTypes.replace(QString(";*"), QString(", *"));
QStringList fileList = QFileDialog::getOpenFileNames(
NULL,
qtr("Select one or more files to open"),
p_intf->p_vlc->psz_homedir,
FileTypes);
QStringList files = fileList;
for (size_t i = 0; i < files.size(); i++)
{
const char * psz_utf8 = files[i].toUtf8().data();
playlist_PlaylistAdd( p_playlist, psz_utf8, psz_utf8,
PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO) |
(i ? PLAYLIST_PREPARSE : 0 ),
PLAYLIST_END );
}
vlc_object_release(p_playlist);
} }
void DialogsProvider::bookmarksDialog() void DialogsProvider::bookmarksDialog()
{ {
} }
void DialogsProvider::popupMenu( int i_dialog ) void DialogsProvider::popupMenu( int i_dialog )
{ {
......
...@@ -69,6 +69,7 @@ public slots: ...@@ -69,6 +69,7 @@ public slots:
void streaminfoDialog(); void streaminfoDialog();
void prefsDialog(); void prefsDialog();
void messagesDialog(); void messagesDialog();
void simpleAppendDialog();
void simpleOpenDialog(); void simpleOpenDialog();
void openDialog(); void openDialog();
void openDialog( int ); void openDialog( int );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment