1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
/*
*
* $Id: k3bvcdlistviewitem.cpp 619556 2007-01-03 17:38:12Z trueg $
* Copyright (C) 2003-2004 Christian Kvasny <chris@k3b.org>
*
* This file is part of the K3b project.
* Copyright (C) 1998-2007 Sebastian Trueg <trueg@k3b.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* See the file "COPYING" for the exact licensing terms.
*/
#include <tdeio/global.h>
#include <kiconloader.h>
// K3b Includes
#include "k3bvcdlistviewitem.h"
#include "k3bvcdtrack.h"
#include <k3bglobals.h>
K3bVcdListViewItem::K3bVcdListViewItem( K3bVcdTrack* track, K3bListView* parent )
: K3bListViewItem( parent ), m_track( track )
{
setEditor( 1, LINE );
animate();
}
K3bVcdListViewItem::K3bVcdListViewItem( K3bVcdTrack* track, K3bListView* parent, TQListViewItem* after )
: K3bListViewItem( parent, after ), m_track( track )
{
setEditor( 1, LINE );
animate();
}
K3bVcdListViewItem::~K3bVcdListViewItem()
{}
TQString K3bVcdListViewItem::text( int i ) const
{
//
// We add two spaces after all strings (except the once renamable)
// to increase readability
//
switch ( i ) {
case 0:
return TQString::number( m_track->index() + 1 ).rightJustify( 2, ' ' ) + " ";
case 1:
return m_track->title();
case 2:
// track mpegtype
return m_track->mpegTypeS() + " ";
case 3:
// track mpegsize
return m_track->resolution() + " ";
case 4:
// track low mpegsize for MPEG1 Stills
return m_track->highresolution() + " ";
case 5:
// track mpegfps
return m_track->video_frate() + " ";
case 6:
// track mpegmbps
return TQString::number( m_track->muxrate() ) + " ";
case 7:
// track mpegduration
return m_track->duration() + " ";
case 8:
// track size
return TDEIO::convertSize( m_track->size() ) + " ";
case 9:
// filename
return m_track->fileName();
default:
return TDEListViewItem::text( i );
}
}
void K3bVcdListViewItem::setText( int col, const TQString& text )
{
if ( col == 1 ) {
// this is the title field
m_track->setTitle( text );
}
TDEListViewItem::setText( col, text );
}
TQString K3bVcdListViewItem::key( int, bool ) const
{
TQString num = TQString::number( m_track->index() );
if ( num.length() == 1 )
return "00" + num;
else if ( num.length() == 2 )
return "0" + num;
return num;
}
bool K3bVcdListViewItem::animate()
{
bool animate = false;
switch ( m_track->mpegType() ) {
case 0: // MPEG_MOTION
setPixmap( 2, ( SmallIcon( "video-x-generic" ) ) );
break;
case 1: // MPEG_STILL
setPixmap( 2, ( SmallIcon( "image-x-generic" ) ) );
break;
case 2: // MPEG_AUDIO
setPixmap( 2, ( SmallIcon( "audio-x-generic" ) ) );
break;
default:
setPixmap( 2, ( SmallIcon( "video-x-generic" ) ) );
break;
}
return animate;
}
|