dialogs/extended.moc.cpp \
dialogs/messages.moc.cpp \
dialogs/errors.moc.cpp \
+ dialogs/external.moc.cpp \
dialogs/plugins.moc.cpp \
dialogs/preferences.moc.cpp \
dialogs/interaction.moc.cpp \
dialogs/extended.cpp \
dialogs/messages.cpp \
dialogs/errors.cpp \
+ dialogs/external.cpp \
dialogs/plugins.cpp \
dialogs/interaction.cpp \
dialogs/sout.cpp \
dialogs/extended.hpp \
dialogs/messages.hpp \
dialogs/errors.hpp \
+ dialogs/external.hpp \
dialogs/plugins.hpp \
dialogs/preferences.hpp \
dialogs/interaction.hpp \
--- /dev/null
+/*****************************************************************************
+ * external.hpp : Dialogs from other LibVLC core and other plugins
+ ****************************************************************************
+ * Copyright (C) 2009 Rémi Denis-Courmont
+ *
+ * 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.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+//#include "qt4.hpp"
+#include "external.hpp"
+#include "errors.hpp"
+#include <vlc_dialog.h>
+
+#include <QMessageBox>
+
+DialogHandler::DialogHandler (intf_thread_t *intf)
+{
+ this->intf = intf;
+
+ connect (this, SIGNAL(message(const struct dialog_fatal_t *)),
+ this, SLOT(displayMessage(const struct dialog_fatal_t *)),
+ Qt::BlockingQueuedConnection);
+ var_Create (intf, "dialog-fatal", VLC_VAR_ADDRESS);
+ var_AddCallback (intf, "dialog-fatal", MessageCallback, this);
+
+ dialog_Register (intf);
+}
+
+DialogHandler::~DialogHandler (void)
+{
+ dialog_Unregister (intf);
+}
+
+int DialogHandler::MessageCallback (vlc_object_t *obj, const char *var,
+ vlc_value_t, vlc_value_t value,
+ void *data)
+{
+ DialogHandler *self = (DialogHandler *)data;
+ const dialog_fatal_t *dialog = (const dialog_fatal_t *)value.p_address;
+
+ emit self->message (dialog);
+ return VLC_SUCCESS;
+}
+
+void DialogHandler::displayMessage (const struct dialog_fatal_t *dialog)
+{
+ if (dialog->modal)
+ QMessageBox::critical (NULL, qfu(dialog->title), qfu(dialog->message),
+ QMessageBox::Ok);
+ else
+ if (config_GetInt (intf, "qt-error-dialogs"))
+ ErrorsDialog::getInstance (intf)->addError(qfu(dialog->title),
+ qfu(dialog->message));
+}
--- /dev/null
+/*****************************************************************************
+ * external.hpp : Dialogs from other LibVLC core and other plugins
+ ****************************************************************************
+ * Copyright (C) 2009 Rémi Denis-Courmont
+ *
+ * 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 VLC_QT4_DIALOGS_EXTERNAL_H_
+# define VLC_QT4_DIALOGS_EXTERNAL_H 1
+
+#include <QObject>
+#include <vlc_common.h>
+
+struct intf_thread_t;
+
+class DialogHandler : public QObject
+{
+ Q_OBJECT
+public:
+ DialogHandler (intf_thread_t *);
+ ~DialogHandler (void);
+
+private:
+ intf_thread_t *intf;
+ static int MessageCallback( vlc_object_t *, const char *, vlc_value_t,
+ vlc_value_t, void * );
+
+private slots:
+ void displayMessage (const struct dialog_fatal_t *);
+
+signals:
+ void message (const struct dialog_fatal_t *);
+};
+
+#endif
#include "components/interface_widgets.hpp"
#include "components/controller.hpp"
#include "components/playlist/playlist.hpp"
+#include "dialogs/external.hpp"
#include "menus.hpp"
#include "recents.hpp"
#include <QLabel>
#include <QGroupBox>
#include <QPushButton>
-#include <QMessageBox>
#include <assert.h>
#include <vlc_keys.h> /* Wheel event */
#include <vlc_vout.h>
-#include <vlc_dialog.h>
-#include "dialogs/errors.hpp"
/* Callback prototypes */
static int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,
/* END CONNECTS ON IM */
+ dialogHandler = new DialogHandler (p_intf);
/************
* Callbacks
var_AddCallback( p_intf, "interaction", InteractCallback, this );
interaction_Register( p_intf );
- connect( this, SIGNAL(fatalDialog( const struct dialog_fatal_t * )),
- this, SLOT(displayFatalDialog( const struct dialog_fatal_t * )),
- Qt::BlockingQueuedConnection );
- var_Create( p_intf, "dialog-fatal", VLC_VAR_ADDRESS );
- var_AddCallback( p_intf, "dialog-fatal", DialogCallback, this );
- dialog_Register( p_intf );
-
var_AddCallback( p_intf->p_libvlc, "intf-show", IntfShowCB, p_intf );
/* Register callback for the intf-popupmenu variable */
{
msg_Dbg( p_intf, "Destroying the main interface" );
+ delete dialogHandler;
+
/* Unsure we hide the videoWidget before destroying it */
if( videoIsActive ) videoWidget->hide();
interaction_Unregister( p_intf );
var_DelCallback( p_intf, "interaction", InteractCallback, this );
- dialog_Unregister( p_intf );
- var_DelCallback( p_intf, "dialog-fatal", DialogCallback, this );
-
p_intf->p_sys->p_mi = NULL;
}
return VLC_SUCCESS;
}
-int MainInterface::DialogCallback( vlc_object_t *p_this,
- const char *type, vlc_value_t previous,
- vlc_value_t value, void *data )
-{
- MainInterface *self = (MainInterface *)data;
- const dialog_fatal_t *dialog = (const dialog_fatal_t *)value.p_address;
- (void) previous;
-
- emit self->fatalDialog (dialog);
- return VLC_SUCCESS;
-}
-
-void MainInterface::displayFatalDialog (const dialog_fatal_t *dialog)
-{
- if (dialog->modal)
- QMessageBox::critical (NULL, qfu(dialog->title), qfu(dialog->message),
- QMessageBox::Ok);
- else
- if (config_GetInt (p_intf, "qt-error-dialogs"))
- ErrorsDialog::getInstance (p_intf)->addError(qfu(dialog->title),
- qfu(dialog->message));
-}
-
/*****************************************************************************
* PopupMenuCB: callback triggered by the intf-popupmenu playlist variable.
* We don't show the menu directly here because we don't want the
class SpeedControlWidget;
class QMenu;
class QSize;
-struct dialog_fatal_t;
+class DialogHandler;
enum {
CONTROLS_VISIBLE = 0x1,
ControlsWidget *controls;
InputControlsWidget *inputC;
FullscreenControllerWidget *fullscreenControls;
+ DialogHandler *dialogHandler;
void handleMainUi( QSettings* );
void askForPrivacy();
virtual void wheelEvent( QWheelEvent * );
virtual void resizeEvent( QResizeEvent * event );
- static int DialogCallback( vlc_object_t *, const char *, vlc_value_t,
- vlc_value_t, void * );
-private slots:
- void displayFatalDialog( const struct dialog_fatal_t * );
-
public slots:
void undockPlaylist();
void dockPlaylist( pl_dock_e i_pos = PL_BOTTOM );
void askUpdate();
void minimalViewToggled( bool );
void fullscreenInterfaceToggled( bool );
- void fatalDialog( const struct dialog_fatal_t * );
};
#endif