]> git.sesse.net Git - vlc/commitdiff
* First implementation of the simpleOpenFile Dialog for Qt4
authorJean-Baptiste Kempf <jb@videolan.org>
Sun, 20 Aug 2006 12:57:07 +0000 (12:57 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Sun, 20 Aug 2006 12:57:07 +0000 (12:57 +0000)
* Cosmetic fixes in messages.

modules/gui/qt4/dialogs/messages.cpp
modules/gui/qt4/dialogs/messages.hpp
modules/gui/qt4/dialogs_provider.cpp
modules/gui/qt4/dialogs_provider.hpp

index 73b437b79e61b930d9e1e09f9d24e2464ea19fff..3cc09904b8faf1199ed55bc8a19c5ef042be0aa9 100644 (file)
@@ -35,19 +35,18 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf, bool _main_input ) :
     setWindowTitle( _("Messages" ) );
     resize(420, 600);
 
-    layout = new QGridLayout(this);
-    closeButton = new QPushButton(qtr("&Close"));
-    clearButton = new QPushButton(qtr("&Clear"));
-    saveLogButton = new QPushButton(qtr("&Save as..."));
-    verbosityBox = new QSpinBox();
+    QGridLayout *layout = new QGridLayout(this);
+    QPushButton *closeButton = new QPushButton(qtr("&Close"));
+    QPushButton *clearButton = new QPushButton(qtr("&Clear"));
+    QPushButton *saveLogButton = new QPushButton(qtr("&Save as..."));
+    QSpinBox *verbosityBox = new QSpinBox();
     verbosityBox->setRange(1, 3);
     verbosityBox->setWrapping(true);
-    verbosityLabel = new QLabel(qtr("Verbosity Level"));
+    QLabel *verbosityLabel = new QLabel(qtr("Verbosity Level"));
     messages = new QTextEdit();
     messages->setReadOnly(true);
     messages->setGeometry(0, 0, 440, 600);
     messages->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-    messagesCursor = new QTextCursor();
 
     layout->addWidget(messages, 0, 0, 1, 0);
     layout->addWidget(verbosityLabel, 1, 0, 1, 1);
index efdd9f8b68c54c12af65739ab5bb9e3bd738f563..ce13c24c0b7128458c804ac9ecd11c3a62fe0b76 100644 (file)
 #include <QTextStream>
 #include <QMessageBox>
 
+class QPushButton;
+class QSpinBox;
+class QGridLayout;
+class QLabel;
+class QTextEdit;
+
 class MessagesDialog : public QVLCFrame
 {
     Q_OBJECT;
@@ -50,15 +56,7 @@ private:
     bool main_input;
     static MessagesDialog *instance;
 
-    QPushButton *closeButton;
-    QPushButton *clearButton;
-    QPushButton *saveLogButton;
-    QGridLayout *layout;
-    QSpinBox *verbosityBox;
-    QLabel *verbosityLabel;
     QTextEdit *messages;
-    QTextCursor *messagesCursor;
-    QFile *saveLogFile;
 
 public slots:
     void updateLog();
index f6888371c795ec8cfed1acd00a5fb25d1ed84554..06b3446a8d2c83821378dbad60e4fe849ef7a798 100644 (file)
@@ -170,15 +170,57 @@ void DialogsProvider::menuUpdateAction( QObject *data )
     f->doFunc( p_intf );
 }
 
+void DialogsProvider::simpleAppendDialog()
+{
+
+}
+
 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::popupMenu( int i_dialog )
 {
 
index 45e20648ee1f049499f443ed73d9806663ce1003..fc72e12b7f4052c11ce3052affdb688468edfe3e 100644 (file)
@@ -69,6 +69,7 @@ public slots:
     void streaminfoDialog();
     void prefsDialog();
     void messagesDialog();
+    void simpleAppendDialog();
     void simpleOpenDialog();
     void openDialog();
     void openDialog( int );