From: Jean-Baptiste Kempf Date: Tue, 9 Dec 2008 14:33:42 +0000 (+0100) Subject: [Qt] Menu integration. X-Git-Tag: 1.0.0-pre1~1898 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=06825f81dea463b28b7fd0e3b59f47f69d46c919;p=vlc [Qt] Menu integration. --- diff --git a/modules/gui/qt4/dialogs/toolbar.hpp b/modules/gui/qt4/dialogs/toolbar.hpp new file mode 100644 index 0000000000..6c993542a4 --- /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 + * + * 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 +#include + +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 30d19023ba..a756e24b0b 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 #include @@ -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 225fe6b80c..2c6eff7c10 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 28f1802f0d..d34513cc5b 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" );