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
0268197b
Commit
0268197b
authored
Sep 16, 2011
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: open network fixes and simplifications
Close #5328
parent
972e5e45
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
36 deletions
+40
-36
modules/gui/qt4/components/open_panels.cpp
modules/gui/qt4/components/open_panels.cpp
+35
-31
modules/gui/qt4/components/open_panels.hpp
modules/gui/qt4/components/open_panels.hpp
+3
-3
modules/gui/qt4/dialogs/open.cpp
modules/gui/qt4/dialogs/open.cpp
+2
-2
No files found.
modules/gui/qt4/components/open_panels.cpp
View file @
0268197b
...
@@ -565,40 +565,50 @@ NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
...
@@ -565,40 +565,50 @@ NetOpenPanel::NetOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
OpenPanel
(
_parent
,
_p_intf
)
OpenPanel
(
_parent
,
_p_intf
)
{
{
ui
.
setupUi
(
this
);
ui
.
setupUi
(
this
);
CONNECT
(
ui
.
urlComboBox
,
editTextChanged
(
const
QString
&
),
this
,
updateMRL
());
/* CONNECTs */
/* */
CONNECT
(
ui
.
urlComboBox
->
lineEdit
(),
textChanged
(
const
QString
&
),
this
,
updateMRL
());
CONNECT
(
ui
.
urlComboBox
,
currentIndexChanged
(
const
QString
&
),
this
,
updateMRL
());
if
(
var_InheritBool
(
p_intf
,
"qt-recentplay"
)
)
if
(
var_InheritBool
(
p_intf
,
"qt-recentplay"
)
)
{
{
mrlList
=
new
QStringListModel
(
b_recentList
=
true
;
getSettings
()
->
value
(
"Open/netMRL"
).
toStringList
()
);
ui
.
urlComboBox
->
addItems
(
getSettings
()
->
value
(
"Open/netMRL"
).
toStringList
()
);
ui
.
urlComboBox
->
setModel
(
mrlList
);
ui
.
urlComboBox
->
setMaxCount
(
10
);
ui
.
urlComboBox
->
clearEditText
();
CONNECT
(
ui
.
urlComboBox
->
lineEdit
(),
editingFinished
(),
this
,
updateModel
()
);
}
}
else
else
mrlList
=
NULL
;
b_recentList
=
false
;
/* Use a simple validator for URLs */
ui
.
urlComboBox
->
setValidator
(
new
UrlValidator
(
this
)
);
ui
.
urlComboBox
->
setValidator
(
new
UrlValidator
(
this
)
);
ui
.
urlComboBox
->
setFocus
();
ui
.
urlComboBox
->
setFocus
();
}
}
NetOpenPanel
::~
NetOpenPanel
()
NetOpenPanel
::~
NetOpenPanel
()
{
{
if
(
!
mrl
List
)
return
;
if
(
!
b_recent
List
)
return
;
QStringList
tempL
=
mrlList
->
stringList
();
/* Create the list with the current items */
while
(
tempL
.
count
()
>
8
)
tempL
.
removeFirst
();
QStringList
mrlList
;
for
(
int
i
=
0
;
i
<
ui
.
urlComboBox
->
count
();
i
++
)
mrlList
<<
ui
.
urlComboBox
->
itemText
(
i
);
getSettings
()
->
setValue
(
"Open/netMRL"
,
tempL
);
/* Clean the list... */
#if HAS_QT45
delete
mrlList
;
mrlList
.
removeDuplicates
();
#endif
/* ...and save the 8 last entries */
getSettings
()
->
setValue
(
"Open/netMRL"
,
mrlList
);
}
}
void
NetOpenPanel
::
clear
()
void
NetOpenPanel
::
clear
()
{}
{
ui
.
urlComboBox
->
clear
();
}
void
NetOpenPanel
::
onAccept
()
{
if
(
ui
.
urlComboBox
->
findText
(
ui
.
urlComboBox
->
currentText
()
)
==
-
1
)
ui
.
urlComboBox
->
insertItem
(
0
,
ui
.
urlComboBox
->
currentText
());
}
void
NetOpenPanel
::
onFocus
()
void
NetOpenPanel
::
onFocus
()
{
{
...
@@ -610,6 +620,9 @@ void NetOpenPanel::updateMRL()
...
@@ -610,6 +620,9 @@ void NetOpenPanel::updateMRL()
{
{
QString
url
=
ui
.
urlComboBox
->
lineEdit
()
->
text
();
QString
url
=
ui
.
urlComboBox
->
lineEdit
()
->
text
();
if
(
url
.
isEmpty
()
)
return
;
emit
methodChanged
(
qfu
(
"network-caching"
)
);
emit
methodChanged
(
qfu
(
"network-caching"
)
);
QStringList
qsl
;
QStringList
qsl
;
...
@@ -617,20 +630,6 @@ void NetOpenPanel::updateMRL()
...
@@ -617,20 +630,6 @@ void NetOpenPanel::updateMRL()
emit
mrlUpdated
(
qsl
,
""
);
emit
mrlUpdated
(
qsl
,
""
);
}
}
void
NetOpenPanel
::
updateModel
()
{
assert
(
mrlList
);
QStringList
tempL
=
mrlList
->
stringList
();
if
(
!
tempL
.
contains
(
ui
.
urlComboBox
->
lineEdit
()
->
text
()
)
)
tempL
.
append
(
ui
.
urlComboBox
->
lineEdit
()
->
text
()
);
mrlList
->
setStringList
(
tempL
);
}
void
UrlValidator
::
fixup
(
QString
&
str
)
const
{
str
=
str
.
trimmed
();
}
QValidator
::
State
UrlValidator
::
validate
(
QString
&
str
,
int
&
)
const
QValidator
::
State
UrlValidator
::
validate
(
QString
&
str
,
int
&
)
const
{
{
if
(
str
.
contains
(
' '
)
)
if
(
str
.
contains
(
' '
)
)
...
@@ -640,6 +639,11 @@ QValidator::State UrlValidator::validate( QString& str, int& ) const
...
@@ -640,6 +639,11 @@ QValidator::State UrlValidator::validate( QString& str, int& ) const
return
QValidator
::
Acceptable
;
return
QValidator
::
Acceptable
;
}
}
void
UrlValidator
::
fixup
(
QString
&
str
)
const
{
str
=
str
.
trimmed
();
}
/**************************************************************************
/**************************************************************************
* Open Capture device ( DVB, PVR, V4L, and similar ) *
* Open Capture device ( DVB, PVR, V4L, and similar ) *
**************************************************************************/
**************************************************************************/
...
...
modules/gui/qt4/components/open_panels.hpp
View file @
0268197b
...
@@ -73,6 +73,7 @@ public:
...
@@ -73,6 +73,7 @@ public:
virtual
~
OpenPanel
()
{};
virtual
~
OpenPanel
()
{};
virtual
void
clear
()
=
0
;
virtual
void
clear
()
=
0
;
virtual
void
onFocus
()
{}
virtual
void
onFocus
()
{}
virtual
void
onAccept
()
{}
protected:
protected:
intf_thread_t
*
p_intf
;
intf_thread_t
*
p_intf
;
public
slots
:
public
slots
:
...
@@ -140,13 +141,12 @@ public:
...
@@ -140,13 +141,12 @@ public:
virtual
~
NetOpenPanel
();
virtual
~
NetOpenPanel
();
virtual
void
clear
()
;
virtual
void
clear
()
;
void
onFocus
();
void
onFocus
();
void
onAccept
();
private:
private:
Ui
::
OpenNetwork
ui
;
Ui
::
OpenNetwork
ui
;
QStringListModel
*
mrl
List
;
bool
b_recent
List
;
public
slots
:
public
slots
:
virtual
void
updateMRL
();
virtual
void
updateMRL
();
private
slots
:
void
updateModel
();
};
};
class
UrlValidator
:
public
QValidator
class
UrlValidator
:
public
QValidator
...
...
modules/gui/qt4/dialogs/open.cpp
View file @
0268197b
...
@@ -358,8 +358,8 @@ void OpenDialog::enqueue( bool b_enqueue )
...
@@ -358,8 +358,8 @@ void OpenDialog::enqueue( bool b_enqueue )
return
;
return
;
}
}
/*
for( int i = 0; i < OPEN_TAB_MAX; i++ )
for
(
int
i
=
0
;
i
<
OPEN_TAB_MAX
;
i
++
)
dynamic_cast<OpenPanel*>( ui.Tab->widget( i ) )->onAccept();
*/
dynamic_cast
<
OpenPanel
*>
(
ui
.
Tab
->
widget
(
i
)
)
->
onAccept
();
/* Sort alphabetically */
/* Sort alphabetically */
itemsMRL
.
sort
();
itemsMRL
.
sort
();
...
...
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