Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
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
videolan
vlc
Commits
9c42dd14
Commit
9c42dd14
authored
Oct 31, 2010
by
Ilkka Ollakka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt4: rework coverflow to use playlist model for art
parent
fbeedd2d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
134 deletions
+23
-134
modules/gui/qt4/components/playlist/views.cpp
modules/gui/qt4/components/playlist/views.cpp
+11
-14
modules/gui/qt4/components/playlist/views.hpp
modules/gui/qt4/components/playlist/views.hpp
+2
-2
modules/gui/qt4/util/pictureflow.cpp
modules/gui/qt4/util/pictureflow.cpp
+8
-85
modules/gui/qt4/util/pictureflow.hpp
modules/gui/qt4/util/pictureflow.hpp
+2
-33
No files found.
modules/gui/qt4/components/playlist/views.cpp
View file @
9c42dd14
...
...
@@ -377,13 +377,12 @@ PicFlowView::PicFlowView( PLModel *p_model, QWidget *parent ) : QAbstractItemVie
{
QHBoxLayout
*
layout
=
new
QHBoxLayout
(
this
);
layout
->
setMargin
(
0
);
picFlow
=
new
PictureFlow
(
this
);
picFlow
=
new
PictureFlow
(
this
,
p_model
);
picFlow
->
setSlideSize
(
QSize
(
128
,
128
));
layout
->
addWidget
(
picFlow
);
setSelectionMode
(
QAbstractItemView
::
SingleSelection
);
setModel
(
p_model
);
//CONNECT( picFlow, centerIndexChanged(int), this, playItem(int) );
}
int
PicFlowView
::
horizontalOffset
()
const
...
...
@@ -405,9 +404,9 @@ void PicFlowView::scrollTo(const QModelIndex &index, QAbstractItemView::ScrollHi
{
int
currentIndex
=
picFlow
->
centerIndex
();
if
(
qAbs
(
currentIndex
-
index
.
row
())
>
100
)
picFlow
->
setCenterIndex
(
index
.
row
()
-
1
);
picFlow
->
setCenterIndex
(
index
.
row
());
else
picFlow
->
showSlide
(
index
.
row
()
-
1
);
picFlow
->
showSlide
(
index
.
row
()
);
}
QModelIndex
PicFlowView
::
indexAt
(
const
QPoint
&
)
const
...
...
@@ -441,20 +440,18 @@ void PicFlowView::setSelection(const QRect &, QFlags<QItemSelectionModel::Select
// No selection possible
}
void
PicFlowView
::
rowsInserted
(
const
QModelIndex
&
parent
,
int
start
,
int
end
)
void
PicFlowView
::
dataChanged
(
const
QModelIndex
&
topLeft
,
const
QModelIndex
&
bottomRight
)
{
for
(
int
i
=
start
;
i
<=
end
;
i
++
)
int
currentIndex
=
picFlow
->
centerIndex
();
for
(
int
i
=
topLeft
.
row
();
i
<=
bottomRight
.
row
();
i
++
)
{
if
(
i
-
5
<=
currentIndex
&&
i
+
5
>=
currentIndex
)
{
const
QModelIndex
index
=
model
()
->
index
(
i
,
0
,
parent
);
if
(
!
index
.
isValid
()
)
picFlow
->
render
();
return
;
/* FIXME, this returns no art, so far */
QPixmap
pix
=
PLModel
::
getArtPixmap
(
index
,
QSize
(
128
,
128
)
);
picFlow
->
addSlide
(
pix
);
}
picFlow
->
render
();
}
}
void
PicFlowView
::
playItem
(
int
i_item
)
...
...
modules/gui/qt4/components/playlist/views.hpp
View file @
9c42dd14
...
...
@@ -116,8 +116,8 @@ protected:
private:
PictureFlow
*
picFlow
;
p
rotected
slots
:
void
rowsInserted
(
const
QModelIndex
&
parent
,
int
start
,
int
end
);
p
ublic
slots
:
void
dataChanged
(
const
QModelIndex
&
,
const
QModelIndex
&
);
private
slots
:
void
playItem
(
int
);
};
...
...
modules/gui/qt4/util/pictureflow.cpp
View file @
9c42dd14
...
...
@@ -42,6 +42,7 @@
#include <QTimer>
#include <QVector>
#include <QWidget>
#include "../components/playlist/playlist_model.hpp"
/* getArtPixmap etc */
// for fixed-point arithmetic, we need minimum 32-bit long
// long long (64-bit) might be useful for multiplication and division
...
...
@@ -136,13 +137,13 @@ public:
int
slideWidth
;
int
slideHeight
;
PictureFlow
::
ReflectionEffect
reflectionEffect
;
QVector
<
QImage
*>
slideImages
;
int
angle
;
int
spacing
;
PFreal
offsetX
;
PFreal
offsetY
;
PLModel
*
model
;
SlideInfo
centerSlide
;
QVector
<
SlideInfo
>
leftSlides
;
QVector
<
SlideInfo
>
rightSlides
;
...
...
@@ -214,8 +215,6 @@ PictureFlowState::PictureFlowState():
PictureFlowState
::~
PictureFlowState
()
{
for
(
int
i
=
0
;
i
<
(
int
)
slideImages
.
count
();
i
++
)
delete
slideImages
[
i
];
}
// readjust the settings, call this when slide dimension is changed
...
...
@@ -594,40 +593,13 @@ QImage* PictureFlowSoftwareRenderer::surface(int slideIndex)
return
0
;
if
(
slideIndex
<
0
)
return
0
;
if
(
slideIndex
>=
(
int
)
state
->
slideImages
.
c
ount
())
if
(
slideIndex
>=
(
int
)
state
->
model
->
rowC
ount
())
return
0
;
int
key
=
slideIndex
;
QImage
*
img
=
state
->
slideImages
.
at
(
slideIndex
);
bool
empty
=
img
?
img
->
isNull
()
:
true
;
if
(
empty
)
{
surfaceCache
.
remove
(
key
);
imageHash
.
remove
(
slideIndex
);
if
(
!
blankSurface
)
{
int
sw
=
state
->
slideWidth
;
int
sh
=
state
->
slideHeight
;
QImage
img
=
QImage
(
sw
,
sh
,
QImage
::
Format_RGB32
);
QPainter
painter
(
&
img
);
QPoint
p1
(
sw
*
4
/
10
,
0
);
QPoint
p2
(
sw
*
6
/
10
,
sh
);
QLinearGradient
linearGrad
(
p1
,
p2
);
linearGrad
.
setColorAt
(
0
,
Qt
::
black
);
linearGrad
.
setColorAt
(
1
,
Qt
::
white
);
painter
.
setBrush
(
linearGrad
);
painter
.
fillRect
(
0
,
0
,
sw
,
sh
,
QBrush
(
linearGrad
));
painter
.
setPen
(
QPen
(
QColor
(
64
,
64
,
64
),
4
));
painter
.
setBrush
(
QBrush
());
painter
.
drawRect
(
2
,
2
,
sw
-
3
,
sh
-
3
);
painter
.
end
();
blankSurface
=
prepareSurface
(
&
img
,
sw
,
sh
,
bgcolor
,
state
->
reflectionEffect
);
}
return
blankSurface
;
}
QImage
*
img
=
new
QImage
(
PLModel
::
getArtPixmap
(
state
->
model
->
index
(
slideIndex
,
0
,
QModelIndex
()
),
QSize
(
state
->
slideWidth
,
state
->
slideHeight
)
).
toImage
());
bool
exist
=
imageHash
.
contains
(
slideIndex
);
if
(
exist
)
...
...
@@ -796,11 +768,12 @@ public:
};
PictureFlow
::
PictureFlow
(
QWidget
*
parent
)
:
QWidget
(
parent
)
PictureFlow
::
PictureFlow
(
QWidget
*
parent
,
PLModel
*
_p_model
)
:
QWidget
(
parent
)
{
d
=
new
PictureFlowPrivate
;
d
->
state
=
new
PictureFlowState
;
d
->
state
->
model
=
_p_model
;
d
->
state
->
reset
();
d
->
state
->
reposition
();
...
...
@@ -830,7 +803,7 @@ PictureFlow::~PictureFlow()
int
PictureFlow
::
slideCount
()
const
{
return
d
->
state
->
slideImages
.
c
ount
();
return
d
->
state
->
model
->
rowC
ount
();
}
QColor
PictureFlow
::
backgroundColor
()
const
...
...
@@ -868,51 +841,6 @@ void PictureFlow::setReflectionEffect(ReflectionEffect effect)
triggerRender
();
}
QImage
PictureFlow
::
slide
(
int
index
)
const
{
QImage
*
i
=
0
;
if
((
index
>=
0
)
&&
(
index
<
slideCount
()))
i
=
d
->
state
->
slideImages
[
index
];
return
i
?
QImage
(
*
i
)
:
QImage
();
}
void
PictureFlow
::
addSlide
(
const
QImage
&
image
)
{
int
c
=
d
->
state
->
slideImages
.
count
();
d
->
state
->
slideImages
.
resize
(
c
+
1
);
d
->
state
->
slideImages
[
c
]
=
new
QImage
(
image
);
triggerRender
();
}
void
PictureFlow
::
addSlide
(
const
QPixmap
&
pixmap
)
{
addSlide
(
pixmap
.
toImage
());
}
void
PictureFlow
::
removeSlide
(
int
index
)
{
int
c
=
d
->
state
->
slideImages
.
count
();
if
(
index
>=
0
&&
index
<
c
)
{
d
->
state
->
slideImages
.
remove
(
index
);
triggerRender
();
}
}
void
PictureFlow
::
setSlide
(
int
index
,
const
QImage
&
image
)
{
if
((
index
>=
0
)
&&
(
index
<
slideCount
()))
{
QImage
*
i
=
image
.
isNull
()
?
0
:
new
QImage
(
image
);
delete
d
->
state
->
slideImages
[
index
];
d
->
state
->
slideImages
[
index
]
=
i
;
triggerRender
();
}
}
void
PictureFlow
::
setSlide
(
int
index
,
const
QPixmap
&
pixmap
)
{
setSlide
(
index
,
pixmap
.
toImage
());
}
int
PictureFlow
::
centerIndex
()
const
{
return
d
->
state
->
centerIndex
;
...
...
@@ -930,11 +858,6 @@ void PictureFlow::setCenterIndex(int index)
void
PictureFlow
::
clear
()
{
int
c
=
d
->
state
->
slideImages
.
count
();
for
(
int
i
=
0
;
i
<
c
;
i
++
)
delete
d
->
state
->
slideImages
[
i
];
d
->
state
->
slideImages
.
resize
(
0
);
d
->
state
->
reset
();
triggerRender
();
}
...
...
modules/gui/qt4/util/pictureflow.hpp
View file @
9c42dd14
...
...
@@ -29,6 +29,7 @@
#define PICTUREFLOW_H
#include <qwidget.h>
#include "../components/playlist/playlist_model.hpp"
/* getArtPixmap etc */
class
PictureFlowPrivate
;
...
...
@@ -62,7 +63,7 @@ public:
/*!
Creates a new PictureFlow widget.
*/
PictureFlow
(
QWidget
*
parent
=
0
);
PictureFlow
(
QWidget
*
parent
=
0
,
PLModel
*
model
=
0
);
/*!
Destroys the widget.
...
...
@@ -94,11 +95,6 @@ public:
*/
int
slideCount
()
const
;
/*!
Returns QImage of specified slide.
*/
QImage
slide
(
int
index
)
const
;
/*!
Returns the index of slide currently shown in the middle of the viewport.
*/
...
...
@@ -117,33 +113,6 @@ public:
public
slots
:
/*!
Adds a new slide.
*/
void
addSlide
(
const
QImage
&
image
);
/*!
Adds a new slide.
*/
void
addSlide
(
const
QPixmap
&
pixmap
);
/*!
Removes an existing slide.
*/
void
removeSlide
(
int
index
);
/*!
Sets an image for specified slide. If the slide already exists,
it will be replaced.
*/
void
setSlide
(
int
index
,
const
QImage
&
image
);
/*!
Sets a pixmap for specified slide. If the slide already exists,
it will be replaced.
*/
void
setSlide
(
int
index
,
const
QPixmap
&
pixmap
);
/*!
Sets slide to be shown in the middle of the viewport. No animation
effect will be produced, unlike using showSlide.
...
...
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