Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
b035ef57
Commit
b035ef57
authored
Jan 17, 2020
by
Pedro Rodrigues
Committed by
Jean-Baptiste Mardelle
Jan 17, 2020
Browse files
fix filters in some file dialogs
add getExtensionsFilter helper
parent
6606ae8c
Changes
11
Hide whitespace changes
Inline
Side-by-side
src/dialogs/clipcreationdialog.cpp
View file @
b035ef57
...
...
@@ -109,6 +109,18 @@ QStringList ClipCreationDialog::getExtensions()
return
allExtensions
;
}
QString
ClipCreationDialog
::
getExtensionsFilter
(
const
QStringList
&
additionalFilters
)
{
const
QString
allExtensions
=
ClipCreationDialog
::
getExtensions
().
join
(
QLatin1Char
(
' '
));
QString
filter
=
i18n
(
"All Supported Files"
)
+
" ("
+
allExtensions
+
')'
;
if
(
!
additionalFilters
.
isEmpty
())
{
filter
+=
";;"
;
filter
.
append
(
additionalFilters
.
join
(
";;"
));
}
return
filter
;
}
// static
void
ClipCreationDialog
::
createColorClip
(
KdenliveDoc
*
doc
,
const
QString
&
parentFolder
,
std
::
shared_ptr
<
ProjectItemModel
>
model
)
{
...
...
src/dialogs/clipcreationdialog.h
View file @
b035ef57
...
...
@@ -38,6 +38,7 @@ class ProjectItemModel;
namespace
ClipCreationDialog
{
QStringList
getExtensions
();
QString
getExtensionsFilter
(
const
QStringList
&
additionalFilters
=
QStringList
());
void
createColorClip
(
KdenliveDoc
*
doc
,
const
QString
&
parentFolder
,
std
::
shared_ptr
<
ProjectItemModel
>
model
);
void
createQTextClip
(
KdenliveDoc
*
doc
,
const
QString
&
parentId
,
Bin
*
bin
,
ProjectClip
*
clip
=
nullptr
);
void
createSlideshowClip
(
KdenliveDoc
*
doc
,
const
QString
&
parentId
,
std
::
shared_ptr
<
ProjectItemModel
>
model
);
...
...
src/dialogs/titletemplatedialog.cpp
View file @
b035ef57
...
...
@@ -62,7 +62,7 @@ TitleTemplateDialog::TitleTemplateDialog(const QString &folder, QWidget *parent)
m_view
.
template_list
->
comboBox
()
->
setCurrentIndex
(
current
);
}
const
QStringList
mimeTypeFilters
=
{
QStringLiteral
(
"application/x-kdenlivetitle"
)};
m_view
.
template_list
->
setFilter
(
mimeTypeFilters
.
join
(
' '
)
);
m_view
.
template_list
->
set
MimeType
Filter
s
(
mimeTypeFilters
);
connect
(
m_view
.
template_list
->
comboBox
(),
static_cast
<
void
(
KComboBox
::*
)(
int
)
>
(
&
KComboBox
::
currentIndexChanged
),
this
,
&
TitleTemplateDialog
::
updatePreview
);
updatePreview
();
...
...
src/dvdwizard/dvdwizardmenu.cpp
View file @
b035ef57
...
...
@@ -468,7 +468,7 @@ void DvdWizardMenu::checkBackgroundType(int ix)
m_scene
->
removeItem
(
m_background
);
}
m_view
.
background_image
->
clear
();
m_view
.
background_image
->
setFilter
(
QStringLiteral
(
"video/mpeg"
));
m_view
.
background_image
->
set
MimeType
Filter
s
({
QStringLiteral
(
"video/mpeg"
)
}
);
m_view
.
loop_movie
->
setVisible
(
true
);
}
}
...
...
src/dvdwizard/dvdwizardvob.cpp
View file @
b035ef57
...
...
@@ -265,9 +265,8 @@ void DvdWizardVob::slotCheckProfiles()
void
DvdWizardVob
::
slotAddVobList
(
QList
<
QUrl
>
list
)
{
if
(
list
.
isEmpty
())
{
QString
allExtensions
=
ClipCreationDialog
::
getExtensions
().
join
(
QLatin1Char
(
' '
));
QString
dialogFilter
=
i18n
(
"All Supported Files"
)
+
QStringLiteral
(
" ("
)
+
allExtensions
+
QStringLiteral
(
");; "
)
+
i18n
(
"MPEG Files"
)
+
QStringLiteral
(
" (*.mpeg *.mpg *.vob);; "
)
+
i18n
(
"All Files"
)
+
QStringLiteral
(
" (*.*)"
);
auto
extraFilters
=
QStringList
()
<<
i18n
(
"MPEG Files"
)
+
QStringLiteral
(
" (*.mpeg *.mpg *.vob)"
)
<<
i18n
(
"All Files"
)
+
QStringLiteral
(
" (*.*)"
);
const
QString
dialogFilter
=
ClipCreationDialog
::
getExtensionsFilter
(
extraFilters
);
list
=
QFileDialog
::
getOpenFileUrls
(
this
,
i18n
(
"Add new video file"
),
QUrl
::
fromLocalFile
(
KRecentDirs
::
dir
(
QStringLiteral
(
":KdenliveDvdFolder"
))),
dialogFilter
);
if
(
!
list
.
isEmpty
())
{
...
...
src/effects/effectstack/view/collapsibleeffectview.cpp
View file @
b035ef57
...
...
@@ -240,9 +240,7 @@ void CollapsibleEffectView::slotCreateGroup()
void
CollapsibleEffectView
::
slotCreateRegion
()
{
QString
allExtensions
=
ClipCreationDialog
::
getExtensions
().
join
(
QLatin1Char
(
' '
));
const
QString
dialogFilter
=
allExtensions
+
QLatin1Char
(
' '
)
+
QLatin1Char
(
'|'
)
+
i18n
(
"All Supported Files"
)
+
QStringLiteral
(
"
\n
* "
)
+
QLatin1Char
(
'|'
)
+
i18n
(
"All Files"
);
const
QString
dialogFilter
=
ClipCreationDialog
::
getExtensionsFilter
(
QStringList
()
<<
i18n
(
"All Files"
)
+
QStringLiteral
(
" (*)"
));
QString
clipFolder
=
KRecentDirs
::
dir
(
QStringLiteral
(
":KdenliveClipFolder"
));
if
(
clipFolder
.
isEmpty
())
{
clipFolder
=
QDir
::
homePath
();
...
...
src/mainwindow.cpp
View file @
b035ef57
...
...
@@ -3264,9 +3264,7 @@ void MainWindow::slotTranscode(const QStringList &urls)
void
MainWindow
::
slotTranscodeClip
()
{
QString
allExtensions
=
ClipCreationDialog
::
getExtensions
().
join
(
QLatin1Char
(
' '
));
const
QString
dialogFilter
=
i18n
(
"All Supported Files"
)
+
QLatin1Char
(
'('
)
+
allExtensions
+
QStringLiteral
(
");;"
)
+
i18n
(
"All Files"
)
+
QStringLiteral
(
"(*)"
);
const
QString
dialogFilter
=
ClipCreationDialog
::
getExtensionsFilter
(
QStringList
()
<<
i18n
(
"All Files"
)
+
QStringLiteral
(
" (*)"
));
QString
clipFolder
=
KRecentDirs
::
dir
(
QStringLiteral
(
":KdenliveClipFolder"
));
QStringList
urls
=
QFileDialog
::
getOpenFileNames
(
this
,
i18n
(
"Files to transcode"
),
clipFolder
,
dialogFilter
);
if
(
urls
.
isEmpty
())
{
...
...
src/mltcontroller/clippropertiescontroller.cpp
View file @
b035ef57
...
...
@@ -1115,7 +1115,7 @@ void ClipPropertiesController::slotAddMarker()
void
ClipPropertiesController
::
slotSaveMarkers
()
{
QScopedPointer
<
QFileDialog
>
fd
(
new
QFileDialog
(
this
,
i18n
(
"Save Clip Markers"
),
pCore
->
projectManager
()
->
current
()
->
projectDataFolder
()));
fd
->
setMimeTypeFilters
(
QStringList
()
<<
QStringLiteral
(
"text/plain"
));
fd
->
setMimeTypeFilters
(
QStringList
()
<<
QStringLiteral
(
"application/json"
)
<<
QStringLiteral
(
"text/plain"
));
fd
->
setFileMode
(
QFileDialog
::
AnyFile
);
fd
->
setAcceptMode
(
QFileDialog
::
AcceptSave
);
if
(
fd
->
exec
()
!=
QDialog
::
Accepted
)
{
...
...
@@ -1141,7 +1141,7 @@ void ClipPropertiesController::slotSaveMarkers()
void
ClipPropertiesController
::
slotLoadMarkers
()
{
QScopedPointer
<
QFileDialog
>
fd
(
new
QFileDialog
(
this
,
i18n
(
"Load Clip Markers"
),
pCore
->
projectManager
()
->
current
()
->
projectDataFolder
()));
fd
->
setMimeTypeFilters
(
QStringList
()
<<
QStringLiteral
(
"text/plain"
));
fd
->
setMimeTypeFilters
(
QStringList
()
<<
QStringLiteral
(
"application/json"
)
<<
QStringLiteral
(
"text/plain"
));
fd
->
setFileMode
(
QFileDialog
::
ExistingFile
);
if
(
fd
->
exec
()
!=
QDialog
::
Accepted
)
{
return
;
...
...
src/project/dialogs/projectsettings.cpp
View file @
b035ef57
...
...
@@ -642,10 +642,12 @@ QStringList ProjectSettings::extractSlideshowUrls(const QString &url)
void
ProjectSettings
::
slotExportToText
()
{
const
QString
savePath
=
QFileDialog
::
getSaveFileName
(
this
,
QString
(),
project_folder
->
url
().
toLocalFile
(),
QStringLiteral
(
"text/plain"
));
if
(
savePath
.
isEmpty
())
{
return
;
}
QFileDialog
fd
(
this
);
fd
.
setMimeTypeFilters
(
QStringList
()
<<
"text/plain"
);
if
(
fd
.
exec
()
!=
QDialog
::
Accepted
)
{
return
;
}
const
QString
savePath
=
fd
.
selectedFiles
().
first
();
QString
text
;
text
.
append
(
i18n
(
"Project folder: %1"
,
project_folder
->
url
().
toLocalFile
())
+
'\n'
);
text
.
append
(
i18n
(
"Project profile: %1"
,
m_pw
->
selectedProfile
())
+
'\n'
);
...
...
src/project/projectmanager.cpp
View file @
b035ef57
...
...
@@ -52,6 +52,15 @@ the Free Software Foundation, either version 3 of the License, or
#include
<QTimeZone>
#include
<audiomixer/mixermanager.hpp>
static
QString
getProjectNameFilters
(
bool
ark
=
true
)
{
auto
filter
=
i18n
(
"Kdenlive project (*.kdenlive)"
);
if
(
ark
)
{
filter
.
append
(
";;"
+
i18n
(
"Archived project (*.tar.gz)"
));
}
return
filter
;
}
ProjectManager
::
ProjectManager
(
QObject
*
parent
)
:
QObject
(
parent
)
,
m_mainTimelineModel
(
nullptr
)
...
...
@@ -342,13 +351,14 @@ bool ProjectManager::saveFileAs()
{
QFileDialog
fd
(
pCore
->
window
());
fd
.
setDirectory
(
m_project
->
url
().
isValid
()
?
m_project
->
url
().
adjusted
(
QUrl
::
RemoveFilename
).
toLocalFile
()
:
KdenliveSettings
::
defaultprojectfolder
());
fd
.
set
MimeTypeFilters
(
QStringList
()
<<
QStringLiteral
(
"application/x-kdenlive"
));
fd
.
set
NameFilter
(
getProjectNameFilters
(
false
));
fd
.
setAcceptMode
(
QFileDialog
::
AcceptSave
);
fd
.
setFileMode
(
QFileDialog
::
AnyFile
);
fd
.
setDefaultSuffix
(
QStringLiteral
(
"kdenlive"
));
if
(
fd
.
exec
()
!=
QDialog
::
Accepted
||
fd
.
selectedFiles
().
isEmpty
())
{
return
false
;
}
QString
outputFile
=
fd
.
selectedFiles
().
constFirst
();
bool
ok
=
false
;
...
...
@@ -384,7 +394,7 @@ void ProjectManager::openFile()
return
;
}
QUrl
url
=
QFileDialog
::
getOpenFileUrl
(
pCore
->
window
(),
QString
(),
QUrl
::
fromLocalFile
(
KRecentDirs
::
dir
(
QStringLiteral
(
":KdenliveProjectsFolder"
))),
get
MimeType
());
get
ProjectNameFilters
());
if
(
!
url
.
isValid
())
{
return
;
}
...
...
@@ -576,15 +586,6 @@ void ProjectManager::slotRevert()
}
}
QString
ProjectManager
::
getMimeType
(
bool
open
)
{
QString
mimetype
=
i18n
(
"Kdenlive project (*.kdenlive)"
);
if
(
open
)
{
mimetype
.
append
(
QStringLiteral
(
";;"
)
+
i18n
(
"Archived project (*.tar.gz)"
));
}
return
mimetype
;
}
KdenliveDoc
*
ProjectManager
::
current
()
{
return
m_project
;
...
...
src/project/projectmanager.h
View file @
b035ef57
...
...
@@ -174,10 +174,6 @@ protected:
bool
updateTimeline
(
int
pos
=
-
1
,
int
scrollPos
=
-
1
);
private:
/** @brief Checks that the Kdenlive MIME type is correctly installed.
* @param open If set to true, this will return the MIME type allowed for file opening (adds .tar.gz format)
* @return The MIME type */
QString
getMimeType
(
bool
open
=
true
);
/** @brief checks if autoback files exists, recovers from it if user says yes, returns true if files were recovered. */
bool
checkForBackupFile
(
const
QUrl
&
url
,
bool
newFile
=
false
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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