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
f9c17d2c
Commit
f9c17d2c
authored
Dec 22, 2012
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt: saveAPlaylist: fix file extension logic (fix #7578)
parent
e10b52d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
8 deletions
+43
-8
modules/gui/qt4/dialogs_provider.cpp
modules/gui/qt4/dialogs_provider.cpp
+43
-8
No files found.
modules/gui/qt4/dialogs_provider.cpp
View file @
f9c17d2c
...
...
@@ -595,21 +595,56 @@ void DialogsProvider::saveAPlaylist()
}
QString
selected
;
QString
file
=
QFileDialog
::
getSaveFileName
(
NULL
,
qtr
(
"Save playlist as..."
),
p_intf
->
p_sys
->
filepath
,
filters
.
join
(
";;"
),
&
selected
);
QFileDialog
*
dialog
=
new
QFileDialog
(
NULL
,
qtr
(
"Save playlist as..."
),
QString
(
p_intf
->
p_sys
->
filepath
),
filters
.
join
(
";;"
)
);
dialog
->
setDefaultSuffix
(
qfu
(
types
[
0
].
filter_patterns
)
);
dialog
->
setAcceptMode
(
QFileDialog
::
AcceptSave
);
dialog
->
exec
();
QString
file
=
dialog
->
selectedFiles
().
first
();
QString
nameFilter
=
dialog
->
selectedNameFilter
();
const
char
*
psz_selected_module
=
NULL
;
const
char
*
psz_last_playlist_ext
=
NULL
;
delete
dialog
;
if
(
file
.
isEmpty
()
)
return
;
/* First test if the file extension is set, and different to selected filter */
for
(
size_t
i
=
0
;
i
<
sizeof
(
types
)
/
sizeof
(
types
[
0
]);
i
++
)
if
(
selected
==
qfu
(
vlc_gettext
(
types
[
i
].
filter_name
)
)
+
" (*."
+
qfu
(
types
[
i
].
filter_patterns
)
+
")"
)
{
if
(
file
.
endsWith
(
QString
(
"."
)
+
qfu
(
types
[
i
].
filter_patterns
)
)
)
{
playlist_Export
(
THEPL
,
qtu
(
toNativeSeparators
(
file
)
),
THEPL
->
p_playing
,
types
[
i
].
module
);
getSettings
()
->
setValue
(
"last-playlist-ext"
,
types
[
i
].
filter_patterns
);
psz_selected_module
=
types
[
i
].
module
;
psz_last_playlist_ext
=
types
[
i
].
filter_patterns
;
break
;
}
}
/* otherwise apply the selected extension */
if
(
!
psz_last_playlist_ext
)
{
for
(
size_t
i
=
0
;
i
<
sizeof
(
types
)
/
sizeof
(
types
[
0
]);
i
++
)
{
if
(
nameFilter
.
startsWith
(
vlc_gettext
(
types
[
i
].
filter_name
)
)
)
{
psz_selected_module
=
types
[
i
].
module
;
psz_last_playlist_ext
=
types
[
i
].
filter_patterns
;
/* Fix file extension */
file
=
file
.
append
(
QString
(
"."
)
+
qfu
(
psz_last_playlist_ext
)
);
break
;
}
}
}
if
(
psz_selected_module
)
{
playlist_Export
(
THEPL
,
qtu
(
toNativeSeparators
(
file
)
),
THEPL
->
p_playing
,
psz_selected_module
);
getSettings
()
->
setValue
(
"last-playlist-ext"
,
psz_last_playlist_ext
);
}
}
/****************************************************************************
...
...
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