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
JuK
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
1
Merge Requests
1
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
Multimedia
JuK
Commits
af441659
Commit
af441659
authored
Jun 13, 2003
by
Scott Wheeler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moving closer to having stuff working in the tree view again...
svn path=/trunk/kdemultimedia/juk/; revision=231194
parent
17d053c6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
23 deletions
+66
-23
playlistbox.cpp
playlistbox.cpp
+27
-6
playlistbox.h
playlistbox.h
+7
-0
viewmode.cpp
viewmode.cpp
+30
-16
viewmode.h
viewmode.h
+2
-1
No files found.
playlistbox.cpp
View file @
af441659
...
...
@@ -417,19 +417,23 @@ void PlaylistBox::slotSetViewMode(int index)
}
////////////////////////////////////////////////////////////////////////////////
// protected methods
//
PlaylistBox::Item
protected methods
////////////////////////////////////////////////////////////////////////////////
PlaylistBox
::
Item
*
PlaylistBox
::
Item
::
m_collectionItem
=
0
;
PlaylistBox
::
Item
::
Item
(
PlaylistBox
*
listBox
,
const
char
*
icon
,
const
QString
&
text
,
Playlist
*
l
)
:
QObject
(
listBox
),
KListViewItem
(
listBox
,
text
),
m_list
(
l
),
m_text
(
text
),
m_iconName
(
icon
),
m_sortedFirst
(
false
)
{
int
iconSize
=
listBox
->
viewModeIndex
()
==
0
?
32
:
16
;
setPixmap
(
0
,
SmallIcon
(
icon
,
iconSize
));
listBox
->
addName
(
text
);
init
();
}
if
(
l
)
connect
(
l
,
SIGNAL
(
signalNameChanged
(
const
QString
&
)),
this
,
SLOT
(
slotSetName
(
const
QString
&
)));
PlaylistBox
::
Item
::
Item
(
Item
*
parent
,
const
char
*
icon
,
const
QString
&
text
,
Playlist
*
l
)
:
QObject
(
parent
->
listView
()),
KListViewItem
(
parent
,
text
),
m_list
(
l
),
m_text
(
text
),
m_iconName
(
icon
),
m_sortedFirst
(
false
)
{
init
();
}
PlaylistBox
::
Item
::~
Item
()
...
...
@@ -475,4 +479,21 @@ void PlaylistBox::Item::slotSetName(const QString &name)
}
}
////////////////////////////////////////////////////////////////////////////////
// PlaylistBox::Item private methods
////////////////////////////////////////////////////////////////////////////////
void
PlaylistBox
::
Item
::
init
()
{
int
iconSize
=
static_cast
<
PlaylistBox
*>
(
listView
())
->
viewModeIndex
()
==
0
?
32
:
16
;
setPixmap
(
0
,
SmallIcon
(
m_iconName
,
iconSize
));
static_cast
<
PlaylistBox
*>
(
listView
())
->
addName
(
m_text
);
if
(
m_list
)
connect
(
m_list
,
SIGNAL
(
signalNameChanged
(
const
QString
&
)),
this
,
SLOT
(
slotSetName
(
const
QString
&
)));
if
(
m_list
==
CollectionList
::
instance
())
m_collectionItem
=
this
;
}
#include "playlistbox.moc"
playlistbox.h
View file @
af441659
...
...
@@ -143,6 +143,7 @@ public:
protected:
Item
(
PlaylistBox
*
listBox
,
const
char
*
icon
,
const
QString
&
text
,
Playlist
*
l
=
0
);
Item
(
Item
*
parent
,
const
char
*
icon
,
const
QString
&
text
,
Playlist
*
l
=
0
);
Playlist
*
playlist
()
const
{
return
m_list
;
}
PlaylistBox
*
listView
()
const
{
return
static_cast
<
PlaylistBox
*>
(
KListViewItem
::
listView
());
}
...
...
@@ -156,14 +157,20 @@ protected:
virtual
QString
text
(
int
column
)
const
{
return
KListViewItem
::
text
(
column
);
}
static
Item
*
collectionItem
()
{
return
m_collectionItem
;
}
protected
slots
:
void
slotSetName
(
const
QString
&
name
);
private:
// setup() was already taken.
void
init
();
Playlist
*
m_list
;
QString
m_text
;
const
char
*
m_iconName
;
bool
m_sortedFirst
;
static
Item
*
m_collectionItem
;
};
#endif
viewmode.cpp
View file @
af441659
...
...
@@ -16,6 +16,7 @@
***************************************************************************/
#include <kiconloader.h>
#include <kdebug.h>
#include <qpixmap.h>
#include <qpainter.h>
...
...
@@ -128,15 +129,15 @@ CompactViewMode::~CompactViewMode()
}
void
CompactViewMode
::
paintCell
(
PlaylistBox
::
Item
*
i
,
void
CompactViewMode
::
paintCell
(
PlaylistBox
::
Item
*
i
tem
,
QPainter
*
painter
,
const
QColorGroup
&
colorGroup
,
int
column
,
int
width
,
int
align
)
{
if
(
width
<
i
->
pixmap
(
column
)
->
width
())
return
;
#if 0 // don't think this code is needed anymore
PlaylistBox
::
Item
*
item
=
static_cast
<
PlaylistBox
::
Item
*>
(
i
);
if(width < item->pixmap(column)->width())
return;
QFontMetrics fm = painter->fontMetrics();
QString line = item->text();
...
...
@@ -153,6 +154,8 @@ void CompactViewMode::paintCell(PlaylistBox::Item *i,
line = "...";
}
item->KListViewItem::setText(column, line);
#endif
item
->
KListViewItem
::
paintCell
(
painter
,
colorGroup
,
column
,
width
,
align
);
}
...
...
@@ -180,24 +183,35 @@ void TreeViewMode::setShown(bool show)
{
if
(
show
)
{
updateIcons
(
16
);
PlaylistBox
::
Item
*
collectionItem
=
PlaylistBox
::
Item
::
collectionItem
();
if
(
!
collectionItem
)
kdDebug
(
65432
)
<<
"TreeViewMode::setShown() - the CollectionList isn't initialized yet."
<<
endl
;
if
(
m_categories
.
isEmpty
())
{
m_categories
.
append
(
new
PlaylistBox
::
Item
(
playlistBox
(),
"midi"
,
i18n
(
"Artists"
)));
m_categories
.
append
(
new
PlaylistBox
::
Item
(
playlistBox
(),
"midi"
,
i18n
(
"Albums"
)));
if
(
collectionItem
&&
m_categories
.
isEmpty
())
{
PlaylistBox
::
Item
*
i
;
i
=
new
PlaylistBox
::
Item
(
collectionItem
,
"cdimage"
,
i18n
(
"Artists"
));
m_categories
.
insert
(
"artists"
,
i
);
i
=
new
PlaylistBox
::
Item
(
collectionItem
,
"cdimage"
,
i18n
(
"Albums"
));
m_categories
.
insert
(
"albums"
,
i
);
QValueListIterator
<
PlaylistBox
::
Item
*>
it
=
m_categories
.
begin
();
for
(
;
it
!=
m_categories
.
end
();
++
it
)
(
*
it
)
->
setSortedFirst
(
true
);
for
(
QDictIterator
<
PlaylistBox
::
Item
>
it
(
m_categories
);
it
.
current
();
++
it
)
it
.
current
(
)
->
setSortedFirst
(
true
);
}
else
{
QValueListIterator
<
PlaylistBox
::
Item
*>
it
=
m_categories
.
begin
();
for
(;
it
!=
m_categories
.
end
();
++
it
)
(
*
it
)
->
setVisible
(
true
);
for
(
QDictIterator
<
PlaylistBox
::
Item
>
it
(
m_categories
);
it
.
current
();
++
it
)
it
.
current
()
->
setVisible
(
true
);
}
}
else
{
QValueListIterator
<
PlaylistBox
::
Item
*>
it
=
m_categories
.
begin
();
for
(;
it
!=
m_categories
.
end
();
++
it
)
(
*
it
)
->
setVisible
(
false
);
for
(
QDictIterator
<
PlaylistBox
::
Item
>
it
(
m_categories
);
it
.
current
();
++
it
)
it
.
current
()
->
setVisible
(
false
);
}
playlistBox
()
->
setRootIsDecorated
(
show
);
}
viewmode.h
View file @
af441659
...
...
@@ -21,6 +21,7 @@
#include <klocale.h>
#include <qstring.h>
#include <qdict.h>
#include "playlistbox.h"
...
...
@@ -80,7 +81,7 @@ public:
virtual
void
setShown
(
bool
shown
);
private:
Q
ValueList
<
PlaylistBox
::
Item
*
>
m_categories
;
Q
Dict
<
PlaylistBox
::
Item
>
m_categories
;
};
#endif
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