Make the video recording button an icon

This commit is contained in:
Martijn Braam
2024-07-15 18:03:35 +02:00
parent 8b525210bc
commit ccf0314b62
8 changed files with 296 additions and 7 deletions

View File

@@ -80,7 +80,7 @@ add_custom_target(
)
file(GLOB srcs src/*.c src/*h)
add_executable(megapixels-gtk ${srcs} ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C} src/state.h)
add_executable(megapixels-gtk ${srcs} medianame.h ${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C} src/state.h)
set_source_files_properties(
${CMAKE_CURRENT_BINARY_DIR}/${GRESOURCE_C}
PROPERTIES GENERATED TRUE

View File

@@ -231,8 +231,8 @@
<child>
<object class="GtkButton" id="movie">
<property name="valign">start</property>
<property name="label">Rec</property>
</object>
<property name="icon-name">video-inactive-symbolic</property>
</object>
</child>
<child>
<object class="GtkButton">

View File

@@ -11,6 +11,9 @@
<file preprocess="xml-stripblanks">shutter-button-symbolic.svg</file>
<file preprocess="xml-stripblanks">shutter-symbolic.svg</file>
<file preprocess="xml-stripblanks">switch-camera-symbolic.svg</file>
<file preprocess="xml-stripblanks">video-inactive-symbolic.svg</file>
<file preprocess="xml-stripblanks">video-recording-symbolic.svg</file>
<file preprocess="xml-stripblanks">video-processing-symbolic.svg</file>
<file>blit.vert</file>
<file>blit.frag</file>
<file>solid.vert</file>

View File

@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="24"
height="24"
viewBox="0 0 6.3499999 6.3500002"
version="1.1"
id="svg8"
sodipodi:docname="video-inactive-symbolic.svg"
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
showgrid="true"
inkscape:zoom="26.767158"
inkscape:cx="22.434209"
inkscape:cy="6.3697462"
inkscape:window-width="2560"
inkscape:window-height="1403"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="layer1">
<inkscape:grid
id="grid1"
units="px"
originx="0"
originy="0"
spacingx="0.26458333"
spacingy="0.26458334"
empcolor="#3f3fff"
empopacity="0.25098039"
color="#3f3fff"
opacity="0.1254902"
empspacing="5"
dotted="false"
gridanglex="30"
gridanglez="30"
visible="true" />
</sodipodi:namedview>
<defs
id="defs2" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1">
<path
id="path1"
style="fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:0.334591px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 1.0428823,1.812686 0.70829048,2.1472779 V 3.1811147 A 1.3570675,1.3570675 0 0 1 1.0239308,3.1405977 1.3570675,1.3570675 0 0 1 2.3812499,4.4979168 1.3570675,1.3570675 0 0 1 2.3387725,4.8240133 H 5.0579847 L 5.3925775,4.4894214 V 3.8202375 l 0.669183,0.6691839 V 2.1472779 L 5.3925775,2.8164618 V 2.1472779 L 5.0481828,1.812686 Z" />
<circle
style="fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:0.334591"
id="path2"
cx="1.0241821"
cy="4.4977627"
r="0.98507524" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:2.11259px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:0.0528147"
x="1.3654528"
y="1.7729727"
id="text2"><tspan
sodipodi:role="line"
id="tspan2"
style="fill:#bebebe;stroke-width:0.0528147;fill-opacity:1"
x="1.3654528"
y="1.7729727">VID</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="24"
height="24"
viewBox="0 0 6.3499999 6.3500002"
version="1.1"
id="svg8"
sodipodi:docname="video-processing-symbolic.svg"
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
showgrid="true"
inkscape:zoom="26.767158"
inkscape:cx="22.434209"
inkscape:cy="6.3697462"
inkscape:window-width="2560"
inkscape:window-height="1403"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="layer1">
<inkscape:grid
id="grid1"
units="px"
originx="0"
originy="0"
spacingx="0.26458333"
spacingy="0.26458334"
empcolor="#3f3fff"
empopacity="0.25098039"
color="#3f3fff"
opacity="0.1254902"
empspacing="5"
dotted="false"
gridanglex="30"
gridanglez="30"
visible="true" />
</sodipodi:namedview>
<defs
id="defs2" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1">
<path
id="path1"
style="fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:0.334591px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 1.0428823,1.812686 0.70829048,2.1472779 V 3.1811147 A 1.3570675,1.3570675 0 0 1 1.0239308,3.1405977 1.3570675,1.3570675 0 0 1 2.3812499,4.4979168 1.3570675,1.3570675 0 0 1 2.3387725,4.8240133 H 5.0579847 L 5.3925775,4.4894214 V 3.8202375 l 0.669183,0.6691839 V 2.1472779 L 5.3925775,2.8164618 V 2.1472779 L 5.0481828,1.812686 Z" />
<circle
style="fill:#7dc3ff;fill-opacity:1;stroke:none;stroke-width:0.334591"
id="path2"
cx="1.0241821"
cy="4.4977627"
r="0.98507524" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:2.11259px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:0.0528147"
x="1.3654528"
y="1.7729727"
id="text2"><tspan
sodipodi:role="line"
id="tspan2"
style="fill:#bebebe;fill-opacity:1;stroke-width:0.0528147"
x="1.3654528"
y="1.7729727">BZY</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="24"
height="24"
viewBox="0 0 6.3499999 6.3500002"
version="1.1"
id="svg8"
sodipodi:docname="video-recording-symbolic.svg"
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
showgrid="true"
inkscape:zoom="26.767158"
inkscape:cx="22.434209"
inkscape:cy="6.3697462"
inkscape:window-width="2560"
inkscape:window-height="1403"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="layer1">
<inkscape:grid
id="grid1"
units="px"
originx="0"
originy="0"
spacingx="0.26458333"
spacingy="0.26458334"
empcolor="#3f3fff"
empopacity="0.25098039"
color="#3f3fff"
opacity="0.1254902"
empspacing="5"
dotted="false"
gridanglex="30"
gridanglez="30"
visible="true" />
</sodipodi:namedview>
<defs
id="defs2" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1">
<path
id="path1"
style="fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:0.334591px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 1.0428823,1.812686 0.70829048,2.1472779 V 3.1811147 A 1.3570675,1.3570675 0 0 1 1.0239308,3.1405977 1.3570675,1.3570675 0 0 1 2.3812499,4.4979168 1.3570675,1.3570675 0 0 1 2.3387725,4.8240133 H 5.0579847 L 5.3925775,4.4894214 V 3.8202375 l 0.669183,0.6691839 V 2.1472779 L 5.3925775,2.8164618 V 2.1472779 L 5.0481828,1.812686 Z" />
<circle
style="fill:#cc0000;fill-opacity:1;stroke:none;stroke-width:0.334591"
id="path2"
cx="1.0241821"
cy="4.4977627"
r="0.98507524" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:2.11259px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#cc0000;fill-opacity:1;stroke:none;stroke-width:0.0528147"
x="1.2361219"
y="1.7604016"
id="text2"><tspan
sodipodi:role="line"
id="tspan2"
style="fill:#cc0000;stroke-width:0.0528147"
x="1.2361219"
y="1.7604016">REC</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -937,8 +937,10 @@ flash_button_clicked(GtkWidget *button, gpointer user_data)
void
notify_movie_progress(void)
{
if (!movie_start)
gtk_button_set_label(GTK_BUTTON(movie), "Rec");
if (!movie_start) {
// Recording started
gtk_button_set_icon_name(GTK_BUTTON(movie), "video-recording-symbolic");
}
}
void
@@ -952,11 +954,11 @@ on_movie_clicked(GtkWidget *widget, gpointer user_data)
{
if (movie_start) {
movie_start = 0;
gtk_button_set_label(GTK_BUTTON(movie), "Busy");
gtk_button_set_icon_name(GTK_BUTTON(movie), "video-processing-symbolic");
on_movie_stop();
} else {
movie_start = 1;
gtk_button_set_label(GTK_BUTTON(movie), "Stop");
gtk_button_set_icon_name(GTK_BUTTON(movie), "video-recording-symbolic");
on_movie_start();
}
}

14
src/medianame.h Normal file
View File

@@ -0,0 +1,14 @@
#include <sys/time.h>
static inline unsigned long long time_usec(void)
{
struct timeval t;
gettimeofday(&t, NULL);
return t.tv_sec * 1000000 + t.tv_usec;
}
static inline void get_name(char *buf, char *dir, char *templ)
{
sprintf(buf, "%s/%lld.%s", dir, time_usec(), templ);
}