Compare commits
No commits in common. "87104a3d719e21401eb7204881d5f4127d91812f" and "0c05a62982e3e8007b2099bfc826f59a268ad656" have entirely different histories.
87104a3d71
...
0c05a62982
6 changed files with 12 additions and 141 deletions
|
@ -18,8 +18,8 @@
|
||||||
|
|
||||||
import QtQuick 2.12
|
import QtQuick 2.12
|
||||||
import QtQuick.Dialogs 1.3
|
import QtQuick.Dialogs 1.3
|
||||||
//import QtQuick.Controls 2.15
|
import QtQuick.Controls 2.15
|
||||||
import eu.ad5001.MixedMenu 1.1
|
//import eu.ad5001.MixedMenu 1.1
|
||||||
import "js/objects.js" as Objects
|
import "js/objects.js" as Objects
|
||||||
import "js/historylib.js" as HistoryLib
|
import "js/historylib.js" as HistoryLib
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ MenuBar {
|
||||||
Action {
|
Action {
|
||||||
text: qsTr("&User manual")
|
text: qsTr("&User manual")
|
||||||
icon.name: 'documentation'
|
icon.name: 'documentation'
|
||||||
onTriggered: Qt.openUrlExternally("https://git.ad5001.eu/Ad5001/LogarithmPlotter/wiki/User-Manual")
|
onTriggered: Qt.openUrlExternally("https://git.ad5001.eu/Ad5001/LogarithmPlotter/wiki")
|
||||||
}
|
}
|
||||||
Action {
|
Action {
|
||||||
text: qsTr("&Changelog")
|
text: qsTr("&Changelog")
|
||||||
|
|
|
@ -47,7 +47,7 @@ ApplicationWindow {
|
||||||
SystemPalette { id: sysPalette; colorGroup: SystemPalette.Active }
|
SystemPalette { id: sysPalette; colorGroup: SystemPalette.Active }
|
||||||
SystemPalette { id: sysPaletteIn; colorGroup: SystemPalette.Disabled }
|
SystemPalette { id: sysPaletteIn; colorGroup: SystemPalette.Disabled }
|
||||||
|
|
||||||
menuBar: appMenu.trueItem
|
menuBar: appMenu//.trueItem
|
||||||
|
|
||||||
AppMenuBar {id: appMenu}
|
AppMenuBar {id: appMenu}
|
||||||
|
|
||||||
|
@ -66,16 +66,15 @@ ApplicationWindow {
|
||||||
z: 3
|
z: 3
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Drawer {
|
||||||
id: sidebar
|
id: sidebar
|
||||||
width: 300
|
width: 300
|
||||||
height: parent.height
|
height: parent.height
|
||||||
//y: root.menuBar.height
|
y: root.menuBar.height
|
||||||
readonly property bool inPortrait: root.width < root.height
|
readonly property bool inPortrait: root.width < root.height
|
||||||
/*modal: true// inPortrait
|
modal: inPortrait
|
||||||
interactive: inPortrait
|
interactive: inPortrait
|
||||||
position: inPortrait ? 0 : 1
|
position: inPortrait ? 0 : 1
|
||||||
*/
|
|
||||||
visible: !inPortrait
|
visible: !inPortrait
|
||||||
|
|
||||||
|
|
||||||
|
@ -110,7 +109,7 @@ ApplicationWindow {
|
||||||
anchors.topMargin: 5
|
anchors.topMargin: 5
|
||||||
anchors.leftMargin: 5
|
anchors.leftMargin: 5
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
//anchors.bottomMargin: sidebarSelector.height
|
anchors.bottomMargin: sidebarSelector.height
|
||||||
width: parent.width - 5
|
width: parent.width - 5
|
||||||
currentIndex: sidebarSelector.currentIndex
|
currentIndex: sidebarSelector.currentIndex
|
||||||
z: -1
|
z: -1
|
||||||
|
@ -138,8 +137,8 @@ ApplicationWindow {
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.left: sidebar.inPortrait ? parent.left : sidebar.right
|
anchors.left: sidebar.inPortrait ? parent.left : sidebar.right
|
||||||
height: parent.height
|
height: parent.height
|
||||||
width: sidebar.inPortrait ? parent.width : parent.width - sidebar.width//*sidebar.position
|
width: sidebar.inPortrait ? parent.width : parent.width - sidebar.position*sidebar.width
|
||||||
x: sidebar.width//*sidebar.position
|
x: sidebar.position*sidebar.width
|
||||||
|
|
||||||
xmin: settings.xmin
|
xmin: settings.xmin
|
||||||
ymax: settings.ymax
|
ymax: settings.ymax
|
||||||
|
|
|
@ -112,9 +112,6 @@ Item {
|
||||||
verticalAlignment: TextInput.AlignVCenter
|
verticalAlignment: TextInput.AlignVCenter
|
||||||
horizontalAlignment: control.label == "" ? TextInput.AlignLeft : TextInput.AlignHCenter
|
horizontalAlignment: control.label == "" ? TextInput.AlignLeft : TextInput.AlignHCenter
|
||||||
color: sysPalette.windowText
|
color: sysPalette.windowText
|
||||||
validator: RegExpValidator {
|
|
||||||
regExp: control.isInt ? /-?[0-9]+/ : control.isDouble ? /-?[0-9]+(\.[0-9]+)?/ : /.+/
|
|
||||||
}
|
|
||||||
focus: true
|
focus: true
|
||||||
text: control.defValue
|
text: control.defValue
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
|
|
|
@ -84,8 +84,8 @@ class EditedProperty extends C.Action {
|
||||||
this.next = this.propertyType.translatedValues[this.propertyType.values.indexOf(this.newValue)]
|
this.next = this.propertyType.translatedValues[this.propertyType.values.indexOf(this.newValue)]
|
||||||
break;
|
break;
|
||||||
case "ObjectType":
|
case "ObjectType":
|
||||||
this.prev = this.previousValue == null ? "null" : this.previousValue.name
|
this.prev = this.previousValue.name
|
||||||
this.next = this.newValue == null ? "null" : this.newValue.name
|
this.next = this.newValue.name
|
||||||
break;
|
break;
|
||||||
case "List":
|
case "List":
|
||||||
this.prev = this.previousValue.join(",")
|
this.prev = this.previousValue.join(",")
|
||||||
|
|
|
@ -146,15 +146,9 @@ class XCursor extends Common.DrawableObject {
|
||||||
|
|
||||||
switch(this.labelPosition) {
|
switch(this.labelPosition) {
|
||||||
case 'left':
|
case 'left':
|
||||||
case 'above-left':
|
|
||||||
case 'below-left':
|
|
||||||
case 'below':
|
|
||||||
case 'above':
|
|
||||||
canvas.drawVisibleText(ctx, text, xpos-textSize.width-5, textSize.height+5)
|
canvas.drawVisibleText(ctx, text, xpos-textSize.width-5, textSize.height+5)
|
||||||
break;
|
break;
|
||||||
case 'right':
|
case 'right':
|
||||||
case 'above-right':
|
|
||||||
case 'below-right':
|
|
||||||
canvas.drawVisibleText(ctx, text, xpos+5, textSize.height+5)
|
canvas.drawVisibleText(ctx, text, xpos+5, textSize.height+5)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -165,25 +159,11 @@ class XCursor extends Common.DrawableObject {
|
||||||
var ypox = canvas.y2px(this.targetElement.execute(this.x.execute()))
|
var ypox = canvas.y2px(this.targetElement.execute(this.x.execute()))
|
||||||
switch(this.labelPosition) {
|
switch(this.labelPosition) {
|
||||||
case 'left':
|
case 'left':
|
||||||
case 'below':
|
|
||||||
case 'above':
|
|
||||||
canvas.drawVisibleText(ctx, text, xpos-textSize.width-5, ypox+textSize.height)
|
canvas.drawVisibleText(ctx, text, xpos-textSize.width-5, ypox+textSize.height)
|
||||||
break;
|
break;
|
||||||
case 'above-left':
|
|
||||||
canvas.drawVisibleText(ctx, text, xpos-textSize.width-5, ypox+textSize.height+12)
|
|
||||||
break;
|
|
||||||
case 'below-left':
|
|
||||||
canvas.drawVisibleText(ctx, text, xpos-textSize.width-5, ypox+textSize.height-12)
|
|
||||||
break;
|
|
||||||
case 'right':
|
case 'right':
|
||||||
canvas.drawVisibleText(ctx, text, xpos+5, ypox+textSize.height)
|
canvas.drawVisibleText(ctx, text, xpos+5, ypox+textSize.height)
|
||||||
break;
|
break;
|
||||||
case 'above-right':
|
|
||||||
canvas.drawVisibleText(ctx, text, xpos+5, ypox+textSize.height+12)
|
|
||||||
break;
|
|
||||||
case 'below-right':
|
|
||||||
canvas.drawVisibleText(ctx, text, xpos+5, ypox+textSize.height-12)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,105 +0,0 @@
|
||||||
<?php
|
|
||||||
#
|
|
||||||
# LogarithmPlotter - 2D plotter software to make BODE plots, sequences and repartition functions.
|
|
||||||
# Copyright (C) 2022 Ad5001 <mail@ad5001.eu>
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
|
|
||||||
# This PHP script generates manuals for LogarithmPlotter in Markdown, HTML and PDF.
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
error_reporting(E_ALL);
|
|
||||||
|
|
||||||
function generate_html(string $title, string $body) : string {
|
|
||||||
$h = "<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>$title</title>
|
|
||||||
<meta charset=\"utf-8\">
|
|
||||||
<style>* {
|
|
||||||
font-family: sans-serif
|
|
||||||
}</style>
|
|
||||||
</head>
|
|
||||||
<body>$body</body>
|
|
||||||
</html>";
|
|
||||||
return $h;
|
|
||||||
}
|
|
||||||
|
|
||||||
function fetch_page(string $man) : string {
|
|
||||||
$ch = curl_init();
|
|
||||||
curl_setopt($ch, CURLOPT_URL, "https://git.ad5001.eu/api/v1/repos/Ad5001/LogarithmPlotter/wiki/page/{$man}");
|
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
||||||
|
|
||||||
$data = json_decode(curl_exec($ch));
|
|
||||||
return base64_decode($data->content_base64);
|
|
||||||
}
|
|
||||||
|
|
||||||
function extract_markdown_links(string $content) : array {
|
|
||||||
preg_match_all(
|
|
||||||
"/\[[\w\d+:',é -]*\]\(([\w\d'+%-]+)\)/i",
|
|
||||||
$content,
|
|
||||||
$matches
|
|
||||||
);
|
|
||||||
return $matches[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
function do_replacements(string $man_name, string $content) : string {
|
|
||||||
$cnt = preg_replace("/# /", "## ", $content);
|
|
||||||
if(str_contains($cnt, $man_name))
|
|
||||||
$cnt = preg_replace("/$man_name/", "#$man_name", $cnt);
|
|
||||||
return $cnt;
|
|
||||||
}
|
|
||||||
|
|
||||||
function remove_navigation(string $content) : string {
|
|
||||||
$lines = explode("\n", $content);
|
|
||||||
return implode("\n", array_slice($lines, 2, count($lines)-3));
|
|
||||||
}
|
|
||||||
|
|
||||||
function fetch_full_manual(string $man_page) : string {
|
|
||||||
$intro = fetch_page($man_page);
|
|
||||||
$pages = extract_markdown_links($intro);
|
|
||||||
# Extract content from first page
|
|
||||||
$lines = explode("\n", $intro);
|
|
||||||
$content = implode("\n", array_slice($lines, 0, count($lines)-count($pages)));
|
|
||||||
$content .= "\n\n[Online version](https://git.ad5001.eu/Ad5001/LogarithmPlotter/wiki/$man_page)\n";
|
|
||||||
# Extract pages
|
|
||||||
foreach($pages as $page) {
|
|
||||||
$content .= "\n<span id=\"$page\"></span>\n";
|
|
||||||
$content .= do_replacements($man_page, remove_navigation(fetch_page($page)));
|
|
||||||
}
|
|
||||||
return $content;
|
|
||||||
}
|
|
||||||
|
|
||||||
function convert_to_html(string $md_content) : string {
|
|
||||||
$ch = curl_init();
|
|
||||||
curl_setopt($ch, CURLOPT_URL, "https://git.ad5001.eu/api/v1/markdown/raw");
|
|
||||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain', 'Accept: text/html'));
|
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
||||||
curl_setopt($ch, CURLOPT_POST, true);
|
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $md_content);
|
|
||||||
|
|
||||||
return curl_exec($ch);
|
|
||||||
}
|
|
||||||
|
|
||||||
function save_manuals(string $man_page) {
|
|
||||||
$md = fetch_full_manual($man_page);
|
|
||||||
$html = generate_html("$man_page", convert_to_html($md));
|
|
||||||
file_put_contents("$man_page.md", $md);
|
|
||||||
file_put_contents("$man_page.html", $html);
|
|
||||||
system("wkhtmltopdf \"$man_page.html\" \"$man_page.pdf\"");
|
|
||||||
}
|
|
||||||
|
|
||||||
save_manuals("User-Manual");
|
|
||||||
save_manuals("Manuel-d'utilisation");
|
|
Loading…
Reference in a new issue