custom style delegate for icon view
This commit is contained in:
+4
-1
@@ -120,7 +120,10 @@ namespace olive {
|
||||
PROJECT_VIEW_TREE,
|
||||
|
||||
/** Display project media in icon browser */
|
||||
PROJECT_VIEW_ICON
|
||||
PROJECT_VIEW_ICON,
|
||||
|
||||
/** Display project media in list browser */
|
||||
PROJECT_VIEW_LIST
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
+43
-24
@@ -26,57 +26,76 @@
|
||||
#include "debug.h"
|
||||
|
||||
int lerp(int a, int b, double t) {
|
||||
return qRound(((1.0 - t) * a) + (t * b));
|
||||
return qRound(((1.0 - t) * a) + (t * b));
|
||||
}
|
||||
|
||||
float float_lerp(float a, float b, float t) {
|
||||
return ((1.0F - t) * a) + (t * b);
|
||||
return ((1.0F - t) * a) + (t * b);
|
||||
}
|
||||
|
||||
double double_lerp(double a, double b, double t) {
|
||||
return ((1.0 - t) * a) + (t * b);
|
||||
return ((1.0 - t) * a) + (t * b);
|
||||
}
|
||||
|
||||
double quad_from_t(double a, double b, double c, double t) {
|
||||
return qPow(1.0 - t, 2)*a + 2*(1.0 - t)*t*b + qPow(t, 2)*c;
|
||||
return qPow(1.0 - t, 2)*a + 2*(1.0 - t)*t*b + qPow(t, 2)*c;
|
||||
}
|
||||
|
||||
double quad_t_from_x(double x, double a, double b, double c) {
|
||||
return (a - b + qSqrt(a*x + c*x - 2*b*x + qPow(b, 2) - a*c))/(a - 2*b + c);
|
||||
// alt: return (a - b - qSqrt(a*x + c*x - 2*b*x + qPow(b, 2) - a*c))/(a - 2*b + c);
|
||||
return (a - b + qSqrt(a*x + c*x - 2*b*x + qPow(b, 2) - a*c))/(a - 2*b + c);
|
||||
// alt: return (a - b - qSqrt(a*x + c*x - 2*b*x + qPow(b, 2) - a*c))/(a - 2*b + c);
|
||||
}
|
||||
|
||||
double cubic_from_t(double a, double b, double c, double d, double t) {
|
||||
return qPow(1.0 - t, 3)*a + 3*qPow(1.0 - t, 2)*t*b + 3*(1.0 - t)*qPow(t, 2)*c + qPow(t, 3)*d;
|
||||
return qPow(1.0 - t, 3)*a + 3*qPow(1.0 - t, 2)*t*b + 3*(1.0 - t)*qPow(t, 2)*c + qPow(t, 3)*d;
|
||||
}
|
||||
|
||||
double cubic_t_from_x(double x_target, double a, double b, double c, double d) {
|
||||
double tolerance = 0.0001;
|
||||
double tolerance = 0.0001;
|
||||
|
||||
double lower = 0.0;
|
||||
double upper = 1.0;
|
||||
double lower = 0.0;
|
||||
double upper = 1.0;
|
||||
|
||||
double percent = 0.5;
|
||||
double x = cubic_from_t(a, b, c, d, percent);
|
||||
double percent = 0.5;
|
||||
double x = cubic_from_t(a, b, c, d, percent);
|
||||
|
||||
while (qAbs(x_target - x) > tolerance) {
|
||||
if (x_target > x) {
|
||||
lower = percent;
|
||||
} else {
|
||||
upper = percent;
|
||||
}
|
||||
while (qAbs(x_target - x) > tolerance) {
|
||||
if (x_target > x) {
|
||||
lower = percent;
|
||||
} else {
|
||||
upper = percent;
|
||||
}
|
||||
|
||||
percent = (upper + lower) / 2.0;
|
||||
x = cubic_from_t(a, b, c, d, percent);
|
||||
}
|
||||
percent = (upper + lower) / 2.0;
|
||||
x = cubic_from_t(a, b, c, d, percent);
|
||||
}
|
||||
|
||||
return percent;
|
||||
return percent;
|
||||
}
|
||||
|
||||
double amplitude_to_db(double amplitude) {
|
||||
return (20.0*(qLn(amplitude)/qLn(10.0)));
|
||||
return (20.0*(qLn(amplitude)/qLn(10.0)));
|
||||
}
|
||||
|
||||
double db_to_amplitude(double db) {
|
||||
return qPow(M_E, (db*qLn(10.0))/20.0);
|
||||
return qPow(M_E, (db*qLn(10.0))/20.0);
|
||||
}
|
||||
|
||||
QRect fit_size_into_rect(const QRect &r, int width, int height)
|
||||
{
|
||||
// Get aspect ratio of object we're fitting
|
||||
double inner_ar = double(width) / double(height);
|
||||
|
||||
// Get aspect ratio of rectangle
|
||||
double rect_ar = double(r.width()) / double(r.height());
|
||||
|
||||
if (rect_ar > inner_ar) {
|
||||
// The rect is wider than the object, so we'll be limiting by height and scaling by width
|
||||
int new_width = qRound(r.height() * inner_ar);
|
||||
return QRect(r.x() + (r.width() / 2 - new_width / 2), r.y(), new_width, r.height());
|
||||
} else {
|
||||
// The rect is taller than the object, so we'll be limiting by width and scaling by height
|
||||
int new_height = qRound(r.width() / inner_ar);
|
||||
return QRect(r.x(), r.y() + (r.height() / 2 - new_height / 2), r.width(), new_height);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#ifndef MATH_H
|
||||
#define MATH_H
|
||||
|
||||
#include <QRect>
|
||||
|
||||
int lerp(int a, int b, double t);
|
||||
float float_lerp(float a, float b, float t);
|
||||
double double_lerp(double a, double b, double t);
|
||||
@@ -30,6 +32,8 @@ double cubic_from_t(double a, double b, double c, double d, double t);
|
||||
double cubic_t_from_x(double x_target, double a, double b, double c, double d);
|
||||
double solveCubicBezier(double p0, double p1, double p2, double p3, double x);
|
||||
|
||||
QRect fit_size_into_rect(const QRect& r, int width, int height);
|
||||
|
||||
// decibel conversion functions
|
||||
double amplitude_to_db(double amplitude);
|
||||
double db_to_amplitude(double db);
|
||||
|
||||
@@ -52,5 +52,6 @@
|
||||
<file>align-right.svg</file>
|
||||
<file>justify-center.svg</file>
|
||||
<file>bold.svg</file>
|
||||
<file>listview.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -0,0 +1,829 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
sodipodi:docname="iconview.svg"
|
||||
inkscape:version="0.91+devel+osxmenu r12922"
|
||||
sodipodi:version="0.32"
|
||||
id="svg2"
|
||||
height="64"
|
||||
width="64"
|
||||
inkscape:output_extension="org.inkscape.output.svg.inkscape"
|
||||
version="1.1"
|
||||
viewBox="0 0 64 64"
|
||||
inkscape:export-filename="/Users/pablo/olive_pablo/icons/iconview.png"
|
||||
inkscape:export-xdpi="96"
|
||||
inkscape:export-ydpi="96">
|
||||
<defs
|
||||
id="defs14">
|
||||
<linearGradient
|
||||
id="linearGradient3253">
|
||||
<stop
|
||||
id="stop3255"
|
||||
offset="0"
|
||||
style="stop-color:#89d5f8;stop-opacity:1;" />
|
||||
<stop
|
||||
id="stop3257"
|
||||
offset="1"
|
||||
style="stop-color:#00899e;stop-opacity:1;" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient11979">
|
||||
<stop
|
||||
id="stop11981"
|
||||
offset="0"
|
||||
style="stop-color:#ffffff;stop-opacity:1;" />
|
||||
<stop
|
||||
id="stop11983"
|
||||
offset="1"
|
||||
style="stop-color:#729fcf;stop-opacity:1" />
|
||||
</linearGradient>
|
||||
<inkscape:perspective
|
||||
id="perspective5736"
|
||||
inkscape:persp3d-origin="24 : 16 : 1"
|
||||
inkscape:vp_z="48 : 24 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 24 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<linearGradient
|
||||
id="linearGradient2846">
|
||||
<stop
|
||||
style="stop-color:#8a8a8a;stop-opacity:1.0000000;"
|
||||
offset="0.0000000"
|
||||
id="stop2848" />
|
||||
<stop
|
||||
style="stop-color:#484848;stop-opacity:1.0000000;"
|
||||
offset="1.0000000"
|
||||
id="stop2850" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient2366">
|
||||
<stop
|
||||
style="stop-color:#ffffff;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop2368" />
|
||||
<stop
|
||||
id="stop2374"
|
||||
offset="0.50000000"
|
||||
style="stop-color:#ffffff;stop-opacity:0.21904762;" />
|
||||
<stop
|
||||
style="stop-color:#ffffff;stop-opacity:1.0000000;"
|
||||
offset="1.0000000"
|
||||
id="stop2370" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient4467">
|
||||
<stop
|
||||
id="stop4469"
|
||||
offset="0"
|
||||
style="stop-color:#ffffff;stop-opacity:1;" />
|
||||
<stop
|
||||
id="stop4471"
|
||||
offset="1.0000000"
|
||||
style="stop-color:#ffffff;stop-opacity:0.24761905;" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient4454">
|
||||
<stop
|
||||
id="stop4456"
|
||||
offset="0.0000000"
|
||||
style="stop-color:#729fcf;stop-opacity:0.20784314;" />
|
||||
<stop
|
||||
id="stop4458"
|
||||
offset="1.0000000"
|
||||
style="stop-color:#729fcf;stop-opacity:0.67619050;" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient4440">
|
||||
<stop
|
||||
id="stop4442"
|
||||
offset="0"
|
||||
style="stop-color:#7d7d7d;stop-opacity:1;" />
|
||||
<stop
|
||||
style="stop-color:#b1b1b1;stop-opacity:1.0000000;"
|
||||
offset="0.50000000"
|
||||
id="stop4448" />
|
||||
<stop
|
||||
id="stop4444"
|
||||
offset="1.0000000"
|
||||
style="stop-color:#686868;stop-opacity:1.0000000;" />
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient4467"
|
||||
id="radialGradient2097"
|
||||
cx="23.070683"
|
||||
cy="35.127438"
|
||||
fx="23.070683"
|
||||
fy="35.127438"
|
||||
r="10.31934"
|
||||
gradientTransform="matrix(0.914812,0.01265023,-0.00821502,0.213562,2.253914,27.18889)"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient4467"
|
||||
id="linearGradient7922"
|
||||
x1="16.874998"
|
||||
y1="22.851799"
|
||||
x2="27.900846"
|
||||
y2="34.976799"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2871"
|
||||
id="linearGradient7186"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="46.834816"
|
||||
y1="45.264122"
|
||||
x2="45.380436"
|
||||
y2="50.939667" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2402"
|
||||
id="linearGradient7184"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="18.935766"
|
||||
y1="23.667896"
|
||||
x2="53.588623"
|
||||
y2="26.649363" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2380"
|
||||
id="linearGradient7180"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="62.513836"
|
||||
y1="36.061237"
|
||||
x2="15.984863"
|
||||
y2="20.60858" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient4467"
|
||||
id="linearGradient7189"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="13.435029"
|
||||
y1="13.604306"
|
||||
x2="22.374878"
|
||||
y2="23.554308"
|
||||
gradientTransform="rotate(180,23.96967,25.01237)" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient4467"
|
||||
id="linearGradient7185"
|
||||
x1="13.435029"
|
||||
y1="13.604306"
|
||||
x2="22.374878"
|
||||
y2="23.554308"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient1322"
|
||||
id="linearGradient4975"
|
||||
x1="34.892849"
|
||||
y1="36.422989"
|
||||
x2="45.918697"
|
||||
y2="48.547989"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(-18.01785,-13.57119)" />
|
||||
<linearGradient
|
||||
id="linearGradient1322">
|
||||
<stop
|
||||
id="stop1324"
|
||||
offset="0.0000000"
|
||||
style="stop-color:#729fcf" />
|
||||
<stop
|
||||
id="stop1326"
|
||||
offset="1.0000000"
|
||||
style="stop-color:#5187d6;stop-opacity:1.0000000;" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient4467"
|
||||
id="linearGradient1491"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="5.9649177"
|
||||
y1="26.048164"
|
||||
x2="52.854095"
|
||||
y2="26.048164" />
|
||||
<linearGradient
|
||||
id="linearGradient2402">
|
||||
<stop
|
||||
style="stop-color:#729fcf;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop2404" />
|
||||
<stop
|
||||
style="stop-color:#528ac5;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop2406" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
id="linearGradient2871">
|
||||
<stop
|
||||
style="stop-color:#3465a4;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop2873" />
|
||||
<stop
|
||||
style="stop-color:#3465a4;stop-opacity:1"
|
||||
offset="1"
|
||||
id="stop2875" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2690"
|
||||
id="linearGradient2696"
|
||||
x1="32.647972"
|
||||
y1="30.748846"
|
||||
x2="37.124462"
|
||||
y2="24.842253"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(-48.77039,-5.765705)" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
id="linearGradient2690">
|
||||
<stop
|
||||
style="stop-color:#c4d7eb;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop2692" />
|
||||
<stop
|
||||
style="stop-color:#c4d7eb;stop-opacity:0;"
|
||||
offset="1"
|
||||
id="stop2694" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2682"
|
||||
id="linearGradient2688"
|
||||
x1="36.713837"
|
||||
y1="31.455952"
|
||||
x2="37.124462"
|
||||
y2="24.842253"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(-48.77039,-5.765705)" />
|
||||
<linearGradient
|
||||
id="linearGradient2682">
|
||||
<stop
|
||||
style="stop-color:#3977c3;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop2684" />
|
||||
<stop
|
||||
style="stop-color:#89aedc;stop-opacity:0;"
|
||||
offset="1"
|
||||
id="stop2686" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient2380">
|
||||
<stop
|
||||
style="stop-color:#b9cfe7;stop-opacity:1"
|
||||
offset="0"
|
||||
id="stop2382" />
|
||||
<stop
|
||||
style="stop-color:#729fcf;stop-opacity:1"
|
||||
offset="1"
|
||||
id="stop2384" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2831"
|
||||
id="linearGradient1486"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(-48.30498,-6.043298)"
|
||||
x1="13.478554"
|
||||
y1="10.612206"
|
||||
x2="15.419417"
|
||||
y2="19.115122" />
|
||||
<linearGradient
|
||||
id="linearGradient2831">
|
||||
<stop
|
||||
style="stop-color:#3465a4;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop2833" />
|
||||
<stop
|
||||
id="stop2855"
|
||||
offset="0.33333334"
|
||||
style="stop-color:#5b86be;stop-opacity:1;" />
|
||||
<stop
|
||||
style="stop-color:#83a8d8;stop-opacity:0;"
|
||||
offset="1"
|
||||
id="stop2835" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient2871"
|
||||
id="linearGradient1488"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="rotate(180,-0.62124,20.04085)"
|
||||
x1="37.128052"
|
||||
y1="29.729605"
|
||||
x2="37.065414"
|
||||
y2="26.194071" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient4467"
|
||||
id="radialGradient1503"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1,0,0,0.536723,0,16.87306)"
|
||||
cx="24.837126"
|
||||
cy="36.421127"
|
||||
fx="24.837126"
|
||||
fy="36.421127"
|
||||
r="15.644737" />
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="0 : 32 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="64 : 32 : 1"
|
||||
inkscape:persp3d-origin="32 : 21.333333 : 1"
|
||||
id="perspective2833" />
|
||||
<linearGradient
|
||||
id="linearGradient3864">
|
||||
<stop
|
||||
id="stop3866"
|
||||
offset="0"
|
||||
style="stop-color:#71b2f8;stop-opacity:1;" />
|
||||
<stop
|
||||
id="stop3868"
|
||||
offset="1"
|
||||
style="stop-color:#002795;stop-opacity:1;" />
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3864"
|
||||
id="radialGradient2571"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
cx="342.58258"
|
||||
cy="27.256668"
|
||||
fx="342.58258"
|
||||
fy="27.256668"
|
||||
r="19.571428"
|
||||
gradientTransform="matrix(1.6258409,0.5434973,-8.8819886e-2,0.2656996,-215.02413,-170.90186)" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3593"
|
||||
id="radialGradient3352"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
cx="345.28433"
|
||||
cy="15.560534"
|
||||
fx="345.28433"
|
||||
fy="15.560534"
|
||||
r="19.571428"
|
||||
gradientTransform="translate(-0.1767767,-2.6516504)" />
|
||||
<linearGradient
|
||||
id="linearGradient3593">
|
||||
<stop
|
||||
style="stop-color:#c8e0f9;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop3595" />
|
||||
<stop
|
||||
style="stop-color:#637dca;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop3597" />
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3593"
|
||||
id="radialGradient3354"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
cx="330.63791"
|
||||
cy="39.962704"
|
||||
fx="330.63791"
|
||||
fy="39.962704"
|
||||
r="19.571428"
|
||||
gradientTransform="translate(-0.1767767,-2.6516504)" />
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="0 : 32 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="64 : 32 : 1"
|
||||
inkscape:persp3d-origin="32 : 21.333333 : 1"
|
||||
id="perspective3372" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3864"
|
||||
id="radialGradient3369"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.6258409,0.5434973,-8.8819886e-2,0.2656996,-461.81066,-173.06271)"
|
||||
cx="342.58258"
|
||||
cy="27.256668"
|
||||
fx="342.58258"
|
||||
fy="27.256668"
|
||||
r="19.571428" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3593"
|
||||
id="radialGradient3372"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.0012324,0,0,0.9421773,-327.50313,-4.3316646)"
|
||||
cx="345.28433"
|
||||
cy="15.560534"
|
||||
fx="345.28433"
|
||||
fy="15.560534"
|
||||
r="19.571428" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3593"
|
||||
id="radialGradient3375"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.0012324,0,0,0.9421773,-287.81791,-28.143054)"
|
||||
cx="330.63791"
|
||||
cy="39.962704"
|
||||
fx="330.63791"
|
||||
fy="39.962704"
|
||||
r="19.571428" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3864"
|
||||
id="radialGradient3380"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.9829174,1.3240854,-1.2330051,0.8105158,-131.04134,-483.74563)"
|
||||
cx="320.44025"
|
||||
cy="113.23357"
|
||||
fx="320.44025"
|
||||
fy="113.23357"
|
||||
r="19.571428" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3864"
|
||||
id="linearGradient3914"
|
||||
x1="6.94525"
|
||||
y1="36.838673"
|
||||
x2="48.691113"
|
||||
y2="36.838673"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.0012324,0,0,0.9421773,-4.8699606,-2.3863162)" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3864"
|
||||
id="linearGradient3792"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.0012324,0,0,0.9421773,-4.8699606,-2.3863162)"
|
||||
x1="6.8300767"
|
||||
y1="34.146042"
|
||||
x2="48.691113"
|
||||
y2="36.838673" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3864"
|
||||
id="radialGradient3812"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.0012324,0,0,0.9421773,-287.81791,-28.143054)"
|
||||
cx="330.63791"
|
||||
cy="39.962704"
|
||||
fx="330.63791"
|
||||
fy="39.962704"
|
||||
r="19.571428" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3593"
|
||||
id="radialGradient3814"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.0012324,0,0,0.9421773,-327.50313,-4.3316646)"
|
||||
cx="345.28433"
|
||||
cy="15.560534"
|
||||
fx="345.28433"
|
||||
fy="15.560534"
|
||||
r="19.571428" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3864"
|
||||
id="radialGradient3816"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.9829174,1.3240854,-1.2330051,0.8105158,-131.04134,-483.74563)"
|
||||
cx="320.44025"
|
||||
cy="113.23357"
|
||||
fx="320.44025"
|
||||
fy="113.23357"
|
||||
r="19.571428" />
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="0 : 32 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="64 : 32 : 1"
|
||||
inkscape:persp3d-origin="32 : 21.333333 : 1"
|
||||
id="perspective2734" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient4467"
|
||||
id="radialGradient3850"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1,0,0,0.6985294,0,202.82863)"
|
||||
cx="225.26402"
|
||||
cy="672.79736"
|
||||
fx="225.26402"
|
||||
fy="672.79736"
|
||||
r="34.345188" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient4467"
|
||||
id="radialGradient3850-4"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1,0,0,0.6985294,0,202.82863)"
|
||||
cx="225.26402"
|
||||
cy="672.79736"
|
||||
fx="225.26402"
|
||||
fy="672.79736"
|
||||
r="34.345188" />
|
||||
<inkscape:perspective
|
||||
sodipodi:type="inkscape:persp3d"
|
||||
inkscape:vp_x="0 : 24 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_z="48 : 24 : 1"
|
||||
inkscape:persp3d-origin="24 : 16 : 1"
|
||||
id="perspective5736-4" />
|
||||
<radialGradient
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.914812,0.01265023,-0.00821502,0.213562,2.253914,27.18889)"
|
||||
r="10.31934"
|
||||
fy="35.127438"
|
||||
fx="23.070683"
|
||||
cy="35.127438"
|
||||
cx="23.070683"
|
||||
id="radialGradient2097-2"
|
||||
xlink:href="#linearGradient4467"
|
||||
inkscape:collect="always" />
|
||||
<radialGradient
|
||||
r="15.644737"
|
||||
fy="36.421127"
|
||||
fx="24.837126"
|
||||
cy="36.421127"
|
||||
cx="24.837126"
|
||||
gradientTransform="matrix(1,0,0,0.536723,0,16.87306)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="radialGradient1503-3"
|
||||
xlink:href="#linearGradient4467"
|
||||
inkscape:collect="always" />
|
||||
<inkscape:perspective
|
||||
id="perspective2833-5"
|
||||
inkscape:persp3d-origin="32 : 21.333333 : 1"
|
||||
inkscape:vp_z="64 : 32 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 32 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<radialGradient
|
||||
gradientTransform="matrix(1.6258409,0.5434973,-8.8819886e-2,0.2656996,-215.02413,-170.90186)"
|
||||
r="19.571428"
|
||||
fy="27.256668"
|
||||
fx="342.58258"
|
||||
cy="27.256668"
|
||||
cx="342.58258"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="radialGradient2571-4"
|
||||
xlink:href="#linearGradient3864"
|
||||
inkscape:collect="always" />
|
||||
<radialGradient
|
||||
gradientTransform="translate(-0.1767767,-2.6516504)"
|
||||
r="19.571428"
|
||||
fy="15.560534"
|
||||
fx="345.28433"
|
||||
cy="15.560534"
|
||||
cx="345.28433"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="radialGradient3352-1"
|
||||
xlink:href="#linearGradient3593"
|
||||
inkscape:collect="always" />
|
||||
<radialGradient
|
||||
gradientTransform="translate(-0.1767767,-2.6516504)"
|
||||
r="19.571428"
|
||||
fy="39.962704"
|
||||
fx="330.63791"
|
||||
cy="39.962704"
|
||||
cx="330.63791"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="radialGradient3354-1"
|
||||
xlink:href="#linearGradient3593"
|
||||
inkscape:collect="always" />
|
||||
<inkscape:perspective
|
||||
id="perspective3372-5"
|
||||
inkscape:persp3d-origin="32 : 21.333333 : 1"
|
||||
inkscape:vp_z="64 : 32 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 32 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<radialGradient
|
||||
r="19.571428"
|
||||
fy="27.256668"
|
||||
fx="342.58258"
|
||||
cy="27.256668"
|
||||
cx="342.58258"
|
||||
gradientTransform="matrix(1.6258409,0.5434973,-8.8819886e-2,0.2656996,-461.81066,-173.06271)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="radialGradient3369-3"
|
||||
xlink:href="#linearGradient3864"
|
||||
inkscape:collect="always" />
|
||||
<radialGradient
|
||||
r="19.571428"
|
||||
fy="15.560534"
|
||||
fx="345.28433"
|
||||
cy="15.560534"
|
||||
cx="345.28433"
|
||||
gradientTransform="matrix(1.0012324,0,0,0.9421773,-327.50313,-4.3316646)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="radialGradient3372-9"
|
||||
xlink:href="#linearGradient3593"
|
||||
inkscape:collect="always" />
|
||||
<radialGradient
|
||||
r="19.571428"
|
||||
fy="39.962704"
|
||||
fx="330.63791"
|
||||
cy="39.962704"
|
||||
cx="330.63791"
|
||||
gradientTransform="matrix(1.0012324,0,0,0.9421773,-287.81791,-28.143054)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="radialGradient3375-2"
|
||||
xlink:href="#linearGradient3593"
|
||||
inkscape:collect="always" />
|
||||
<radialGradient
|
||||
r="19.571428"
|
||||
fy="113.23357"
|
||||
fx="320.44025"
|
||||
cy="113.23357"
|
||||
cx="320.44025"
|
||||
gradientTransform="matrix(0.9829174,1.3240854,-1.2330051,0.8105158,-131.04134,-483.74563)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="radialGradient3380-0"
|
||||
xlink:href="#linearGradient3864"
|
||||
inkscape:collect="always" />
|
||||
<radialGradient
|
||||
r="19.571428"
|
||||
fy="39.962704"
|
||||
fx="330.63791"
|
||||
cy="39.962704"
|
||||
cx="330.63791"
|
||||
gradientTransform="matrix(1.0012324,0,0,0.9421773,-287.81791,-28.143054)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="radialGradient3812-9"
|
||||
xlink:href="#linearGradient3864"
|
||||
inkscape:collect="always" />
|
||||
<radialGradient
|
||||
r="19.571428"
|
||||
fy="15.560534"
|
||||
fx="345.28433"
|
||||
cy="15.560534"
|
||||
cx="345.28433"
|
||||
gradientTransform="matrix(1.0012324,0,0,0.9421773,-327.50313,-4.3316646)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="radialGradient3814-9"
|
||||
xlink:href="#linearGradient3593"
|
||||
inkscape:collect="always" />
|
||||
<radialGradient
|
||||
r="19.571428"
|
||||
fy="113.23357"
|
||||
fx="320.44025"
|
||||
cy="113.23357"
|
||||
cx="320.44025"
|
||||
gradientTransform="matrix(0.9829174,1.3240854,-1.2330051,0.8105158,-131.04134,-483.74563)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="radialGradient3816-2"
|
||||
xlink:href="#linearGradient3864"
|
||||
inkscape:collect="always" />
|
||||
<inkscape:perspective
|
||||
id="perspective2734-9"
|
||||
inkscape:persp3d-origin="32 : 21.333333 : 1"
|
||||
inkscape:vp_z="64 : 32 : 1"
|
||||
inkscape:vp_y="0 : 1000 : 0"
|
||||
inkscape:vp_x="0 : 32 : 1"
|
||||
sodipodi:type="inkscape:persp3d" />
|
||||
<radialGradient
|
||||
r="34.345188"
|
||||
fy="672.79736"
|
||||
fx="225.26402"
|
||||
cy="672.79736"
|
||||
cx="225.26402"
|
||||
gradientTransform="matrix(1,0,0,0.6985294,0,202.82863)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="radialGradient3850-8"
|
||||
xlink:href="#linearGradient4467"
|
||||
inkscape:collect="always" />
|
||||
<radialGradient
|
||||
r="34.345188"
|
||||
fy="672.79736"
|
||||
fx="225.26402"
|
||||
cy="672.79736"
|
||||
cx="225.26402"
|
||||
gradientTransform="matrix(1,0,0,0.6985294,0,202.82863)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="radialGradient3850-4-2"
|
||||
xlink:href="#linearGradient4467"
|
||||
inkscape:collect="always" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
stroke="#3465a4"
|
||||
inkscape:window-y="23"
|
||||
inkscape:window-x="47"
|
||||
inkscape:window-height="927"
|
||||
inkscape:window-width="1633"
|
||||
inkscape:showpageshadow="true"
|
||||
inkscape:document-units="px"
|
||||
inkscape:grid-bbox="true"
|
||||
showgrid="true"
|
||||
inkscape:current-layer="layer1"
|
||||
inkscape:cy="30.888147"
|
||||
inkscape:cx="33.014148"
|
||||
inkscape:zoom="10.726351"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
borderopacity="1"
|
||||
bordercolor="#ffffff"
|
||||
pagecolor="#000000"
|
||||
id="base"
|
||||
fill="#729fcf"
|
||||
inkscape:window-maximized="0"
|
||||
borderlayer="true"
|
||||
inkscape:snap-global="true"
|
||||
inkscape:snap-bbox="true"
|
||||
inkscape:snap-bbox-midpoints="false"
|
||||
inkscape:bbox-nodes="true"
|
||||
inkscape:snap-nodes="true"
|
||||
inkscape:snap-smooth-nodes="true">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid0001"
|
||||
color="#ffffff"
|
||||
opacity="0.15686275"
|
||||
empcolor="#ffffff"
|
||||
empopacity="0.31372549"
|
||||
dotted="false"
|
||||
empspacing="8"
|
||||
spacingx="1"
|
||||
spacingy="1"
|
||||
visible="true"
|
||||
snapvisiblegridlinesonly="true" />
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid0002"
|
||||
spacingx="32"
|
||||
spacingy="32"
|
||||
empspacing="2"
|
||||
empcolor="#ffffff"
|
||||
empopacity="0.47058824"
|
||||
color="#ffffff"
|
||||
opacity="0.31372549"
|
||||
visible="true"
|
||||
enabled="true" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata4">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:creator>
|
||||
<cc:Agent>
|
||||
<dc:title>Martin Ruskov</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:creator>
|
||||
<dc:source>http://commons.wikimedia.org/wiki/Tango_icon</dc:source>
|
||||
<cc:license
|
||||
rdf:resource="http://creativecommons.org/licenses/by-sa/2.0/" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
<cc:License
|
||||
rdf:about="http://creativecommons.org/licenses/by-sa/2.0/">
|
||||
<cc:permits
|
||||
rdf:resource="http://web.resource.org/cc/Reproduction" />
|
||||
<cc:permits
|
||||
rdf:resource="http://web.resource.org/cc/Distribution" />
|
||||
<cc:requires
|
||||
rdf:resource="http://web.resource.org/cc/Notice" />
|
||||
<cc:requires
|
||||
rdf:resource="http://web.resource.org/cc/Attribution" />
|
||||
<cc:permits
|
||||
rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
|
||||
<cc:requires
|
||||
rdf:resource="http://web.resource.org/cc/ShareAlike" />
|
||||
</cc:License>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
inkscape:label="Layer 1"
|
||||
id="layer1"
|
||||
transform="translate(0,16)">
|
||||
<rect
|
||||
style="opacity:1;fill:#ffffff;fill-opacity:0.86274511;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
||||
id="rect14587"
|
||||
width="56"
|
||||
height="25"
|
||||
x="4"
|
||||
y="-12"
|
||||
rx="4" />
|
||||
<rect
|
||||
style="opacity:1;fill:#ffffff;fill-opacity:0.8627451;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
||||
id="rect14591"
|
||||
width="56"
|
||||
height="25"
|
||||
x="4"
|
||||
y="19"
|
||||
rx="4"
|
||||
ry="4" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 25 KiB |
+39
-13
@@ -103,31 +103,31 @@ Project::Project(QWidget *parent) :
|
||||
|
||||
QPushButton* toolbar_new = new QPushButton();
|
||||
toolbar_new->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/add-button.svg")));
|
||||
toolbar_new->setToolTip("New");
|
||||
toolbar_new->setToolTip(tr("New"));
|
||||
connect(toolbar_new, SIGNAL(clicked(bool)), this, SLOT(make_new_menu()));
|
||||
toolbar->addWidget(toolbar_new);
|
||||
|
||||
QPushButton* toolbar_open = new QPushButton();
|
||||
toolbar_open->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/open.svg")));
|
||||
toolbar_open->setToolTip("Open Project");
|
||||
toolbar_open->setToolTip(tr("Open Project"));
|
||||
connect(toolbar_open, SIGNAL(clicked(bool)), olive::Global.get(), SLOT(OpenProject()));
|
||||
toolbar->addWidget(toolbar_open);
|
||||
|
||||
QPushButton* toolbar_save = new QPushButton();
|
||||
toolbar_save->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/save.svg")));
|
||||
toolbar_save->setToolTip("Save Project");
|
||||
toolbar_save->setToolTip(tr("Save Project"));
|
||||
connect(toolbar_save, SIGNAL(clicked(bool)), olive::Global.get(), SLOT(save_project()));
|
||||
toolbar->addWidget(toolbar_save);
|
||||
|
||||
QPushButton* toolbar_undo = new QPushButton();
|
||||
toolbar_undo->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/undo.svg")));
|
||||
toolbar_undo->setToolTip("Undo");
|
||||
toolbar_undo->setToolTip(tr("Undo"));
|
||||
connect(toolbar_undo, SIGNAL(clicked(bool)), olive::Global.get(), SLOT(undo()));
|
||||
toolbar->addWidget(toolbar_undo);
|
||||
|
||||
QPushButton* toolbar_redo = new QPushButton();
|
||||
toolbar_redo->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/redo.svg")));
|
||||
toolbar_redo->setToolTip("Redo");
|
||||
toolbar_redo->setToolTip(tr("Redo"));
|
||||
connect(toolbar_redo, SIGNAL(clicked(bool)), olive::Global.get(), SLOT(redo()));
|
||||
toolbar->addWidget(toolbar_redo);
|
||||
|
||||
@@ -138,16 +138,22 @@ Project::Project(QWidget *parent) :
|
||||
|
||||
QPushButton* toolbar_tree_view = new QPushButton();
|
||||
toolbar_tree_view->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/treeview.svg")));
|
||||
toolbar_tree_view->setToolTip("Tree View");
|
||||
toolbar_tree_view->setToolTip(tr("Tree View"));
|
||||
connect(toolbar_tree_view, SIGNAL(clicked(bool)), this, SLOT(set_tree_view()));
|
||||
toolbar->addWidget(toolbar_tree_view);
|
||||
|
||||
QPushButton* toolbar_icon_view = new QPushButton();
|
||||
toolbar_icon_view->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/iconview.svg")));
|
||||
toolbar_icon_view->setToolTip("Icon View");
|
||||
toolbar_icon_view->setToolTip(tr("Icon View"));
|
||||
connect(toolbar_icon_view, SIGNAL(clicked(bool)), this, SLOT(set_icon_view()));
|
||||
toolbar->addWidget(toolbar_icon_view);
|
||||
|
||||
QPushButton* toolbar_list_view = new QPushButton();
|
||||
toolbar_list_view->setIcon(olive::icon::CreateIconFromSVG(QStringLiteral(":/icons/listview.svg")));
|
||||
toolbar_list_view->setToolTip(tr("List View"));
|
||||
connect(toolbar_list_view, SIGNAL(clicked(bool)), this, SLOT(set_list_view()));
|
||||
toolbar->addWidget(toolbar_list_view);
|
||||
|
||||
verticalLayout->addWidget(toolbar_widget);
|
||||
|
||||
// tree view
|
||||
@@ -180,9 +186,9 @@ Project::Project(QWidget *parent) :
|
||||
|
||||
icon_view_controls->addStretch();
|
||||
|
||||
QSlider* icon_size_slider = new QSlider(Qt::Horizontal);
|
||||
icon_size_slider = new QSlider(Qt::Horizontal);
|
||||
icon_size_slider->setMinimum(16);
|
||||
icon_size_slider->setMaximum(120);
|
||||
icon_size_slider->setMaximum(256);
|
||||
icon_view_controls->addWidget(icon_size_slider);
|
||||
connect(icon_size_slider, SIGNAL(valueChanged(int)), this, SLOT(set_icon_view_size(int)));
|
||||
|
||||
@@ -191,12 +197,12 @@ Project::Project(QWidget *parent) :
|
||||
icon_view = new SourceIconView(sources_common);
|
||||
icon_view->project_parent = this;
|
||||
icon_view->setModel(&sorter);
|
||||
icon_view->setIconSize(QSize(100, 100));
|
||||
icon_view->setGridSize(QSize(100, 100));
|
||||
icon_view->setViewMode(QListView::IconMode);
|
||||
icon_view->setUniformItemSizes(true);
|
||||
icon_view_container_layout->addWidget(icon_view);
|
||||
|
||||
icon_size_slider->setValue(icon_view->iconSize().height());
|
||||
icon_size_slider->setValue(icon_view->gridSize().height());
|
||||
|
||||
verticalLayout->addWidget(icon_view_container);
|
||||
|
||||
@@ -1322,13 +1328,22 @@ void Project::save_project(bool autorecovery) {
|
||||
|
||||
void Project::update_view_type() {
|
||||
tree_view->setVisible(olive::CurrentConfig.project_view_type == olive::PROJECT_VIEW_TREE);
|
||||
icon_view_container->setVisible(olive::CurrentConfig.project_view_type == olive::PROJECT_VIEW_ICON);
|
||||
icon_view_container->setVisible(olive::CurrentConfig.project_view_type == olive::PROJECT_VIEW_ICON
|
||||
|| olive::CurrentConfig.project_view_type == olive::PROJECT_VIEW_LIST);
|
||||
|
||||
|
||||
switch (olive::CurrentConfig.project_view_type) {
|
||||
case olive::PROJECT_VIEW_TREE:
|
||||
sources_common.view = tree_view;
|
||||
break;
|
||||
case olive::PROJECT_VIEW_ICON:
|
||||
case olive::PROJECT_VIEW_LIST:
|
||||
icon_view->setViewMode(olive::CurrentConfig.project_view_type == olive::PROJECT_VIEW_ICON ?
|
||||
QListView::IconMode : QListView::ListMode);
|
||||
|
||||
// update list/grid size since they use this value slightly differently
|
||||
set_icon_view_size(icon_size_slider->value());
|
||||
|
||||
sources_common.view = icon_view;
|
||||
break;
|
||||
}
|
||||
@@ -1339,6 +1354,12 @@ void Project::set_icon_view() {
|
||||
update_view_type();
|
||||
}
|
||||
|
||||
void Project::set_list_view()
|
||||
{
|
||||
olive::CurrentConfig.project_view_type = olive::PROJECT_VIEW_LIST;
|
||||
update_view_type();
|
||||
}
|
||||
|
||||
void Project::set_tree_view() {
|
||||
olive::CurrentConfig.project_view_type = olive::PROJECT_VIEW_TREE;
|
||||
update_view_type();
|
||||
@@ -1367,7 +1388,12 @@ void Project::clear_recent_projects() {
|
||||
}
|
||||
|
||||
void Project::set_icon_view_size(int s) {
|
||||
icon_view->setIconSize(QSize(s, s));
|
||||
if (icon_view->viewMode() == QListView::IconMode) {
|
||||
icon_view->setGridSize(QSize(s, s));
|
||||
} else {
|
||||
icon_view->setGridSize(QSize());
|
||||
icon_view->setIconSize(QSize(s, s));
|
||||
}
|
||||
}
|
||||
|
||||
void Project::set_up_dir_enabled() {
|
||||
|
||||
@@ -112,6 +112,7 @@ private:
|
||||
QString get_file_name_from_path(const QString &path);
|
||||
QDir proj_dir;
|
||||
QWidget* icon_view_container;
|
||||
QSlider* icon_size_slider;
|
||||
QPushButton* directory_up;
|
||||
QLineEdit* toolbar_search;
|
||||
|
||||
@@ -124,6 +125,7 @@ private:
|
||||
private slots:
|
||||
void update_view_type();
|
||||
void set_icon_view();
|
||||
void set_list_view();
|
||||
void set_tree_view();
|
||||
void clear_recent_projects();
|
||||
void set_icon_view_size(int);
|
||||
|
||||
@@ -77,17 +77,3 @@ FootageStream* Footage::get_stream_from_file_index(bool video, int index) {
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void FootageStream::make_square_thumb() {
|
||||
// generate square version for QListView?
|
||||
int square_size = qMax(video_preview.width(), video_preview.height());
|
||||
QPixmap pixmap(square_size, square_size);
|
||||
pixmap.fill(Qt::transparent);
|
||||
QPainter p(&pixmap);
|
||||
int diff = (video_preview.width() - video_preview.height())>>1;
|
||||
int sqx = (diff < 0) ? -diff : 0;
|
||||
int sqy = (diff > 0) ? diff : 0;
|
||||
p.drawImage(sqx, sqy, video_preview);
|
||||
p.end();
|
||||
video_preview_square = QIcon(pixmap);
|
||||
}
|
||||
|
||||
@@ -62,9 +62,7 @@ struct FootageStream {
|
||||
// preview thumbnail/waveform
|
||||
bool preview_done;
|
||||
QImage video_preview;
|
||||
QIcon video_preview_square;
|
||||
QVector<char> audio_preview;
|
||||
void make_square_thumb();
|
||||
};
|
||||
|
||||
struct Footage {
|
||||
|
||||
+24
-15
@@ -284,6 +284,24 @@ int Media::columnCount() const {
|
||||
return 3;
|
||||
}
|
||||
|
||||
QString Media::GetStringDuration() {
|
||||
if (get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||
Sequence* s = to_sequence().get();
|
||||
return frame_to_timecode(s->getEndFrame(), olive::CurrentConfig.timecode_view, s->frame_rate);
|
||||
}
|
||||
if (get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
Footage* f = to_footage();
|
||||
double r = 30;
|
||||
|
||||
if (f->video_tracks.size() > 0 && !qIsNull(f->video_tracks.at(0).video_frame_rate))
|
||||
r = f->video_tracks.at(0).video_frame_rate * f->speed;
|
||||
|
||||
long len = f->get_length_in_frames(r);
|
||||
if (len > 0) return frame_to_timecode(len, olive::CurrentConfig.timecode_view, r);
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
QVariant Media::data(int column, int role) {
|
||||
switch (role) {
|
||||
case Qt::DecorationRole:
|
||||
@@ -292,7 +310,7 @@ QVariant Media::data(int column, int role) {
|
||||
Footage* f = to_footage();
|
||||
if (f->video_tracks.size() > 0
|
||||
&& f->video_tracks.at(0).preview_done) {
|
||||
return f->video_tracks.at(0).video_preview_square;
|
||||
return QIcon(QPixmap::fromImage(f->video_tracks.at(0).video_preview));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,20 +322,7 @@ QVariant Media::data(int column, int role) {
|
||||
case 0: return (root) ? QCoreApplication::translate("Media", "Name") : get_name();
|
||||
case 1:
|
||||
if (root) return QCoreApplication::translate("Media", "Duration");
|
||||
if (get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||
Sequence* s = to_sequence().get();
|
||||
return frame_to_timecode(s->getEndFrame(), olive::CurrentConfig.timecode_view, s->frame_rate);
|
||||
}
|
||||
if (get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
Footage* f = to_footage();
|
||||
double r = 30;
|
||||
|
||||
if (f->video_tracks.size() > 0 && !qIsNull(f->video_tracks.at(0).video_frame_rate))
|
||||
r = f->video_tracks.at(0).video_frame_rate * f->speed;
|
||||
|
||||
long len = f->get_length_in_frames(r);
|
||||
if (len > 0) return frame_to_timecode(len, olive::CurrentConfig.timecode_view, r);
|
||||
}
|
||||
return GetStringDuration();
|
||||
break;
|
||||
case 2:
|
||||
if (root) return QCoreApplication::translate("Media", "Rate");
|
||||
@@ -336,6 +341,10 @@ QVariant Media::data(int column, int role) {
|
||||
break;
|
||||
case Qt::ToolTipRole:
|
||||
return tooltip;
|
||||
|
||||
case Qt::UserRole:
|
||||
// User role returns the duration
|
||||
return GetStringDuration();
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
@@ -87,6 +87,8 @@ private:
|
||||
int type;
|
||||
VoidPtr object;
|
||||
|
||||
QString GetStringDuration();
|
||||
|
||||
// item functions
|
||||
QList<MediaPtr> children;
|
||||
Media* parent;
|
||||
|
||||
@@ -153,8 +153,6 @@ bool PreviewGenerator::retrieve_preview(const QString& hash) {
|
||||
QString thumb_path = get_thumbnail_path(hash, ms);
|
||||
QFile f(thumb_path);
|
||||
if (f.exists() && ms.video_preview.load(thumb_path)) {
|
||||
//dout << "loaded thumb" << ms->file_index << "from" << thumb_path;
|
||||
ms.make_square_thumb();
|
||||
ms.preview_done = true;
|
||||
} else {
|
||||
found = false;
|
||||
@@ -364,8 +362,6 @@ void PreviewGenerator::generate_waveform() {
|
||||
&data,
|
||||
linesize);
|
||||
|
||||
s->make_square_thumb();
|
||||
|
||||
// is video interlaced?
|
||||
s->video_auto_interlacing = (temp_frame->interlaced_frame) ? ((temp_frame->top_field_first) ? VIDEO_TOP_FIELD_FIRST : VIDEO_BOTTOM_FIELD_FIRST) : VIDEO_PROGRESSIVE;
|
||||
s->video_interlacing = s->video_auto_interlacing;
|
||||
|
||||
@@ -46,6 +46,8 @@ public:
|
||||
void dropEvent(QWidget *parent, QDropEvent* e, const QModelIndex& drop_item, const QModelIndexList &items);
|
||||
|
||||
void item_click(Media* m, const QModelIndex &index);
|
||||
public slots:
|
||||
void stop_rename_timer();
|
||||
private slots:
|
||||
void create_seq_from_selected();
|
||||
void reveal_in_browser();
|
||||
@@ -62,7 +64,6 @@ private:
|
||||
QModelIndex editing_index;
|
||||
QModelIndexList selected_items;
|
||||
Project* project_parent;
|
||||
void stop_rename_timer();
|
||||
QTimer rename_timer;
|
||||
|
||||
// we cache the selected footage items for open_create_proxy_dialog()
|
||||
|
||||
@@ -21,18 +21,22 @@
|
||||
#include "sourceiconview.h"
|
||||
|
||||
#include <QMimeData>
|
||||
#include <QImage>
|
||||
|
||||
#include "panels/project.h"
|
||||
#include "project/media.h"
|
||||
#include "project/sourcescommon.h"
|
||||
#include "global/debug.h"
|
||||
#include "global/math.h"
|
||||
|
||||
SourceIconView::SourceIconView(SourcesCommon &commons) :
|
||||
commons_(commons)
|
||||
{
|
||||
setMovement(QListView::Free);
|
||||
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
setResizeMode(QListView::Adjust);
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
setItemDelegate(&delegate_);
|
||||
connect(this, SIGNAL(clicked(const QModelIndex&)), this, SLOT(item_click(const QModelIndex&)));
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu()));
|
||||
}
|
||||
@@ -88,3 +92,124 @@ void SourceIconView::mouseDoubleClickEvent(QMouseEvent *) {
|
||||
// Double click was not a folder, so we perform the default behavior (sending the double click to SourcesCommon)
|
||||
commons_.mouseDoubleClickEvent(selectedIndexes());
|
||||
}
|
||||
|
||||
SourceIconDelegate::SourceIconDelegate(QObject *parent) :
|
||||
QStyledItemDelegate (parent)
|
||||
{
|
||||
}
|
||||
|
||||
QSize SourceIconDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
if (option.decorationPosition == QStyleOptionViewItem::Top) { // Icon Mode
|
||||
|
||||
return QSize(256, 256);
|
||||
|
||||
} else {
|
||||
|
||||
return QSize(option.decorationSize.height(), option.decorationSize.height());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void SourceIconDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
QFontMetrics fm = painter->fontMetrics();
|
||||
QRect img_rect = option.rect;
|
||||
|
||||
if (option.decorationPosition == QStyleOptionViewItem::Top) { // Icon Mode
|
||||
|
||||
// Draw Text
|
||||
if (fm.height() < option.rect.height() / 2) {
|
||||
img_rect.setHeight(img_rect.height()-fm.height());
|
||||
|
||||
QRect text_rect = option.rect;
|
||||
text_rect.setTop(text_rect.top() + option.rect.height() - fm.height());
|
||||
|
||||
QColor text_bgcolor;
|
||||
QColor text_fgcolor;
|
||||
|
||||
if (option.state & QStyle::State_Selected) {
|
||||
text_bgcolor = option.palette.highlight().color();
|
||||
text_fgcolor = option.palette.highlightedText().color();
|
||||
} else {
|
||||
text_bgcolor = Qt::white;
|
||||
text_fgcolor = Qt::black;
|
||||
}
|
||||
|
||||
painter->fillRect(text_rect, text_bgcolor);
|
||||
painter->setPen(text_fgcolor);
|
||||
|
||||
QString duration_str = index.data(Qt::UserRole).toString();
|
||||
int timecode_width = fm.width(duration_str);
|
||||
int max_name_width = option.rect.width();
|
||||
|
||||
if (timecode_width < option.rect.width() / 2) {
|
||||
painter->drawText(text_rect, Qt::AlignBottom | Qt::AlignRight, index.data(Qt::UserRole).toString());
|
||||
max_name_width -= timecode_width;
|
||||
}
|
||||
|
||||
painter->drawText(text_rect,
|
||||
Qt::AlignBottom | Qt::AlignLeft,
|
||||
fm.elidedText(index.data(Qt::DisplayRole).toString(), Qt::ElideRight, max_name_width));
|
||||
|
||||
}
|
||||
|
||||
// Draw image
|
||||
QIcon ico = index.data(Qt::DecorationRole).value<QIcon>();
|
||||
QSize icon_size = ico.actualSize(img_rect.size());
|
||||
img_rect = QRect(img_rect.x() + (img_rect.width() / 2 - icon_size.width() / 2),
|
||||
img_rect.y() + (img_rect.height() / 2 - icon_size.height() / 2),
|
||||
icon_size.width(),
|
||||
icon_size.height());
|
||||
painter->drawPixmap(img_rect, ico.pixmap(icon_size));
|
||||
|
||||
if (option.state & QStyle::State_Selected) {
|
||||
QColor highlight_color = option.palette.highlight().color();
|
||||
highlight_color.setAlphaF(0.5);
|
||||
|
||||
painter->setCompositionMode(QPainter::CompositionMode_SourceAtop);
|
||||
painter->fillRect(img_rect, highlight_color);
|
||||
}
|
||||
} else if (option.decorationPosition == QStyleOptionViewItem::Left) { // List Mode
|
||||
|
||||
if (option.state & QStyle::State_Selected) {
|
||||
painter->fillRect(option.rect, option.palette.highlight());
|
||||
}
|
||||
|
||||
img_rect.setWidth(qMin(img_rect.width(), img_rect.height()));
|
||||
|
||||
QIcon ico = index.data(Qt::DecorationRole).value<QIcon>();
|
||||
QSize icon_size = ico.actualSize(img_rect.size());
|
||||
img_rect = QRect(img_rect.x() + (img_rect.width() / 2 - icon_size.width() / 2),
|
||||
img_rect.y() + (img_rect.height() / 2 - icon_size.height() / 2),
|
||||
icon_size.width(),
|
||||
icon_size.height());
|
||||
painter->drawPixmap(img_rect, ico.pixmap(icon_size));
|
||||
|
||||
QRect text_rect = option.rect;
|
||||
text_rect.setLeft(text_rect.left() + option.rect.height());
|
||||
|
||||
int maximum_line_count = qMax(1, option.rect.height() / fm.height() - 1);
|
||||
QString text;
|
||||
if (maximum_line_count == 1) {
|
||||
text = index.data(Qt::DisplayRole).toString();
|
||||
} else {
|
||||
text = index.data(Qt::ToolTipRole).toString();
|
||||
if (text.isEmpty()) {
|
||||
text = index.data(Qt::DisplayRole).toString();
|
||||
} else {
|
||||
QStringList strings = text.split("\n");
|
||||
while (strings.size() > maximum_line_count) {
|
||||
strings.removeLast();
|
||||
}
|
||||
text = strings.join("\n");
|
||||
}
|
||||
}
|
||||
|
||||
painter->setPen(option.state & QStyle::State_Selected ?
|
||||
option.palette.highlightedText().color() : option.palette.text().color());
|
||||
|
||||
painter->drawText(text_rect, Qt::AlignLeft | Qt::AlignVCenter, text);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,10 +23,19 @@
|
||||
|
||||
#include <QListView>
|
||||
#include <QDropEvent>
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
#include "project/sourcescommon.h"
|
||||
|
||||
class Project;
|
||||
class SourceIconDelegate;
|
||||
|
||||
class SourceIconDelegate : public QStyledItemDelegate {
|
||||
public:
|
||||
SourceIconDelegate(QObject *parent = nullptr);
|
||||
virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
};
|
||||
|
||||
class SourceIconView : public QListView {
|
||||
Q_OBJECT
|
||||
@@ -46,6 +55,7 @@ private slots:
|
||||
void item_click(const QModelIndex& index);
|
||||
private:
|
||||
SourcesCommon& commons_;
|
||||
SourceIconDelegate delegate_;
|
||||
};
|
||||
|
||||
#endif // SOURCEICONVIEW_H
|
||||
|
||||
Reference in New Issue
Block a user