Skip to content
GitLab
Menu
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
059750ad
Commit
059750ad
authored
Jun 01, 2020
by
Jean-Baptiste Mardelle
Browse files
Ensure newly created folder is active so that added clips go in it.
parent
431e7174
Pipeline
#22030
passed with stage
in 13 minutes and 17 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/bin/bin.cpp
View file @
059750ad
...
...
@@ -613,6 +613,10 @@ bool MyTreeView::isEditing() const
void
MyTreeView
::
setEditing
(
bool
edit
)
{
setState
(
edit
?
QAbstractItemView
::
EditingState
:
QAbstractItemView
::
NoState
);
if
(
!
edit
)
{
// Ensure edited item is selected
emit
selectCurrent
();
}
}
bool
MyTreeView
::
performDrag
()
...
...
@@ -1742,15 +1746,16 @@ void Bin::slotAddFolder()
if
(
m_listType
==
BinTreeView
)
{
// Make sure parent folder is expanded
if
(
parentFolder
->
clipId
().
toInt
()
>
-
1
)
{
auto
i
x
=
m_itemModel
->
getIndexFromItem
(
parentFolder
);
auto
parentI
x
=
m_itemModel
->
getIndexFromItem
(
parentFolder
);
auto
*
view
=
static_cast
<
QTreeView
*>
(
m_itemView
);
view
->
expand
(
m_proxyModel
->
mapFromSource
(
i
x
));
view
->
expand
(
m_proxyModel
->
mapFromSource
(
parentI
x
));
}
}
// Edit folder name
auto
folder
=
m_itemModel
->
getFolderByBinId
(
newId
);
auto
ix
=
m_itemModel
->
getIndexFromItem
(
folder
);
// Scroll to ensure folder is visible
m_itemView
->
scrollTo
(
m_proxyModel
->
mapFromSource
(
ix
),
QAbstractItemView
::
PositionAtCenter
);
qDebug
()
<<
"selecting"
<<
ix
;
...
...
@@ -1768,6 +1773,17 @@ void Bin::slotAddFolder()
}
}
void
Bin
::
ensureCurrent
()
{
const
QModelIndexList
indexes
=
m_proxyModel
->
selectionModel
()
->
selectedRows
(
0
);
for
(
const
QModelIndex
&
ix
:
indexes
)
{
if
(
!
ix
.
isValid
())
{
continue
;
}
m_itemView
->
setCurrentIndex
(
ix
);
}
}
QModelIndex
Bin
::
getIndexForId
(
const
QString
&
id
,
bool
folderWanted
)
const
{
QModelIndexList
items
=
m_itemModel
->
match
(
m_itemModel
->
index
(
0
,
0
),
AbstractProjectItem
::
DataId
,
QVariant
::
fromValue
(
id
),
1
,
Qt
::
MatchRecursive
);
...
...
@@ -2027,6 +2043,7 @@ void Bin::slotInitView(QAction *action)
view
->
setWordWrap
(
true
);
connect
(
view
,
&
MyTreeView
::
updateDragMode
,
m_itemModel
.
get
(),
&
ProjectItemModel
::
setDragType
,
Qt
::
DirectConnection
);
connect
(
view
,
&
MyTreeView
::
processDragEnd
,
this
,
&
Bin
::
processDragEnd
);
connect
(
view
,
&
MyTreeView
::
selectCurrent
,
this
,
&
Bin
::
ensureCurrent
);
connect
(
view
,
&
MyTreeView
::
displayBinFrame
,
this
,
&
Bin
::
showBinFrame
);
if
(
!
m_headerInfo
.
isEmpty
())
{
view
->
header
()
->
restoreState
(
m_headerInfo
);
...
...
src/bin/bin.h
View file @
059750ad
...
...
@@ -117,6 +117,7 @@ signals:
void
updateDragMode
(
PlaylistState
::
ClipState
type
);
void
displayBinFrame
(
QModelIndex
ix
,
int
frame
);
void
processDragEnd
();
void
selectCurrent
();
};
class
SmallJobLabel
:
public
QPushButton
...
...
@@ -292,6 +293,8 @@ private slots:
void
slotSetSorting
();
/** @brief Show/hide date column */
void
slotShowColumn
(
bool
show
);
/** @brief Ensure current item is selected */
void
ensureCurrent
();
/** @brief Go to parent folder */
void
slotBack
();
/** @brief Setup the bin view type (icon view, tree view, ...).
...
...
src/bin/clipcreator.cpp
View file @
059750ad
...
...
@@ -138,7 +138,7 @@ QDomDocument ClipCreator::getXmlFromUrl(const QString &path)
QString
ClipCreator
::
createClipFromFile
(
const
QString
&
path
,
const
QString
&
parentFolder
,
const
std
::
shared_ptr
<
ProjectItemModel
>
&
model
,
Fun
&
undo
,
Fun
&
redo
,
const
std
::
function
<
void
(
const
QString
&
)
>
&
readyCallBack
)
{
qDebug
()
<<
"/////////// createClipFromFile"
<<
path
<<
parentFolder
<<
path
;
qDebug
()
<<
"/////////// createClipFromFile"
<<
path
<<
parentFolder
;
QDomDocument
xml
=
getXmlFromUrl
(
path
);
if
(
xml
.
isNull
())
{
return
QStringLiteral
(
"-1"
);
...
...
Write
Preview
Supports
Markdown
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