Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
2a2773ed
Commit
2a2773ed
authored
Mar 07, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt4: move dialog handler to a separate file
parent
7cba3abb
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
127 additions
and
43 deletions
+127
-43
modules/gui/qt4/Modules.am
modules/gui/qt4/Modules.am
+3
-0
modules/gui/qt4/dialogs/external.cpp
modules/gui/qt4/dialogs/external.cpp
+70
-0
modules/gui/qt4/dialogs/external.hpp
modules/gui/qt4/dialogs/external.hpp
+48
-0
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.cpp
+4
-36
modules/gui/qt4/main_interface.hpp
modules/gui/qt4/main_interface.hpp
+2
-7
No files found.
modules/gui/qt4/Modules.am
View file @
2a2773ed
...
@@ -27,6 +27,7 @@ nodist_SOURCES_qt4 = \
...
@@ -27,6 +27,7 @@ nodist_SOURCES_qt4 = \
dialogs/extended.moc.cpp \
dialogs/extended.moc.cpp \
dialogs/messages.moc.cpp \
dialogs/messages.moc.cpp \
dialogs/errors.moc.cpp \
dialogs/errors.moc.cpp \
dialogs/external.moc.cpp \
dialogs/plugins.moc.cpp \
dialogs/plugins.moc.cpp \
dialogs/preferences.moc.cpp \
dialogs/preferences.moc.cpp \
dialogs/interaction.moc.cpp \
dialogs/interaction.moc.cpp \
...
@@ -201,6 +202,7 @@ SOURCES_qt4 = qt4.cpp \
...
@@ -201,6 +202,7 @@ SOURCES_qt4 = qt4.cpp \
dialogs/extended.cpp \
dialogs/extended.cpp \
dialogs/messages.cpp \
dialogs/messages.cpp \
dialogs/errors.cpp \
dialogs/errors.cpp \
dialogs/external.cpp \
dialogs/plugins.cpp \
dialogs/plugins.cpp \
dialogs/interaction.cpp \
dialogs/interaction.cpp \
dialogs/sout.cpp \
dialogs/sout.cpp \
...
@@ -246,6 +248,7 @@ noinst_HEADERS = \
...
@@ -246,6 +248,7 @@ noinst_HEADERS = \
dialogs/extended.hpp \
dialogs/extended.hpp \
dialogs/messages.hpp \
dialogs/messages.hpp \
dialogs/errors.hpp \
dialogs/errors.hpp \
dialogs/external.hpp \
dialogs/plugins.hpp \
dialogs/plugins.hpp \
dialogs/preferences.hpp \
dialogs/preferences.hpp \
dialogs/interaction.hpp \
dialogs/interaction.hpp \
...
...
modules/gui/qt4/dialogs/external.cpp
0 → 100644
View file @
2a2773ed
/*****************************************************************************
* 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
));
}
modules/gui/qt4/dialogs/external.hpp
0 → 100644
View file @
2a2773ed
/*****************************************************************************
* 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
modules/gui/qt4/main_interface.cpp
View file @
2a2773ed
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
#include "components/interface_widgets.hpp"
#include "components/interface_widgets.hpp"
#include "components/controller.hpp"
#include "components/controller.hpp"
#include "components/playlist/playlist.hpp"
#include "components/playlist/playlist.hpp"
#include "dialogs/external.hpp"
#include "menus.hpp"
#include "menus.hpp"
#include "recents.hpp"
#include "recents.hpp"
...
@@ -56,14 +57,11 @@
...
@@ -56,14 +57,11 @@
#include <QLabel>
#include <QLabel>
#include <QGroupBox>
#include <QGroupBox>
#include <QPushButton>
#include <QPushButton>
#include <QMessageBox>
#include <assert.h>
#include <assert.h>
#include <vlc_keys.h>
/* Wheel event */
#include <vlc_keys.h>
/* Wheel event */
#include <vlc_vout.h>
#include <vlc_vout.h>
#include <vlc_dialog.h>
#include "dialogs/errors.hpp"
/* Callback prototypes */
/* Callback prototypes */
static
int
PopupMenuCB
(
vlc_object_t
*
p_this
,
const
char
*
psz_variable
,
static
int
PopupMenuCB
(
vlc_object_t
*
p_this
,
const
char
*
psz_variable
,
...
@@ -198,6 +196,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
...
@@ -198,6 +196,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
/* END CONNECTS ON IM */
/* END CONNECTS ON IM */
dialogHandler
=
new
DialogHandler
(
p_intf
);
/************
/************
* Callbacks
* Callbacks
...
@@ -206,13 +205,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
...
@@ -206,13 +205,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
var_AddCallback
(
p_intf
,
"interaction"
,
InteractCallback
,
this
);
var_AddCallback
(
p_intf
,
"interaction"
,
InteractCallback
,
this
);
interaction_Register
(
p_intf
);
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
);
var_AddCallback
(
p_intf
->
p_libvlc
,
"intf-show"
,
IntfShowCB
,
p_intf
);
/* Register callback for the intf-popupmenu variable */
/* Register callback for the intf-popupmenu variable */
...
@@ -289,6 +281,8 @@ MainInterface::~MainInterface()
...
@@ -289,6 +281,8 @@ MainInterface::~MainInterface()
{
{
msg_Dbg
(
p_intf
,
"Destroying the main interface"
);
msg_Dbg
(
p_intf
,
"Destroying the main interface"
);
delete
dialogHandler
;
/* Unsure we hide the videoWidget before destroying it */
/* Unsure we hide the videoWidget before destroying it */
if
(
videoIsActive
)
videoWidget
->
hide
();
if
(
videoIsActive
)
videoWidget
->
hide
();
...
@@ -332,9 +326,6 @@ MainInterface::~MainInterface()
...
@@ -332,9 +326,6 @@ MainInterface::~MainInterface()
interaction_Unregister
(
p_intf
);
interaction_Unregister
(
p_intf
);
var_DelCallback
(
p_intf
,
"interaction"
,
InteractCallback
,
this
);
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
;
p_intf
->
p_sys
->
p_mi
=
NULL
;
}
}
...
@@ -1235,29 +1226,6 @@ static int InteractCallback( vlc_object_t *p_this,
...
@@ -1235,29 +1226,6 @@ static int InteractCallback( vlc_object_t *p_this,
return
VLC_SUCCESS
;
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.
* PopupMenuCB: callback triggered by the intf-popupmenu playlist variable.
* We don't show the menu directly here because we don't want the
* We don't show the menu directly here because we don't want the
...
...
modules/gui/qt4/main_interface.hpp
View file @
2a2773ed
...
@@ -49,7 +49,7 @@ class FullscreenControllerWidget;
...
@@ -49,7 +49,7 @@ class FullscreenControllerWidget;
class
SpeedControlWidget
;
class
SpeedControlWidget
;
class
QMenu
;
class
QMenu
;
class
QSize
;
class
QSize
;
struct
dialog_fatal_t
;
class
DialogHandler
;
enum
{
enum
{
CONTROLS_VISIBLE
=
0x1
,
CONTROLS_VISIBLE
=
0x1
,
...
@@ -108,6 +108,7 @@ private:
...
@@ -108,6 +108,7 @@ private:
ControlsWidget
*
controls
;
ControlsWidget
*
controls
;
InputControlsWidget
*
inputC
;
InputControlsWidget
*
inputC
;
FullscreenControllerWidget
*
fullscreenControls
;
FullscreenControllerWidget
*
fullscreenControls
;
DialogHandler
*
dialogHandler
;
void
handleMainUi
(
QSettings
*
);
void
handleMainUi
(
QSettings
*
);
void
askForPrivacy
();
void
askForPrivacy
();
...
@@ -151,11 +152,6 @@ private:
...
@@ -151,11 +152,6 @@ private:
virtual
void
wheelEvent
(
QWheelEvent
*
);
virtual
void
wheelEvent
(
QWheelEvent
*
);
virtual
void
resizeEvent
(
QResizeEvent
*
event
);
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
:
public
slots
:
void
undockPlaylist
();
void
undockPlaylist
();
void
dockPlaylist
(
pl_dock_e
i_pos
=
PL_BOTTOM
);
void
dockPlaylist
(
pl_dock_e
i_pos
=
PL_BOTTOM
);
...
@@ -194,7 +190,6 @@ signals:
...
@@ -194,7 +190,6 @@ signals:
void
askUpdate
();
void
askUpdate
();
void
minimalViewToggled
(
bool
);
void
minimalViewToggled
(
bool
);
void
fullscreenInterfaceToggled
(
bool
);
void
fullscreenInterfaceToggled
(
bool
);
void
fatalDialog
(
const
struct
dialog_fatal_t
*
);
};
};
#endif
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment