[vlc-devel] commit: [Qt] Menu integration. (Jean-Baptiste Kempf )

git version control git at videolan.org
Tue Dec 9 17:56:46 CET 2008


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Tue Dec  9 15:33:42 2008 +0100| [06825f81dea463b28b7fd0e3b59f47f69d46c919] | committer: Jean-Baptiste Kempf 

[Qt] Menu integration.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=06825f81dea463b28b7fd0e3b59f47f69d46c919
---

 modules/gui/qt4/dialogs/toolbar.hpp  |   91 ++++++++++++++++++++++++++++++++++
 modules/gui/qt4/dialogs_provider.cpp |    6 ++
 modules/gui/qt4/dialogs_provider.hpp |    1 +
 modules/gui/qt4/menus.cpp            |    2 +
 4 files changed, 100 insertions(+), 0 deletions(-)

diff --git a/modules/gui/qt4/dialogs/toolbar.hpp b/modules/gui/qt4/dialogs/toolbar.hpp
new file mode 100644
index 0000000..6c99354
--- /dev/null
+++ b/modules/gui/qt4/dialogs/toolbar.hpp
@@ -0,0 +1,91 @@
+/*****************************************************************************
+ * ToolbarEdit.hpp : ToolbarEdit dialogs
+ ****************************************************************************
+ * Copyright (C) 2007 the VideoLAN team
+ * $Id$
+ *
+ * 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 _TOOLBAREDIT_DIALOG_H_
+#define _TOOLBAREDIT_DIALOG_H_
+
+#include "util/qvlcframe.hpp"
+#include "components/controller.hpp"
+
+#include <QRubberBand>
+#include <QListWidget>
+
+class ToolbarEditDialog;
+
+class WidgetListing : public QListWidget
+{
+    Q_OBJECT;
+public:
+    WidgetListing( intf_thread_t *, QWidget *_parent = 0 );
+protected:
+    virtual void startDrag( Qt::DropActions /*supportedActions*/ );
+private:
+    ToolbarEditDialog *parent;
+};
+
+class ToolbarEditDialog : public QVLCFrame
+{
+    Q_OBJECT;
+public:
+    static ToolbarEditDialog * getInstance( intf_thread_t *p_intf )
+    {
+        if( !instance)
+            instance = new ToolbarEditDialog( p_intf );
+        return instance;
+    }
+    virtual ~ToolbarEditDialog();
+    int getOptions() { return flatBox->isChecked() * WIDGET_FLAT +
+        bigBox->isChecked() * WIDGET_BIG; }
+private:
+    ToolbarEditDialog( intf_thread_t * );
+    static ToolbarEditDialog *instance;
+
+    QCheckBox *flatBox, *bigBox, *shinyBox;
+
+    WidgetListing *widgetListing;
+};
+
+class DroppingController: public AbstractController
+{
+    Q_OBJECT;
+public:
+    DroppingController( intf_thread_t *  );
+
+protected:
+    virtual void createAndAddWidget( QBoxLayout *controlLayout, int i_index,
+            buttonType_e i_type, int i_option );
+    virtual void dragEnterEvent ( QDragEnterEvent * event );
+    virtual void dragMoveEvent(QDragMoveEvent *event);
+    virtual void dropEvent ( QDropEvent * event );
+    virtual void dragLeaveEvent ( QDragLeaveEvent * event );
+
+    virtual void doAction( int );
+private:
+    QRubberBand *rubberband;
+
+    int getParentPosInLayout( QPoint point);
+
+};
+
+#endif
+
diff --git a/modules/gui/qt4/dialogs_provider.cpp b/modules/gui/qt4/dialogs_provider.cpp
index 30d1902..a756e24 100644
--- a/modules/gui/qt4/dialogs_provider.cpp
+++ b/modules/gui/qt4/dialogs_provider.cpp
@@ -50,6 +50,7 @@
 #include "dialogs/help.hpp"
 #include "dialogs/gototime.hpp"
 #include "dialogs/podcast_configuration.hpp"
+#include "dialogs/toolbar.hpp"
 
 #include <QEvent>
 #include <QApplication>
@@ -238,6 +239,11 @@ void DialogsProvider::podcastConfigureDialog()
     PodcastConfigDialog::getInstance( p_intf )->toggleVisible();
 }
 
+void DialogsProvider::toolbarDialog()
+{
+    ToolbarEditDialog::getInstance( p_intf )->toggleVisible();
+}
+
 /* Generic open file */
 void DialogsProvider::openFileGenericDialog( intf_dialog_args_t *p_arg )
 {
diff --git a/modules/gui/qt4/dialogs_provider.hpp b/modules/gui/qt4/dialogs_provider.hpp
index 225fe6b..2c6eff7 100644
--- a/modules/gui/qt4/dialogs_provider.hpp
+++ b/modules/gui/qt4/dialogs_provider.hpp
@@ -148,6 +148,7 @@ public slots:
     void aboutDialog();
     void gotoTimeDialog();
     void podcastConfigureDialog();
+    void toolbarDialog();
 
     void openFileGenericDialog( intf_dialog_args_t * );
 
diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp
index 28f1802..d34513c 100644
--- a/modules/gui/qt4/menus.cpp
+++ b/modules/gui/qt4/menus.cpp
@@ -362,6 +362,8 @@ QMenu *QVLCMenu::ToolsMenu( intf_thread_t *p_intf )
 #endif
     menu->addSeparator();
 
+    addDPStaticEntry( menu, qtr( "&Customize Interface..." ), "",
+        ":/preferences", SLOT( toolbarDialog() ), "" );
     addDPStaticEntry( menu, qtr( "&Preferences..." ), "",
         ":/preferences", SLOT( prefsDialog() ), "Ctrl+P" );
 




More information about the vlc-devel mailing list