Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
kdenlive
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
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
Farid Abdelnour
kdenlive
Commits
f1981d12
Commit
f1981d12
authored
Mar 10, 2008
by
Jean-Baptiste Mardelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
User can now save & delete custom export profiles
svn path=/branches/KDE4/; revision=2045
parent
f96ebb40
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
296 additions
and
19 deletions
+296
-19
src/CMakeLists.txt
src/CMakeLists.txt
+1
-0
src/kdenlivedoc.cpp
src/kdenlivedoc.cpp
+6
-0
src/kdenlivedoc.h
src/kdenlivedoc.h
+2
-0
src/renderwidget.cpp
src/renderwidget.cpp
+146
-18
src/renderwidget.h
src/renderwidget.h
+4
-0
src/widgets/renderwidget_ui.ui
src/widgets/renderwidget_ui.ui
+5
-1
src/widgets/saveprofile_ui.ui
src/widgets/saveprofile_ui.ui
+132
-0
No files found.
src/CMakeLists.txt
View file @
f1981d12
...
...
@@ -38,6 +38,7 @@ kde4_add_ui_files(kdenlive_UI
widgets/titlewidget_ui.ui
widgets/timelinebuttons_ui.ui
widgets/renderwidget_ui.ui
widgets/saveprofile_ui.ui
)
set
(
kdenlive_SRCS
...
...
src/kdenlivedoc.cpp
View file @
f1981d12
...
...
@@ -114,6 +114,12 @@ ClipManager *KdenliveDoc::clipManager() {
return
m_clipManager
;
}
QString
KdenliveDoc
::
getDocumentStandard
()
{
//WARNING: this way to tell the video standard is a bit hackish...
if
(
m_profile
.
description
.
contains
(
"pal"
,
Qt
::
CaseInsensitive
)
||
m_profile
.
description
.
contains
(
"25"
,
Qt
::
CaseInsensitive
)
||
m_profile
.
description
.
contains
(
"50"
,
Qt
::
CaseInsensitive
))
return
"PAL"
;
return
"NTSC"
;
}
QString
KdenliveDoc
::
profilePath
()
const
{
return
m_profile
.
path
;
}
...
...
src/kdenlivedoc.h
View file @
f1981d12
...
...
@@ -69,6 +69,8 @@ Q_OBJECT public:
void
setThumbsProgress
(
KUrl
url
,
int
progress
);
QString
profilePath
()
const
;
QString
description
()
const
;
/** Returns the document format: PAL or NTSC */
QString
getDocumentStandard
();
private:
KUrl
m_url
;
...
...
src/renderwidget.cpp
View file @
f1981d12
...
...
@@ -23,22 +23,35 @@
#include <KStandardDirs>
#include <KDebug>
#include <KMessageBox>
#include <KComboBox>
#include "kdenlivesettings.h"
#include "renderwidget.h"
#include "ui_saveprofile_ui.h"
const
int
GroupRole
=
Qt
::
UserRole
;
const
int
ExtensionRole
=
GroupRole
+
1
;
const
int
StandardRole
=
GroupRole
+
2
;
const
int
RenderRole
=
GroupRole
+
3
;
const
int
ParamsRole
=
GroupRole
+
4
;
const
int
EditableRole
=
GroupRole
+
5
;
RenderWidget
::
RenderWidget
(
QWidget
*
parent
)
:
QDialog
(
parent
),
m_standard
(
"PAL"
)
{
m_view
.
setupUi
(
this
);
m_view
.
buttonDelete
->
setIcon
(
KIcon
(
"trash-empty"
));
m_view
.
buttonDelete
->
setToolTip
(
i18n
(
"Delete profile"
));
m_view
.
buttonDelete
->
setEnabled
(
false
);
m_view
.
buttonSave
->
setIcon
(
KIcon
(
"document-new"
));
m_view
.
buttonSave
->
setToolTip
(
i18n
(
"Create new profile"
));
connect
(
m_view
.
buttonSave
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
slotSaveProfile
()));
connect
(
m_view
.
buttonDelete
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
slotDeleteProfile
()));
connect
(
m_view
.
buttonStart
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
slotExport
()));
connect
(
m_view
.
out_file
,
SIGNAL
(
textChanged
(
const
QString
&
)),
this
,
SLOT
(
slotUpdateButtons
()));
connect
(
m_view
.
format_list
,
SIGNAL
(
currentRowChanged
(
int
)),
this
,
SLOT
(
refreshView
()));
connect
(
m_view
.
size_list
,
SIGNAL
(
currentRowChanged
(
int
)),
this
,
SLOT
(
refreshParams
()));
m_view
.
buttonStart
->
setEnabled
(
false
);
parseProfiles
();
}
...
...
@@ -48,6 +61,121 @@ void RenderWidget::slotUpdateButtons() {
else
m_view
.
buttonStart
->
setEnabled
(
true
);
}
void
RenderWidget
::
slotSaveProfile
()
{
Ui
::
SaveProfile_UI
ui
;
QDialog
*
d
=
new
QDialog
(
this
);
ui
.
setupUi
(
d
);
QString
customGroup
=
i18n
(
"Custom"
);
QStringList
groupNames
;
for
(
int
i
=
0
;
i
<
m_view
.
format_list
->
count
();
i
++
)
groupNames
.
append
(
m_view
.
format_list
->
item
(
i
)
->
text
());
if
(
!
groupNames
.
contains
(
customGroup
))
groupNames
.
prepend
(
customGroup
);
ui
.
group_name
->
addItems
(
groupNames
);
int
pos
=
ui
.
group_name
->
findText
(
customGroup
);
ui
.
group_name
->
setCurrentIndex
(
pos
);
ui
.
parameters
->
setText
(
m_view
.
advanced_params
->
text
());
ui
.
extension
->
setText
(
m_view
.
size_list
->
currentItem
()
->
data
(
ExtensionRole
).
toString
());
ui
.
profile_name
->
setFocus
();
if
(
d
->
exec
()
==
QDialog
::
Accepted
)
{
QString
exportFile
=
KStandardDirs
::
locateLocal
(
"data"
,
"kdenlive/export/customprofiles.xml"
);
QDomDocument
doc
;
QFile
file
(
exportFile
);
doc
.
setContent
(
&
file
,
false
);
file
.
close
();
QDomElement
documentElement
;
bool
groupExists
=
false
;
QString
groupName
;
QString
newProfileName
=
ui
.
profile_name
->
text
();
QString
newGroupName
=
ui
.
group_name
->
currentText
();
QDomNodeList
groups
=
doc
.
elementsByTagName
(
"group"
);
int
i
=
0
;
if
(
groups
.
count
()
==
0
)
{
QDomElement
profiles
=
doc
.
createElement
(
"profiles"
);
doc
.
appendChild
(
profiles
);
}
else
while
(
!
groups
.
item
(
i
).
isNull
())
{
documentElement
=
groups
.
item
(
i
).
toElement
();
groupName
=
documentElement
.
attribute
(
"name"
);
kDebug
()
<<
"// SAVE, PARSING FROUP: "
<<
i
<<
", name: "
<<
groupName
<<
", LOOK FR: "
<<
newGroupName
;
if
(
groupName
==
newGroupName
)
{
groupExists
=
true
;
break
;
}
i
++
;
}
if
(
!
groupExists
)
{
documentElement
=
doc
.
createElement
(
"group"
);
documentElement
.
setAttribute
(
"name"
,
ui
.
group_name
->
currentText
());
documentElement
.
setAttribute
(
"renderer"
,
"avformat"
);
doc
.
documentElement
().
appendChild
(
documentElement
);
}
QDomElement
profileElement
=
doc
.
createElement
(
"profile"
);
profileElement
.
setAttribute
(
"name"
,
newProfileName
);
profileElement
.
setAttribute
(
"extension"
,
ui
.
extension
->
text
().
simplified
());
profileElement
.
setAttribute
(
"args"
,
ui
.
parameters
->
text
().
simplified
());
documentElement
.
appendChild
(
profileElement
);
//QCString save = doc.toString().utf8();
if
(
!
file
.
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Text
))
{
KMessageBox
::
sorry
(
this
,
i18n
(
"Unable to write to file %1"
,
exportFile
));
delete
d
;
return
;
}
QTextStream
out
(
&
file
);
out
<<
doc
.
toString
();
file
.
close
();
parseProfiles
();
}
delete
d
;
}
void
RenderWidget
::
slotDeleteProfile
()
{
QString
currentGroup
=
m_view
.
format_list
->
currentItem
()
->
text
();
QString
currentProfile
=
m_view
.
size_list
->
currentItem
()
->
text
();
QString
exportFile
=
KStandardDirs
::
locateLocal
(
"data"
,
"kdenlive/export/customprofiles.xml"
);
QDomDocument
doc
;
QFile
file
(
exportFile
);
doc
.
setContent
(
&
file
,
false
);
file
.
close
();
QDomElement
documentElement
;
bool
groupExists
=
false
;
QString
groupName
;
QDomNodeList
groups
=
doc
.
elementsByTagName
(
"group"
);
int
i
=
0
;
while
(
!
groups
.
item
(
i
).
isNull
())
{
documentElement
=
groups
.
item
(
i
).
toElement
();
groupName
=
documentElement
.
attribute
(
"name"
);
if
(
groupName
==
currentGroup
)
{
QDomNodeList
children
=
documentElement
.
childNodes
();
for
(
int
j
=
0
;
j
<
children
.
count
();
j
++
)
{
QDomElement
pro
=
children
.
at
(
j
).
toElement
();
if
(
pro
.
attribute
(
"name"
)
==
currentProfile
)
{
groups
.
item
(
i
).
removeChild
(
children
.
at
(
j
));
if
(
groups
.
item
(
i
).
childNodes
().
isEmpty
())
doc
.
documentElement
().
removeChild
(
groups
.
item
(
i
));
break
;
}
}
break
;
}
i
++
;
}
if
(
!
file
.
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Text
))
{
KMessageBox
::
sorry
(
this
,
i18n
(
"Unable to write to file %1"
,
exportFile
));
return
;
}
QTextStream
out
(
&
file
);
out
<<
doc
.
toString
();
file
.
close
();
parseProfiles
();
}
void
RenderWidget
::
slotExport
()
{
QFile
f
(
m_view
.
out_file
->
url
().
path
());
if
(
f
.
exists
())
{
...
...
@@ -103,23 +231,35 @@ void RenderWidget::refreshParams() {
}
else
{
m_view
.
out_file
->
setUrl
(
KUrl
(
QDir
::
homePath
()
+
"/untitled."
+
extension
));
}
if
(
item
->
data
(
EditableRole
).
toString
().
isEmpty
())
m_view
.
buttonDelete
->
setEnabled
(
false
);
else
m_view
.
buttonDelete
->
setEnabled
(
true
);
}
void
RenderWidget
::
parseProfiles
()
{
m_view
.
size_list
->
clear
();
m_view
.
format_list
->
clear
();
QString
exportFile
=
KStandardDirs
::
locate
(
"data"
,
"kdenlive/export/profiles.xml"
);
parseFile
(
exportFile
,
false
);
exportFile
=
KStandardDirs
::
locateLocal
(
"data"
,
"kdenlive/export/customprofiles.xml"
);
parseFile
(
exportFile
,
true
);
refreshView
();
}
void
RenderWidget
::
parseFile
(
QString
exportFile
,
bool
editable
)
{
QDomDocument
doc
;
QFile
file
(
exportFile
);
doc
.
setContent
(
&
file
,
false
);
file
.
close
();
QDomElement
documentElement
;
QDomElement
profileElement
;
QDomNodeList
groups
=
doc
.
elementsByTagName
(
"group"
);
if
(
groups
.
count
()
==
0
)
{
kDebug
()
<<
"// Export file: "
<<
exportFile
<<
" IS BROKEN"
;
return
;
}
kDebug
()
<<
"// FOUND FFECT GROUP: "
<<
groups
.
count
()
<<
" IS BROKEN"
;
int
i
=
0
;
QString
groupName
;
QString
profileName
;
...
...
@@ -134,7 +274,8 @@ void RenderWidget::parseProfiles() {
groupName
=
documentElement
.
attribute
(
"name"
,
QString
::
null
);
extension
=
documentElement
.
attribute
(
"extension"
,
QString
::
null
);
renderer
=
documentElement
.
attribute
(
"renderer"
,
QString
::
null
);
new
QListWidgetItem
(
groupName
,
m_view
.
format_list
);
if
(
m_view
.
format_list
->
findItems
(
groupName
,
Qt
::
MatchExactly
).
isEmpty
())
new
QListWidgetItem
(
groupName
,
m_view
.
format_list
);
QDomNode
n
=
groups
.
item
(
i
).
firstChild
();
while
(
!
n
.
isNull
())
{
...
...
@@ -150,29 +291,16 @@ void RenderWidget::parseProfiles() {
item
->
setData
(
RenderRole
,
renderer
);
item
->
setData
(
StandardRole
,
standard
);
item
->
setData
(
ParamsRole
,
params
);
if
(
editable
)
item
->
setData
(
EditableRole
,
"true"
);
n
=
n
.
nextSibling
();
}
i
++
;
/*
bool ladspaOk = true;
if (tag == "ladspa") {
QString library = documentElement.attribute("library", QString::null);
if (KStandardDirs::locate("ladspa_plugin", library).isEmpty()) ladspaOk = false;
}
// Parse effect file
if ((filtersList.contains(tag) || producersList.contains(tag)) && ladspaOk) {
bool isAudioEffect = false;
QDomNode propsnode = documentElement.elementsByTagName("properties").item(0);
if (!propsnode.isNull()) {
QDomElement propselement = propsnode.toElement();
*/
}
refreshView
();
}
#include "renderwidget.moc"
src/renderwidget.h
View file @
f1981d12
...
...
@@ -32,16 +32,20 @@ class RenderWidget : public QDialog {
public:
RenderWidget
(
QWidget
*
parent
=
0
);
void
setDocumentStandard
(
QString
std
);
private
slots
:
void
slotUpdateButtons
();
void
slotExport
();
void
refreshView
();
void
refreshParams
();
void
slotSaveProfile
();
void
slotDeleteProfile
();
private:
Ui
::
RenderWidget_UI
m_view
;
QString
m_standard
;
void
parseProfiles
();
void
parseFile
(
QString
exportFile
,
bool
editable
);
signals:
void
doRender
(
const
QString
&
,
const
QStringList
&
,
bool
,
bool
);
...
...
src/widgets/renderwidget_ui.ui
View file @
f1981d12
...
...
@@ -112,7 +112,11 @@
</widget>
</item>
<item row="2" column="0" colspan="3" >
<widget class="KLineEdit" name="advanced_params" />
<widget class="KLineEdit" name="advanced_params" >
<property name="readOnly" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="3" >
<widget class="QToolButton" name="buttonSave" >
...
...
src/widgets/saveprofile_ui.ui
0 → 100644
View file @
f1981d12
<ui version="4.0" >
<class>SaveProfile_UI</class>
<widget class="QDialog" name="SaveProfile_UI" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>225</height>
</rect>
</property>
<property name="windowTitle" >
<string>Save Profile</string>
</property>
<layout class="QGridLayout" name="gridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Group</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2" >
<widget class="KComboBox" name="group_name" />
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Profile name</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2" >
<widget class="KLineEdit" name="profile_name" />
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>Extension</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2" >
<widget class="KLineEdit" name="extension" >
<property name="maxLength" >
<number>4</number>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Parameters</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="3" >
<widget class="KLineEdit" name="parameters" />
</item>
<item row="5" column="2" >
<spacer name="verticalSpacer" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>17</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="0" colspan="3" >
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
<customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>SaveProfile_UI</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel" >
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>SaveProfile_UI</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel" >
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
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