Qt4: Please help...
authorJean-Baptiste Kempf <jb@videolan.org>
Wed, 29 Nov 2006 20:17:08 +0000 (20:17 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Wed, 29 Nov 2006 20:17:08 +0000 (20:17 +0000)
Adds an help menu with help and about.
Dialogs are still empty.

modules/gui/qt4/Modules.am
modules/gui/qt4/dialogs/help.cpp [new file with mode: 0644]
modules/gui/qt4/dialogs/help.hpp [new file with mode: 0644]
modules/gui/qt4/dialogs_provider.cpp
modules/gui/qt4/dialogs_provider.hpp
modules/gui/qt4/menus.cpp
modules/gui/qt4/menus.hpp

index b037d0b..ae88d4b 100644 (file)
@@ -43,6 +43,7 @@ TOMOC = main_interface \
        dialogs/extended \
        dialogs/interaction \
        dialogs/sout \
+       dialogs/help \
     dialogs/open \
        components/extended_panels \
        components/infopanels \
@@ -71,6 +72,7 @@ nodist_SOURCES_qt4 = \
                dialogs/prefs_dialog.moc.cpp \
                dialogs/interaction.moc.cpp \
                dialogs/sout.moc.cpp \
+               dialogs/help.moc.cpp \
                dialogs/open.moc.cpp \
                components/extended_panels.moc.cpp \
                components/infopanels.moc.cpp \
@@ -119,6 +121,7 @@ SOURCES_qt4 =       qt4.cpp \
                dialogs/errors.cpp \
                dialogs/interaction.cpp \
                dialogs/sout.cpp \
+               dialogs/help.cpp \
                dialogs/open.cpp \
                components/extended_panels.cpp \
                components/infopanels.cpp \
@@ -149,6 +152,7 @@ EXTRA_DIST += \
        dialogs/prefs_dialog.hpp \
        dialogs/interaction.hpp \
        dialogs/sout.hpp \
+       dialogs/help.hpp \
        dialogs/open.hpp \
        components/extended_panels.hpp \
        components/infopanels.hpp \
diff --git a/modules/gui/qt4/dialogs/help.cpp b/modules/gui/qt4/dialogs/help.cpp
new file mode 100644 (file)
index 0000000..a23db37
--- /dev/null
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Help.cpp : Help and About dialogs
+ ****************************************************************************
+ * Copyright (C) 2006 the VideoLAN team
+ * $Id: Messages.cpp 16024 2006-07-13 13:51:05Z xtophe $
+ *
+ * Authors: Jean-Baptiste Kempf <jb (at) videolan.org>
+ *
+ * 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.
+ *****************************************************************************/
+
+#include "dialogs/help.hpp"
+
+#include "dialogs_provider.hpp"
+#include "util/qvlcframe.hpp"
+#include "qt4.hpp"
+
+HelpDialog *HelpDialog::instance = NULL;
+
+HelpDialog::HelpDialog( intf_thread_t *_p_intf) :  QVLCFrame( _p_intf )
+{
+    setWindowTitle( qtr( "Help" ) );
+    resize(600, 400);
+
+    QGridLayout *layout = new QGridLayout(this);
+    QPushButton *closeButton = new QPushButton(qtr("&Close"));
+
+    BUTTONACT( closeButton, close() );
+}
+
+HelpDialog::~HelpDialog()
+{
+}
+void HelpDialog::close()
+{
+    this->toggleVisible();
+}
+
+AboutDialog *AboutDialog::instance = NULL;
+
+AboutDialog::AboutDialog( intf_thread_t *_p_intf) :  QVLCFrame( _p_intf )
+{
+    setWindowTitle( qtr( "About" ) );
+    resize(600, 400);
+
+    QGridLayout *layout = new QGridLayout(this);
+    QPushButton *closeButton = new QPushButton(qtr("&Close"));
+
+    BUTTONACT( closeButton, close() );
+}
+
+AboutDialog::~AboutDialog()
+{
+}
+void AboutDialog::close()
+{
+    this->toggleVisible();
+}
diff --git a/modules/gui/qt4/dialogs/help.hpp b/modules/gui/qt4/dialogs/help.hpp
new file mode 100644 (file)
index 0000000..2f6afad
--- /dev/null
@@ -0,0 +1,67 @@
+/*****************************************************************************
+ * Help.hpp : Help and About dialogs
+ ****************************************************************************
+ * Copyright (C) 2006 the VideoLAN team
+ * $Id: Messages.hpp 16024 2006-07-13 13:51:05Z xtophe $
+ *
+ * Authors: Jean-Baptiste Kempf <jb (at) videolan.org>
+ *
+ * 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. *****************************************************************************/
+
+#ifndef _HELP_DIALOG_H_
+#define _HELP_DIALOG_H_
+
+#include "util/qvlcframe.hpp"
+
+class HelpDialog : public QVLCFrame
+{
+    Q_OBJECT;
+public:
+    static HelpDialog * getInstance( intf_thread_t *p_intf )
+    {
+        if( !instance)
+            instance = new HelpDialog( p_intf);
+        return instance;
+    }
+    virtual ~HelpDialog();
+
+private:
+    HelpDialog( intf_thread_t *);
+    static HelpDialog *instance;
+public slots:
+    void close();
+};
+
+
+class AboutDialog : public QVLCFrame
+{
+    Q_OBJECT;
+public:
+    static AboutDialog * getInstance( intf_thread_t *p_intf )
+    {
+        if( !instance)
+            instance = new AboutDialog( p_intf);
+        return instance;
+    }
+    virtual ~AboutDialog();
+
+private:
+    AboutDialog( intf_thread_t *);
+    static AboutDialog *instance;
+public slots:
+    void close();
+};
+
+#endif
index 89e2a20..e241315 100644 (file)
@@ -38,6 +38,7 @@
 #include "dialogs/extended.hpp"
 #include "dialogs/sout.hpp"
 #include "dialogs/open.hpp"
+#include "dialogs/help.hpp"
 
 DialogsProvider* DialogsProvider::instance = NULL;
 
@@ -116,9 +117,9 @@ void DialogsProvider::PLAppendDialog()
 void DialogsProvider::MLAppendDialog()
 {
 }
-void DialogsProvider::openDialog( int i_dialog )
+void DialogsProvider::openDialog( int i_tab )
 {
-    OpenDialog::getInstance( p_intf )->toggleVisible();
+    OpenDialog::getInstance( p_intf )->showTab( i_tab );
 }
 
 void DialogsProvider::doInteraction( intf_dialog_args_t *p_arg )
@@ -183,6 +184,16 @@ void DialogsProvider::messagesDialog()
     MessagesDialog::getInstance( p_intf )->toggleVisible();
 }
 
+void DialogsProvider::helpDialog()
+{
+    HelpDialog::getInstance( p_intf )->toggleVisible();
+}
+
+void DialogsProvider::aboutDialog()
+{
+    AboutDialog::getInstance( p_intf )->toggleVisible();
+}
+
 void DialogsProvider::menuAction( QObject *data )
 {
     QVLCMenu::DoAction( p_intf, data );
index 2aef00b..f92906c 100644 (file)
@@ -96,6 +96,8 @@ public slots:
     void openMLDirectory();
     void quit();
     void switchToSkins();
+    void helpDialog();
+    void aboutDialog();
 };
 
 #endif
index 50ce7c2..404c492 100644 (file)
@@ -135,7 +135,7 @@ void QVLCMenu::createMenuBar( MainInterface *mi, intf_thread_t *p_intf,
     BAR_DADD( AudioMenu( p_intf, NULL ), qtr("Audio"), 2 );
     BAR_DADD( NavigMenu( p_intf, NULL ), qtr("Navigation"), 3 );
 
-    //    BAR_ADD( HelpMenu(), qtr("Help" ) );
+    BAR_ADD( HelpMenu(), qtr("Help" ) );
 }
 QMenu *QVLCMenu::FileMenu()
 {
@@ -326,6 +326,16 @@ QMenu *QVLCMenu::SDMenu( intf_thread_t *p_intf )
     return menu;
 }
 
+QMenu *QVLCMenu::HelpMenu()
+{
+    QMenu *menu = new QMenu();
+    DP_SADD( qtr("Help") , "", "", helpDialog() );
+                menu->addSeparator();
+    DP_SADD( qtr("About VLC media player..."), "", "", aboutDialog() );
+    return menu;
+}
+
+
 /*****************************************************************************
  * Popup menus
  *****************************************************************************/
index 69e0313..7109bd4 100644 (file)
@@ -70,6 +70,7 @@ public:
     static QMenu *VideoMenu( intf_thread_t * , QMenu * );
     static QMenu *AudioMenu( intf_thread_t * , QMenu * );
     static QMenu *InterfacesMenu( intf_thread_t *p_intf, QMenu * );
+    static QMenu *HelpMenu();
 
     /* Popups */
     static void AudioPopupMenu( intf_thread_t * );