Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLMC
Manage
Activity
Members
Labels
Plan
Issues
26
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLMC
Commits
96f5e67f
Commit
96f5e67f
authored
8 years ago
by
luyikei
Browse files
Options
Downloads
Patches
Plain Diff
Add ThumbnailImageProvider
parent
367fecdf
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Makefile.am
+3
-0
3 additions, 0 deletions
Makefile.am
src/Gui/timeline/ThumbnailImageProvider.cpp
+47
-0
47 additions, 0 deletions
src/Gui/timeline/ThumbnailImageProvider.cpp
src/Gui/timeline/ThumbnailImageProvider.h
+27
-0
27 additions, 0 deletions
src/Gui/timeline/ThumbnailImageProvider.h
with
77 additions
and
0 deletions
Makefile.am
+
3
−
0
View file @
96f5e67f
...
...
@@ -209,6 +209,7 @@ vlmc_SOURCES += \
src/Gui/settings/SettingsDialog.cpp
\
src/Gui/settings/StringWidget.cpp
\
src/Gui/timeline/Timeline.cpp
\
src/Gui/timeline/ThumbnailImageProvider.cpp
\
src/Gui/widgets/ExtendedLabel.cpp
\
src/Gui/widgets/FramelessButton.cpp
\
src/Gui/widgets/NotificationZone.cpp
\
...
...
@@ -249,6 +250,7 @@ vlmc_SOURCES += \
src/Gui/wizard/firstlaunch/Done.h
\
src/Gui/wizard/OpenPage.h
\
src/Gui/timeline/Timeline.h
\
src/Gui/timeline/ThumbnailImageProvider.h
\
src/Gui/About.h
\
src/Gui/LanguageHelper.h
\
src/Gui/library/ListViewController.h
\
...
...
@@ -317,6 +319,7 @@ nodist_vlmc_SOURCES += \
src/Gui/preview/PreviewRuler.moc.cpp
\
src/Gui/settings/PreferenceWidget.moc.cpp
\
src/Gui/timeline/Timeline.moc.cpp
\
src/Gui/timeline/ThumbnailImageProvider.moc.cpp
\
src/Gui/settings/LanguageWidget.moc.cpp
\
src/Gui/import/TagWidget.moc.cpp
\
src/Gui/widgets/NotificationZone.moc.cpp
\
...
...
This diff is collapsed.
Click to expand it.
src/Gui/timeline/ThumbnailImageProvider.cpp
0 → 100644
+
47
−
0
View file @
96f5e67f
#include
"ThumbnailImageProvider.h"
#include
"Workflow/MainWorkflow.h"
#include
"Main/Core.h"
ThumbnailImageProvider
::
ThumbnailImageProvider
()
:
QQuickImageProvider
(
QQuickImageProvider
::
Pixmap
)
{
connect
(
Core
::
instance
()
->
workflow
(),
&
MainWorkflow
::
thumbnailUpdated
,
this
,
[
this
]
(
const
QString
&
uuid
,
quint32
pos
,
const
QPixmap
&
pixmap
)
{
auto
id
=
uuid
+
"/"
+
QString
::
number
(
pos
);
auto
it
=
m_pixMap
.
find
(
id
);
if
(
it
==
m_pixMap
.
end
()
)
m_pixMap
.
insert
(
id
,
pixmap
);
emit
imageReady
(
uuid
,
pos
);
},
Qt
::
DirectConnection
);
}
QPixmap
ThumbnailImageProvider
::
requestPixmap
(
const
QString
&
id
,
QSize
*
size
,
const
QSize
&
requestedSize
)
{
QString
tmp
=
id
;
tmp
.
replace
(
"%7B"
,
"{"
);
tmp
.
replace
(
"%7D"
,
"}"
);
auto
it
=
m_pixMap
.
find
(
tmp
);
if
(
it
==
m_pixMap
.
end
()
)
{
*
size
=
QSize
(
requestedSize
.
width
(),
requestedSize
.
height
()
);
return
QPixmap
(
requestedSize
);
}
auto
pixmap
=
it
.
value
();
*
size
=
pixmap
.
size
();
if
(
requestedSize
.
isValid
()
==
true
)
return
pixmap
.
scaled
(
requestedSize
);
return
pixmap
;
}
bool
ThumbnailImageProvider
::
hasImage
(
const
QString
&
uuid
,
quint32
pos
)
{
return
m_pixMap
.
find
(
uuid
+
"/"
+
QString
::
number
(
pos
)
)
!=
m_pixMap
.
end
();
}
This diff is collapsed.
Click to expand it.
src/Gui/timeline/ThumbnailImageProvider.h
0 → 100644
+
27
−
0
View file @
96f5e67f
#ifndef THUMBNAILIMAGEPROVIDER_H
#define THUMBNAILIMAGEPROVIDER_H
#include
<QMap>
#include
<QQuickImageProvider>
class
ThumbnailImageProvider
:
public
QObject
,
public
QQuickImageProvider
{
Q_OBJECT
public:
ThumbnailImageProvider
();
virtual
QPixmap
requestPixmap
(
const
QString
&
id
,
QSize
*
size
,
const
QSize
&
requestedSize
)
override
;
public
slots
:
bool
hasImage
(
const
QString
&
uuid
,
quint32
pos
);
signals:
void
imageReady
(
const
QString
&
uuid
,
quint32
pos
);
private:
// uuid/pos, pixmap
QMap
<
QString
,
QPixmap
>
m_pixMap
;
};
#endif // THUMBNAILIMAGEPROVIDER_H
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment