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
143011b4
Commit
143011b4
authored
Mar 08, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt4: back-end for dialog_Progress
parent
fcdea129
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
111 additions
and
1 deletion
+111
-1
modules/gui/qt4/dialogs/external.cpp
modules/gui/qt4/dialogs/external.cpp
+76
-1
modules/gui/qt4/dialogs/external.hpp
modules/gui/qt4/dialogs/external.hpp
+35
-0
No files found.
modules/gui/qt4/dialogs/external.cpp
View file @
143011b4
...
@@ -33,6 +33,8 @@
...
@@ -33,6 +33,8 @@
#include <QLabel>
#include <QLabel>
#include <QLineEdit>
#include <QLineEdit>
#include <QMessageBox>
#include <QMessageBox>
#include <QProgressDialog>
#include <QMutex>
QVLCVariable
::
QVLCVariable
(
vlc_object_t
*
obj
,
const
char
*
varname
,
int
type
)
QVLCVariable
::
QVLCVariable
(
vlc_object_t
*
obj
,
const
char
*
varname
,
int
type
)
:
object
(
obj
),
name
(
qfu
(
varname
))
:
object
(
obj
),
name
(
qfu
(
varname
))
...
@@ -59,7 +61,8 @@ DialogHandler::DialogHandler (intf_thread_t *intf)
...
@@ -59,7 +61,8 @@ DialogHandler::DialogHandler (intf_thread_t *intf)
:
intf
(
intf
),
:
intf
(
intf
),
message
(
VLC_OBJECT
(
intf
),
"dialog-fatal"
,
VLC_VAR_ADDRESS
),
message
(
VLC_OBJECT
(
intf
),
"dialog-fatal"
,
VLC_VAR_ADDRESS
),
login
(
VLC_OBJECT
(
intf
),
"dialog-login"
,
VLC_VAR_ADDRESS
),
login
(
VLC_OBJECT
(
intf
),
"dialog-login"
,
VLC_VAR_ADDRESS
),
question
(
VLC_OBJECT
(
intf
),
"dialog-question"
,
VLC_VAR_ADDRESS
)
question
(
VLC_OBJECT
(
intf
),
"dialog-question"
,
VLC_VAR_ADDRESS
),
progressBar
(
VLC_OBJECT
(
intf
),
"dialog-progress-bar"
,
VLC_VAR_ADDRESS
)
{
{
connect
(
&
message
,
SIGNAL
(
pointerChanged
(
vlc_object_t
*
,
void
*
)),
connect
(
&
message
,
SIGNAL
(
pointerChanged
(
vlc_object_t
*
,
void
*
)),
SLOT
(
displayMessage
(
vlc_object_t
*
,
void
*
)),
SLOT
(
displayMessage
(
vlc_object_t
*
,
void
*
)),
...
@@ -70,6 +73,12 @@ DialogHandler::DialogHandler (intf_thread_t *intf)
...
@@ -70,6 +73,12 @@ DialogHandler::DialogHandler (intf_thread_t *intf)
connect
(
&
question
,
SIGNAL
(
pointerChanged
(
vlc_object_t
*
,
void
*
)),
connect
(
&
question
,
SIGNAL
(
pointerChanged
(
vlc_object_t
*
,
void
*
)),
SLOT
(
requestAnswer
(
vlc_object_t
*
,
void
*
)),
SLOT
(
requestAnswer
(
vlc_object_t
*
,
void
*
)),
Qt
::
BlockingQueuedConnection
);
Qt
::
BlockingQueuedConnection
);
connect
(
&
progressBar
,
SIGNAL
(
pointerChanged
(
vlc_object_t
*
,
void
*
)),
SLOT
(
startProgressBar
(
vlc_object_t
*
,
void
*
)),
Qt
::
BlockingQueuedConnection
);
connect
(
this
,
SIGNAL
(
progressBarDestroyed
(
QWidget
*
)),
SLOT
(
stopProgressBar
(
QWidget
*
)));
dialog_Register
(
intf
);
dialog_Register
(
intf
);
}
}
...
@@ -168,3 +177,69 @@ void DialogHandler::requestAnswer (vlc_object_t *, void *value)
...
@@ -168,3 +177,69 @@ void DialogHandler::requestAnswer (vlc_object_t *, void *value)
delete
box
;
delete
box
;
data
->
answer
=
answer
;
data
->
answer
=
answer
;
}
}
QVLCProgressDialog
::
QVLCProgressDialog
(
DialogHandler
*
parent
,
struct
dialog_progress_bar_t
*
data
)
:
QProgressDialog
(
qfu
(
data
->
message
),
data
->
cancel
?
(
"&"
+
qfu
(
data
->
cancel
))
:
0
,
0
,
1000
),
cancelled
(
false
),
handler
(
parent
)
{
if
(
data
->
title
!=
NULL
)
setWindowTitle
(
qfu
(
data
->
title
));
setMinimumDuration
(
0
);
connect
(
this
,
SIGNAL
(
progressed
(
int
)),
SLOT
(
setValue
(
int
)));
connect
(
this
,
SIGNAL
(
canceled
(
void
)),
SLOT
(
saveCancel
(
void
)));
data
->
pf_update
=
update
;
data
->
pf_check
=
check
;
data
->
pf_destroy
=
destroy
;
data
->
p_sys
=
this
;
}
QVLCProgressDialog
::~
QVLCProgressDialog
(
void
)
{
}
void
QVLCProgressDialog
::
update
(
void
*
priv
,
float
value
)
{
QVLCProgressDialog
*
self
=
static_cast
<
QVLCProgressDialog
*>
(
priv
);
emit
self
->
progressed
((
int
)(
value
*
1000.
));
}
static
QMutex
cancel_mutex
;
bool
QVLCProgressDialog
::
check
(
void
*
priv
)
{
QVLCProgressDialog
*
self
=
static_cast
<
QVLCProgressDialog
*>
(
priv
);
QMutexLocker
locker
(
&
cancel_mutex
);
return
self
->
cancelled
;
}
void
QVLCProgressDialog
::
destroy
(
void
*
priv
)
{
QVLCProgressDialog
*
self
=
static_cast
<
QVLCProgressDialog
*>
(
priv
);
emit
self
->
handler
->
progressBarDestroyed
(
self
);
}
void
QVLCProgressDialog
::
saveCancel
(
void
)
{
QMutexLocker
locker
(
&
cancel_mutex
);
cancelled
=
true
;
}
void
DialogHandler
::
startProgressBar
(
vlc_object_t
*
,
void
*
value
)
{
dialog_progress_bar_t
*
data
=
(
dialog_progress_bar_t
*
)
value
;
QWidget
*
dlg
=
new
QVLCProgressDialog
(
this
,
data
);
dlg
->
show
();
}
void
DialogHandler
::
stopProgressBar
(
QWidget
*
dlg
)
{
delete
dlg
;
}
\ No newline at end of file
modules/gui/qt4/dialogs/external.hpp
View file @
143011b4
...
@@ -42,10 +42,14 @@ signals:
...
@@ -42,10 +42,14 @@ signals:
};
};
struct
intf_thread_t
;
struct
intf_thread_t
;
class
QProgressDialog
;
class
DialogHandler
:
public
QObject
class
DialogHandler
:
public
QObject
{
{
Q_OBJECT
Q_OBJECT
friend
class
QVLCProgressDialog
;
public:
public:
DialogHandler
(
intf_thread_t
*
);
DialogHandler
(
intf_thread_t
*
);
~
DialogHandler
(
void
);
~
DialogHandler
(
void
);
...
@@ -55,11 +59,42 @@ private:
...
@@ -55,11 +59,42 @@ private:
QVLCVariable
message
;
QVLCVariable
message
;
QVLCVariable
login
;
QVLCVariable
login
;
QVLCVariable
question
;
QVLCVariable
question
;
QVLCVariable
progressBar
;
signals:
void
progressBarDestroyed
(
QWidget
*
);
private
slots
:
private
slots
:
void
displayMessage
(
vlc_object_t
*
,
void
*
);
void
displayMessage
(
vlc_object_t
*
,
void
*
);
void
requestLogin
(
vlc_object_t
*
,
void
*
);
void
requestLogin
(
vlc_object_t
*
,
void
*
);
void
requestAnswer
(
vlc_object_t
*
,
void
*
);
void
requestAnswer
(
vlc_object_t
*
,
void
*
);
void
startProgressBar
(
vlc_object_t
*
,
void
*
);
void
stopProgressBar
(
QWidget
*
);
};
/* Put here instead of .cpp because of MOC */
#include <QProgressDialog>
class
QVLCProgressDialog
:
public
QProgressDialog
{
Q_OBJECT
public:
QVLCProgressDialog
(
DialogHandler
*
parent
,
struct
dialog_progress_bar_t
*
);
virtual
~
QVLCProgressDialog
(
void
);
private:
DialogHandler
*
handler
;
bool
cancelled
;
static
void
update
(
void
*
,
float
);
static
bool
check
(
void
*
);
static
void
destroy
(
void
*
);
private
slots
:
void
saveCancel
(
void
);
signals:
void
progressed
(
int
);
void
destroyed
(
void
);
};
};
#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