Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
VideoLAN
VLMC
Commits
3773971a
Commit
3773971a
authored
Aug 08, 2009
by
Hugo Beauzee-Luyssen
Browse files
Tags can now be added
parent
2399aee5
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/gui/MediaProperty.cpp
View file @
3773971a
...
...
@@ -2,6 +2,7 @@
#include
<QTime>
#include
<QPushButton>
#include
<QStringListModel>
#include
<QInputDialog>
#include
"MediaProperty.h"
#include
"ui_MediaProperty.h"
...
...
@@ -31,6 +32,8 @@ MediaProperty::MediaProperty( Media* media, QWidget *parent ) :
QStringListModel
*
model
=
new
QStringListModel
(
media
->
getMetaTags
(),
this
);
ui
->
metaTagsView
->
setModel
(
model
);
connect
(
ui
->
addTagButton
,
SIGNAL
(
clicked
()
),
this
,
SLOT
(
addTagRequired
()
)
);
}
MediaProperty
::~
MediaProperty
()
...
...
@@ -54,5 +57,26 @@ void MediaProperty::changeEvent( QEvent *e )
void
MediaProperty
::
apply
()
{
QStringListModel
*
model
=
dynamic_cast
<
QStringListModel
*>
(
ui
->
metaTagsView
->
model
()
);
if
(
model
==
NULL
)
return
;
m_media
->
setMetaTags
(
model
->
stringList
()
);
}
void
MediaProperty
::
addTagRequired
()
{
bool
ok
;
QString
newTags
=
QInputDialog
::
getText
(
this
,
tr
(
"New tags edition"
),
tr
(
"Enter tags (you can enter multiple tags, separated by a comma)"
),
QLineEdit
::
Normal
,
""
,
&
ok
);
if
(
ok
==
true
&&
newTags
.
length
()
>
0
)
{
QStringListModel
*
model
=
dynamic_cast
<
QStringListModel
*>
(
ui
->
metaTagsView
->
model
()
);
if
(
model
==
NULL
)
return
;
QStringList
list
=
model
->
stringList
();
QStringList
toAdd
=
newTags
.
split
(
","
,
QString
::
SkipEmptyParts
);
list
.
append
(
toAdd
);
model
->
setStringList
(
list
);
ui
->
metaTagsView
->
update
(
QModelIndex
()
);
}
}
src/gui/MediaProperty.h
View file @
3773971a
...
...
@@ -43,6 +43,7 @@ protected:
private
slots
:
void
apply
();
void
addTagRequired
();
private:
Ui
::
MediaProperty
*
ui
;
...
...
src/gui/ui/MediaProperty.ui
View file @
3773971a
...
...
@@ -14,7 +14,7 @@
<string/>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<item
row=
"0"
column=
"0"
>
<item
row=
"0"
column=
"0"
colspan=
"3"
>
<widget
class=
"QFrame"
name=
"frame"
>
<property
name=
"frameShape"
>
<enum>
QFrame::StyledPanel
</enum>
...
...
@@ -57,30 +57,8 @@
</layout>
</widget>
</item>
<item
row=
"4"
column=
"3"
>
<widget
class=
"QDialogButtonBox"
name=
"buttonBox"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Fixed"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"layoutDirection"
>
<enum>
Qt::LeftToRight
</enum>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"standardButtons"
>
<set>
QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok
</set>
</property>
<property
name=
"centerButtons"
>
<bool>
false
</bool>
</property>
</widget>
</item>
<item
row=
"4"
column=
"2"
>
<spacer
name=
"horizontalSpacer"
>
<item
row=
"0"
column=
"3"
>
<spacer
name=
"horizontalSpacer_2"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
...
...
@@ -92,7 +70,7 @@
</property>
</spacer>
</item>
<item
row=
"0"
column=
"
2
"
colspan=
"2"
>
<item
row=
"0"
column=
"
4
"
colspan=
"2"
>
<widget
class=
"QGroupBox"
name=
"groupBox"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Expanding"
vsizetype=
"Preferred"
>
...
...
@@ -181,8 +159,18 @@
</layout>
</widget>
</item>
<item
row=
"0"
column=
"1"
>
<spacer
name=
"horizontalSpacer_2"
>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
<string>
Metatags :
</string>
</property>
</widget>
</item>
<item
row=
"2"
column=
"0"
colspan=
"6"
>
<widget
class=
"QListView"
name=
"metaTagsView"
/>
</item>
<item
row=
"3"
column=
"4"
>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
...
...
@@ -194,13 +182,32 @@
</property>
</spacer>
</item>
<item
row=
"3"
column=
"0"
colspan=
"6"
>
<widget
class=
"QListView"
name=
"metaTagsView"
/>
<item
row=
"3"
column=
"5"
>
<widget
class=
"QDialogButtonBox"
name=
"buttonBox"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Fixed"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"layoutDirection"
>
<enum>
Qt::LeftToRight
</enum>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"standardButtons"
>
<set>
QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok
</set>
</property>
<property
name=
"centerButtons"
>
<bool>
false
</bool>
</property>
</widget>
</item>
<item
row=
"1"
column=
"
0
"
>
<widget
class=
"Q
Label"
name=
"label
"
>
<item
row=
"1"
column=
"
1
"
>
<widget
class=
"Q
ToolButton"
name=
"addTagButton
"
>
<property
name=
"text"
>
<string>
Metatags :
</string>
<string>
...
</string>
</property>
</widget>
</item>
...
...
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