Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Multimedia
JuK
Commits
8d27910d
Commit
8d27910d
authored
Feb 26, 2003
by
Scott Wheeler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some incomplete API cleanups; at least they build / work
svn path=/trunk/kdemultimedia/juk/; revision=209567
parent
857bb030
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
68 deletions
+53
-68
playlistbox.cpp
playlistbox.cpp
+41
-56
playlistbox.h
playlistbox.h
+12
-12
No files found.
playlistbox.cpp
View file @
8d27910d
...
...
@@ -36,33 +36,33 @@
// PlaylistBox public methods
////////////////////////////////////////////////////////////////////////////////
PlaylistBox
::
PlaylistBox
(
PlaylistSplitter
*
parent
,
const
char
*
name
)
:
KListBox
(
parent
,
name
)
PlaylistBox
::
PlaylistBox
(
PlaylistSplitter
*
parent
,
const
char
*
name
)
:
KListBox
(
parent
,
name
),
m_splitter
(
parent
),
m_updatePlaylistStack
(
true
)
{
splitter
=
parent
;
updatePlaylistStack
=
true
;
m_collectionContextMenu
=
new
KPopupMenu
()
;
m_collectionContextMenu
->
insertItem
(
SmallIcon
(
"editcopy"
),
i18n
(
"Duplicate..."
),
this
,
SLOT
(
contextDuplicate
()))
;
collectionContextMenu
=
new
KPopupMenu
();
collectionContextMenu
->
insertItem
(
SmallIcon
(
"editcopy"
),
i18n
(
"Duplicate..."
),
this
,
SLOT
(
contextDuplicate
()));
playlistContextMenu
=
new
KPopupMenu
();
playlistContextMenu
->
insertItem
(
SmallIcon
(
"filesave"
),
i18n
(
"Save"
),
this
,
SLOT
(
contextSave
()));
playlistContextMenu
->
insertItem
(
SmallIcon
(
"filesaveas"
),
i18n
(
"Save As..."
),
this
,
SLOT
(
contextSaveAs
()));
playlistContextMenu
->
insertItem
(
i18n
(
"Rename..."
),
this
,
SLOT
(
contextRename
()));
playlistContextMenu
->
insertItem
(
SmallIcon
(
"editcopy"
),
i18n
(
"Duplicate..."
),
this
,
SLOT
(
contextDuplicate
()));
playlistContextMenu
->
insertItem
(
SmallIcon
(
"edittrash"
),
i18n
(
"Remove"
),
this
,
SLOT
(
contextDeleteItem
()));
m_playlistContextMenu
=
new
KPopupMenu
();
m_playlistContextMenu
->
insertItem
(
SmallIcon
(
"filesave"
),
i18n
(
"Save"
),
this
,
SLOT
(
contextSave
()));
m_playlistContextMenu
->
insertItem
(
SmallIcon
(
"filesaveas"
),
i18n
(
"Save As..."
),
this
,
SLOT
(
contextSaveAs
()));
m_playlistContextMenu
->
insertItem
(
i18n
(
"Rename..."
),
this
,
SLOT
(
contextRename
()));
m_playlistContextMenu
->
insertItem
(
SmallIcon
(
"editcopy"
),
i18n
(
"Duplicate..."
),
this
,
SLOT
(
contextDuplicate
()));
m_playlistContextMenu
->
insertItem
(
SmallIcon
(
"edittrash"
),
i18n
(
"Remove"
),
this
,
SLOT
(
contextDeleteItem
()));
setAcceptDrops
(
true
);
connect
(
this
,
SIGNAL
(
currentChanged
(
QListBoxItem
*
)),
this
,
SLOT
(
p
laylistChanged
(
QListBoxItem
*
)));
this
,
SLOT
(
slotP
laylistChanged
(
QListBoxItem
*
)));
connect
(
this
,
SIGNAL
(
doubleClicked
(
QListBoxItem
*
)),
this
,
SLOT
(
p
laylistDoubleClicked
(
QListBoxItem
*
)));
this
,
SLOT
(
slotP
laylistDoubleClicked
(
QListBoxItem
*
)));
}
PlaylistBox
::~
PlaylistBox
()
{
delete
playlistContextMenu
;
delete
m_collectionContextMenu
;
delete
m_playlistContextMenu
;
}
void
PlaylistBox
::
createItem
(
Playlist
*
playlist
,
const
char
*
icon
,
bool
raise
)
...
...
@@ -71,7 +71,7 @@ void PlaylistBox::createItem(Playlist *playlist, const char *icon, bool raise)
return
;
Item
*
i
=
new
Item
(
this
,
SmallIcon
(
icon
,
32
),
playlist
->
name
(),
playlist
);
_playlistDict
.
insert
(
playlist
,
i
);
m
_playlistDict
.
insert
(
playlist
,
i
);
if
(
raise
)
{
setCurrentItem
(
i
);
...
...
@@ -87,7 +87,7 @@ void PlaylistBox::sort()
bool
collectionSelected
=
isSelected
(
collectionItem
);
updatePlaylistStack
=
false
;
m_
updatePlaylistStack
=
false
;
if
(
collectionSelected
)
setSelected
(
collectionItem
,
false
);
...
...
@@ -99,7 +99,7 @@ void PlaylistBox::sort()
if
(
collectionSelected
)
setSelected
(
collectionItem
,
true
);
updatePlaylistStack
=
true
;
m_
updatePlaylistStack
=
true
;
}
void
PlaylistBox
::
raise
(
Playlist
*
playlist
)
...
...
@@ -107,7 +107,7 @@ void PlaylistBox::raise(Playlist *playlist)
if
(
!
playlist
)
return
;
Item
*
i
=
_playlistDict
.
find
(
playlist
);
Item
*
i
=
m
_playlistDict
.
find
(
playlist
);
clearSelection
();
setSelected
(
i
,
true
);
...
...
@@ -116,11 +116,6 @@ void PlaylistBox::raise(Playlist *playlist)
ensureCurrentVisible
();
}
QStringList
PlaylistBox
::
names
()
const
{
return
nameList
;
}
QPtrList
<
Playlist
>
PlaylistBox
::
playlists
()
const
{
QPtrList
<
Playlist
>
l
;
...
...
@@ -218,10 +213,10 @@ void PlaylistBox::duplicate(Item *item)
// If this text is changed, please also change it in PlaylistSplitter::createPlaylist().
QString
name
=
QInputDialog
::
getText
(
i18n
(
"New Playlist"
),
i18n
(
"Please enter a name for the new playlist:"
),
QLineEdit
::
Normal
,
splitter
->
uniquePlaylistName
(
item
->
text
(),
true
),
&
ok
);
QLineEdit
::
Normal
,
m_
splitter
->
uniquePlaylistName
(
item
->
text
(),
true
),
&
ok
);
if
(
ok
)
{
Playlist
*
p
=
splitter
->
createPlaylist
(
name
);
splitter
->
add
(
item
->
playlist
()
->
files
(),
p
);
Playlist
*
p
=
m_
splitter
->
createPlaylist
(
name
);
m_
splitter
->
add
(
item
->
playlist
()
->
files
(),
p
);
}
}
}
...
...
@@ -246,8 +241,8 @@ void PlaylistBox::deleteItem(Item *item)
return
;
}
name
List
.
remove
(
item
->
text
());
_playlistDict
.
remove
(
item
->
playlist
());
m_
name
s
.
remove
(
item
->
text
());
m
_playlistDict
.
remove
(
item
->
playlist
());
delete
item
->
playlist
();
delete
item
;
}
...
...
@@ -273,7 +268,7 @@ void PlaylistBox::decode(QMimeSource *s, Item *item)
for
(
KURL
::
List
::
Iterator
it
=
urls
.
begin
();
it
!=
urls
.
end
();
it
++
)
files
.
append
((
*
it
).
path
());
splitter
->
add
(
files
,
item
->
playlist
());
m_
splitter
->
add
(
files
,
item
->
playlist
());
}
}
...
...
@@ -321,7 +316,7 @@ void PlaylistBox::mousePressEvent(QMouseEvent *e)
if
(
e
->
button
()
==
Qt
::
RightButton
)
{
QListBoxItem
*
i
=
itemAt
(
e
->
pos
());
if
(
i
)
d
rawContextMenu
(
i
,
e
->
globalPos
());
slotD
rawContextMenu
(
i
,
e
->
globalPos
());
e
->
accept
();
}
else
{
...
...
@@ -330,69 +325,59 @@ void PlaylistBox::mousePressEvent(QMouseEvent *e)
}
}
void
PlaylistBox
::
addName
(
const
QString
&
name
)
{
nameList
.
append
(
name
);
}
////////////////////////////////////////////////////////////////////////////////
// PlaylistBox private slots
////////////////////////////////////////////////////////////////////////////////
void
PlaylistBox
::
p
laylistChanged
(
QListBoxItem
*
item
)
void
PlaylistBox
::
slotP
laylistChanged
(
QListBoxItem
*
item
)
{
Item
*
i
=
dynamic_cast
<
Item
*>
(
item
);
if
(
updatePlaylistStack
&&
i
&&
i
->
playlist
())
if
(
m_
updatePlaylistStack
&&
i
&&
i
->
playlist
())
emit
(
currentChanged
(
i
->
playlist
()));
}
void
PlaylistBox
::
p
laylistDoubleClicked
(
QListBoxItem
*
)
void
PlaylistBox
::
slotP
laylistDoubleClicked
(
QListBoxItem
*
)
{
/*
Item *i = dynamic_cast<Item *>(item);
if(i)
emit(doubleClicked(i));
*/
emit
(
doubleClicked
());
}
void
PlaylistBox
::
d
rawContextMenu
(
QListBoxItem
*
item
,
const
QPoint
&
point
)
void
PlaylistBox
::
slotD
rawContextMenu
(
QListBoxItem
*
item
,
const
QPoint
&
point
)
{
Item
*
i
=
static_cast
<
Item
*>
(
item
);
contextMenuOn
=
i
;
m_
contextMenuOn
=
i
;
if
(
i
)
if
(
i
->
playlist
()
==
CollectionList
::
instance
())
collectionContextMenu
->
popup
(
point
);
m_
collectionContextMenu
->
popup
(
point
);
else
playlistContextMenu
->
popup
(
point
);
m_
playlistContextMenu
->
popup
(
point
);
}
void
PlaylistBox
::
contextSave
()
{
save
(
contextMenuOn
);
save
(
m_
contextMenuOn
);
}
void
PlaylistBox
::
contextSaveAs
()
{
saveAs
(
contextMenuOn
);
saveAs
(
m_
contextMenuOn
);
}
void
PlaylistBox
::
contextRename
()
{
rename
(
contextMenuOn
);
rename
(
m_
contextMenuOn
);
}
void
PlaylistBox
::
contextDuplicate
()
{
duplicate
(
contextMenuOn
);
duplicate
(
m_
contextMenuOn
);
}
void
PlaylistBox
::
contextDeleteItem
()
{
deleteItem
(
contextMenuOn
);
contextMenuOn
=
0
;
deleteItem
(
m_
contextMenuOn
);
m_
contextMenuOn
=
0
;
}
////////////////////////////////////////////////////////////////////////////////
...
...
@@ -434,8 +419,8 @@ PlaylistBox *PlaylistBox::Item::listBox() const
void
PlaylistBox
::
Item
::
setName
(
const
QString
&
name
)
{
if
(
listBox
())
{
listBox
()
->
name
List
.
remove
(
text
());
listBox
()
->
name
List
.
append
(
name
);
listBox
()
->
m_
name
s
.
remove
(
text
());
listBox
()
->
m_
name
s
.
append
(
name
);
setText
(
name
);
listBox
()
->
updateItem
(
this
);
...
...
playlistbox.h
View file @
8d27910d
...
...
@@ -51,7 +51,7 @@ public:
void
sort
();
void
raise
(
Playlist
*
playlist
);
QStringList
names
()
const
;
QStringList
names
()
const
{
return
m_names
;
}
QPtrList
<
Playlist
>
playlists
()
const
;
public
slots
:
...
...
@@ -93,16 +93,16 @@ private:
* This is used by PlaylistItemBox (a friend class) to add names to the name
* list returned by names().
*/
void
addName
(
const
QString
&
name
)
;
void
addName
(
const
QString
&
name
)
{
m_names
.
append
(
name
);
}
private
slots
:
/**
* Catches QListBox::currentChanged(QListBoxItem *), does a cast and then re-emits
* the signal as currentChanged(Item *).
*/
void
p
laylistChanged
(
QListBoxItem
*
item
);
void
p
laylistDoubleClicked
(
QListBoxItem
*
);
void
d
rawContextMenu
(
QListBoxItem
*
item
,
const
QPoint
&
point
);
void
slotP
laylistChanged
(
QListBoxItem
*
item
);
void
slotP
laylistDoubleClicked
(
QListBoxItem
*
);
void
slotD
rawContextMenu
(
QListBoxItem
*
item
,
const
QPoint
&
point
);
// context menu entries
void
contextSave
();
...
...
@@ -112,13 +112,13 @@ private slots:
void
contextDeleteItem
();
private:
PlaylistSplitter
*
splitter
;
QStringList
name
List
;
KPopupMenu
*
collectionContextMenu
;
KPopupMenu
*
playlistContextMenu
;
Item
*
contextMenuOn
;
bool
updatePlaylistStack
;
QPtrDict
<
Item
>
_playlistDict
;
PlaylistSplitter
*
m_
splitter
;
QStringList
m_
name
s
;
KPopupMenu
*
m_
collectionContextMenu
;
KPopupMenu
*
m_
playlistContextMenu
;
Item
*
m_
contextMenuOn
;
bool
m_
updatePlaylistStack
;
QPtrDict
<
Item
>
m
_playlistDict
;
};
...
...
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