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
2652d1bc
Commit
2652d1bc
authored
Dec 02, 2013
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: update QUrlValidator (fix #9932)
somehow #3435
parent
d470a924
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
4 deletions
+20
-4
modules/gui/qt4/util/validators.cpp
modules/gui/qt4/util/validators.cpp
+19
-4
modules/gui/qt4/util/validators.hpp
modules/gui/qt4/util/validators.hpp
+1
-0
No files found.
modules/gui/qt4/util/validators.cpp
View file @
2652d1bc
...
...
@@ -24,12 +24,27 @@
#include "validators.hpp"
#include <QUrl>
QValidator
::
State
UrlValidator
::
validate
(
QString
&
str
,
int
&
)
const
{
str
=
str
.
trimmed
();
if
(
str
.
contains
(
' '
)
)
if
(
str
.
startsWith
(
' '
)
)
return
QValidator
::
Invalid
;
if
(
!
str
.
contains
(
"://"
)
)
if
(
str
.
isEmpty
()
)
return
QValidator
::
Intermediate
;
QUrl
url
(
str
);
if
(
url
.
scheme
().
isEmpty
()
)
return
QValidator
::
Intermediate
;
return
QValidator
::
Acceptable
;
return
(
url
.
isValid
()
)
?
QValidator
::
Acceptable
:
QValidator
::
Intermediate
;
}
void
UrlValidator
::
fixup
(
QString
&
input
)
const
{
while
(
input
.
startsWith
(
' '
)
)
input
.
chop
(
1
);
QUrl
fixed
(
input
,
QUrl
::
TolerantMode
);
input
=
fixed
.
toString
();
}
modules/gui/qt4/util/validators.hpp
View file @
2652d1bc
...
...
@@ -29,6 +29,7 @@ class UrlValidator : public QValidator
public:
UrlValidator
(
QObject
*
parent
)
:
QValidator
(
parent
)
{
}
virtual
QValidator
::
State
validate
(
QString
&
,
int
&
)
const
;
virtual
void
fixup
(
QString
&
input
)
const
;
};
#endif // VALIDATORS_HPP
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