Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
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 ) :
OpenPanel
(
_parent
,
_p_intf
)
{
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"
)
)
{
mrlList
=
new
QStringListModel
(
getSettings
()
->
value
(
"Open/netMRL"
).
toStringList
()
);
ui
.
urlComboBox
->
setModel
(
mrlList
);
ui
.
urlComboBox
->
clearEditText
();
CONNECT
(
ui
.
urlComboBox
->
lineEdit
(),
editingFinished
(),
this
,
updateModel
()
);
b_recentList
=
true
;
ui
.
urlComboBox
->
addItems
(
getSettings
()
->
value
(
"Open/netMRL"
).
toStringList
()
);
ui
.
urlComboBox
->
setMaxCount
(
10
);
}
else
mrlList
=
NULL
;
b_recentList
=
false
;
/* Use a simple validator for URLs */
ui
.
urlComboBox
->
setValidator
(
new
UrlValidator
(
this
)
);
ui
.
urlComboBox
->
setFocus
();
}
NetOpenPanel
::~
NetOpenPanel
()
{
if
(
!
mrl
List
)
return
;
if
(
!
b_recent
List
)
return
;
QStringList
tempL
=
mrlList
->
stringList
();
while
(
tempL
.
count
()
>
8
)
tempL
.
removeFirst
();
/* Create the list with the current items */
QStringList
mrlList
;
for
(
int
i
=
0
;
i
<
ui
.
urlComboBox
->
count
();
i
++
)
mrlList
<<
ui
.
urlComboBox
->
itemText
(
i
);
getSettings
()
->
setValue
(
"Open/netMRL"
,
tempL
);
delete
mrlList
;
/* Clean the list... */
#if HAS_QT45
mrlList
.
removeDuplicates
();
#endif
/* ...and save the 8 last entries */
getSettings
()
->
setValue
(
"Open/netMRL"
,
mrlList
);
}
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
()
{
...
...
@@ -610,6 +620,9 @@ void NetOpenPanel::updateMRL()
{
QString
url
=
ui
.
urlComboBox
->
lineEdit
()
->
text
();
if
(
url
.
isEmpty
()
)
return
;
emit
methodChanged
(
qfu
(
"network-caching"
)
);
QStringList
qsl
;
...
...
@@ -617,20 +630,6 @@ void NetOpenPanel::updateMRL()
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
{
if
(
str
.
contains
(
' '
)
)
...
...
@@ -640,6 +639,11 @@ QValidator::State UrlValidator::validate( QString& str, int& ) const
return
QValidator
::
Acceptable
;
}
void
UrlValidator
::
fixup
(
QString
&
str
)
const
{
str
=
str
.
trimmed
();
}
/**************************************************************************
* Open Capture device ( DVB, PVR, V4L, and similar ) *
**************************************************************************/
...
...
modules/gui/qt4/components/open_panels.hpp
View file @
0268197b
...
...
@@ -73,6 +73,7 @@ public:
virtual
~
OpenPanel
()
{};
virtual
void
clear
()
=
0
;
virtual
void
onFocus
()
{}
virtual
void
onAccept
()
{}
protected:
intf_thread_t
*
p_intf
;
public
slots
:
...
...
@@ -140,13 +141,12 @@ public:
virtual
~
NetOpenPanel
();
virtual
void
clear
()
;
void
onFocus
();
void
onAccept
();
private:
Ui
::
OpenNetwork
ui
;
QStringListModel
*
mrl
List
;
bool
b_recent
List
;
public
slots
:
virtual
void
updateMRL
();
private
slots
:
void
updateModel
();
};
class
UrlValidator
:
public
QValidator
...
...
modules/gui/qt4/dialogs/open.cpp
View file @
0268197b
...
...
@@ -358,8 +358,8 @@ void OpenDialog::enqueue( bool b_enqueue )
return
;
}
/*
for( int i = 0; i < OPEN_TAB_MAX; i++ )
dynamic_cast<OpenPanel*>( ui.Tab->widget( i ) )->onAccept();
*/
for
(
int
i
=
0
;
i
<
OPEN_TAB_MAX
;
i
++
)
dynamic_cast
<
OpenPanel
*>
(
ui
.
Tab
->
widget
(
i
)
)
->
onAccept
();
/* Sort alphabetically */
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