[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog.spec
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,6 +2,6 @@
<service name="tar_git">
<param name="url">https://github.com/monich/harbour-mmslog.git</param>
<param name="branch">master</param>
- <param name="revision">c07e27d</param>
+ <param name="revision">ce14d48</param>
</service>
</services>
\ No newline at end of file
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/harbour-mmslog.pro
^
|
@@ -70,11 +70,13 @@
HEADERS += \
$${HARBOUR_LIB_INCLUDE}/HarbourDebug.h \
$${HARBOUR_LIB_INCLUDE}/HarbourSigChildHandler.h \
+ $${HARBOUR_LIB_INCLUDE}/HarbourSystemInfo.h \
$${HARBOUR_LIB_INCLUDE}/HarbourTransferMethodInfo.h \
$${HARBOUR_LIB_INCLUDE}/HarbourTransferMethodsModel.h
SOURCES += \
$${HARBOUR_LIB_SRC}/HarbourSigChildHandler.cpp \
+ $${HARBOUR_LIB_SRC}/HarbourSystemInfo.cpp \
$${HARBOUR_LIB_SRC}/HarbourTransferMethodInfo.cpp \
$${HARBOUR_LIB_SRC}/HarbourTransferMethodsModel.cpp
@@ -109,6 +111,7 @@
qml/main.qml \
qml/cover/*.qml \
qml/pages/*.qml \
+ qml/pages/images/*.svg \
settings/*.qml \
settings/harbour-$${NAME}.json \
icons/*.svg \
@@ -142,7 +145,7 @@
GENERATED_SOURCES += $${DBUSLOGGER_C}
# Icons
-ICON_SIZES = 86 108 128 256
+ICON_SIZES = 86 108 128 172 256
for(s, ICON_SIZES) {
icon_target = icon$${s}
icon_dir = icons/$${s}x$${s}
@@ -157,6 +160,7 @@
# harbour-lib QML components
HARBOUR_QML_COMPONENTS = \
+ $${HARBOUR_LIB_QML}/HarbourHighlightIcon.qml \
$${HARBOUR_LIB_QML}/HarbourShareMethodList.qml
qml_components.files = $${HARBOUR_QML_COMPONENTS}
@@ -195,11 +199,13 @@
ofonomanager.source_flags = -N -c OrgOfonoManager
# Translations
+TRANSLATION_IDBASED=-idbased
TRANSLATION_SOURCES = \
$${_PRO_FILE_PWD_}/qml \
$${_PRO_FILE_PWD_}/settings
-TRANSLATION_FILES = $${NAME} \
+TRANSLATION_FILES = \
+ $${NAME} \
$${NAME}-nl \
$${NAME}-ru \
$${NAME}-sv
@@ -210,21 +216,17 @@
out = $${OUT_PWD}/translations/$${PREFIX}-$${t}
lupdate_target = lupdate_$$suffix
- lrelease_target = lrelease_$$suffix
-
- $${lupdate_target}.commands = lupdate -noobsolete $${TRANSLATION_SOURCES} -ts \"$${in}.ts\" && \
+ $${lupdate_target}.commands = lupdate -noobsolete -locations none $${TRANSLATION_SOURCES} -ts \"$${in}.ts\" && \
mkdir -p \"$${OUT_PWD}/translations\" && [ \"$${in}.ts\" != \"$${out}.ts\" ] && \
cp -af \"$${in}.ts\" \"$${out}.ts\" || :
- $${lrelease_target}.target = $${out}.qm
- $${lrelease_target}.depends = $${lupdate_target}
- $${lrelease_target}.commands = lrelease -idbased \"$${out}.ts\"
-
- QMAKE_EXTRA_TARGETS += $${lrelease_target} $${lupdate_target}
- PRE_TARGETDEPS += $${out}.qm
- qm.files += $${out}.qm
+ qm_target = qm_$$suffix
+ $${qm_target}.path = $$TRANSLATIONS_PATH
+ $${qm_target}.depends = $${lupdate_target}
+ $${qm_target}.commands = lrelease $$TRANSLATION_IDBASED \"$${out}.ts\" && \
+ $(INSTALL_FILE) \"$${out}.qm\" $(INSTALL_ROOT)$${TRANSLATIONS_PATH}/
+
+ QMAKE_EXTRA_TARGETS += $${lupdate_target} $${qm_target}
+ INSTALLS += $${qm_target}
+ OTHER_FILES += $${in}.ts
}
-
-qm.path = $$TRANSLATIONS_PATH
-qm.CONFIG += no_check_exist
-INSTALLS += qm
|
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/icons/108x108/harbour-mmslog.png
^
|
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/icons/128x128/harbour-mmslog.png
^
|
|
Added |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/icons/172x172/harbour-mmslog.png
^
|
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/icons/256x256/harbour-mmslog.png
^
|
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/icons/86x86/harbour-mmslog.png
^
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/icons/harbour-mmslog.svg
^
|
@@ -1,10 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Generator: Adobe Illustrator 17.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
-
<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:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
@@ -17,98 +12,67 @@
viewBox="0 0 86 86"
enable-background="new 0 0 86 86"
xml:space="preserve"
- id="svg7194"
- inkscape:version="0.48.2 r9819"
+ inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"
sodipodi:docname="harbour-mmslog.svg"
inkscape:export-filename="harbour-mmslog.png"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90"><metadata
- id="metadata7221"><rdf:RDF><cc:Work
- rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
- id="defs7219" /><sodipodi:namedview
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1"
- objecttolerance="10"
- gridtolerance="10"
- guidetolerance="10"
- inkscape:pageopacity="0"
- inkscape:pageshadow="2"
- inkscape:window-width="1245"
- inkscape:window-height="990"
- id="namedview7217"
- showgrid="true"
- inkscape:snap-grids="true"
- inkscape:zoom="5.6568543"
- inkscape:cx="65.024212"
- inkscape:cy="25.276657"
- inkscape:window-x="1561"
- inkscape:window-y="83"
- inkscape:window-maximized="0"
- inkscape:current-layer="svg7194"><inkscape:grid
- type="xygrid"
- id="grid7958"
- empspacing="5"
- visible="true"
- enabled="true"
- snapvisiblegridlinesonly="true" /></sodipodi:namedview>
-<g
- id="Layer_2"
- display="none">
-</g>
-<g
- id="Layer_1">
- <linearGradient
- id="SVGID_1_"
- gradientUnits="userSpaceOnUse"
- x1="12.8062"
- y1="12.8066"
- x2="85.2829"
- y2="85.2833">
- <stop
- offset="0.0049"
- style="stop-color:#08C0CC"
- id="stop7199" />
- <stop
- offset="1"
- style="stop-color:#1C8C79"
- id="stop7201" />
- </linearGradient>
- <path
- d="M85.699,43c0-23.582-19.117-42.7-42.7-42.7C19.417,0.3,0.3,19.418,0.3,43 c0,23.583,19.117,42.7,42.7,42.7c0.636,0,41.277,0,41.277,0c0.786,0,1.423-0.637,1.423-1.423C85.7,84.277,85.699,43.636,85.699,43z "
- id="path7203"
- fill="url(#SVGID_1_)" />
- <g
- id="g7205">
- </g>
-</g>
-<path
- sodipodi:type="arc"
- style="fill:#97fff8;fill-opacity:1;fill-rule:nonzero;stroke:none"
- id="path8470"
- sodipodi:cx="120"
- sodipodi:cy="44.885593"
- sodipodi:rx="20"
- sodipodi:ry="18.885593"
- d="m 140,44.885593 a 20,18.885593 0 1 1 -40,0 20,18.885593 0 1 1 40,0 z"
- transform="matrix(1.1457627,0,0,1.1913843,-94.491524,-10.475991)" /><g
- id="Zoom__x2B_"
- transform="matrix(2.997423,0,0,3.1000509,33.42846,23.850079)"><g
- id="g4"><path
- inkscape:connector-curvature="0"
- style="fill-rule:evenodd"
- d="m 14.368652,15.067469 -3.792495,-3.659847 c 1.039687,-1.4383406 1.654048,-3.1833581 1.654048,-5.0690415 0,-4.8992286 -4.1141153,-8.8708225 -9.189153,-8.8708225 -5.0750379,0 -9.189153,3.9715939 -9.189153,8.8708225 0,4.8992285 4.1141151,8.8708215 9.189153,8.8708215 1.9533514,0 3.7609888,-0.593078 5.2509443,-1.596748 l 3.7911817,3.659848 c 0.631427,0.609552 1.654048,0.609552 2.285474,0 0.631426,-0.609553 0.630114,-1.595481 0,-2.205033 z m -11.3276,-2.392587 c -3.6244645,0 -6.5636807,-2.8373957 -6.5636807,-6.3363015 0,-3.498906 2.9392162,-6.33630181 6.5636807,-6.33630181 3.6244643,0 6.5636809,2.83739581 6.5636809,6.33630181 0,3.4989058 -2.9392166,6.3363015 -6.5636809,6.3363015 z"
- id="path6"
- sodipodi:nodetypes="ccsssscsscsssss" /></g></g><g
- style="font-size:14px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#7e3659;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans Bold"
- id="text9373"><path
- d="m 27.492676,48.007324 0,-10.021484 3.02832,0 1.818359,6.835937 1.797852,-6.835937 3.035156,0 0,10.021484 -1.879883,0 0,-7.888672 -1.989257,7.888672 -1.948243,0 -1.982421,-7.888672 0,7.888672 z"
- style=""
- id="path9378" /><path
- d="m 39.168457,48.007324 0,-10.021484 3.02832,0 1.81836,6.835937 1.797851,-6.835937 3.035157,0 0,10.021484 -1.879883,0 0,-7.888672 -1.989258,7.888672 -1.948242,0 -1.982422,-7.888672 0,7.888672 z"
- style=""
- id="path9380" /><path
- d="m 50.358887,44.746582 1.96875,-0.191406 c 0.118487,0.66081 0.358884,1.146161 0.721191,1.456054 0.362301,0.309898 0.85107,0.464846 1.466309,0.464844 0.651687,2e-6 1.142735,-0.137856 1.473144,-0.413574 0.330397,-0.275714 0.495599,-0.598142 0.495606,-0.967285 -7e-6,-0.236976 -0.06951,-0.438636 -0.208496,-0.604981 -0.139004,-0.166337 -0.38168,-0.311031 -0.728028,-0.434082 -0.236984,-0.08203 -0.777023,-0.22786 -1.620117,-0.4375 -1.084638,-0.268875 -1.845705,-0.599279 -2.283203,-0.991211 -0.615236,-0.551426 -0.922852,-1.223626 -0.922852,-2.016601 0,-0.510409 0.144693,-0.987785 0.434082,-1.432129 0.289387,-0.444327 0.706379,-0.782705 1.250977,-1.015137 0.544593,-0.232412 1.201982,-0.348622 1.972168,-0.348633 1.257807,1.1e-5 2.204583,0.275726 2.840332,0.827149 0.635734,0.551441 0.969555,1.287443 1.001465,2.208008 l -2.023438,0.08887 c -0.08659,-0.514967 -0.272304,-0.885246 -0.557129,-1.11084 -0.284836,-0.225578 -0.712081,-0.33837 -1.281738,-0.338379 -0.587894,9e-6 -1.04818,0.120777 -1.380859,0.362305 -0.214196,0.154956 -0.321292,0.362312 -0.321289,0.62207 -3e-6,0.236987 0.100257,0.439786 0.300781,0.608399 0.255205,0.214199 0.874996,0.437506 1.859375,0.669921 0.984369,0.232428 1.712396,0.472825 2.184082,0.721192 0.471672,0.248377 0.840812,0.587895 1.107422,1.018554 0.266593,0.430669 0.399894,0.962732 0.399902,1.596192 -8e-6,0.574221 -0.159513,1.111981 -0.478515,1.613281 -0.319019,0.501303 -0.77019,0.873861 -1.353516,1.117676 -0.58334,0.243815 -1.310227,0.365722 -2.180664,0.365723 -1.266931,-1e-6 -2.239911,-0.292806 -2.918945,-0.878418 -0.679038,-0.585611 -1.084636,-1.438963 -1.216797,-2.560059 z"
- style=""
- id="path9382" /></g></svg>
+ inkscape:export-xdpi="96"
+ inkscape:export-ydpi="96">
+ <linearGradient
+ id="SVGID_1_"
+ gradientUnits="userSpaceOnUse"
+ x1="12.8062"
+ y1="12.8066"
+ x2="85.2829"
+ y2="85.2833">
+ <stop
+ offset="0.0049"
+ style="stop-color:#08C0CC"/>
+ <stop
+ offset="1"
+ style="stop-color:#1C8C79"/>
+ </linearGradient>
+ <path
+ d="M85.699,43c0-23.582-19.117-42.7-42.7-42.7C19.417,0.3,0.3,19.418,0.3,43 c0,23.583,19.117,42.7,42.7,42.7c0.636,0,41.277,0,41.277,0c0.786,0,1.423-0.637,1.423-1.423C85.7,84.277,85.699,43.636,85.699,43z "
+ fill="url(#SVGID_1_)"/>
+ <circle
+ style="opacity:0.5;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.66950643;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+ cx="42"
+ cy="42"
+ r="35"/>
+ <g
+ transform="matrix(2.997423,0,0,3.1000509,60.672469,0.81563373)">
+ <path
+ inkscape:connector-curvature="0"
+ style="fill-rule:evenodd;stroke-width:4.05610228"
+ d="M 42.927734,6.5332031 C 22.674003,6.5332028 6.2558594,22.906844 6.2558594,43.103516 c 0,20.19667 16.4181456,36.568359 36.6718746,36.568359 7.795536,0 15.010839,-2.444483 20.957032,-6.582031 L 70.6875,79.875 c 2.512359,2.468735 5.770375,2.020405 8.099609,-0.273438 2.845634,-2.802374 3.310983,-6.309409 0.980469,-8.855468 L 73,64 c 4.149237,-5.929446 6.601563,-13.122911 6.601562,-20.896484 0,-20.196671 -16.420099,-36.5703132 -36.673828,-36.5703129 z M 43,13 A 30,30 0 0 1 73,43 30,30 0 0 1 43,73 30,30 0 0 1 13,43 30,30 0 0 1 43,13 Z"
+ transform="matrix(0.33361991,0,0,0.32257535,-20.493757,-0.59678988)"/>
+ </g>
+ <g
+ transform="matrix(0.07142857,0,0,0.07146503,23.285715,4.4452808)"
+ style="opacity:1;fill:#7e3659;fill-opacity:1">
+ <g
+ style="fill:#7e3659;fill-opacity:1">
+ <path
+ d="m 569.99999,616.46623 c 0,41.71196 -40.39883,75.48441 -84.03505,75.48441 H 429.94158 V 805.355 L 246.58072,691.95064 H 38.035037 c -46.3863192,0 -84.035048,-33.89095 -84.035048,-75.48441 v -239.2512 c 0,-41.83044 37.6487288,-75.60291 84.035048,-75.60291 H 485.96494 c 46.38632,0 84.03505,33.89097 84.03505,75.60291 z"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="sscccsssssss"
+ style="fill:#7e3659;fill-opacity:1;stroke-width:1.23395777" />
+ </g>
+ </g>
+ <g
+ transform="matrix(1.0317705,0,0,1,-2.3661321,-3.185062)"
+ style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:14px;line-height:125%;font-family:Sans;-inkscape-font-specification:'Sans Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#c5c5c5;fill-opacity:1;stroke:none">
+ <path
+ inkscape:connector-curvature="0"
+ d="M 27.492676,48.007324 V 37.98584 h 3.02832 l 1.818359,6.835937 1.797852,-6.835937 h 3.035156 V 48.007324 H 35.29248 v -7.888672 l -1.989257,7.888672 H 31.35498 l -1.982421,-7.888672 v 7.888672 z"
+ style="fill:#c5c5c5;fill-opacity:1"/>
+ <path
+ inkscape:connector-curvature="0"
+ d="M 39.168457,48.007324 V 37.98584 h 3.02832 l 1.81836,6.835937 1.797851,-6.835937 h 3.035157 v 10.021484 h -1.879883 v -7.888672 l -1.989258,7.888672 H 43.030762 L 41.04834,40.118652 v 7.888672 z"
+ style="fill:#c5c5c5;fill-opacity:1"/>
+ <path
+ inkscape:connector-curvature="0"
+ d="m 50.358887,44.746582 1.96875,-0.191406 c 0.118487,0.66081 0.358884,1.146161 0.721191,1.456054 0.362301,0.309898 0.85107,0.464846 1.466309,0.464844 0.651687,2e-6 1.142735,-0.137856 1.473144,-0.413574 0.330397,-0.275714 0.495599,-0.598142 0.495606,-0.967285 -7e-6,-0.236976 -0.06951,-0.438636 -0.208496,-0.604981 -0.139004,-0.166337 -0.38168,-0.311031 -0.728028,-0.434082 -0.236984,-0.08203 -0.777023,-0.22786 -1.620117,-0.4375 -1.084638,-0.268875 -1.845705,-0.599279 -2.283203,-0.991211 -0.615236,-0.551426 -0.922852,-1.223626 -0.922852,-2.016601 0,-0.510409 0.144693,-0.987785 0.434082,-1.432129 0.289387,-0.444327 0.706379,-0.782705 1.250977,-1.015137 0.544593,-0.232412 1.201982,-0.348622 1.972168,-0.348633 1.257807,1.1e-5 2.204583,0.275726 2.840332,0.827149 0.635734,0.551441 0.969555,1.287443 1.001465,2.208008 l -2.023438,0.08887 c -0.08659,-0.514967 -0.272304,-0.885246 -0.557129,-1.11084 -0.284836,-0.225578 -0.712081,-0.33837 -1.281738,-0.338379 -0.587894,9e-6 -1.04818,0.120777 -1.380859,0.362305 -0.214196,0.154956 -0.321292,0.362312 -0.321289,0.62207 -3e-6,0.236987 0.100257,0.439786 0.300781,0.608399 0.255205,0.214199 0.874996,0.437506 1.859375,0.669921 0.984369,0.232428 1.712396,0.472825 2.184082,0.721192 0.471672,0.248377 0.840812,0.587895 1.107422,1.018554 0.266593,0.430669 0.399894,0.962732 0.399902,1.596192 -8e-6,0.574221 -0.159513,1.111981 -0.478515,1.613281 -0.319019,0.501303 -0.77019,0.873861 -1.353516,1.117676 -0.58334,0.243815 -1.310227,0.365722 -2.180664,0.365723 -1.266931,-1e-6 -2.239911,-0.292806 -2.918945,-0.878418 -0.679038,-0.585611 -1.084636,-1.438963 -1.216797,-2.560059 z"
+ style="fill:#c5c5c5;fill-opacity:1"/>
+ </g>
+</svg>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/qml/pages/LogPage.qml
^
|
@@ -1,6 +1,6 @@
/*
- Copyright (C) 2014-2017 Jolla Ltd.
- Contact: Slava Monich <slava.monich@jolla.com>
+ Copyright (C) 2014-2021 Jolla Ltd.
+ Copyright (C) 2014-2021 Slava Monich <slava.monich@jolla.com>
You may use this file under the terms of BSD license as follows:
@@ -8,14 +8,14 @@
modification, are permitted provided that the following conditions
are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Jolla Ltd nor the names of its contributors may
- be used to endorse or promote products derived from this software
- without specific prior written permission.
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the names of the copyright holders nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -37,7 +37,6 @@
id: page
allowedOrientations: window.allowedOrientations
property bool _clear
- property var _settingsComponent
function packAndShare() {
FsIoLog.pack()
@@ -60,12 +59,10 @@
text: qsTrId("mmslog-logpage-pm-settings")
visible: AppSettingsMenu
onClicked: {
- if (!_settingsComponent) {
- _settingsComponent = Qt.createComponent("../settings/SettingsPage.qml")
- }
- pageStack.push(_settingsComponent, {
- "title" : text,
- "allowedOrientations": window.allowedOrientations
+ pageStack.push(Qt.resolvedUrl("../settings/SettingsPage.qml"), {
+ title : text,
+ allowedOrientations: allowedOrientations,
+ inApp: true
})
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/qml/pages/SharePage.qml
^
|
@@ -1,6 +1,6 @@
/*
- Copyright (C) 2014-2020 Jolla Ltd.
- Copyright (C) 2014-2020 Slava Monich <slava.monich@jolla.com>
+ Copyright (C) 2014-2021 Jolla Ltd.
+ Copyright (C) 2014-2021 Slava Monich <slava.monich@jolla.com>
You may use this file under the terms of BSD license as follows:
@@ -42,10 +42,12 @@
allowedOrientations: window.allowedOrientations
// backNavigation has to be true when the page is pushed to the page stack
// so that the right animation is used (consistent with the settings page)
- backNavigation: _canShare || (status === PageStatus.Activating || status === PageStatus.Inactive)
+ backNavigation: _readyToShare || (status === PageStatus.Activating || status === PageStatus.Inactive)
// Don't show the back indicator while the push animation is active
- showNavigationIndicator: _canShare && (status === PageStatus.Active || status === PageStatus.Deactivating)
- property bool _canShare: !FsIoLog.packing && !FsIoLog.saving && !minWaitTimer.running
+ showNavigationIndicator: _readyToShare && (status === PageStatus.Active || status === PageStatus.Deactivating)
+ readonly property string _sharingApiVersion: SystemInfo.packageVersion("declarative-transferengine-qt5")
+ readonly property bool _sharingBroken: SystemInfo.compareVersions(_sharingApiVersion, "0.4.0") >= 0 // QML API break
+ property bool _readyToShare: !FsIoLog.packing && !FsIoLog.saving && !minWaitTimer.running
property bool _portrait: page.orientation === Orientation.Portrait
property real _fullHeight: _portrait ? window.height : window.width
@@ -80,7 +82,7 @@
contentHeight: parent.height
PullDownMenu {
- visible: _canShare || active
+ visible: _readyToShare || active
MenuItem {
//% "Save to documents"
text: qsTrId("mmslog-sharepage-pm-save-to-documents")
@@ -100,32 +102,74 @@
title: qsTrId("mmslog-sharepage-header")
}
- HarbourShareMethodList {
+ Item {
id: shareMethods
-
- visible: opacity > 0
- opacity: _canShare
- model: TransferMethodsModel
- source: FsIoLog.archivePath
- type: FsIoLog.archiveType
- subject: "Jolla MMS log"
- emailTo: "mms-debug@jolla.com"
- //: Share list item
- //% "Add account"
- addAccountText: qsTrId("mmslog-sharemethodlist-add-account")
- Behavior on opacity { FadeAnimation {} }
anchors {
top: header.bottom
left: parent.left
}
- VerticalScrollDecorator {}
+ width: parent.width
+ visible: opacity > 0
+ opacity: _readyToShare
+ Behavior on opacity { FadeAnimation {} }
+
+ Loader {
+ active: _sharingBroken
+ anchors.fill: parent
+ sourceComponent: Component {
+ Item {
+ anchors.fill: parent
+
+ InfoLabel {
+ id: sharingBrokenInfo
+ //: Info label displayed instead of sharing method list
+ //% "In-app sharing is not available in this version of Sailfish OS. Use the pulley menu to save tarball to the documents folder."
+ text: qsTrId("mmslog-sharepage-sharing_broken")
+ }
+ Item {
+ anchors {
+ left: parent.left
+ right: parent.right
+ top: sharingBrokenInfo.bottom
+ bottom: parent.bottom
+ }
+ HarbourHighlightIcon {
+ anchors.centerIn: parent
+ sourceSize.height: Math.min(Math.floor(parent.height/2), Theme.itemSizeSmall)
+ visible: height >= Theme.itemSizeSmall // Too small would look too stupid
+ source: "images/shrug.svg"
+ }
+ }
+ }
+ }
+ }
+
+ Loader {
+ active: !_sharingBroken
+ anchors.fill: parent
+ sourceComponent: Component {
+ HarbourShareMethodList {
+ visible: opacity > 0
+ opacity: _readyToShare
+ model: TransferMethodsModel
+ source: FsIoLog.archivePath
+ type: FsIoLog.archiveType
+ subject: "Jolla MMS log"
+ emailTo: "mms-debug@jolla.com"
+ //: Share list item
+ //% "Add account"
+ addAccountText: qsTrId("mmslog-sharemethodlist-add-account")
+ VerticalScrollDecorator {}
+ }
+ }
+ }
}
Label {
id: warning
visible: opacity > 0
- opacity: _canShare
+ opacity: _readyToShare
height: implicitHeight
Behavior on opacity { FadeAnimation {} }
wrapMode: Text.WordWrap
@@ -186,14 +230,14 @@
Column {
visible: opacity > 0
- opacity: _canShare ? 0 : 1
+ opacity: _readyToShare ? 0 : 1
anchors.centerIn: parent
spacing: Theme.paddingLarge
Behavior on opacity { FadeAnimation {} }
BusyIndicator {
anchors.horizontalCenter: parent.horizontalCenter
size: BusyIndicatorSize.Large
- running: !_canShare
+ running: !_readyToShare
}
Label {
anchors.horizontalCenter: parent.horizontalCenter
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/qml/pages/images/shrug.svg
^
|
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<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:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ data-name="Layer 1"
+ viewBox="0 0 990 256"
+ x="0px"
+ y="0px"
+ version="1.1"
+ sodipodi:docname="shrug.svg"
+ width="990"
+ height="256"
+ inkscape:version="0.92.4 (unknown)">
+ <path
+ d="m 11,11 v 6 h 0.326172 130.906248 v -6 z"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cccccc"
+ style="fill:#ffffff;fill-opacity:1;stroke-width:0.94984353" />
+ <path
+ d="M 149.96289,36.078124 144.15625,37.589842 190.59766,216 l 5.80468,-1.51172 z"
+ inkscape:connector-curvature="0"
+ style="fill:#ffffff;fill-opacity:1" />
+ <path
+ d="m 198,240 v 6 H 198.32118 328 v -6 z"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cccccc"
+ style="fill:#ffffff;fill-opacity:1;stroke-width:0.94538701" />
+ <path
+ d="M 376.1582,33.171875 C 362.28589,51.688512 351.98553,70.338553 345.30273,89.125 l -0.002,0.0078 -0.004,0.0098 c -12.37394,35.51069 -11.3405,74.32142 2.90624,109.12304 7.60619,18.6139 16.93627,34.92103 28.00586,48.88868 l 4.70313,-3.72852 c -10.67706,-13.47235 -19.73382,-29.27024 -27.1543,-47.42969 l -0.002,-0.002 C 340.06542,162.55145 339.07069,125.25993 350.95703,91.134766 l 0.002,-0.0059 c 0.001,-0.0039 0.003,-0.0078 0.004,-0.01172 6.45074,-18.127832 16.43463,-36.243334 29.99805,-54.347657 z"
+ inkscape:connector-curvature="0"
+ style="fill:#ffffff;fill-opacity:1" />
+ <path
+ d="m 494.04492,28.730469 -5.77539,1.621093 c 0.001,0.0053 0.002,0.01231 0.004,0.01758 0.0161,0.05651 0.0308,0.128878 0.0469,0.185547 2.65735,9.61058 5.40015,21.690414 7.60742,33.486328 1.96046,10.672786 3.49318,21.145236 4.1211,29.396484 l 5.98437,-0.421875 c -6.4e-4,-0.0099 -0.003,-0.0233 -0.004,-0.0332 h 0.002 c -0.0106,-0.139094 -0.0417,-0.320786 -0.0527,-0.460938 -0.60102,-8.783062 -2.24661,-19.908852 -4.41016,-31.220703 -0.001,-0.0053 -0.003,-0.01032 -0.004,-0.01563 -2.1115,-11.238441 -4.71676,-22.554965 -7.38086,-32.007812 -0.0446,-0.161935 -0.0883,-0.368655 -0.13281,-0.529297 h -0.002 c -0.002,-0.0054 -0.002,-0.01223 -0.004,-0.01758 z m -71.27539,12.230469 -5.36523,2.6875 c 8.42285,17.229905 18.25626,43.731277 21.26953,58.861332 8.9e-4,0.004 0.003,0.0111 0.004,0.0156 l 5.88672,-1.1543 c -8.9e-4,-0.005 -0.003,-0.011 -0.004,-0.0156 h 0.002 c -0.0198,-0.0996 -0.0676,-0.23757 -0.0879,-0.33789 -3.2778,-16.64471 -13.00287,-43.026164 -21.61719,-59.869142 -0.0203,-0.04163 -0.0422,-0.09518 -0.0625,-0.136719 h -0.002 c -0.008,-0.0151 -0.0157,-0.0357 -0.0234,-0.05078 z"
+ inkscape:connector-curvature="0"
+ style="fill:#ffffff;fill-opacity:1" />
+ <path
+ d="m 657,240 v 6 h 130 v -6 z"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccccc"
+ style="fill:#ffffff;fill-opacity:1;stroke-width:0.94549257" />
+ <path
+ d="M 838.90625,36.080077 792.50586,214.49023 798.3125,216 844.71289,37.589842 Z"
+ inkscape:connector-curvature="0"
+ style="fill:#ffffff;fill-opacity:1" />
+ <path
+ d="m 844,11 v 6 h 0.0155 129.98447 v -6 z"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cccccc"
+ style="fill:#ffffff;fill-opacity:1;stroke-width:0.99490809" />
+ <path
+ d="m 578.96484,42.914062 c -0.002,0.0087 -0.005,0.01668 -0.008,0.02539 -0.005,0.01728 -0.009,0.03351 -0.0137,0.05078 -9.50605,29.413681 -21.1647,58.821388 -36.60352,82.037108 -3.8417,5.25941 -7.51658,10.76511 -11.30078,15.59571 -9.5594,11.5474 -20.08402,22.99363 -30.49804,32.14453 -0.003,0.003 -0.006,0.005 -0.01,0.008 -3.25805,2.74173 -6.70789,5.56042 -9.66016,7.82617 -14.8901,9.94916 -28.26673,18.81712 -42.74023,24.67188 -0.20537,0.0811 -0.49187,0.18614 -0.27539,0.10742 l 1.98242,5.66211 c 0.004,-0.001 0.0617,-0.0238 0.0664,-0.0254 v 0.002 c 0.24398,-0.0887 0.19767,-0.0744 0.42968,-0.16601 0.0621,-0.0245 0.18755,-0.077 0.26368,-0.10743 2.53888,-0.88475 20.61424,-7.52925 43.89257,-25.35742 3.30323,-2.49817 6.64469,-5.18748 9.96875,-8.07617 0.003,-0.002 0.005,-0.006 0.008,-0.008 3.3e-4,-2.9e-4 0.002,2.9e-4 0.002,0 9.42116,-8.12845 19.99102,-18.78019 30.5293,-32.08399 0.2786,-0.35042 0.5493,-0.63961 0.82812,-0.99414 2.14017,-2.73204 4.24949,-5.77917 6.375,-8.74414 19.36286,-27.93569 35.16871,-63.647847 42.49805,-90.806641 0.0176,-0.06478 0.039,-0.124621 0.0566,-0.189453 h -0.002 c 0.002,-0.0087 0.006,-0.01667 0.008,-0.02539 z"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccccccccccccccccccccccccccc"
+ style="fill:#ffffff;fill-opacity:1" />
+ <path
+ d="m 615.80288,32.017546 c 13.87231,18.516637 24.17267,37.166677 30.85547,55.953125 l 0.002,0.0078 0.004,0.0098 c 12.37394,35.510689 11.3405,74.321419 -2.90624,109.123049 -7.60619,18.6139 -16.93627,34.92103 -28.00586,48.88868 l -4.70313,-3.72853 c 10.67706,-13.47235 19.73382,-29.27024 27.1543,-47.42968 l 0.002,-0.002 c 13.69024,-33.44267 14.68497,-70.73419 2.79863,-104.859353 l -0.002,-0.0059 c -0.001,-0.0039 -0.003,-0.0078 -0.004,-0.01172 C 634.54731,71.834984 624.56342,53.719482 611,35.61516 Z"
+ inkscape:connector-curvature="0"
+ style="fill:#ffffff;fill-opacity:1" />
+</svg>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/settings/SettingsPage.qml
^
|
@@ -1,6 +1,6 @@
/*
- Copyright (C) 2015-2017 Jolla Ltd.
- Contact: Slava Monich <slava.monich@jolla.com>
+ Copyright (C) 2015-2021 Jolla Ltd.
+ Copyright (C) 2015-2021 Slava Monich <slava.monich@jolla.com>
You may use this file under the terms of BSD license as follows:
@@ -8,14 +8,14 @@
modification, are permitted provided that the following conditions
are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Jolla Ltd nor the names of its contributors may
- be used to endorse or promote products derived from this software
- without specific prior written permission.
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the names of the copyright holders nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -37,6 +37,11 @@
Page {
readonly property string rootPath: "/apps/harbour-mmslog/"
property alias title: pageHeader.title
+ property bool inApp
+
+ // jolla-settings expects these properties:
+ property var applicationName
+ property var applicationIcon
SilicaFlickable {
anchors.fill: parent
@@ -48,8 +53,28 @@
PageHeader {
id: pageHeader
- //% "MMS Logger"
- title: qsTrId("mmslog-settings-page-header")
+ rightMargin: Theme.horizontalPageMargin + (appIcon.visible ? (height - appIcon.padding) : 0)
+ title: applicationName ? applicationName :
+ //: Settings page title (app name)
+ //% "MMS Logger"
+ qsTrId("mmslog-settings-page-header")
+ description: inApp ? "" :
+ //: Settings page header description (app version)
+ //% "Version %1"
+ qsTrId("mmslog-settings-version").arg("1.0.18")
+
+ Image {
+ id: appIcon
+ readonly property int padding: Theme.paddingLarge
+ readonly property int size: pageHeader.height - 2 * padding
+ x: pageHeader.width - width - Theme.horizontalPageMargin
+ y: padding
+ width: size
+ height: size
+ sourceSize: Qt.size(size,size)
+ source: applicationIcon ? applicationIcon : ""
+ visible: appIcon.status === Image.Ready
+ }
}
Slider {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/LICENSE
^
|
@@ -1,5 +1,5 @@
-Copyright (C) 2015-2019 Jolla Ltd.
-Copyright (C) 2015-2019 Slava Monich <slava@monich.com>
+Copyright (C) 2015-2021 Jolla Ltd.
+Copyright (C) 2015-2021 Slava Monich <slava@monich.com>
You may use this file under the terms of BSD license as follows:
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/harbour-lib.pro
^
|
@@ -24,14 +24,17 @@
SOURCES += \
src/HarbourBase32.cpp \
+ src/HarbourBase45.cpp \
src/HarbourClipboard.cpp \
src/HarbourDisplayBlanking.cpp \
src/HarbourJson.cpp \
src/HarbourLib.cpp \
src/HarbourMce.cpp \
src/HarbourMediaPlugin.cpp \
+ src/HarbourObject.cpp \
src/HarbourOrganizeListModel.cpp \
src/HarbourPolicyPlugin.cpp \
+ src/HarbourProcessState.cpp \
src/HarbourSelectionListModel.cpp \
src/HarbourSigChildHandler.cpp \
src/HarbourSingleImageProvider.cpp \
@@ -54,14 +57,17 @@
INCLUDEPATH += include
PUBLIC_HEADERS += \
include/HarbourBase32.h \
+ include/HarbourBase45.h \
include/HarbourClipboard.h \
include/HarbourDebug.h \
include/HarbourDisplayBlanking.h \
include/HarbourJson.h \
include/HarbourLib.h \
include/HarbourMediaPlugin.h \
+ include/HarbourObject.h \
include/HarbourOrganizeListModel.h \
include/HarbourPolicyPlugin.h \
+ include/HarbourProcessState.h \
include/HarbourSelectionListModel.h \
include/HarbourSigChildHandler.h \
include/HarbourSingleImageProvider.h \
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/include/HarbourBase32.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2019 Jolla Ltd.
- * Copyright (C) 2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2019-2021 Jolla Ltd.
+ * Copyright (C) 2019-2021 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -31,8 +31,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef HARBOUR_IMAGE_BASE32_H
-#define HARBOUR_IMAGE_BASE32_H
+#ifndef HARBOUR_BASE32_H
+#define HARBOUR_BASE32_H
#include <QString>
#include <QByteArray>
@@ -46,4 +46,4 @@
static bool isValidBase32(QString aBase32);
};
-#endif // HARBOUR_IMAGE_BASE32_H
+#endif // HARBOUR_BASE32_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/include/HarbourBase45.h
^
|
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2021 Jolla Ltd.
+ * Copyright (C) 2021 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HARBOUR_BASE45_H
+#define HARBOUR_BASE45_H
+
+#include <QString>
+#include <QByteArray>
+
+class HarbourBase45 {
+ class Private;
+ HarbourBase45();
+public:
+ static bool isValidBase45(QString aBase45);
+ static QByteArray fromBase45(QString aBase45);
+ static QString toBase45(QByteArray aBinary);
+};
+
+#endif // HARBOUR_BASE45_H
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/include/HarbourJson.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2015 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2015-2020 Jolla Ltd.
+ * Copyright (C) 2015-2020 Slava Monich <slava@monich.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -8,27 +8,31 @@
* modification, are permitted provided that the following conditions
* are met:
*
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Nemo Mobile nor the names of its contributors
- * may be used to endorse or promote products derived from this
- * software without specific prior written permission.
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation
+ * are those of the authors and should not be interpreted as representing
+ * any official policies, either expressed or implied.
*/
#ifndef HARBOUR_JSON_H
@@ -38,8 +42,8 @@
#include <QVariant>
namespace HarbourJson {
- bool save(QString aPath, const QVariantMap& aMap);
- bool load(QString aPath, QVariantMap& aRoot);
+ bool save(const QString& aPath, const QVariantMap& aMap);
+ bool load(const QString& aPath, QVariantMap& aRoot);
}
#endif // HARBOUR_JSON_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/include/HarbourObject.h
^
|
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2021 Jolla Ltd.
+ * Copyright (C) 2021 Slava Monich <slava@monich.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation
+ * are those of the authors and should not be interpreted as representing
+ * any official policies, either expressed or implied.
+ */
+
+#ifndef HARBOUR_OBJECT_H
+#define HARBOUR_OBJECT_H
+
+#include <QObject>
+#include <QList>
+#include <QQmlListProperty>
+
+// Fixes the "Cannot assign to non-existent default property" problem
+// with QtObject in QML.
+class HarbourObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQmlListProperty<QObject> children READ children)
+ Q_CLASSINFO("DefaultProperty", "children")
+
+public:
+ HarbourObject(QObject* aParent = Q_NULLPTR);
+
+ QQmlListProperty<QObject> children();
+
+private:
+ QList<QObject*> iChidren;
+};
+
+#endif // HARBOUR_OBJECT_H
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/include/HarbourProcessState.h
^
|
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2021 Jolla Ltd.
+ * Copyright (C) 2021 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef HARBOUR_PROCESS_STATE_H
+#define HARBOUR_PROCESS_STATE_H
+
+#include <QObject>
+
+class QQmlEngine;
+class QJSEngine;
+
+class HarbourProcessState: public QObject
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(HarbourProcessState)
+ Q_PROPERTY(bool jailedApp READ isJailedApp CONSTANT)
+
+public:
+ explicit HarbourProcessState(QObject* aParent = Q_NULLPTR);
+
+ // Callback for qmlRegisterSingletonType<HarbourProcessState>
+ static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
+
+ static bool isJailedApp();
+};
+
+#endif // HARBOUR_PROCESS_STATE_H
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/include/HarbourQrCodeGenerator.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2019 Jolla Ltd.
- * Copyright (C) 2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2019-2021 Jolla Ltd.
+ * Copyright (C) 2019-2021 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -39,26 +39,43 @@
class HarbourQrCodeGenerator : public QObject {
Q_OBJECT
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
+ Q_PROPERTY(int ecLevel READ ecLevel WRITE setEcLevel NOTIFY ecLevelChanged)
Q_PROPERTY(QString code READ code NOTIFY codeChanged)
Q_PROPERTY(QString qrcode READ code NOTIFY codeChanged)
Q_PROPERTY(bool running READ running NOTIFY runningChanged)
+ Q_ENUMS(ECLevel)
public:
+ enum ECLevel {
+ ECLevelDefault = -1,
+ ECLevelLowest = 0,
+ ECLevel_L = ECLevelLowest,
+ ECLevel_M,
+ ECLevel_Q,
+ ECLevel_H,
+ ECLevelHighest = ECLevel_H,
+ ECLevelCount
+ };
+
HarbourQrCodeGenerator(QObject* aParent = Q_NULLPTR);
QString text() const;
void setText(QString aValue);
+ ECLevel ecLevel() const;
+ void setEcLevel(int aValue);
+
QString code() const;
bool running() const;
- static QByteArray generate(QString aText);
+ static QByteArray generate(QString aText, ECLevel aEcLevel = ECLevelDefault);
// Callback for qmlRegisterSingletonType<HarbourQrCodeGenerator>
static QObject* createSingleton(QQmlEngine* aEngine, QJSEngine* aScript);
Q_SIGNALS:
void textChanged();
+ void ecLevelChanged();
void codeChanged();
void runningChanged();
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/include/HarbourSystemInfo.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2020 Jolla Ltd.
- * Copyright (C) 2020 Slava Monich <slava@monich.com>
+ * Copyright (C) 2020-2021 Jolla Ltd.
+ * Copyright (C) 2020-2021 Slava Monich <slava@monich.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -61,7 +61,11 @@
QString osName() const;
QString osVersion() const;
+ Q_INVOKABLE QString packageVersion(QString aPackage);
Q_INVOKABLE int osVersionCompare(QString aVersion);
+ Q_INVOKABLE static int compareVersions(QString aVersion1, QString aVersion2);
+
+ static QString queryPackageVersion(QString aVersion);
static int osVersionCompareWith(QString aVersion);
private:
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/include/HarbourTemporaryFile.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018 Jolla Ltd.
- * Copyright (C) 2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2021 Jolla Ltd.
+ * Copyright (C) 2018-2021 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -8,27 +8,31 @@
* modification, are permitted provided that the following conditions
* are met:
*
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * - Neither the name of Jolla Ltd nor the names of its contributors
- * may be used to endorse or promote products derived from this
- * software without specific prior written permission.
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation
+ * are those of the authors and should not be interpreted as representing
+ * any official policies, either expressed or implied.
*/
#ifndef HARBOUR_TEMPORARY_FILE_H
@@ -44,17 +48,27 @@
Q_PROPERTY(QString fileTemplate READ fileTemplate WRITE setFileTemplate NOTIFY fileTemplateChanged)
Q_PROPERTY(QString content READ content WRITE setContent NOTIFY contentChanged)
Q_PROPERTY(QString fileName READ fileName NOTIFY fileNameChanged)
+ Q_PROPERTY(Location location READ location WRITE setLocation NOTIFY locationChanged)
Q_PROPERTY(QUrl url READ url NOTIFY urlChanged)
+ Q_ENUMS(Location)
public:
+ enum Location {
+ Tmp,
+ Downloads
+ };
+
explicit HarbourTemporaryFile(QObject* aParent = NULL);
~HarbourTemporaryFile();
QString content() const;
- void setContent(QString value);
+ void setContent(QString aValue);
QString fileTemplate() const;
- void setFileTemplate(QString value);
+ void setFileTemplate(QString aValue);
+
+ Location location() const;
+ void setLocation(Location aValue);
QString fileName() const;
QUrl url() const;
@@ -63,6 +77,7 @@
void fileTemplateChanged();
void contentChanged();
void fileNameChanged();
+ void locationChanged();
void urlChanged();
private:
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/qml/HarbourGrayscaleEffect.qml
^
|
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2020 Jolla Ltd.
+ * Copyright (C) 2020 Slava Monich <slava@monich.com>
+ *
+ * You may use this file under the terms of BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import QtQuick 2.0
+
+ShaderEffect {
+ property variant source
+
+ vertexShader: "
+ uniform highp mat4 qt_Matrix;
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ varying highp vec2 coord;
+ void main() {
+ coord = qt_MultiTexCoord0;
+ gl_Position = qt_Matrix * qt_Vertex;
+ }"
+ fragmentShader: "
+ varying highp vec2 coord;
+ uniform sampler2D source;
+ uniform lowp float qt_Opacity;
+ void main() {
+ lowp vec4 tex = texture2D(source, coord);
+ gl_FragColor = vec4(vec3(dot(tex.rgb,
+ vec3(0.344, 0.5, 0.156))),
+ tex.a) * qt_Opacity;
+ }"
+}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/qml/HarbourPasswordInputField.qml
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018 Jolla Ltd.
- * Copyright (C) 2018 Slava Monich <slava@monich.com>
+ * Copyright (C) 2018-2021 Jolla Ltd.
+ * Copyright (C) 2018-2021 Slava Monich <slava@monich.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -64,6 +64,7 @@
onActiveChanged: {
if (!Qt.application.active) {
_usePasswordEchoMode = true
+ if (!readOnly) text = "" // Reset whatever has been typed
}
}
}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/qml/HarbourPressEffect.qml
^
|
@@ -0,0 +1,18 @@
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+ShaderEffect {
+ property variant source
+ property color color: Theme.rgba(Theme.highlightBackgroundColor, Theme.highlightBackgroundOpacity)
+ fragmentShader: "
+ uniform sampler2D source;
+ uniform highp vec4 color;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ void main(void) {
+ highp vec4 pixelColor = texture2D(source, qt_TexCoord0);
+ gl_FragColor = vec4(mix(pixelColor.rgb/max(pixelColor.a, 0.00390625),
+ color.rgb/max(color.a, 0.00390625), color.a) *
+ pixelColor.a, pixelColor.a) * qt_Opacity;
+ }"
+}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/qml/HarbourTextFlip.qml
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2019-2020 Jolla Ltd.
- * Copyright (C) 2019-2020 Slava Monich <slava@monich.com>
+ * Copyright (C) 2019-2021 Jolla Ltd.
+ * Copyright (C) 2019-2021 Slava Monich <slava@monich.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -41,6 +41,7 @@
property real duration: 500
property bool enabled: true
property string property: "text"
+ readonly property bool running: animation.running
property var animation: SequentialAnimation {
alwaysRunToEnd: true
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/src/HarbourBase45.cpp
^
|
@@ -0,0 +1,204 @@
+/*
+ * Copyright (C) 2021 Jolla Ltd.
+ * Copyright (C) 2021 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "HarbourBase45.h"
+
+#include "HarbourDebug.h"
+
+// ==========================================================================
+// HarbourBase45::Private
+// ==========================================================================
+
+class HarbourBase45::Private {
+public:
+ enum {
+ BASE = 45,
+ BASE2 = BASE * BASE,
+ REVERSE_MAP_SIZE = 91
+ };
+ static const char mapBase45[BASE];
+ static const int reverseMapBase45[REVERSE_MAP_SIZE];
+ static bool isValidChar(uint x);
+};
+
+const char HarbourBase45::Private::mapBase45[HarbourBase45::Private::BASE] = {
+ '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
+ 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
+ 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
+ 'W', 'X', 'Y', 'Z', ' ', '$', '%', '*',
+ '+', '-', '.', '/', ':'
+};
+
+const int HarbourBase45::Private::reverseMapBase45[HarbourBase45::Private::REVERSE_MAP_SIZE] = {
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1,
+ 36, -1, -1, -1, 37, 38, -1, -1,
+ -1, -1, 39, 40, -1, 41, 42, 43,
+ 0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 44, -1, -1, -1, -1, -1,
+ -1, 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
+};
+
+inline bool HarbourBase45::Private::isValidChar(uint x)
+{
+ return (x < Private::REVERSE_MAP_SIZE) && Private::reverseMapBase45[x] >= 0;
+}
+
+// ==========================================================================
+// HarbourBase45::Private
+// ==========================================================================
+
+bool HarbourBase45::isValidBase45(QString aBase45)
+{
+ const int len = aBase45.length();
+
+ if (!((len % 3) % 2)) {
+ const QChar* chars = aBase45.constData();
+ int i = 0;
+
+ while ((i + 2) < len) {
+ const uint c = chars[i++].unicode();
+ const uint d = chars[i++].unicode();
+ const uint e = chars[i++].unicode();
+
+ if (!Private::isValidChar(c) ||
+ !Private::isValidChar(d) ||
+ !Private::isValidChar(e) ||
+ (Private::reverseMapBase45[c] +
+ Private::reverseMapBase45[d] * Private::BASE +
+ Private::reverseMapBase45[e] * Private::BASE2) > 0xffff) {
+ return false;
+ }
+ }
+
+ if (i < len) {
+ const uint c = chars[i++].unicode();
+ const uint d = chars[i++].unicode();
+
+ if (!Private::isValidChar(c) ||
+ !Private::isValidChar(d) ||
+ (Private::reverseMapBase45[c] +
+ Private::reverseMapBase45[d] * Private::BASE) > 0xff) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
+}
+
+QByteArray HarbourBase45::fromBase45(QString aBase45)
+{
+ QByteArray out;
+ const int len = aBase45.length();
+ const int tail = (len % 3);
+
+ if (!(tail % 2)) {
+ const QChar* chars = aBase45.constData();
+ int i = 0;
+
+ out.reserve(len/3*2 + tail/2);
+ while ((i + 2) < len) {
+ const uint c = chars[i++].unicode();
+ const uint d = chars[i++].unicode();
+ const uint e = chars[i++].unicode();
+
+ if (!Private::isValidChar(c) ||
+ !Private::isValidChar(d) ||
+ !Private::isValidChar(e)) {
+ return QByteArray();
+ }
+ const uint n = Private::reverseMapBase45[c] +
+ Private::reverseMapBase45[d] * Private::BASE +
+ Private::reverseMapBase45[e] * Private::BASE2;
+ if (n > 0xffff) {
+ return QByteArray();
+ }
+ char ab[2];
+ ab[0] = (char)(n >> 8);
+ ab[1] = (char)n;
+ out.append(ab, sizeof(ab));
+ }
+
+ if (i < len) {
+ const uint c = chars[i++].unicode();
+ const uint d = chars[i++].unicode();
+
+ if (!Private::isValidChar(c) ||
+ !Private::isValidChar(d)) {
+ return QByteArray();
+ }
+ const uint a = Private::reverseMapBase45[c] +
+ Private::reverseMapBase45[d] * Private::BASE;
+ if (a > 0xff) {
+ return QByteArray();
+ }
+ out.append((char)a);
+ }
+ }
+ return out;
+}
+
+QString HarbourBase45::toBase45(QByteArray aBinary)
+{
+ const uchar* ptr = (uchar*)aBinary.constData();
+ const int n = aBinary.size();
+ int i;
+
+ QString str;
+ str.reserve(3 * (n / 2) + 2 * (n % 2));
+ for (i = 0; (i + 1) < n; i += 2) {
+ uint e = (uint)(ptr[i]) * 256 + ptr[i+1];
+ const uchar c = (uchar)(e % Private::BASE);
+ e = (e - c)/Private::BASE;
+ const uchar d = (uchar)(e % Private::BASE);
+ e = (e - d)/Private::BASE;
+ str.append(QChar::fromLatin1(Private::mapBase45[c]));
+ str.append(QChar::fromLatin1(Private::mapBase45[d]));
+ str.append(QChar::fromLatin1(Private::mapBase45[e]));
+ }
+ if (i < n) {
+ uchar d = ptr[i];
+ const uchar c = d % Private::BASE;
+ d = (d - c)/Private::BASE;
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/src/HarbourJson.cpp
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2015 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2015-2020 Jolla Ltd.
+ * Copyright (C) 2015-2020 Slava Monich <slava@monich.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -8,27 +8,31 @@
* modification, are permitted provided that the following conditions
* are met:
*
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Nemo Mobile nor the names of its contributors
- * may be used to endorse or promote products derived from this
- * software without specific prior written permission.
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation
+ * are those of the authors and should not be interpreted as representing
+ * any official policies, either expressed or implied.
*/
#include "HarbourJson.h"
@@ -46,35 +50,64 @@
# include <qjson/serializer.h>
#endif
-bool HarbourJson::save(QString aPath, const QVariantMap& aMap)
+#include <unistd.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+bool HarbourJson::save(const QString& aPath, const QVariantMap& aMap)
{
QFileInfo file(aPath);
QDir dir(file.dir());
if (dir.mkpath(dir.absolutePath())) {
- QFile f(file.absoluteFilePath());
+ const QString absPath(file.absoluteFilePath());
+ QFile f(absPath);
if (!aMap.isEmpty()) {
+ struct stat st;
+ const QByteArray pathBytes(absPath.toLocal8Bit());
+ const char* path = pathBytes.constData();
+ const bool haveFileAttr = (stat(path, &st) == 0);
+
if (f.open(QIODevice::WriteOnly)) {
+ bool ok;
#if QT_VERSION >= 0x050000
if (f.write(QJsonDocument::fromVariant(aMap).toJson()) >= 0) {
- return true;
+ ok = true;
+ } else {
+ HWARN("Error writing" << absPath << f.errorString());
}
#else
QJson::Serializer serializer;
QByteArray json = serializer.serialize(aMap);
if (!json.isNull()) {
- if (f.write(json ) >= 0) {
- return true;
+ if (f.write(json) >= 0) {
+ ok = true;
+ } else {
+ HWARN("Error writing" << absPath << f.errorString());
}
} else {
HWARN("Json serialization error");
}
#endif
- HWARN("Error writing" << aPath << f.errorString());
+ if (ok) {
+ if (haveFileAttr) {
+ // Try to restore ownership and mode
+ if (chown(path, st.st_uid, st.st_gid)) {
+ HWARN("Failed to chown" << path << ":" <<
+ strerror(errno));
+ }
+ if (chmod(path, st.st_mode & ~S_IFMT)) {
+ HWARN("Failed to chmod" << path << ":" <<
+ strerror(errno));
+ }
+ }
+ return true;
+ }
} else {
- HWARN("Error opening" << aPath << f.errorString());
+ HWARN("Error opening" << absPath << f.errorString());
}
} else if (!f.remove()) {
- HWARN("Error removing" << aPath << f.errorString());
+ HWARN("Error removing" << absPath << f.errorString());
}
} else {
HWARN("Failed to create" << dir.absolutePath());
@@ -82,7 +115,7 @@
return false;
}
-bool HarbourJson::load(QString aPath, QVariantMap& aRoot)
+bool HarbourJson::load(const QString& aPath, QVariantMap& aRoot)
{
QFile f(aPath);
if (f.exists()) {
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/src/HarbourObject.cpp
^
|
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2021 Jolla Ltd.
+ * Copyright (C) 2021 Slava Monich <slava@monich.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation
+ * are those of the authors and should not be interpreted as representing
+ * any official policies, either expressed or implied.
+ */
+
+#include "HarbourObject.h"
+
+HarbourObject::HarbourObject(QObject* aParent) :
+ QObject(aParent)
+{
+}
+
+QQmlListProperty<QObject> HarbourObject::children()
+{
+ return QQmlListProperty<QObject>(this, iChidren);
+}
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/src/HarbourProcessState.cpp
^
|
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2021 Jolla Ltd.
+ * Copyright (C) 2021 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "HarbourProcessState.h"
+#include "HarbourDebug.h"
+
+#include <unistd.h>
+
+HarbourProcessState::HarbourProcessState(QObject* aParent) :
+ QObject(aParent)
+{
+}
+
+// Callback for qmlRegisterSingletonType<HarbourProcessState>
+QObject* HarbourProcessState::createSingleton(QQmlEngine*, QJSEngine*)
+{
+ return new HarbourProcessState;
+}
+
+bool HarbourProcessState::isJailedApp()
+{
+ static int processJailed = -1;
+
+ // Apps are not supposed to be started by the root systemd process.
+ // Firejail tells us that our parent pid is 1.
+ // We could additionally check that /proc contains only our and
+ // parent pids, if ppid check becomes not reliable enough.
+ if (processJailed < 0) {
+ bool simulate = false;
+ const char* var = "HARBOUR_JAIL_STATE";
+ processJailed = QString(qgetenv(var)).toInt(&simulate);
+ if (!simulate || processJailed < 0) {
+ if (getppid() == 1) {
+ HWARN("We are jailed!");
+ processJailed = 1;
+ } else{
+ HDEBUG("Cool, we are free!");
+ processJailed = 0;
+ }
+ } else {
+ HWARN(var << processJailed);
+ }
+ }
+ return processJailed > 0;
+}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/src/HarbourQrCodeGenerator.cpp
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2019 Jolla Ltd.
- * Copyright (C) 2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2019-2021 Jolla Ltd.
+ * Copyright (C) 2019-2021 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -11,8 +11,8 @@
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
* distribution.
* 3. Neither the names of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived
@@ -45,25 +45,31 @@
// HarbourQrCodeGenerator::Task
// ==========================================================================
-class HarbourQrCodeGenerator::Task : public HarbourTask {
+class HarbourQrCodeGenerator::Task : public HarbourTask
+{
Q_OBJECT
+
public:
- Task(QThreadPool* aPool, QString aText);
+ Task(QThreadPool* aPool, QString aText, ECLevel aEcLevel);
void performTask() Q_DECL_OVERRIDE;
+
public:
QString iText;
QString iCode;
+ ECLevel iEcLevel;
};
-HarbourQrCodeGenerator::Task::Task(QThreadPool* aPool, QString aText) :
+HarbourQrCodeGenerator::Task::Task(QThreadPool* aPool, QString aText,
+ ECLevel aEcLevel) :
HarbourTask(aPool),
- iText(aText)
+ iText(aText),
+ iEcLevel(aEcLevel)
{
}
void HarbourQrCodeGenerator::Task::performTask()
{
- QByteArray bytes(generate(iText));
+ QByteArray bytes(generate(iText, iEcLevel));
if (!bytes.isEmpty()) {
iCode = HarbourBase32::toBase32(bytes);
}
@@ -73,7 +79,8 @@
// HarbourQrCodeGenerator::Private
// ==========================================================================
-class HarbourQrCodeGenerator::Private : public QObject {
+class HarbourQrCodeGenerator::Private : public QObject
+{
Q_OBJECT
public:
@@ -82,6 +89,10 @@
HarbourQrCodeGenerator* parentObject() const;
void setText(QString aValue);
+ void setEcLevel(int aValue);
+ void regenerate();
+
+ static QRecLevel realEcLevel(ECLevel aEcLevel);
public Q_SLOTS:
void onTaskDone();
@@ -89,6 +100,7 @@
public:
QThreadPool* iThreadPool;
Task* iTask;
+ ECLevel iEcLevel;
QString iText;
QString iCode;
};
@@ -96,7 +108,8 @@
HarbourQrCodeGenerator::Private::Private(HarbourQrCodeGenerator* aParent) :
QObject(aParent),
iThreadPool(new QThreadPool(this)),
- iTask(Q_NULLPTR)
+ iTask(Q_NULLPTR),
+ iEcLevel(ECLevelDefault)
{
// Serialize the tasks:
iThreadPool->setMaxThreadCount(1);
@@ -104,6 +117,7 @@
HarbourQrCodeGenerator::Private::~Private()
{
+ if (iTask) iTask->release();
iThreadPool->waitForDone();
}
@@ -112,19 +126,52 @@
return qobject_cast<HarbourQrCodeGenerator*>(parent());
}
+QRecLevel HarbourQrCodeGenerator::Private::realEcLevel(ECLevel aEcLevel)
+{
+ switch (aEcLevel) {
+ case ECLevel_L: return QR_ECLEVEL_L;
+ case ECLevel_M: return QR_ECLEVEL_M;
+ case ECLevel_Q: return QR_ECLEVEL_Q;
+ case ECLevel_H: return QR_ECLEVEL_H;
+ case ECLevelDefault:
+ case ECLevelCount:
+ break;
+ }
+ return QR_ECLEVEL_M; // default
+}
+
void HarbourQrCodeGenerator::Private::setText(QString aText)
{
if (iText != aText) {
iText = aText;
- HarbourQrCodeGenerator* obj = parentObject();
- const bool wasRunning = (iTask != Q_NULLPTR);
- if (iTask) iTask->release(this);
- iTask = new Task(iThreadPool, aText);
- iTask->submit(this, SLOT(onTaskDone()));
- Q_EMIT obj->textChanged();
- if (!wasRunning) {
- Q_EMIT obj->runningChanged();
+ regenerate();
+ Q_EMIT parentObject()->textChanged();
+ }
+}
+
+void HarbourQrCodeGenerator::Private::setEcLevel(int aValue)
+{
+ const ECLevel level = (aValue < ECLevelDefault) ? ECLevelDefault :
+ (aValue > ECLevelHighest) ? ECLevelHighest : (ECLevel)aValue;
+ if (iEcLevel != level) {
+ const QRecLevel prevRealLevel = realEcLevel(iEcLevel);
+ iEcLevel = level;
+ if (realEcLevel(level) != prevRealLevel) {
+ regenerate();
}
+ Q_EMIT parentObject()->ecLevelChanged();
+ }
+}
+
+void HarbourQrCodeGenerator::Private::regenerate()
+{
+ HarbourQrCodeGenerator* obj = parentObject();
+ const bool wasRunning = (iTask != Q_NULLPTR);
+ if (iTask) iTask->release();
+ iTask = new Task(iThreadPool, iText, iEcLevel);
+ iTask->submit(this, SLOT(onTaskDone()));
+ if (!wasRunning) {
+ Q_EMIT obj->runningChanged();
}
}
@@ -156,7 +203,7 @@
// Callback for qmlRegisterSingletonType<HarbourQrCodeGenerator>
QObject* HarbourQrCodeGenerator::createSingleton(QQmlEngine* aEngine, QJSEngine*)
{
- return new HarbourQrCodeGenerator(aEngine);
+ return new HarbourQrCodeGenerator(); // Singleton doesn't need a parent
}
QString HarbourQrCodeGenerator::text() const
@@ -169,6 +216,16 @@
iPrivate->setText(aValue);
}
+HarbourQrCodeGenerator::ECLevel HarbourQrCodeGenerator::ecLevel() const
+{
+ return iPrivate->iEcLevel;
+}
+
+void HarbourQrCodeGenerator::setEcLevel(int aValue)
+{
+ iPrivate->setEcLevel(aValue);
+}
+
QString HarbourQrCodeGenerator::code() const
{
return iPrivate->iCode;
@@ -179,10 +236,11 @@
return iPrivate->iTask != Q_NULLPTR;
}
-QByteArray HarbourQrCodeGenerator::generate(QString aText)
+QByteArray HarbourQrCodeGenerator::generate(QString aText, ECLevel aEcLevel)
{
QByteArray in(aText.toUtf8()), out;
- QRcode* code = QRcode_encodeString(in.constData(), 0, QR_ECLEVEL_M, QR_MODE_8, true);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/src/HarbourSystemInfo.cpp
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2020 Jolla Ltd.
- * Copyright (C) 2020 Slava Monich <slava@monich.com>
+ * Copyright (C) 2020-2021 Jolla Ltd.
+ * Copyright (C) 2020-2021 Slava Monich <slava@monich.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -44,6 +44,11 @@
#include <QFile>
#include <QTextStream>
+#include <unistd.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
// ==========================================================================
// HarbourSystemInfo::Private
// ==========================================================================
@@ -63,10 +68,13 @@
static int compareVersions(const QVector<uint> aVersion1, const QVector<uint> aVersion2);
static int compareVersions(const QVector<uint> aVersion1, const QString aVersion2);
+ QString getPackageVersion(QString aPackage);
+
public:
QString iName;
QString iVersion;
QVector<uint> iParsedVersion;
+ QMap<QString,QString> iPackageVersions;
};
const QString HarbourSystemInfo::Private::NAME("NAME");
@@ -159,6 +167,21 @@
return compareVersions(aVersion1, Private::parseVersion(aVersion2));
}
+QString HarbourSystemInfo::Private::getPackageVersion(QString aPackage)
+{
+ QString version;
+ if (!aPackage.isEmpty()) {
+ version = iPackageVersions.value(aPackage);
+ if (version.isEmpty()) {
+ version = HarbourSystemInfo::queryPackageVersion(aPackage);
+ if (!version.isEmpty()) {
+ iPackageVersions.insert(aPackage, version);
+ }
+ }
+ }
+ return version;
+}
+
// ==========================================================================
// HarbourSystemInfo
// ==========================================================================
@@ -192,6 +215,11 @@
return iPrivate->iVersion;
}
+QString HarbourSystemInfo::packageVersion(QString aPackage)
+{
+ return iPrivate->getPackageVersion(aPackage);
+}
+
int HarbourSystemInfo::osVersionCompare(QString aVersion)
{
return Private::compareVersions(iPrivate->iParsedVersion, aVersion);
@@ -203,3 +231,52 @@
const QString os(Private::parseOsRelease(keys).value(Private::VERSION_ID));
return Private::compareVersions(Private::parseVersion(os), aVersion);
}
+
+int HarbourSystemInfo::compareVersions(QString aVersion1, QString aVersion2)
+{
+ return Private::compareVersions(Private::parseVersion(aVersion1),
+ Private::parseVersion(aVersion2));
+}
+
+QString HarbourSystemInfo::queryPackageVersion(QString aPackage)
+{
+ QString version;
+ int fds[2];
+ if (pipe(fds) == 0) {
+ pid_t pid = fork();
+ if (!pid) {
+ const QByteArray package(aPackage.toLatin1());
+ const char* argv[6];
+ argv[0] = "rpm";
+ argv[1] = "-q";
+ argv[2] = "--qf";
+ argv[3] = "%{version}";
+ argv[4] = package.constData();
+ argv[5] = NULL;
+ while ((dup2(fds[1], STDOUT_FILENO) == -1) && (errno == EINTR));
+ execvp(argv[0], (char**)argv);
+ exit(1);
+ }
+ close(fds[1]);
+
+ // There shouldn't be much output
+ QByteArray out;
+ const int chunk = 16;
+ ssize_t n = 0;
+ do {
+ const int size = out.size();
+ out.resize(size + chunk);
+ while ((n = read(fds[0], out.data() + size, chunk)) == -1 && (errno == EINTR));
+ out.resize(size + qMax(n, (ssize_t)0));
+ } while (n > 0);
+
+ // Parse the version
+ if (out.size() > 0) {
+ version = QString::fromLatin1(out);
+ HDEBUG(qPrintable(aPackage) << qPrintable(version));
+ }
+ waitpid(pid, NULL, 0);
+ close(fds[0]);
+ }
+ return version;
+}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/src/HarbourTemporaryFile.cpp
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018 Jolla Ltd.
- * Copyright (C) 2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2021 Jolla Ltd.
+ * Copyright (C) 2018-2021 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -8,27 +8,31 @@
* modification, are permitted provided that the following conditions
* are met:
*
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * - Neither the name of Jolla Ltd nor the names of its contributors
- * may be used to endorse or promote products derived from this
- * software without specific prior written permission.
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation
+ * are those of the authors and should not be interpreted as representing
+ * any official policies, either expressed or implied.
*/
#include "HarbourTemporaryFile.h"
@@ -37,6 +41,7 @@
#include <QDir>
#include <QTemporaryFile>
#include <QTextStream>
+#include <QStandardPaths>
// ==========================================================================
// HarbourTemporaryFile::Private
@@ -48,9 +53,11 @@
~Private();
void reopen(HarbourTemporaryFile* aObject);
+ QString directoryPath() const;
QString fileName() const;
public:
+ Location iLocation;
QTemporaryFile* iFile;
QString iFileTemplate;
QString iContent;
@@ -58,7 +65,8 @@
};
HarbourTemporaryFile::Private::Private() :
- iFile(NULL)
+ iLocation(Tmp),
+ iFile(NULL)
{
}
@@ -76,6 +84,21 @@
return iFile ? iFile->fileName() : QString();
}
+QString
+HarbourTemporaryFile::Private::directoryPath() const
+{
+ QStandardPaths::StandardLocation type = QStandardPaths::TempLocation;
+ switch (iLocation) {
+ case Downloads:
+ type = QStandardPaths::DownloadLocation;
+ break;
+ case Tmp:
+ // This is the default
+ break;
+ }
+ return QStandardPaths::writableLocation(type);
+}
+
void
HarbourTemporaryFile::Private::reopen(
HarbourTemporaryFile* aObject)
@@ -89,7 +112,7 @@
iUrl = QUrl();
}
if (!iContent.isEmpty() && !iFileTemplate.isEmpty()) {
- iFile = new QTemporaryFile(QDir::tempPath() +
+ iFile = new QTemporaryFile(directoryPath() +
QDir::separator() + iFileTemplate);
iFile->setAutoRemove(true);
if (iFile->open()) {
@@ -159,6 +182,22 @@
}
}
+HarbourTemporaryFile::Location
+HarbourTemporaryFile::location() const
+{
+ return iPrivate->iLocation;
+}
+
+void
+HarbourTemporaryFile::setLocation(Location aValue)
+{
+ if (iPrivate->iLocation != aValue) {
+ iPrivate->iLocation = aValue;
+ iPrivate->reopen(this);
+ Q_EMIT locationChanged();
+ }
+}
+
QString
HarbourTemporaryFile::fileName() const
{
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/test/Makefile
^
|
@@ -0,0 +1,6 @@
+# -*- Mode: makefile-gmake -*-
+
+all:
+%:
+ @$(MAKE) -C TestHarbourBase32 $*
+ @$(MAKE) -C TestHarbourBase45 $*
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/test/Makefile.common
^
|
@@ -0,0 +1,200 @@
+# -*- Mode: makefile-gmake -*-
+
+.PHONY: clean all debug release coverage
+
+#
+# Real test makefile defines EXE (and possibly SRC) and includes this one.
+#
+
+ifndef EXE
+${error EXE not defined}
+endif
+
+SRC ?= $(EXE).cpp
+
+#
+# Required packages
+#
+
+PKGS += Qt5Core glib-2.0
+
+#
+# Default target
+#
+
+all: debug release
+
+#
+# Directories
+#
+
+SRC_DIR = .
+TOP_DIR = ../..
+HARBOUR_DIR = $(TOP_DIR)
+BUILD_DIR = build
+DEBUG_BUILD_DIR = $(BUILD_DIR)/debug
+RELEASE_BUILD_DIR = $(BUILD_DIR)/release
+COVERAGE_BUILD_DIR = $(BUILD_DIR)/coverage
+
+#
+# Tools and flags
+#
+
+CC = $(CROSS_COMPILE)gcc
+LD = $(CC)
+MOC = qtchooser -run-tool=moc -qt=5
+WARNINGS = -Wall
+INCLUDES = -I$(BUILD_DIR) -I$(HARBOUR_DIR)/include
+BASE_FLAGS = -fPIC
+BASE_LDFLAGS = $(BASE_FLAGS) $(LDFLAGS)
+BASE_CFLAGS = $(BASE_FLAGS) $(CFLAGS)
+FULL_CFLAGS = $(BASE_CFLAGS) $(DEFINES) $(WARNINGS) $(INCLUDES) -MMD -MP \
+ $(shell pkg-config --cflags $(PKGS))
+FULL_LDFLAGS = $(BASE_LDFLAGS)
+LIBS = $(shell pkg-config --libs $(PKGS)) -lstdc++
+QUIET_MAKE = make --no-print-directory
+DEBUG_FLAGS = -g
+RELEASE_FLAGS =
+COVERAGE_FLAGS = -g
+
+DEBUG_LDFLAGS = $(FULL_LDFLAGS) $(DEBUG_FLAGS)
+RELEASE_LDFLAGS = $(FULL_LDFLAGS) $(RELEASE_FLAGS)
+COVERAGE_LDFLAGS = $(FULL_LDFLAGS) $(COVERAGE_FLAGS) --coverage
+
+DEBUG_CFLAGS = $(FULL_CFLAGS) $(DEBUG_FLAGS) -DDEBUG -DHARBOUR_DEBUG
+RELEASE_CFLAGS = $(FULL_CFLAGS) $(RELEASE_FLAGS) -O2
+COVERAGE_CFLAGS = $(FULL_CFLAGS) $(COVERAGE_FLAGS) --coverage
+
+#
+# Files
+#
+
+DEBUG_OBJS = \
+ $(MOC_H:%.h=$(DEBUG_BUILD_DIR)/moc_h_%.o) \
+ $(MOC_CPP:%.cpp=$(DEBUG_BUILD_DIR)/moc_cpp_%.o) \
+ $(SRC:%.cpp=$(DEBUG_BUILD_DIR)/%.o) \
+ $(HARBOUR_SRC:%.cpp=$(DEBUG_BUILD_DIR)/harbour_%.o)
+RELEASE_OBJS = \
+ $(MOC_H:%.h=$(RELEASE_BUILD_DIR)/moc_h_%.o) \
+ $(MOC_CPP:%.cpp=$(RELEASE_BUILD_DIR)/moc_cpp_%.o) \
+ $(SRC:%.cpp=$(RELEASE_BUILD_DIR)/%.o) \
+ $(HARBOUR_SRC:%.cpp=$(RELEASE_BUILD_DIR)/harbour_%.o)
+COVERAGE_OBJS = \
+ $(MOC_H:%.h=$(COVERAGE_BUILD_DIR)/moc_h_%.o) \
+ $(MOC_CPP:%.cpp=$(COVERAGE_BUILD_DIR)/moc_cpp_%.o) \
+ $(SRC:%.cpp=$(COVERAGE_BUILD_DIR)/%.o) \
+ $(HARBOUR_SRC:%.cpp=$(COVERAGE_BUILD_DIR)/harbour_%.o)
+
+#
+# Dependencies
+#
+
+DEPS = $(DEBUG_OBJS:%.o=%.d) $(RELEASE_OBJS:%.o=%.d) $(COVERAGE_OBJS:%.o=%.d)
+ifneq ($(MAKECMDGOALS),clean)
+ifneq ($(strip $(DEPS)),)
+-include $(DEPS)
+endif
+endif
+
+$(DEBUG_OBJS): | $(DEBUG_BUILD_DIR)
+$(RELEASE_OBJS): | $(RELEASE_BUILD_DIR)
+$(COVERAGE_OBJS): | $(COVERAGE_BUILD_DIR)
+
+#
+# Rules
+#
+
+DEBUG_EXE = $(DEBUG_BUILD_DIR)/$(EXE)
+RELEASE_EXE = $(RELEASE_BUILD_DIR)/$(EXE)
+COVERAGE_EXE = $(COVERAGE_BUILD_DIR)/$(EXE)
+
+debug: $(DEBUG_EXE)
+
+release: $(RELEASE_EXE)
+
+coverage: $(COVERAGE_EXE)
+
+clean:
+ rm -f *~
+ rm -fr $(BUILD_DIR)
+
+test_banner:
+ @echo "===========" $(EXE) "=========== "
+
+test: test_banner debug
+ @$(DEBUG_EXE)
+
+valgrind: test_banner debug
+ @G_DEBUG=gc-friendly G_SLICE=always-malloc valgrind --tool=memcheck --leak-check=full --show-possibly-lost=no $(DEBUG_EXE)
+
+$(BUILD_DIR):
+ mkdir -p $@
+
+$(DEBUG_BUILD_DIR):
+ mkdir -p $@
+
+$(RELEASE_BUILD_DIR):
+ mkdir -p $@
+
+$(COVERAGE_BUILD_DIR):
+ mkdir -p $@
+
+$(BUILD_DIR)/moc_%.cpp : $(APP_DIR)/%.h
+ $(MOC) $< -o $@
+
+$(BUILD_DIR)/%.moc : $(APP_DIR)/%.cpp
+ $(MOC) $< -o $@
+
+$(DEBUG_BUILD_DIR)/%.o : $(SRC_DIR)/%.cpp
+ $(CC) -c $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(RELEASE_BUILD_DIR)/%.o : $(SRC_DIR)/%.cpp
+ $(CC) -c $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(COVERAGE_BUILD_DIR)/%.o : $(SRC_DIR)/%.cpp
+ $(CC) -c $(COVERAGE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(DEBUG_BUILD_DIR)/moc_h_%.o : $(BUILD_DIR)/moc_%.cpp $(BUILD_DIR)
+ $(CC) -c $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(RELEASE_BUILD_DIR)/moc_h_%.o : $(BUILD_DIR)/moc_%.cpp $(BUILD_DIR)
+ $(CC) -c $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(COVERAGE_BUILD_DIR)/moc_h_%.o : $(BUILD_DIR)/moc_%.cpp $(BUILD_DIR)
+ $(CC) -c $(COVERAGE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(DEBUG_BUILD_DIR)/moc_cpp_%.o : $(HARBOUR_DIR)/%.cpp $(BUILD_DIR)/%.moc
+ $(CC) -c $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(RELEASE_BUILD_DIR)/moc_cpp_%.o : $(HARBOUR_DIR)/%.cpp $(BUILD_DIR)/%.moc
+ $(CC) -c $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(COVERAGE_BUILD_DIR)/moc_cpp_%.o : $(HARBOUR_DIR)/%.cpp $(BUILD_DIR)/%.moc
+ $(CC) -c $(COVERAGE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(DEBUG_BUILD_DIR)/app_%.o : $(APP_DIR)/%.cpp
+ $(CC) -c $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(RELEASE_BUILD_DIR)/app_%.o : $(APP_DIR)/%.cpp
+ $(CC) -c $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(COVERAGE_BUILD_DIR)/app_%.o : $(APP_DIR)/%.cpp
+ $(CC) -c $(COVERAGE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(DEBUG_BUILD_DIR)/harbour_%.o : $(HARBOUR_DIR)/src/%.cpp
+ $(CC) -c $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(RELEASE_BUILD_DIR)/harbour_%.o : $(HARBOUR_DIR)/src/%.cpp
+ $(CC) -c $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(COVERAGE_BUILD_DIR)/harbour_%.o : $(HARBOUR_DIR)/src/%.cpp
+ $(CC) -c $(COVERAGE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(DEBUG_EXE): $(DEBUG_OBJS)
+ $(LD) $(DEBUG_LDFLAGS) $^ $(LIBS) -o $@
+
+$(RELEASE_EXE): $(RELEASE_OBJS)
+ $(LD) $(RELEASE_LDFLAGS) $^ $(LIBS) -o $@
+
+$(COVERAGE_EXE): $(COVERAGE_OBJS)
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/test/TestHarbourBase32/Makefile
^
|
@@ -0,0 +1,6 @@
+# -*- Mode: makefile-gmake -*-
+
+EXE = TestHarbourBase32
+HARBOUR_SRC = HarbourBase32.cpp
+
+include ../Makefile.common
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/test/TestHarbourBase32/TestHarbourBase32.cpp
^
|
@@ -0,0 +1,202 @@
+/*
+ * Copyright (C) 2021 Jolla Ltd.
+ * Copyright (C) 2021 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "HarbourBase32.h"
+#include "HarbourDebug.h"
+
+#include <glib.h>
+
+/*==========================================================================*
+ * isValidBase45
+ *==========================================================================*/
+
+static
+void
+test_isValidBase32(
+ void)
+{
+ g_assert(HarbourBase32::isValidBase32("AEBAGBAFAYDQQCIKBMGA2DQPCAIREEYUCULBOGI2DMOB2HQ7"));
+ g_assert(HarbourBase32::isValidBase32("aebagbaf aydqqcik bmga2dqp caireeyu culbogi2 dmob2hq7"));
+ g_assert(HarbourBase32::isValidBase32("ae"));
+ g_assert(!HarbourBase32::isValidBase32("aeb"));
+ g_assert(HarbourBase32::isValidBase32("aeba"));
+ g_assert(HarbourBase32::isValidBase32("aebag"));
+ g_assert(!HarbourBase32::isValidBase32("aebagb"));
+ g_assert(!HarbourBase32::isValidBase32("aebagb= x"));
+ g_assert(HarbourBase32::isValidBase32("aebagba"));
+ g_assert(HarbourBase32::isValidBase32("aebagbaf"));
+ g_assert(HarbourBase32::isValidBase32("aebagbafa"));
+ g_assert(HarbourBase32::isValidBase32("aebagbafay"));
+ g_assert(!HarbourBase32::isValidBase32(QString()));
+ g_assert(!HarbourBase32::isValidBase32(" "));
+ g_assert(!HarbourBase32::isValidBase32("01234567"));
+ g_assert(!HarbourBase32::isValidBase32("88888888"));
+ g_assert(!HarbourBase32::isValidBase32("{}"));
+ g_assert(!HarbourBase32::isValidBase32("[]"));
+}
+
+/*==========================================================================*
+ * fromBase32
+ *==========================================================================*/
+
+static
+void
+test_fromBase32(
+ void)
+{
+ static const char out[] = {
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
+ 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14,
+ 0x15, 0x16, 0x17, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F
+ };
+ QString in1("AEBAGBAFAYDQQCIKBMGA2DQPCAIREEYUCULBOGI2DMOB2HQ7");
+ QString in2("aebagbaf aydqqcik bmga2dqp caireeyu culbogi2 dmob2hq7");
+ QByteArray out1(HarbourBase32::fromBase32(in1));
+ QByteArray out2(HarbourBase32::fromBase32(in2));
+ g_assert(out1 == out2);
+ g_assert(out1 == QByteArray(out, sizeof(out)));
+ g_assert(HarbourBase32::fromBase32("ae") == QByteArray(out, 1));
+ g_assert(HarbourBase32::fromBase32("aeb").isEmpty());
+ g_assert(HarbourBase32::fromBase32("aeba") == QByteArray(out, 2));
+ g_assert(HarbourBase32::fromBase32("aebag") == QByteArray(out, 3));
+ g_assert(HarbourBase32::fromBase32("aebagb").isEmpty());
+ g_assert(HarbourBase32::fromBase32("aebagb=x").isEmpty());
+ g_assert(HarbourBase32::fromBase32("aebagb= x").isEmpty());
+ g_assert(HarbourBase32::fromBase32("aebagba") == QByteArray(out, 4));
+ g_assert(HarbourBase32::fromBase32("aebagbaf") == QByteArray(out, 5));
+ g_assert(HarbourBase32::fromBase32("aebagbafa") == QByteArray(out, 5));
+ g_assert(HarbourBase32::fromBase32("aebagbafay") == QByteArray(out, 6));
+ g_assert(HarbourBase32::fromBase32(QString()).isEmpty());
+ g_assert(HarbourBase32::fromBase32(" ").isEmpty());
+ g_assert(HarbourBase32::fromBase32("01234567").isEmpty());
+ g_assert(HarbourBase32::fromBase32("88888888").isEmpty());
+ g_assert(HarbourBase32::fromBase32("{}").isEmpty());
+ g_assert(HarbourBase32::fromBase32("[]").isEmpty());
+}
+
+/*==========================================================================*
+ * base32pad
+ *==========================================================================*/
+
+static
+void
+test_base32pad(
+ void)
+{
+ static const char out[] = {
+ 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23
+ };
+ QString in1("DMOB2HQ7EA====="); // One pad character missing
+ QString in2("DMOB2HQ7EAQQ====="); // One extra pagging character
+ QString in3("DMOB2HQ7EAQSE== ="); // Space is ignored
+ QString in4("DMOB2HQ7EAQSEIY=");
+ g_assert(HarbourBase32::fromBase32(in1) == QByteArray(out, sizeof(out) - 3));
+ g_assert(HarbourBase32::fromBase32(in2) == QByteArray(out, sizeof(out) - 2));
+ g_assert(HarbourBase32::fromBase32(in3) == QByteArray(out, sizeof(out) - 1));
+ g_assert(HarbourBase32::fromBase32(in4) == QByteArray(out, sizeof(out)));
+ g_assert(HarbourBase32::fromBase32(QString("=================")).isEmpty());
+ g_assert(HarbourBase32::fromBase32(QString("=DMOB2HQ7EAQSEIY=")).isEmpty());
+ g_assert(HarbourBase32::fromBase32(QString("DMOB2HQ7EB=")).isEmpty());
+}
+
+/*==========================================================================*
+ * toBase32
+ *==========================================================================*/
+
+static
+void
+test_toBase32(
+ void)
+{
+ static const char in[] = {
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
+ 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14,
+ 0x15, 0x16, 0x17, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F
+ };
+ QString out("aebagbafaydqqcikbmga2dqpcaireeyuculbogi2dmob2hq7");
+ g_assert(HarbourBase32::toBase32(QByteArray()).isEmpty());
+ g_assert(HarbourBase32::toBase32(QByteArray(in, sizeof(in))) == out);
+}
+
+/*==========================================================================*
+ * rfc4648
+ *==========================================================================*/
+
+static
+void
+test_rfc4648(
+ void)
+{
+ // Test vectors from RFC 4648
+ static const char* test[][2] = {
+ { "f", "MY======" },
+ { "fo", "MZXQ====" },
+ { "foo", "MZXW6===" },
+ { "foob", "MZXW6YQ=" },
+ { "fooba", "MZXW6YTB" },
+ { "foobar", "MZXW6YTBOI======" }
+ };
+
+ for (guint i = 0; i < G_N_ELEMENTS(test); i++) {
+ QByteArray data(test[i][0]);
+ QString base32(test[i][1]);
+ g_assert(HarbourBase32::isValidBase32(base32));
+ g_assert(HarbourBase32::fromBase32(base32) == data);
+ g_assert(HarbourBase32::toBase32(data, false) == base32);
+ }
+}
+
+/*==========================================================================*
+ * Common
+ *==========================================================================*/
+
+#define TEST_(name) "/HarbourBase32/" name
+
+int main(int argc, char* argv[])
+{
+ g_test_init(&argc, &argv, NULL);
+ g_test_add_func(TEST_("isValidBase32"), test_isValidBase32);
+ g_test_add_func(TEST_("fromBase32"), test_fromBase32);
+ g_test_add_func(TEST_("base32pad"), test_base32pad);
+ g_test_add_func(TEST_("rfc4648"), test_rfc4648);
+ g_test_add_func(TEST_("toBase32"), test_toBase32);
+ return g_test_run();
+}
+
+/*
+ * Local Variables:
+ * mode: C++
+ * c-basic-offset: 4
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/test/TestHarbourBase45/Makefile
^
|
@@ -0,0 +1,6 @@
+# -*- Mode: makefile-gmake -*-
+
+EXE = TestHarbourBase45
+HARBOUR_SRC = HarbourBase45.cpp
+
+include ../Makefile.common
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/test/TestHarbourBase45/TestHarbourBase45.cpp
^
|
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2021 Jolla Ltd.
+ * Copyright (C) 2021 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "HarbourBase45.h"
+#include "HarbourDebug.h"
+
+#include <glib.h>
+
+/*==========================================================================*
+ * isValidBase45
+ *==========================================================================*/
+
+static
+void
+test_isValidBase45(
+ void)
+{
+ g_assert(HarbourBase45::isValidBase45("")); // Empty is considered valid
+ g_assert(HarbourBase45::isValidBase45("BB8"));
+ g_assert(HarbourBase45::isValidBase45("%69 VD92EX0"));
+ g_assert(HarbourBase45::isValidBase45("UJCLQE7W581"));
+ g_assert(!HarbourBase45::isValidBase45("AA("));
+ g_assert(!HarbourBase45::isValidBase45("A(A"));
+ g_assert(!HarbourBase45::isValidBase45("(AA"));
+ g_assert(!HarbourBase45::isValidBase45("A("));
+ g_assert(!HarbourBase45::isValidBase45("A["));
+ g_assert(!HarbourBase45::isValidBase45("[A"));
+ g_assert(!HarbourBase45::isValidBase45("A"));
+ g_assert(!HarbourBase45::isValidBase45("ZZ"));
+ g_assert(!HarbourBase45::isValidBase45("ZZZ"));
+}
+
+/*==========================================================================*
+ * toBase45
+ *==========================================================================*/
+
+static
+void
+test_toBase45(
+ void)
+{
+ g_assert(HarbourBase45::toBase45(QByteArray()).isEmpty());
+ // Examples from draft-faltstrom-base45-07
+ g_assert(HarbourBase45::toBase45(QByteArray("AB")) == QString("BB8"));
+ g_assert(HarbourBase45::toBase45(QByteArray("Hello!!")) == QString("%69 VD92EX0"));
+ g_assert(HarbourBase45::toBase45(QByteArray("base-45")) == QString("UJCLQE7W581"));
+}
+
+/*==========================================================================*
+ * fromBase45
+ *==========================================================================*/
+
+static
+void
+test_fromBase45(
+ void)
+{
+ // Invalid
+ g_assert(HarbourBase45::fromBase45(QByteArray("AA[")).isEmpty());
+ g_assert(HarbourBase45::fromBase45(QByteArray("A[A")).isEmpty());
+ g_assert(HarbourBase45::fromBase45(QByteArray("[AA")).isEmpty());
+ g_assert(HarbourBase45::fromBase45(QByteArray("AA(")).isEmpty());
+ g_assert(HarbourBase45::fromBase45(QByteArray("A(A")).isEmpty());
+ g_assert(HarbourBase45::fromBase45(QByteArray("(AA")).isEmpty());
+ g_assert(HarbourBase45::fromBase45(QByteArray("A(")).isEmpty());
+ g_assert(HarbourBase45::fromBase45(QByteArray("A[")).isEmpty());
+ g_assert(HarbourBase45::fromBase45(QByteArray("[A")).isEmpty());
+ g_assert(HarbourBase45::fromBase45(QByteArray("A")).isEmpty());
+ g_assert(HarbourBase45::fromBase45(QByteArray("ZZ")).isEmpty());
+ g_assert(HarbourBase45::fromBase45(QByteArray("ZZZ")).isEmpty());
+ // Valid
+ g_assert(HarbourBase45::fromBase45(QByteArray()).isEmpty());
+ g_assert(HarbourBase45::fromBase45(QByteArray("BB8")) == QByteArray("AB"));
+ g_assert(HarbourBase45::fromBase45(QByteArray("%69 VD92EX0")) == QByteArray("Hello!!"));
+ g_assert(HarbourBase45::fromBase45(QByteArray("UJCLQE7W581")) == QByteArray("base-45"));
+}
+
+/*==========================================================================*
+ * Common
+ *==========================================================================*/
+
+#define TEST_(name) "/HarbourBase45/" name
+
+int main(int argc, char* argv[])
+{
+ g_test_init(&argc, &argv, NULL);
+ g_test_add_func(TEST_("isValidBase45"), test_isValidBase45);
+ g_test_add_func(TEST_("fromBase45"), test_fromBase45);
+ g_test_add_func(TEST_("toBase45"), test_toBase45);
+ return g_test_run();
+}
+
+/*
+ * Local Variables:
+ * mode: C++
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/test/coverage/.gitignore
^
|
@@ -0,0 +1,4 @@
+app.gcov
+full.gcov
+report
+*~
|
[-]
[+]
|
Added |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/harbour-lib/test/coverage/run
^
|
@@ -0,0 +1,55 @@
+#!/bin/bash
+#
+# This script requires lcov, dirname
+#
+
+TESTS="\
+TestHarbourBase32 \
+TestHarbourBase45"
+
+function err() {
+ echo "*** ERROR!" $1
+ exit 1
+}
+
+# Check the required tools
+which lcov >> /dev/null || err "Please install lcov"
+which dirname >> /dev/null || err "Please install dirname"
+
+# LCOV 1.10 has branch coverage disabled per default
+# Previous versions didn't have the --rc option
+if [ ! -z "$(lcov --help | grep ' --rc ')" ] ; then
+ LCOV_OPT="--rc lcov_branch_coverage=1"
+ GENHTML_OPT="--branch-coverage"
+fi
+
+pushd `dirname $0` > /dev/null
+COV_DIR="$PWD"
+pushd .. > /dev/null
+TEST_DIR="$PWD"
+pushd .. > /dev/null
+TOP_DIR="$PWD"
+popd > /dev/null
+popd > /dev/null
+popd > /dev/null
+
+FULL_COV="$COV_DIR/full.gcov"
+APP_COV="$COV_DIR/app.gcov"
+
+make -C "$TEST_DIR" clean
+rm -f "$FULL_COV" "$APP_COV"
+TESTS_COV=
+
+for t in $TESTS ; do
+ pushd "$TEST_DIR/$t"
+ make -C "$TEST_DIR/$t" clean coverage || exit 1
+ build/coverage/$t || exit 1
+ TEST_COV="$TEST_DIR/$t/build/coverage/$t.cov"
+ lcov $LCOV_OPT -c -d build/coverage -o "$TEST_COV" || exit 1
+ TESTS_COV+="-a $TEST_COV "
+ popd
+done
+
+lcov $LCOV_OPT $TESTS_COV -o "$FULL_COV" || exit 1
+lcov $LCOV_OPT -e "$FULL_COV" "$TOP_DIR/src/*" -o "$APP_COV" || exit 1
+genhtml $GENHTML_OPT "$APP_COV" -t "HarbourLib" --output-directory "$COV_DIR/report" || exit 1
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libdbuslog/LICENSE
^
|
@@ -1,5 +1,5 @@
-Copyright (C) 2016-2019 Jolla Ltd.
-Copyright (C) 2016-2019 Slava Monich <slava.monich@jolla.com>
+Copyright (C) 2016-2021 Jolla Ltd.
+Copyright (C) 2016-2021 Slava Monich <slava.monich@jolla.com>
You may use this file under the terms of BSD license as follows:
@@ -13,8 +13,8 @@
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the names of the copyright holders nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libdbuslog/VERSION
^
|
@@ -1 +1 @@
-1.0.19
+1.0.21
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libdbuslog/client/src/dbuslog_client.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2020 Jolla Ltd.
- * Copyright (C) 2016-2020 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2021 Jolla Ltd.
+ * Copyright (C) 2016-2021 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -1163,15 +1163,16 @@
DBusLogClientPriv* priv = self->priv;
GASSERT(!priv->init);
GASSERT(!priv->autostart);
+ if (priv->proxy && priv->cookie) {
+ org_nemomobile_logger_call_log_close(priv->proxy, priv->cookie,
+ NULL, NULL, NULL);
+ }
dbus_log_client_disconnect(self, FALSE);
g_ptr_array_unref(self->categories);
g_hash_table_destroy(priv->categories);
if (priv->name_watch_id) {
g_bus_unwatch_name(priv->name_watch_id);
}
- if (priv->proxy) {
- g_object_unref(priv->proxy);
- }
g_free(priv->path);
G_OBJECT_CLASS(PARENT_CLASS)->finalize(object);
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libdbuslog/debian/changelog
^
|
@@ -1,3 +1,10 @@
+libdbuslog (1.0.21) unstable; urgency=low
+
+ * Do not close client side of the pipe twice
+ * Notify log server when client gets destroyed
+
+ -- Slava Monich <slava.monich@jolla.com> Thu, 05 Aug 2021 00:46:51 +0300
+
libdbuslog (1.0.19) unstable; urgency=low
* Added dbus_log_server_set_category_level() function
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libdbuslog/debian/copyright
^
|
@@ -1,5 +1,5 @@
-Copyright (C) 2016-2019 Jolla Ltd.
-Copyright (C) 2016-2019 Slava Monich <slava.monich@jolla.com>
+Copyright (C) 2016-2021 Jolla Ltd.
+Copyright (C) 2016-2021 Slava Monich <slava.monich@jolla.com>
You may use this file under the terms of BSD license as follows:
@@ -13,8 +13,8 @@
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the names of the copyright holders nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libdbuslog/rpm/libdbuslog.spec
^
|
@@ -1,10 +1,9 @@
Name: dbuslog-tools
-Version: 1.0.19
+Version: 1.0.21
Release: 0
Summary: Command line client for libdbuslogserver
-Group: Development/Tools
License: BSD
-URL: https://git.sailfishos.org/mer-core/libdbuslog
+URL: https://github.com/sailfishos/libdbuslog
Source: %{name}-%{version}.tar.bz2
%define libglibutil_version 1.0.43
@@ -42,7 +41,6 @@
%package -n libdbuslogserver-common-devel
Summary: Common development files
-Group: Development/Libraries
%description -n libdbuslogserver-common-devel
This package contains development files shared by libdbuslogserver-dbus-devel
@@ -56,7 +54,6 @@
%package -n libdbuslogserver-dbus
Summary: Library of logging utilities for libdbus based programs
-Group: Development/Libraries
BuildRequires: pkgconfig(dbus-1)
Requires: libglibutil >= %{libglibutil_version}
Requires(post): /sbin/ldconfig
@@ -93,7 +90,6 @@
%package -n libdbuslogserver-gio
Summary: Library of logging utilities for gio based programs
-Group: Development/Libraries
Requires: libglibutil >= %{libglibutil_version}
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libdbuslog/server/Makefile
^
|
@@ -386,7 +386,7 @@
$(INSTALL_FILES) $(INSTALL_COMMON_HEADERS) $(INSTALL_INCLUDE_DIR)
dbus-install: $(INSTALL_LIB_DIR)
- $(INSTALL_FILES) $(DBUS_RELEASE_LIB) $(INSTALL_LIB_DIR)
+ $(INSTALL) -m 755 $(DBUS_RELEASE_LIB) $(INSTALL_LIB_DIR)
ln -sf $(DBUS_LIB) $(INSTALL_LIB_DIR)/$(DBUS_LIB_SYMLINK2)
ln -sf $(DBUS_LIB_SYMLINK2) $(INSTALL_LIB_DIR)/$(DBUS_LIB_SYMLINK1)
@@ -396,7 +396,7 @@
ln -sf $(DBUS_LIB_SYMLINK1) $(INSTALL_LIB_DIR)/$(DBUS_LIB_DEV_SYMLINK)
gio-install: $(INSTALL_LIB_DIR)
- $(INSTALL_FILES) $(GIO_RELEASE_LIB) $(INSTALL_LIB_DIR)
+ $(INSTALL) -m 755 $(GIO_RELEASE_LIB) $(INSTALL_LIB_DIR)
ln -sf $(GIO_LIB) $(INSTALL_LIB_DIR)/$(GIO_LIB_SYMLINK2)
ln -sf $(GIO_LIB_SYMLINK2) $(INSTALL_LIB_DIR)/$(GIO_LIB_SYMLINK1)
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libdbuslog/server/src/dbus/dbuslog_server_dbus.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2020 Jolla Ltd.
- * Copyright (C) 2016-2020 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2021 Jolla Ltd.
+ * Copyright (C) 2016-2021 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -378,7 +378,6 @@
dbus_message_iter_init_append(reply, &it);
dbus_message_iter_append_basic(&it, DBUS_TYPE_UNIX_FD, &fd);
dbus_message_iter_append_basic(&it, DBUS_TYPE_UINT32, &cookie);
- close(fd);
return reply;
} else {
return dbus_log_server_error(msg, fd);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libdbuslog/server/src/dbuslog_server.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2020 Jolla Ltd.
- * Copyright (C) 2016-2020 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2021 Jolla Ltd.
+ * Copyright (C) 2016-2021 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -635,6 +635,26 @@
* Internal API
*==========================================================================*/
+gboolean
+dbus_log_server_steal_readfd(
+ DBusLogServer* self,
+ const char* name,
+ int fd)
+{
+ if (fd >= 0) {
+ DBusLogServerPriv* priv = self->priv;
+ DBusLogServerPeer* peer = g_hash_table_lookup(priv->peers, name);
+ if (peer) {
+ DBusLogSender* sender = peer->sender;
+ if (sender->readfd == fd) {
+ sender->readfd = -1;
+ return TRUE;
+ }
+ }
+ }
+ return FALSE;
+}
+
void
dbus_log_server_peer_vanished(
DBusLogServer* self,
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libdbuslog/server/src/dbuslog_server_p.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2020 Jolla Ltd.
- * Copyright (C) 2016-2020 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2021 Jolla Ltd.
+ * Copyright (C) 2016-2021 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -118,6 +118,13 @@
const char* path)
G_GNUC_INTERNAL;
+gboolean
+dbus_log_server_steal_readfd(
+ DBusLogServer* server,
+ const char* peer,
+ int fd)
+ G_GNUC_INTERNAL;
+
void
dbus_log_server_peer_vanished(
DBusLogServer* self,
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libdbuslog/server/src/gio/dbuslog_server_gio.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2020 Jolla Ltd.
- * Copyright (C) 2016-2020 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2021 Jolla Ltd.
+ * Copyright (C) 2016-2021 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -401,12 +401,15 @@
int err = -EFAULT;
GASSERT(self->bus);
if (self->bus) {
- const gint fd = dbus_log_server_call_log_open(&self->server,
- g_dbus_method_invocation_get_sender(call));
+ DBusLogServer* server = &self->server;
+ const char* name = g_dbus_method_invocation_get_sender(call);
+ const gint fd = dbus_log_server_call_log_open(server, name);
if (fd >= 0) {
+ /* GUnixFDList takes ownership of the descriptor */
GUnixFDList* fdl = g_unix_fd_list_new_from_array(&fd, 1);
org_nemomobile_logger_complete_log_open(proxy, call, fdl,
g_variant_new_handle(fd), DBUSLOG_LOG_COOKIE);
+ dbus_log_server_steal_readfd(server, name, fd);
g_object_unref(fdl);
return TRUE;
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libglibutil/.gitignore
^
|
@@ -4,6 +4,7 @@
test/coverage/full.gcov
test/coverage/libglibutil.gcov
test/coverage/results
+debian/.debhelper
debian/files
debian/libglibutil-dev.debhelper.log
debian/libglibutil-dev.install
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libglibutil/LICENSE
^
|
@@ -1,4 +1,4 @@
-Copyright (C) 2014-2020 Jolla Ltd.
+Copyright (C) 2014-2021 Jolla Ltd.
You may use this file under the terms of BSD license as follows:
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libglibutil/Makefile
^
|
@@ -20,7 +20,7 @@
VERSION_MAJOR = 1
VERSION_MINOR = 0
-VERSION_RELEASE = 46
+VERSION_RELEASE = 55
# Version for pkg-config
PCVERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_RELEASE)
@@ -134,9 +134,9 @@
# Rules
#
-debug: $(DEBUG_STATIC_LIB) $(DEBUG_LIB) $(DEBUG_LINK) $(DEBUG_DEV_LINK)
+debug: $(DEBUG_STATIC_LIB) $(DEBUG_DEV_LINK)
-release: $(RELEASE_STATIC_LIB) $(RELEASE_LIB) $(RELEASE_LINK) $(RELEASE_DEV_LINK)
+release: $(RELEASE_STATIC_LIB) $(RELEASE_DEV_LINK)
coverage: $(COVERAGE_STATIC_LIB)
@@ -187,25 +187,23 @@
$(DEBUG_LIB): $(DEBUG_OBJS)
$(LD) $(DEBUG_OBJS) $(DEBUG_LDFLAGS) -o $@
- ln -sf $(LIB) $(DEBUG_LINK)
$(RELEASE_LIB): $(RELEASE_OBJS)
$(LD) $(RELEASE_OBJS) $(RELEASE_LDFLAGS) -o $@
- ln -sf $(LIB) $(RELEASE_LINK)
ifeq ($(KEEP_SYMBOLS),0)
$(STRIP) $@
endif
-$(DEBUG_LINK):
+$(DEBUG_LINK): $(DEBUG_LIB)
ln -sf $(LIB) $@
-$(RELEASE_LINK):
+$(RELEASE_LINK): $(RELEASE_LIB)
ln -sf $(LIB) $@
-$(DEBUG_DEV_LINK):
+$(DEBUG_DEV_LINK): $(DEBUG_LINK)
ln -sf $(LIB_SYMLINK1) $@
-$(RELEASE_DEV_LINK):
+$(RELEASE_DEV_LINK): $(RELEASE_LINK)
ln -sf $(LIB_SYMLINK1) $@
$(DEBUG_STATIC_LIB): $(DEBUG_OBJS)
@@ -245,8 +243,15 @@
INSTALL_INCLUDE_DIR = $(DESTDIR)/usr/include/gutil
INSTALL_PKGCONFIG_DIR = $(DESTDIR)$(ABS_LIBDIR)/pkgconfig
+#
+# rpm based systems expect libraries to be 755
+# deb based systems expect libraries to be 644
+#
+# 755 works for both because dh_fixperms removes execute permissions
+# from any libraries and other files that don't need it.
+#
install: $(INSTALL_LIB_DIR)
- $(INSTALL_FILES) $(RELEASE_LIB) $(INSTALL_LIB_DIR)
+ $(INSTALL) -m 755 $(RELEASE_LIB) $(INSTALL_LIB_DIR)
ln -sf $(LIB) $(INSTALL_LIB_DIR)/$(LIB_SYMLINK2)
ln -sf $(LIB_SYMLINK2) $(INSTALL_LIB_DIR)/$(LIB_SYMLINK1)
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libglibutil/debian/changelog
^
|
@@ -1,3 +1,65 @@
+libglibutil (1.0.55) unstable; urgency=low
+
+ * Added gutil_log_dump()
+ * Added gutil_range_init_with_bytes()
+ * Added gutil_range_has_prefix()
+ * Added gutil_range_skip_prefix()
+
+ -- Slava Monich <slava.monich@jolla.com> Sun, 23 May 2021 03:33:58 +0300
+
+libglibutil (1.0.54) unstable; urgency=low
+
+ * Added GUtilRange type
+ * Tweaked interpretation of environment variables
+
+ -- Slava Monich <slava.monich@jolla.com> Mon, 17 May 2021 16:06:25 +0300
+
+libglibutil (1.0.53) unstable; urgency=low
+
+ * Optimized gutil_parse_int()
+ * Added gutil_parse_uint()
+
+ -- Slava Monich <slava.monich@jolla.com> Wed, 05 May 2021 15:30:57 +0300
+
+libglibutil (1.0.52) unstable; urgency=low
+
+ * Added gutil_memdup()
+
+ -- Slava Monich <slava.monich@jolla.com> Sun, 18 Apr 2021 17:40:41 +0300
+
+libglibutil (1.0.51) unstable; urgency=low
+
+ * Initialize default log settings from the environment
+ * Disable timestamps by default
+ * Added gutil_log_tid option
+ * Added gutil_ptrv_free()
+
+ -- Slava Monich <slava.monich@jolla.com> Thu, 25 Feb 2021 19:36:05 +0200
+
+libglibutil (1.0.50) unstable; urgency=low
+
+ * Added gutil_ptrv_length()
+
+ -- Slava Monich <slava.monich@jolla.com> Wed, 28 Oct 2020 17:59:10 +0200
+
+libglibutil (1.0.49) unstable; urgency=low
+
+ * Added gutil_slice_free() macro
+
+ -- Slava Monich <slava.monich@jolla.com> Sat, 17 Oct 2020 01:01:25 +0300
+
+libglibutil (1.0.48) unstable; urgency=low
+
+ * Make library executable on rpm based systems
+
+ -- Slava Monich <slava.monich@jolla.com> Mon, 31 Aug 2020 00:07:18 +0300
+
+libglibutil (1.0.47) unstable; urgency=low
+
+ * Added gutil_strv_addv()
+
+ -- Slava Monich <slava.monich@jolla.com> Tue, 28 Jul 2020 13:56:08 +0300
+
libglibutil (1.0.46) unstable; urgency=low
* Allow STRIP to be defined by the environment
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libglibutil/debian/copyright
^
|
@@ -1,4 +1,4 @@
-Copyright (C) 2014-2020 Jolla Ltd.
+Copyright (C) 2014-2021 Jolla Ltd.
You may use this file under the terms of BSD license as follows:
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libglibutil/include/gutil_log.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2014-2019 Jolla Ltd.
- * Copyright (C) 2014-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2014-2021 Jolla Ltd.
+ * Copyright (C) 2014-2021 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -14,8 +14,8 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the names of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -139,6 +139,14 @@
const char* format,
va_list va);
+void
+gutil_log_dump(
+ const GLogModule* module,
+ int level,
+ const char* prefix,
+ const void* data,
+ gsize size); /* Since 1.0.55 */
+
/* Check if logging is enabled for the specified log level */
gboolean
gutil_log_enabled(
@@ -167,6 +175,7 @@
extern GLogProc gutil_log_func;
extern GLogProc2 gutil_log_func2;
extern gboolean gutil_log_timestamp; /* Only affects stdout and stderr */
+extern gboolean gutil_log_tid; /* Since 1.0.51 */
/* Log module (optional) */
#define GLOG_MODULE_DEFINE_(var,name) \
@@ -317,9 +326,12 @@
GLOG_LEVEL_DEBUG, f, ##args)
# define GDEBUG_(f,args...) gutil_log(GLOG_MODULE_CURRENT, \
GLOG_LEVEL_DEBUG, "%s() " f, __FUNCTION__, ##args)
+# define GDEBUG_DUMP(buf,n) gutil_log_dump(GLOG_MODULE_CURRENT, \
+ GLOG_LEVEL_DEBUG, NULL, buf, n) /* Since 1.0.55 */
# else
# define GDEBUG(f,args...) GLOG_NOTHING
# define GDEBUG_(f,args...) GLOG_NOTHING
+# define GDEBUG_DUMP(buf,n) GLOG_NOTHING /* Since 1.0.55 */
# endif /* GUTIL_LOG_DEBUG */
#else
# define GDEBUG_ GDEBUG
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libglibutil/include/gutil_macros.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2014-2015 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2014-2020 Jolla Ltd.
+ * Copyright (C) 2014-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -13,9 +13,9 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Jolla Ltd nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -48,6 +48,8 @@
# define G_PACKED
#endif
+#define gutil_slice_free(x) g_slice_free1(sizeof(*(x)), x) /* Since 1.0.49 */
+
#endif /* GUTIL_MACROS_H */
/*
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libglibutil/include/gutil_misc.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2019 Jolla Ltd.
- * Copyright (C) 2016-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2021 Jolla Ltd.
+ * Copyright (C) 2016-2021 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -70,6 +70,12 @@
int* value); /* Since 1.0.30 */
gboolean
+gutil_parse_uint(
+ const char* str,
+ int base,
+ unsigned int* value); /* Since 1.0.53 */
+
+gboolean
gutil_data_equal(
const GUtilData* data1,
const GUtilData* data2); /* Since 1.0.31 */
@@ -117,6 +123,34 @@
GBytes* bytes,
const GUtilData* data); /* Since 1.0.41 */
+gsize
+gutil_ptrv_length(
+ const void* ptrv); /* Since 1.0.50 */
+
+void
+gutil_ptrv_free(
+ void** ptrv); /* Since 1.0.51 */
+
+void*
+gutil_memdup(
+ const void* ptr,
+ gsize size); /* Since 1.0.52 */
+
+gsize
+gutil_range_init_with_bytes(
+ GUtilRange* range,
+ GBytes* bytes); /* Since 1.0.55 */
+
+gboolean
+gutil_range_has_prefix(
+ const GUtilRange* range,
+ const GUtilData* prefix); /* Since 1.0.55 */
+
+gboolean
+gutil_range_skip_prefix(
+ GUtilRange* range,
+ const GUtilData* prefix); /* Since 1.0.55 */
+
G_END_DECLS
#endif /* GUTIL_MISC_H */
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libglibutil/include/gutil_strv.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2014-2019 Jolla Ltd.
- * Copyright (C) 2014-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2014-2020 Jolla Ltd.
+ * Copyright (C) 2014-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -82,7 +82,19 @@
GStrV*
gutil_strv_add(
GStrV* sv,
- const char* s);
+ const char* s)
+ G_GNUC_WARN_UNUSED_RESULT;
+
+/**
+ * Appends new string(s) to the array.
+ */
+GStrV*
+gutil_strv_addv(
+ GStrV* sv,
+ const char* s,
+ ...) /* Since 1.0.47 */
+ G_GNUC_WARN_UNUSED_RESULT
+ G_GNUC_NULL_TERMINATED;
/**
* Removes the string from the specified position in the array.
@@ -91,7 +103,8 @@
gutil_strv_remove_at(
GStrV* sv,
int pos,
- gboolean free_string);
+ gboolean free_string)
+ G_GNUC_WARN_UNUSED_RESULT;
/**
* Checks two string arrays for equality.
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libglibutil/include/gutil_types.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2014-2018 Jolla Ltd.
- * Copyright (C) 2014-2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2014-2021 Jolla Ltd.
+ * Copyright (C) 2014-2021 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -14,8 +14,8 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the names of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -54,6 +54,11 @@
gsize size;
} GUtilData;
+typedef struct gutil_range {
+ const guint8* ptr;
+ const guint8* end;
+} GUtilRange; /* Since 1.0.54 */
+
#define GLOG_MODULE_DECL(m) extern GLogModule m;
typedef struct glog_module GLogModule;
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libglibutil/rpm/libglibutil.spec
^
|
@@ -1,11 +1,12 @@
Name: libglibutil
-Version: 1.0.46
+
+Version: 1.0.55
Release: 0
Summary: Library of glib utilities
-Group: Development/Libraries
License: BSD
URL: https://git.sailfishos.org/mer-core/libglibutil
Source: %{name}-%{version}.tar.bz2
+
BuildRequires: pkgconfig(glib-2.0)
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
@@ -25,7 +26,7 @@
%setup -q
%build
-make LIBDIR=%{_libdir} KEEP_SYMBOLS=1 release pkgconfig
+make %{_smp_mflags} LIBDIR=%{_libdir} KEEP_SYMBOLS=1 release pkgconfig
%install
rm -rf %{buildroot}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libglibutil/src/gutil_idlepool.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2018 Jolla Ltd.
- * Copyright (C) 2016-2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2020 Jolla Ltd.
+ * Copyright (C) 2016-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -14,8 +14,8 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the names of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -31,6 +31,7 @@
*/
#include <gutil_idlepool.h>
+#include <gutil_macros.h>
#include <gutil_log.h>
#include <glib-object.h>
@@ -103,7 +104,7 @@
/* Clear pointer to the shared instance */
if (self->shared) *(self->shared) = NULL;
gutil_idle_pool_drain(self);
- g_slice_free(GUtilIdlePool, self);
+ gutil_slice_free(self);
}
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libglibutil/src/gutil_idlequeue.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2017 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2017-2020 Jolla Ltd.
+ * Copyright (C) 2017-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -13,9 +13,9 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Jolla Ltd nor the names of its contributors may
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -31,6 +31,7 @@
*/
#include "gutil_idlequeue.h"
+#include "gutil_macros.h"
#include "gutil_log.h"
typedef struct gutil_idle_queue_item GUtilIdleQueueItem;
@@ -60,7 +61,7 @@
if (item->destroy) {
item->destroy(item->data);
}
- g_slice_free(GUtilIdleQueueItem, item);
+ gutil_slice_free(item);
}
static
@@ -151,7 +152,7 @@
GASSERT(q->ref_count > 0);
if (g_atomic_int_dec_and_test(&q->ref_count)) {
gutil_idle_queue_cancel_all(q);
- g_slice_free(GUtilIdleQueue, q);
+ gutil_slice_free(q);
}
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libglibutil/src/gutil_ints.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2017 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2017-2021 Jolla Ltd.
+ * Copyright (C) 2017-2021 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -13,9 +13,9 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Jolla Ltd nor the names of its contributors may
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -32,6 +32,8 @@
#include "gutil_intarray.h"
#include "gutil_ints.h"
+#include "gutil_misc.h"
+#include "gutil_macros.h"
struct gutil_ints {
const int* data;
@@ -44,10 +46,10 @@
GUtilInts*
gutil_ints_new(
const int* data,
- guint count)
+ guint n)
{
- if (data && count) {
- return gutil_ints_new_take(g_memdup(data, count*sizeof(int)), count);
+ if (data && n) {
+ return gutil_ints_new_take(gutil_memdup(data, n * sizeof(int)), n);
} else {
return NULL;
}
@@ -134,7 +136,7 @@
if (ints->free_func) {
ints->free_func(ints->user_data);
}
- g_slice_free(GUtilInts, ints);
+ gutil_slice_free(ints);
}
}
}
@@ -154,12 +156,12 @@
/* We can allow the caller to free the data */
result = (int*)ints->data;
} else {
- result = g_memdup(ints->data, ints->count * sizeof(int));
+ result = gutil_memdup(ints->data, ints->count * sizeof(int));
ints->free_func(ints->user_data);
}
- g_slice_free(GUtilInts, ints);
+ gutil_slice_free(ints);
} else {
- result = g_memdup(ints->data, ints->count * sizeof(int));
+ result = gutil_memdup(ints->data, ints->count * sizeof(int));
}
return result;
} else {
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libglibutil/src/gutil_log.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2014-2019 Jolla Ltd.
- * Copyright (C) 2014-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2014-2021 Jolla Ltd.
+ * Copyright (C) 2014-2021 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -31,9 +31,17 @@
*/
#include "gutil_log.h"
+#include "gutil_misc.h"
-#if defined(DEBUG) && defined(_WIN32)
+#include <stdlib.h>
+
+#ifdef unix
+# include <unistd.h>
+# include <sys/syscall.h>
+# define gettid() ((int)syscall(SYS_gettid))
+#elif defined(_WIN32)
# include <windows.h>
+# define gettid() ((int)GetCurrentThreadId())
#endif
#ifndef GLOG_SYSLOG
@@ -49,7 +57,10 @@
#endif /* GLOG_GLIB */
/* Allows timestamps in stdout log */
-gboolean gutil_log_timestamp = TRUE;
+gboolean gutil_log_timestamp = FALSE;
+
+/* Adds thread id prefix */
+gboolean gutil_log_tid = FALSE; /* Since 1.0.51 */
/* Log configuration */
static GUTIL_DEFINE_LOG_FN2(gutil_log_default_proc);
@@ -191,8 +202,18 @@
}
#endif
if (name) {
+#ifdef gettid
+ if (gutil_log_tid)
+ fprintf(out, "[%d] %s[%s] %s%s\n", gettid(), t, name, prefix, msg);
+ else
+#endif
fprintf(out, "%s[%s] %s%s\n", t, name, prefix, msg);
} else {
+#ifdef gettid
+ if (gutil_log_tid)
+ fprintf(out, "[%d] %s%s%s\n", gettid(), t, prefix, msg);
+ else
+#endif
fprintf(out, "%s%s%s\n", t, prefix, msg);
}
if (msg != buf) g_free(msg);
@@ -280,13 +301,27 @@
}
}
- if (name || prefix) {
+ if (name || prefix
+#ifdef gettid
+ || gutil_log_tid
+#endif
+ ) {
char buf[512];
char* msg = gutil_log_format(buf, sizeof(buf), format, va);
if (!prefix) prefix = "";
if (name) {
+#ifdef gettid
+ if (gutil_log_tid)
+ syslog(priority, "[%d] [%s] %s%s", gettid(), name, prefix, msg);
+ else
+#endif
syslog(priority, "[%s] %s%s", name, prefix, msg);
} else {
+#ifdef gettid
+ if (gutil_log_tid)
+ syslog(priority, "[%d] %s%s", gettid(), prefix, msg);
+ else
+#endif
syslog(priority, "%s%s", prefix, msg);
}
if (msg != buf) g_free(msg);
@@ -455,6 +490,30 @@
return FALSE;
}
+void
+gutil_log_dump(
+ const GLogModule* module,
+ int level,
+ const char* prefix,
+ const void* data,
+ gsize size) /* Since 1.0.55 */
+{
+ if (gutil_log_enabled(module, level)) {
+ const guint8* ptr = data;
+ guint off = 0;
+
+ if (!prefix) prefix = "";
+ while (size > 0) {
+ char buf[GUTIL_HEXDUMP_BUFSIZE];
+ const guint consumed = gutil_hexdump(buf, ptr + off, size);
+
+ gutil_log(module, level, "%s%04X: %s", prefix, off, buf);
+ size -= consumed;
+ off += consumed;
+ }
+ }
+}
+
/* gutil_log_parse_option helper */
static
int
@@ -607,6 +666,33 @@
GLOG_TYPE_CUSTOM;
}
+/* Initialize defaults from the environment */
+#ifndef _WIN32
+__attribute__((constructor))
+static
+void
+gutil_log_init()
+{
+ int val = 0;
+
+ if (gutil_parse_int(getenv("GUTIL_LOG_DEFAULT_LEVEL"), 0, &val) &&
+ val >= GLOG_LEVEL_INHERIT && val <= GLOG_LEVEL_VERBOSE) {
+ gutil_log_default.level = val;
+ GDEBUG("Default log level %d", val);
+ }
+
+ if (gutil_parse_int(getenv("GUTIL_LOG_TIMESTAMP"), 0, &val) && val >= 0) {
+ gutil_log_timestamp = (val > 0);
+ GDEBUG("Timestamps %s", (val > 0) ? "enabled" : "disabled");
+ }
+
+ if (gutil_parse_int(getenv("GUTIL_LOG_TID"), 0, &val) && val >= 0) {
+ gutil_log_tid = (val > 0);
+ GDEBUG("Thread id prefix %s", (val > 0) ? "enabled" : "disabled");
+ }
+}
+#endif
+
/*
* Local Variables:
* mode: C
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libglibutil/src/gutil_misc.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2019 Jolla Ltd.
- * Copyright (C) 2016-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2021 Jolla Ltd.
+ * Copyright (C) 2016-2021 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -36,7 +36,6 @@
#include <ctype.h>
#include <limits.h>
-#include <errno.h>
void
gutil_disconnect_handlers(
@@ -46,6 +45,7 @@
{
if (G_LIKELY(instance) && G_LIKELY(ids)) {
int i;
+
for (i=0; i<count; i++) {
if (ids[i]) {
g_signal_handler_disconnect(instance, ids[i]);
@@ -64,6 +64,7 @@
if (str && data && len > 0 && !(len & 1)) {
gssize i;
guint8* ptr = data;
+
for (i=0; i<len; i+=2) {
static const guint8 hex[] = {
0, 1, 2, 3, 4, 5, 6, 7, /* 0x30..0x37 */
@@ -76,7 +77,8 @@
};
const char x1 = str[i];
const char x2 = str[i+1];
- if (isxdigit(x1) && isxdigit(x2)) {
+
+ if (g_ascii_isxdigit(x1) && g_ascii_isxdigit(x2)) {
*ptr++ = (hex[x1-0x30] << 4) + hex[x2-0x30];
} else {
return NULL;
@@ -95,9 +97,11 @@
if (str) {
if (len < 0) len = strlen(str);
if (len > 0 && !(len & 1)) {
- void* data = g_malloc(len/2);
+ const gsize n = len/2;
+ void* data = g_malloc(n);
+
if (gutil_hex2bin(str, len, data)) {
- return g_bytes_new_take(data, len/2);
+ return g_bytes_new_take(data, n);
}
g_free(data);
}
@@ -153,36 +157,74 @@
return bytes_dumped;
}
-/* Since 1.0.30 */
+static
+const char*
+gutil_strstrip(
+ const char* str,
+ char** tmp)
+{
+ /* Caller makes sure that str isn't NULL */
+ const gsize len = strlen(str);
+
+ if (g_ascii_isspace(str[0]) || g_ascii_isspace(str[len - 1])) {
+ /* Need to modify the original string */
+ return (*tmp = g_strstrip(gutil_memdup(str, len + 1)));
+ } else {
+ /* The original string is fine as is */
+ return str;
+ }
+}
+
gboolean
gutil_parse_int(
const char* str,
int base,
- int* value)
+ int* value) /* Since 1.0.30 */
+{
+ gboolean ok = FALSE;
+
+ if (str && str[0]) {
+ char* tmp = NULL;
+ char* end = NULL;
+ const char* stripped = gutil_strstrip(str, &tmp);
+ const gint64 ll = g_ascii_strtoll(stripped, &end, base);
+
+ ok = !*end && ll >= INT_MIN && ll <= INT_MAX;
+ if (ok && value) {
+ *value = (int)ll;
+ }
+ g_free(tmp);
+ }
+ return ok;
+}
+
+gboolean
+gutil_parse_uint(
+ const char* str,
+ int base,
+ unsigned int* value) /* Since 1.0.53 */
{
gboolean ok = FALSE;
if (str && str[0]) {
- char* str2 = g_strstrip(g_strdup(str));
- char* end = str2;
- gint64 l;
-
- errno = 0;
- l = g_ascii_strtoll(str2, &end, base);
- ok = !*end && errno != ERANGE && l >= INT_MIN && l <= INT_MAX;
+ char* tmp = NULL;
+ char* end = NULL;
+ const char* stripped = gutil_strstrip(str, &tmp);
+ const guint64 ull = g_ascii_strtoull(stripped, &end, base);
+
+ ok = !*end && ull <= UINT_MAX;
if (ok && value) {
- *value = (int)l;
+ *value = (unsigned int)ull;
}
- g_free(str2);
+ g_free(tmp);
}
return ok;
}
-/* since 1.0.31 */
gboolean
gutil_data_equal(
const GUtilData* data1,
- const GUtilData* data2)
+ const GUtilData* data2) /* Since 1.0.31 */
{
if (data1 == data2) {
return TRUE;
@@ -415,6 +457,97 @@
}
}
+/* Calculates the length of NULL-terminated array of pointers */
+gsize
+gutil_ptrv_length(
+ const void* ptrv) /* Since 1.0.50 */
+{
+ if (G_LIKELY(ptrv)) {
+ gsize len = 0;
+ const gconstpointer* ptr = ptrv;
+
+ while (*ptr++) len++;
+ return len;
+ } else {
+ return 0;
+ }
+}
+
+/* Frees NULL-terminated array of pointers and whatever they're pointing to. */
+void
+gutil_ptrv_free(
+ void** ptrv) /* Since 1.0.51 */
+{
+ if (G_LIKELY(ptrv)) {
+ void** ptr = ptrv;
+
+ while (*ptr) g_free(*ptr++);
+ g_free(ptrv);
+ }
+}
+
+/* Similar to g_memdup but takes gsize as the number of bytes to copy */
+void*
+gutil_memdup(
+ const void* ptr,
+ gsize size) /* Since 1.0.52 */
+{
+ if (G_LIKELY(ptr) && G_LIKELY(size)) {
+ void* copy = g_malloc(size);
+
+ memcpy(copy, ptr, size);
+ return copy;
+ } else {
+ return NULL;
+ }
+}
+
+gsize
+gutil_range_init_with_bytes(
+ GUtilRange* range,
+ GBytes* bytes) /* Since 1.0.55 */
+{
+ gsize size = 0;
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libglibutil/src/gutil_ring.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2020 Jolla Ltd.
+ * Copyright (C) 2016-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -13,9 +13,9 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Jolla Ltd nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -31,6 +31,7 @@
*/
#include "gutil_ring.h"
+#include "gutil_macros.h"
#include "gutil_log.h"
struct gutil_ring {
@@ -101,7 +102,7 @@
}
}
g_free(r->data);
- g_slice_free(GUtilRing, r);
+ gutil_slice_free(r);
}
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libglibutil/src/gutil_strv.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2014-2019 Jolla Ltd.
- * Copyright (C) 2014-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2014-2020 Jolla Ltd.
+ * Copyright (C) 2014-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -31,6 +31,7 @@
*/
#include "gutil_strv.h"
+#include "gutil_misc.h"
#include <stdlib.h>
@@ -41,13 +42,7 @@
gutil_strv_length(
const GStrV* sv)
{
- if (G_LIKELY(sv)) {
- guint i = 0;
- while (sv[i]) i++;
- return i;
- } else {
- return 0;
- }
+ return (guint) gutil_ptrv_length(sv);
}
/**
@@ -125,14 +120,42 @@
const char* s)
{
if (s) {
- const guint len = gutil_strv_length(sv);
- GStrV* newsv = g_realloc(sv, sizeof(char*)*(len+2));
- newsv[len] = g_strdup(s);
- newsv[len+1] = NULL;
- return newsv;
- } else {
- return sv;
+ guint len = gutil_strv_length(sv);
+
+ sv = g_renew(char*, sv, len + 2);
+ sv[len++] = g_strdup(s);
+ sv[len] = NULL;
+ }
+ return sv;
+}
+
+/**
+ * Appends new strings to the array.
+ */
+GStrV*
+gutil_strv_addv(
+ GStrV* sv,
+ const char* s,
+ ...)
+{
+ if (s) {
+ va_list va;
+ const char* s1;
+ guint len, i, n;
+
+ va_start(va, s);
+ for (n = 1; (s1 = va_arg(va, char*)) != NULL; n++);
+ va_end(va);
+
+ len = gutil_strv_length(sv);
+ sv = g_renew(gchar*, sv, len + n + 1);
+ sv[len++] = g_strdup(s);
+ va_start(va, s);
+ for (i = 1; i < n; i++) sv[len++] = g_strdup(va_arg(va, char*));
+ va_end(va);
+ sv[len] = NULL;
}
+ return sv;
}
/**
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libglibutil/test/test_log/test_log.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2017-2019 Jolla Ltd.
- * Copyright (C) 2017-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2017-2021 Jolla Ltd.
+ * Copyright (C) 2017-2021 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -14,8 +14,8 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the names of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -41,24 +41,24 @@
#include "gutil_log.h"
static TestOpt test_opt;
-
-/*==========================================================================*
- * Basic
- *==========================================================================*/
-
-static GString* test_log_basic_buf;
+static GString* test_log_buf;
static
void
-test_log_basic_fn(
+test_log_fn(
const char* name,
int level,
const char* format,
va_list va)
{
- g_string_append_vprintf(test_log_basic_buf, format, va);
+ g_string_append_vprintf(test_log_buf, format, va);
+ g_string_append_c(test_log_buf, '\n');
}
+/*==========================================================================*
+ * Basic
+ *==========================================================================*/
+
static
void
test_log_basic(
@@ -68,8 +68,8 @@
const GLogProc2 fn2 = gutil_log_func2;
const int level = gutil_log_default.level;
GLOG_MODULE_DEFINE2_(module, "test", gutil_log_default);
- test_log_basic_buf = g_string_new(NULL);
- gutil_log_func = test_log_basic_fn;
+ test_log_buf = g_string_new(NULL);
+ gutil_log_func = test_log_fn;
module.level = GLOG_LEVEL_INHERIT;
gutil_log_default.level = GLOG_LEVEL_ERR;
@@ -77,10 +77,10 @@
gutil_log(NULL, GLOG_LEVEL_DEBUG, "Debug!");
gutil_log(&module, GLOG_LEVEL_DEBUG, "Debug!");
gutil_log_assert(NULL, GLOG_LEVEL_WARN, "Test!", __FILE__, __LINE__);
- g_assert(!test_log_basic_buf->len);
+ g_assert(!test_log_buf->len);
gutil_log(&module, GLOG_LEVEL_ERR, "Err!");
- g_assert(test_log_basic_buf->len);
- g_string_set_size(test_log_basic_buf, 0);
+ g_assert(test_log_buf->len);
+ g_string_set_size(test_log_buf, 0);
/* With NULL parent, still gutil_log_default is going to be checked */
module.parent = NULL;
@@ -88,19 +88,19 @@
gutil_log(NULL, GLOG_LEVEL_DEBUG, "Debug!");
gutil_log(&module, GLOG_LEVEL_DEBUG, "Debug!");
gutil_log_assert(NULL, GLOG_LEVEL_WARN, "Test!", __FILE__, __LINE__);
- g_assert(!test_log_basic_buf->len);
+ g_assert(!test_log_buf->len);
gutil_log(&module, GLOG_LEVEL_ERR, "Err!");
- g_assert(test_log_basic_buf->len);
- g_string_set_size(test_log_basic_buf, 0);
+ g_assert(test_log_buf->len);
+ g_string_set_size(test_log_buf, 0);
gutil_log(&module, GLOG_LEVEL_ALWAYS, "Always!");
- g_assert(test_log_basic_buf->len);
- g_string_set_size(test_log_basic_buf, 0);
+ g_assert(test_log_buf->len);
+ g_string_set_size(test_log_buf, 0);
/* Test GLOG_FLAG_DISABLE */
module.flags |= GLOG_FLAG_DISABLE;
gutil_log(&module, GLOG_LEVEL_ALWAYS, "Always!");
- g_assert(!test_log_basic_buf->len);
+ g_assert(!test_log_buf->len);
module.flags &= ~GLOG_FLAG_DISABLE;
/* Without log functions these calls have no effect */
@@ -109,8 +109,8 @@
gutil_log_func2 = NULL;
gutil_log(NULL, GLOG_LEVEL_ALWAYS, "Always!");
- g_string_free(test_log_basic_buf, TRUE);
- test_log_basic_buf = NULL;
+ g_string_free(test_log_buf, TRUE);
+ test_log_buf = NULL;
gutil_log_default.level = level;
gutil_log_func = fn;
gutil_log_func2 = fn2;
@@ -169,7 +169,7 @@
stdout = default_stdout;
g_assert(fflush(out) == 0);
GDEBUG("%s", buf->str);
- g_assert(!g_strcmp0(buf->str, "WARNING: Test\n"));
+ g_assert_cmpstr(buf->str, == ,"WARNING: Test\n");
g_string_set_size(buf, 0);
/* Error prefix */
@@ -178,7 +178,7 @@
stdout = default_stdout;
g_assert(fflush(out) == 0);
GDEBUG("%s", buf->str);
- g_assert(!g_strcmp0(buf->str, "ERROR: Test\n"));
+ g_assert_cmpstr(buf->str, == ,"ERROR: Test\n");
g_string_set_size(buf, 0);
/* Empty name (dropped) */
@@ -188,7 +188,7 @@
stdout = default_stdout;
g_assert(fflush(out) == 0);
GDEBUG("%s", buf->str);
- g_assert(!g_strcmp0(buf->str, "Test\n"));
+ g_assert_cmpstr(buf->str, == ,"Test\n");
g_string_set_size(buf, 0);
/* Non-empty name */
@@ -198,7 +198,7 @@
stdout = default_stdout;
g_assert(fflush(out) == 0);
GDEBUG("%s", buf->str);
- g_assert(!g_strcmp0(buf->str, "[test] Test\n"));
+ g_assert_cmpstr(buf->str, == ,"[test] Test\n");
g_string_set_size(buf, 0);
/* Hide the name */
@@ -208,7 +208,7 @@
stdout = default_stdout;
g_assert(fflush(out) == 0);
GDEBUG("%s", buf->str);
- g_assert(!g_strcmp0(buf->str, "Test\n"));
+ g_assert_cmpstr(buf->str, == ,"Test\n");
g_string_set_size(buf, 0);
/* Forward output to test_log_drop */
@@ -284,13 +284,56 @@
const GLogProc fn = gutil_log_func;
g_assert(gutil_log_set_type(GLOG_TYPE_STDOUT, "test"));
g_assert(gutil_log_func == gutil_log_stdout);
- g_assert(!g_strcmp0(gutil_log_get_type(), GLOG_TYPE_STDOUT));
+ g_assert_cmpstr(gutil_log_get_type(), == ,GLOG_TYPE_STDOUT);
g_assert(gutil_log_set_type(GLOG_TYPE_STDERR, "test"));
g_assert(gutil_log_func == gutil_log_stderr);
- g_assert(!g_strcmp0(gutil_log_get_type(), GLOG_TYPE_STDERR));
+ g_assert_cmpstr(gutil_log_get_type(), == ,GLOG_TYPE_STDERR);
g_assert(!gutil_log_set_type("whatever", "test"));
gutil_log_func = NULL;
- g_assert(!g_strcmp0(gutil_log_get_type(), GLOG_TYPE_CUSTOM));
+ g_assert_cmpstr(gutil_log_get_type(), == ,GLOG_TYPE_CUSTOM);
+ gutil_log_func = fn;
+}
+
+/*==========================================================================*
+ * Dump
+ *==========================================================================*/
+
+static
+void
+test_log_dump(
+ void)
+{
+ static const guint8 short_data[] = { 0x01, 0x02, 0x03, 0x04 };
+ static const guint8 long_data[] = {
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
+ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
+ 0x00
+ };
+
+ const GLogProc fn = gutil_log_func;
+ test_log_buf = g_string_new(NULL);
+ gutil_log_func = test_log_fn;
+
+ gutil_log_dump(&gutil_log_default, GLOG_LEVEL_NONE, NULL,
+ short_data, sizeof(short_data));
+ g_assert_cmpuint(test_log_buf->len, == ,0);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libglibutil/test/test_misc/test_misc.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2016-2019 Jolla Ltd.
- * Copyright (C) 2016-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2016-2021 Jolla Ltd.
+ * Copyright (C) 2016-2021 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -175,18 +175,59 @@
g_assert(!gutil_parse_int("0 trailing garbage", 0, NULL));
g_assert(gutil_parse_int("0", 0, NULL));
g_assert(gutil_parse_int("0", 0, &value));
- g_assert(value == 0);
+ g_assert_cmpint(value, == ,0);
+ g_assert(gutil_parse_int("-1", 0, &value));
+ g_assert_cmpint(value, == ,-1);
+ g_assert(gutil_parse_int("42", 0, &value));
+ g_assert_cmpint(value, == ,42);
g_assert(!gutil_parse_int("0x10000000000000000", 0, &value));
g_assert(!gutil_parse_int("-2147483649", 0, &value));
g_assert(!gutil_parse_int("4294967295", 0, &value));
g_assert(gutil_parse_int(" 0x7fffffff ", 0, &value));
- g_assert(value == 0x7fffffff);
+ g_assert_cmpint(value, == ,0x7fffffff);
g_assert(gutil_parse_int(" 7fffffff ", 16, &value));
- g_assert(value == 0x7fffffff);
+ g_assert_cmpint(value, == ,0x7fffffff);
+ g_assert(gutil_parse_int("7ffffffe ", 16, &value));
+ g_assert_cmpint(value, == ,0x7ffffffe);
g_assert(!gutil_parse_int("0xffffffff", 0, &value));
}
/*==========================================================================*
+ * parse_uint
+ *==========================================================================*/
+
+static
+void
+test_parse_uint(
+ void)
+{
+ unsigned int value;
+
+ g_assert(!gutil_parse_uint(NULL, 0, NULL));
+ g_assert(!gutil_parse_uint("", 0, NULL));
+ g_assert(!gutil_parse_uint("garbage", 0, NULL));
+ g_assert(!gutil_parse_uint("0 trailing garbage", 0, NULL));
+ g_assert(gutil_parse_uint("0", 0, NULL));
+ g_assert(gutil_parse_uint("0", 0, &value));
+ g_assert_cmpuint(value, == ,0);
+ g_assert(gutil_parse_uint("42", 0, &value));
+ g_assert_cmpuint(value, == ,42);
+ g_assert(!gutil_parse_uint("0x10000000000000000", 0, &value));
+ g_assert(!gutil_parse_uint("-2147483649", 0, &value));
+ g_assert(!gutil_parse_uint("-1", 0, &value));
+ g_assert(gutil_parse_uint("4294967295", 0, &value));
+ g_assert_cmpuint(value, == ,4294967295);
+ g_assert(gutil_parse_uint(" 0x7fffffff ", 0, &value));
+ g_assert_cmpuint(value, == ,0x7fffffff);
+ g_assert(gutil_parse_uint(" 7fffffff ", 16, &value));
+ g_assert_cmpuint(value, == ,0x7fffffff);
+ g_assert(gutil_parse_uint("7ffffffe ", 16, &value));
+ g_assert_cmpuint(value, == ,0x7ffffffe);
+ g_assert(gutil_parse_uint("0xffffffff", 0, &value));
+ g_assert_cmpuint(value, == ,0xffffffff);
+}
+
+/*==========================================================================*
* data_equal
*==========================================================================*/
@@ -485,6 +526,138 @@
}
/*==========================================================================*
+ * ptrv_length
+ *==========================================================================*/
+
+static
+void
+test_ptrv_length(
+ void)
+{
+ static const gconstpointer ptrv0[] = { NULL };
+ static const gconstpointer ptrv1[] = { ptrv0, NULL };
+
+ g_assert_cmpuint(gutil_ptrv_length(NULL), == ,0);
+ g_assert_cmpuint(gutil_ptrv_length(ptrv0), == ,0);
+ g_assert_cmpuint(gutil_ptrv_length(ptrv1), == ,1);
+}
+
+/*==========================================================================*
+ * ptrv_free
+ *==========================================================================*/
+
+static
+void
+test_ptrv_free(
+ void)
+{
+ void** ptrv0 = g_new0(void*, 1);
+ void** ptrv1 = g_new0(void*, 2);
+
+ ptrv1[0] = g_new0(int, 1);
+ gutil_ptrv_free(NULL);
+ gutil_ptrv_free(ptrv0);
+ gutil_ptrv_free(ptrv1);
+}
+
+/*==========================================================================*
+ * memdup
+ *==========================================================================*/
+
+static
+void
+test_memdup(
+ void)
+{
+ static const guint8 data[] = { 0x01, 0x02, 0x03 };
+ void* copy = gutil_memdup(data, sizeof(data));
+
+ g_assert(copy);
+ g_assert(!memcmp(copy, data, sizeof(data)));
+ g_free(copy);
+
+ g_assert(!gutil_memdup(data, 0));
+ g_assert(!gutil_memdup(NULL, 0));
+ g_assert(!gutil_memdup(NULL, 1));
+}
+
+/*==========================================================================*
+ * range_init
+ *==========================================================================*/
+
+static
+void
+test_range_init(
+ void)
+{
+ static const guint8 data[] = { 0x01, 0x02, 0x03 };
+ GBytes* bytes = g_bytes_new_static(data, sizeof(data));
+ GUtilRange range;
+
+ g_assert(!gutil_range_init_with_bytes(NULL, NULL));
+ g_assert(!gutil_range_init_with_bytes(&range, NULL));
+ g_assert(!range.ptr);
+ g_assert(!range.end);
+
+ g_assert(gutil_range_init_with_bytes(&range, bytes) == sizeof(data));
+ g_assert(range.ptr == data);
+ g_assert(range.end == (data + sizeof(data)));
+ g_bytes_unref(bytes);
+}
+
+/*==========================================================================*
+ * range_prefix
+ *==========================================================================*/
+
+static
+void
+test_range_prefix(
+ void)
+{
+ static const guint8 data[] = { 0x01, 0x02, 0x03, 0x04 };
+ static const guint8 prefix[] = { 0x01, 0x02 };
+ static const guint8 not_prefix[] = { 0x03, 0x04 };
+ static const guint8 too_long[] = { 0x01, 0x02, 0x03, 0x04, 0x05 };
+ GUtilData prefix_data, not_prefix_data, too_long_data;
+ GUtilRange range;
+
+ memset(&range, 0, sizeof(range));
+ g_assert(!gutil_range_has_prefix(NULL, NULL));
+ g_assert(!gutil_range_has_prefix(&range, NULL));
+
+ not_prefix_data.bytes = not_prefix;
+ not_prefix_data.size = sizeof(not_prefix);
+ too_long_data.bytes = too_long;
+ too_long_data.size = sizeof(too_long);
+
+ range.end = range.ptr = data; /* Empty range */
+ memset(&prefix_data, 0, sizeof(prefix_data)); /* Empty prefix */
+ /* Empty range doesn't have NULL prefix */
+ g_assert(!gutil_range_has_prefix(&range, NULL));
+ /* But does have empty prefix */
+ g_assert(gutil_range_has_prefix(&range, &prefix_data));
+
+ /* And doesn't have non-empty prefix */
+ g_assert(!gutil_range_has_prefix(&range, ¬_prefix_data));
+ prefix_data.bytes = prefix;
+ prefix_data.size = sizeof(prefix);
+ g_assert(!gutil_range_has_prefix(&range, &prefix_data));
+
+ range.end = range.ptr + sizeof(data);
+
+ g_assert(gutil_range_has_prefix(&range, &prefix_data));
+ g_assert(!gutil_range_has_prefix(&range, ¬_prefix_data));
+ g_assert(!gutil_range_has_prefix(&range, &too_long_data));
+
+ /* Test skipping */
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/libglibutil/test/test_strv/test_strv.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2015-2019 Jolla Ltd.
- * Copyright (C) 2015-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2015-2020 Jolla Ltd.
+ * Copyright (C) 2015-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -84,6 +84,35 @@
}
/*==========================================================================*
+ * Add
+ *==========================================================================*/
+
+static
+void
+test_addv(
+ void)
+{
+ char** sv1;
+ char** sv2;
+
+ g_assert(!gutil_strv_add(NULL, NULL));
+ g_assert(!gutil_strv_addv(NULL, NULL, NULL));
+
+ sv1 = gutil_strv_add(NULL, "a");
+ g_assert(gutil_strv_addv(sv1, NULL, NULL) == sv1);
+ sv2 = gutil_strv_addv(NULL, "a", NULL);
+ g_assert(gutil_strv_equal(sv1, sv2));
+
+ g_strfreev(sv1);
+ sv1 = g_strsplit("a,bb,ccc", ",", 0);
+ sv2 = gutil_strv_addv(sv2, "bb", "ccc", NULL);
+ g_assert(gutil_strv_equal(sv1, sv2));
+
+ g_strfreev(sv1);
+ g_strfreev(sv2);
+}
+
+/*==========================================================================*
* Equal
*==========================================================================*/
@@ -92,15 +121,14 @@
test_equal(
void)
{
- /* gutil_strv_add(NULL, NULL) is a nop */
- char** sv1 = gutil_strv_add(gutil_strv_add(gutil_strv_add(gutil_strv_add(
- gutil_strv_add(gutil_strv_add(NULL, NULL), "a"), "b"), "c"), " "), "");
+ char** sv1 = gutil_strv_addv(NULL, "a", "b", "c", " ", "", NULL);
char** sv2 = g_strsplit("a,b,c, ,", ",", 0);
char** sv3 = g_strsplit("a,a,a, ,", ",", 0);
char** sv4 = g_strsplit("a,b,c,,", ",", 0);
char** sv5 = g_strsplit("a,b,c,", ",", 0);
char* empty = NULL;
+ g_assert(!gutil_strv_add(NULL, NULL));
g_assert(gutil_strv_equal(NULL, NULL));
g_assert(gutil_strv_equal(NULL, &empty));
g_assert(gutil_strv_equal(&empty, NULL));
@@ -247,6 +275,7 @@
{
g_test_init(&argc, &argv, NULL);
g_test_add_func(TEST_PREFIX "basic", test_basic);
+ g_test_add_func(TEST_PREFIX "addv", test_addv);
g_test_add_func(TEST_PREFIX "last", test_last);
g_test_add_func(TEST_PREFIX "equal", test_equal);
g_test_add_func(TEST_PREFIX "find", test_find);
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/main.cpp
^
|
@@ -1,6 +1,6 @@
/*
- Copyright (C) 2014-2020 Jolla Ltd.
- Copyright (C) 2014-2020 Slava Monich <slava.monich@jolla.com>
+ Copyright (C) 2014-2021 Jolla Ltd.
+ Copyright (C) 2014-2021 Slava Monich <slava.monich@jolla.com>
You may use this file under the terms of BSD license as follows:
@@ -37,6 +37,7 @@
#include "HarbourDebug.h"
#include "HarbourSigChildHandler.h"
+#include "HarbourSystemInfo.h"
#include "HarbourTransferMethodsModel.h"
#include <sailfishapp.h>
@@ -110,6 +111,7 @@
FsIoLogModel* mmsLog = new FsIoLogModel(settings, app);
MMSEngine* mmsEngine = new MMSEngine(mmsLog->dirName(), app);
HarbourTransferMethodsModel* tm = new HarbourTransferMethodsModel(app);
+ HarbourSystemInfo* si = new HarbourSystemInfo(app);
tm->setFilter(mmsLog->archiveType());
mmsLog->connect(mmsEngine, SIGNAL(message(QString,bool)),
SLOT(append(QString,bool)));
@@ -127,7 +129,7 @@
QQmlContext* context = view->rootContext();
context->setContextProperty("FsIoLog", mmsLog);
context->setContextProperty("TransferMethodsModel", tm);
- context->setContextProperty("AppSettings", settings);
+ context->setContextProperty("SystemInfo", si);
context->setContextProperty("AppSettings", settings);
context->setContextProperty("AppSettingsMenu",
QVariant::fromValue(appSettingsMenu));
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/src/mmslogmodel.cpp
^
|
@@ -1,6 +1,6 @@
/*
- Copyright (C) 2014-2020 Jolla Ltd.
- Copyright (C) 2014-2020 Slava Monich <slava.monich@jolla.com>
+ Copyright (C) 2014-2021 Jolla Ltd.
+ Copyright (C) 2014-2021 Slava Monich <slava.monich@jolla.com>
You may use this file under the terms of BSD license as follows:
@@ -302,14 +302,8 @@
iPid = fork();
if (iPid > 0) {
// Parent
- HDEBUG("Tar done, pid" << aPid << "status" << aStatus);
- const QByteArray tarball(iArchivePath.toLocal8Bit());
- if (chown(tarball.constData(), getuid(), getgid()) < 0) {
- HWARN("Failed to chown" << tarball.constData() << ":"
- << strerror(errno));
- }
- iPid = -1;
- packingChanged();
+ HDEBUG("Tar started, pid" << iPid);
+ packingChanged();
} else if (iPid == 0) {
// Child
sleep(1); // To improve parent's chance to finish the flush
@@ -323,6 +317,11 @@
{
if (iPid > 0 && iPid == aPid) {
HDEBUG("Tar done, pid" << aPid <<", status" << aStatus);
+ const QByteArray tarball(iArchivePath.toLocal8Bit());
+ if (chown(tarball.constData(), getuid(), getgid()) < 0) {
+ HWARN("Failed to chown" << tarball.constData() << ":"
+ << strerror(errno));
+ }
iPid = -1;
packingChanged();
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/translations/harbour-mmslog-nl.ts
^
|
@@ -35,6 +35,11 @@
<source>Pack and send</source>
<translation>Inpakken en verzenden</translation>
</message>
+ <message id="mmslog-sharepage-sharing_broken">
+ <source>In-app sharing is not available in this version of Sailfish OS. Use the pulley menu to save tarball to the documents folder.</source>
+ <extracomment>Info label displayed instead of sharing method list</extracomment>
+ <translation type="unfinished">In-app delen is niet beschikbaar voor deze versie van Sailfish OS. Gebruik het katrolmenu om tarball op te slaan in de documentenmap.</translation>
+ </message>
<message id="mmslog-sharepage-warning">
<source>Keep in mind that some of the information contained in this archive may be considered private. If you would like to check what you are about to send, please consider sending it to yourself first and emailing this file to mms-debug@jolla.com later from your computer. If you trust Jolla, then you can conveniently email it to Jolla directly from your phone.</source>
<translation>Let op: sommige informatie in dit archief is mogelijk privé. Als je wil nakijken wat je gaat verzenden, kan je het eerst naar je eigen e-mailadres verzenden en daar de inhoud controleren, en daarna vanop je computer dit bestand naar mms-debug@jolla.com te verzenden. Als je Jolla vertrouwt, kan je het gewoonweg rechtstreeks vanop je telefoon e-mailen.</translation>
@@ -57,8 +62,14 @@
</message>
<message id="mmslog-settings-page-header">
<source>MMS Logger</source>
+ <extracomment>Settings page title (app name)</extracomment>
<translation>Mms-logger</translation>
</message>
+ <message id="mmslog-settings-version">
+ <source>Version %1</source>
+ <extracomment>Settings page header description (app version)</extracomment>
+ <translation type="unfinished">Versie %1</translation>
+ </message>
<message id="mmslog-settings-logsizelimit">
<source>Screen buffer size</source>
<translation>Schermbuffergrootte</translation>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/translations/harbour-mmslog-ru.ts
^
|
@@ -35,6 +35,11 @@
<source>Pack and send</source>
<translation>Упаковка и отправка</translation>
</message>
+ <message id="mmslog-sharepage-sharing_broken">
+ <source>In-app sharing is not available in this version of Sailfish OS. Use the pulley menu to save tarball to the documents folder.</source>
+ <extracomment>Info label displayed instead of sharing method list</extracomment>
+ <translation>Увы, но в этой версии Sailfish OS ничего так просто расшарить не получится. Вы можете сохранить тарбол в документы, а дальше разбирайтесь сами, что с ним делать.</translation>
+ </message>
<message id="mmslog-sharepage-warning">
<source>Keep in mind that some of the information contained in this archive may be considered private. If you would like to check what you are about to send, please consider sending it to yourself first and emailing this file to mms-debug@jolla.com later from your computer. If you trust Jolla, then you can conveniently email it to Jolla directly from your phone.</source>
<translation>Возможно, вы не захотите делиться с другими некоторой информацией, которую собрала эта программа. Вы можете сначала переслать файл на свой компьютер, проверить, нет ли внутри чего лишнего и отправить его по адресу mms-debug@jolla.com привычным вам способом. Если же вы доверяете Jolla, то можете отослать его в службу поддержки непосредственно с телефона.</translation>
@@ -57,7 +62,13 @@
</message>
<message id="mmslog-settings-page-header">
<source>MMS Logger</source>
- <translation>MMS Регистратор</translation>
+ <extracomment>Settings page title (app name)</extracomment>
+ <translation>MMS логгер</translation>
+ </message>
+ <message id="mmslog-settings-version">
+ <source>Version %1</source>
+ <extracomment>Settings page header description (app version)</extracomment>
+ <translation>Версия %1</translation>
</message>
<message id="mmslog-settings-logsizelimit">
<source>Screen buffer size</source>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/translations/harbour-mmslog-sv.ts
^
|
@@ -35,6 +35,11 @@
<source>Pack and send</source>
<translation>Paketera och sänd</translation>
</message>
+ <message id="mmslog-sharepage-sharing_broken">
+ <source>In-app sharing is not available in this version of Sailfish OS. Use the pulley menu to save tarball to the documents folder.</source>
+ <extracomment>Info label displayed instead of sharing method list</extracomment>
+ <translation type="unfinished">Delning i appen är inte tillgänglig för den här versionen av Sailfish OS. Använd remskivmenyn för att spara tarball i dokumentmappen.</translation>
+ </message>
<message id="mmslog-sharepage-warning">
<source>Keep in mind that some of the information contained in this archive may be considered private. If you would like to check what you are about to send, please consider sending it to yourself first and emailing this file to mms-debug@jolla.com later from your computer. If you trust Jolla, then you can conveniently email it to Jolla directly from your phone.</source>
<translation>Notera att viss information i detta arkiv kan anses vara av privat natur. Om du vill veta vad du är på väg att skicka, kan du skicka det till dig själv först och sedan skicka filen vidare till mms-debug@jolla.com, från din dator. Om du litar på Jolla, kan du naturligtvis skicka den direkt till Jolla från din telefon.</translation>
@@ -57,8 +62,14 @@
</message>
<message id="mmslog-settings-page-header">
<source>MMS Logger</source>
+ <extracomment>Settings page title (app name)</extracomment>
<translation>MMS Logger</translation>
</message>
+ <message id="mmslog-settings-version">
+ <source>Version %1</source>
+ <extracomment>Settings page header description (app version)</extracomment>
+ <translation type="unfinished">Version %1</translation>
+ </message>
<message id="mmslog-settings-logsizelimit">
<source>Screen buffer size</source>
<translation>Skärmbuffertstorlek</translation>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-mmslog-1.0.18.tar.bz2/translations/harbour-mmslog.ts
^
|
@@ -35,6 +35,11 @@
<source>Pack and send</source>
<translation>Pack and send</translation>
</message>
+ <message id="mmslog-sharepage-sharing_broken">
+ <source>In-app sharing is not available in this version of Sailfish OS. Use the pulley menu to save tarball to the documents folder.</source>
+ <extracomment>Info label displayed instead of sharing method list</extracomment>
+ <translation>In-app sharing is not available in this version of Sailfish OS. Use the pulley menu to save tarball to the documents folder.</translation>
+ </message>
<message id="mmslog-sharepage-warning">
<source>Keep in mind that some of the information contained in this archive may be considered private. If you would like to check what you are about to send, please consider sending it to yourself first and emailing this file to mms-debug@jolla.com later from your computer. If you trust Jolla, then you can conveniently email it to Jolla directly from your phone.</source>
<translation>Keep in mind that some of the information contained in this archive may be considered private. If you would like to check what you are about to send, please consider sending it to yourself first and emailing this file to mms-debug@jolla.com later from your computer. If you trust Jolla, then you can conveniently email it to Jolla directly from your phone.</translation>
@@ -57,8 +62,14 @@
</message>
<message id="mmslog-settings-page-header">
<source>MMS Logger</source>
+ <extracomment>Settings page title (app name)</extracomment>
<translation>MMS Logger</translation>
</message>
+ <message id="mmslog-settings-version">
+ <source>Version %1</source>
+ <extracomment>Settings page header description (app version)</extracomment>
+ <translation>Version %1</translation>
+ </message>
<message id="mmslog-settings-logsizelimit">
<source>Screen buffer size</source>
<translation>Screen buffer size</translation>
|