Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
77c9756c
Commit
77c9756c
authored
Mar 08, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt4: back-end for dialog_Login
parent
2a2773ed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
2 deletions
+76
-2
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
+6
-2
No files found.
modules/gui/qt4/dialogs/external.cpp
View file @
77c9756c
...
...
@@ -2,6 +2,7 @@
* external.hpp : Dialogs from other LibVLC core and other plugins
****************************************************************************
* Copyright (C) 2009 Rémi Denis-Courmont
* Copyright (C) 2006 the VideoLAN team
*
* 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
...
...
@@ -27,6 +28,10 @@
#include "errors.hpp"
#include <vlc_dialog.h>
#include <QDialog>
#include <QDialogButtonBox>
#include <QLabel>
#include <QLineEdit>
#include <QMessageBox>
DialogHandler
::
DialogHandler
(
intf_thread_t
*
intf
)
...
...
@@ -39,12 +44,20 @@ DialogHandler::DialogHandler (intf_thread_t *intf)
var_Create
(
intf
,
"dialog-fatal"
,
VLC_VAR_ADDRESS
);
var_AddCallback
(
intf
,
"dialog-fatal"
,
MessageCallback
,
this
);
connect
(
this
,
SIGNAL
(
authentication
(
struct
dialog_login_t
*
)),
this
,
SLOT
(
requestLogin
(
struct
dialog_login_t
*
)),
Qt
::
BlockingQueuedConnection
);
var_Create
(
intf
,
"dialog-login"
,
VLC_VAR_ADDRESS
);
var_AddCallback
(
intf
,
"dialog-login"
,
LoginCallback
,
this
);
dialog_Register
(
intf
);
}
DialogHandler
::~
DialogHandler
(
void
)
{
dialog_Unregister
(
intf
);
var_DelCallback
(
intf
,
"dialog-login"
,
LoginCallback
,
this
);
var_DelCallback
(
intf
,
"dialog-fatal"
,
MessageCallback
,
this
);
}
int
DialogHandler
::
MessageCallback
(
vlc_object_t
*
obj
,
const
char
*
var
,
...
...
@@ -68,3 +81,60 @@ void DialogHandler::displayMessage (const struct dialog_fatal_t *dialog)
ErrorsDialog
::
getInstance
(
intf
)
->
addError
(
qfu
(
dialog
->
title
),
qfu
(
dialog
->
message
));
}
int
DialogHandler
::
LoginCallback
(
vlc_object_t
*
obj
,
const
char
*
var
,
vlc_value_t
,
vlc_value_t
value
,
void
*
data
)
{
DialogHandler
*
self
=
(
DialogHandler
*
)
data
;
dialog_login_t
*
dialog
=
(
dialog_login_t
*
)
value
.
p_address
;
emit
self
->
authentication
(
dialog
);
return
VLC_SUCCESS
;
}
void
DialogHandler
::
requestLogin
(
struct
dialog_login_t
*
data
)
{
QDialog
*
dialog
=
new
QDialog
;
QLayout
*
layout
=
new
QVBoxLayout
(
dialog
);
dialog
->
setWindowTitle
(
qfu
(
data
->
title
));
layout
->
setMargin
(
2
);
/* User name and password fields */
QWidget
*
panel
=
new
QWidget
(
dialog
);
QGridLayout
*
grid
=
new
QGridLayout
;
grid
->
addWidget
(
new
QLabel
(
qfu
(
data
->
message
)),
0
,
0
,
1
,
2
);
QLineEdit
*
userLine
=
new
QLineEdit
;
grid
->
addWidget
(
new
QLabel
(
qtr
(
"User name"
)),
1
,
0
);
grid
->
addWidget
(
userLine
,
1
,
1
);
QLineEdit
*
passLine
=
new
QLineEdit
;
passLine
->
setEchoMode
(
QLineEdit
::
Password
);
grid
->
addWidget
(
new
QLabel
(
qtr
(
"Password"
)),
2
,
0
);
grid
->
addWidget
(
passLine
,
2
,
1
);
panel
->
setLayout
(
grid
);
layout
->
addWidget
(
panel
);
/* OK, Cancel buttons */
QDialogButtonBox
*
buttonBox
;
buttonBox
=
new
QDialogButtonBox
(
QDialogButtonBox
::
Ok
|
QDialogButtonBox
::
Cancel
);
connect
(
buttonBox
,
SIGNAL
(
accepted
()),
dialog
,
SLOT
(
accept
()));
connect
(
buttonBox
,
SIGNAL
(
rejected
()),
dialog
,
SLOT
(
reject
()));
layout
->
addWidget
(
buttonBox
);
/* Run the dialog */
dialog
->
setLayout
(
layout
);
if
(
dialog
->
exec
())
{
*
data
->
username
=
strdup
(
qtu
(
userLine
->
text
()));
*
data
->
password
=
strdup
(
qtu
(
passLine
->
text
()));
}
else
*
data
->
username
=
*
data
->
password
=
NULL
;
delete
dialog
;
}
modules/gui/qt4/dialogs/external.hpp
View file @
77c9756c
...
...
@@ -35,14 +35,18 @@ public:
private:
intf_thread_t
*
intf
;
static
int
MessageCallback
(
vlc_object_t
*
,
const
char
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
static
int
MessageCallback
(
vlc_object_t
*
,
const
char
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
static
int
LoginCallback
(
vlc_object_t
*
obj
,
const
char
*
,
vlc_value_t
,
vlc_value_t
,
void
*
data
);
private
slots
:
void
displayMessage
(
const
struct
dialog_fatal_t
*
);
void
requestLogin
(
struct
dialog_login_t
*
data
);
signals:
void
message
(
const
struct
dialog_fatal_t
*
);
void
authentication
(
struct
dialog_login_t
*
);
};
#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