mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-06-11 13:43:13 +02:00
87d5ae5580
Extends the headless command-line export with two CSV outputs: qelectrotech --export-cables <project.qet> <output.csv> wiring list qelectrotech --export-wires <project.qet> <output.csv> wire numbers - --export-cables reuses WiringListExport (one row per conductor). - --export-wires reuses ConductorNumExport::wiresNum() (distinct wire numbers). WiringListExport::toCsv() mixed CSV generation with the file dialog and writing. Extracted the generation into a new const method toCsvString() that returns the CSV; toCsv() now calls it and writes the result. This makes the wiring list usable headlessly with no behavioural change to the GUI export. Addresses part of the CLI export requests (#162, #309): @pkess specifically asked to "export all connections as a list".
61 lines
1.9 KiB
C++
61 lines
1.9 KiB
C++
/*
|
|
Copyright 2006-2025 The QElectroTech Team
|
|
This file is part of QElectroTech.
|
|
|
|
QElectroTech 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 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
QElectroTech 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 QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
#ifndef CLI_EXPORT_H
|
|
#define CLI_EXPORT_H
|
|
|
|
#include <QStringList>
|
|
|
|
/**
|
|
@brief Headless command-line export.
|
|
|
|
Implements the long-requested batch/headless export
|
|
(qelectrotech.org bugtracker #171, GitHub #309): render a project's
|
|
diagrams to files without opening the GUI.
|
|
|
|
Detected and handled in main() before the GUI is created.
|
|
*/
|
|
namespace CLIExport {
|
|
|
|
/**
|
|
@brief True if @p args request a CLI export
|
|
(i.e. contain one of the export options).
|
|
*/
|
|
bool isExportRequest(const QStringList &args);
|
|
|
|
/**
|
|
@brief Run the CLI export described by @p args.
|
|
@return process exit code (0 on success).
|
|
|
|
Usage:
|
|
qelectrotech --export-pdf <project.qet> <output.pdf>
|
|
qelectrotech --export-png <project.qet> <output_dir>
|
|
qelectrotech --export-svg <project.qet> <output_dir>
|
|
qelectrotech --export-cables <project.qet> <output.csv>
|
|
qelectrotech --export-wires <project.qet> <output.csv>
|
|
|
|
PDF: one multi-page document (one diagram per page).
|
|
PNG/SVG: one file per diagram, named <output_dir>/<NN>_<title>.<ext>.
|
|
cables: wiring list (one row per conductor) as CSV.
|
|
wires: list of distinct wire numbers as CSV.
|
|
*/
|
|
int run(const QStringList &args);
|
|
|
|
}
|
|
|
|
#endif // CLI_EXPORT_H
|