]> git.sesse.net Git - vlc/commitdiff
[Qt] Menu integration.
authorJean-Baptiste Kempf <jb@videolan.org>
Tue, 9 Dec 2008 14:33:42 +0000 (15:33 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Tue, 9 Dec 2008 16:56:30 +0000 (17:56 +0100)
modules/gui/qt4/dialogs/toolbar.hpp [new file with mode: 0644]
modules/gui/qt4/dialogs_provider.cpp
modules/gui/qt4/dialogs_provider.hpp
modules/gui/qt4/menus.cpp

diff --git a/modules/gui/qt4/dialogs/toolbar.hpp b/modules/gui/qt4/dialogs/toolbar.hpp
new file mode 100644 (file)
index 0000000..6c99354
--- /dev/null
@@ -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
+
index 30d19023ba44ca01554855a31239f31c95519f78..a756e24b0bcf8cef9ac09b718b05a3e2c218a59e 100644 (file)
@@ -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 )
 {
index 225fe6b80c1598b379df11ed8b3b0cdbd8113435..2c6eff7c10a8746f8c6982f38cb526b7059c8027 100644 (file)
@@ -148,6 +148,7 @@ public slots:
     void aboutDialog();
     void gotoTimeDialog();
     void podcastConfigureDialog();
+    void toolbarDialog();
 
     void openFileGenericDialog( intf_dialog_args_t * );
 
index 28f1802f0d139df475781379e4455c4ac3e05f18..d34513cc5b31cbf7ef93bc2b04f8055369746d37 100644 (file)
@@ -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" );