mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 22:09:52 +08:00
PlantUML: add [web]/plantuml_args to pass extra arguments to PlantUML
This commit is contained in:
parent
0faf79b45b
commit
b463340101
@ -281,6 +281,10 @@ plantuml_server=http://www.plantuml.com/plantuml
|
|||||||
; PlantUML JAR location
|
; PlantUML JAR location
|
||||||
plantuml_jar=
|
plantuml_jar=
|
||||||
|
|
||||||
|
; Additional PlantUML arguments
|
||||||
|
; Double quotes to enclose arguments with spaces
|
||||||
|
plantuml_args=
|
||||||
|
|
||||||
; Graphviz Dot location
|
; Graphviz Dot location
|
||||||
graphviz_dot=
|
graphviz_dot=
|
||||||
|
|
||||||
|
@ -289,6 +289,9 @@ void VConfigManager::initialize()
|
|||||||
m_plantUMLServer = getConfigFromSettings("web", "plantuml_server").toString();
|
m_plantUMLServer = getConfigFromSettings("web", "plantuml_server").toString();
|
||||||
m_plantUMLJar = getConfigFromSettings("web", "plantuml_jar").toString();
|
m_plantUMLJar = getConfigFromSettings("web", "plantuml_jar").toString();
|
||||||
|
|
||||||
|
QString plantUMLArgs = getConfigFromSettings("web", "plantuml_args").toString();
|
||||||
|
m_plantUMLArgs = VUtils::parseCombinedArgString(plantUMLArgs);
|
||||||
|
|
||||||
m_enableGraphviz = getConfigFromSettings("global", "enable_graphviz").toBool();
|
m_enableGraphviz = getConfigFromSettings("global", "enable_graphviz").toBool();
|
||||||
m_graphvizDot = getConfigFromSettings("web", "graphviz_dot").toString();
|
m_graphvizDot = getConfigFromSettings("web", "graphviz_dot").toString();
|
||||||
}
|
}
|
||||||
|
@ -478,6 +478,8 @@ public:
|
|||||||
const QString &getPlantUMLJar() const;
|
const QString &getPlantUMLJar() const;
|
||||||
void setPlantUMLJar(const QString &p_jarPath);
|
void setPlantUMLJar(const QString &p_jarPath);
|
||||||
|
|
||||||
|
const QStringList &getPlantUMLArgs() const;
|
||||||
|
|
||||||
const QString &getGraphvizDot() const;
|
const QString &getGraphvizDot() const;
|
||||||
void setGraphvizDot(const QString &p_dotPath);
|
void setGraphvizDot(const QString &p_dotPath);
|
||||||
|
|
||||||
@ -888,6 +890,8 @@ private:
|
|||||||
|
|
||||||
QString m_plantUMLJar;
|
QString m_plantUMLJar;
|
||||||
|
|
||||||
|
QStringList m_plantUMLArgs;
|
||||||
|
|
||||||
// The name of the config file in each directory, obsolete.
|
// The name of the config file in each directory, obsolete.
|
||||||
// Use c_dirConfigFile instead.
|
// Use c_dirConfigFile instead.
|
||||||
static const QString c_obsoleteDirConfigFile;
|
static const QString c_obsoleteDirConfigFile;
|
||||||
@ -2279,6 +2283,11 @@ inline void VConfigManager::setPlantUMLJar(const QString &p_jarPath)
|
|||||||
setConfigToSettings("web", "plantuml_jar", p_jarPath);
|
setConfigToSettings("web", "plantuml_jar", p_jarPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const QStringList &VConfigManager::getPlantUMLArgs() const
|
||||||
|
{
|
||||||
|
return m_plantUMLArgs;
|
||||||
|
}
|
||||||
|
|
||||||
inline const QString &VConfigManager::getGraphvizDot() const
|
inline const QString &VConfigManager::getGraphvizDot() const
|
||||||
{
|
{
|
||||||
return m_graphvizDot;
|
return m_graphvizDot;
|
||||||
|
@ -32,7 +32,10 @@ void VGraphvizHelper::processAsync(int p_id, TimeStamp p_timeStamp, const QStrin
|
|||||||
qDebug() << m_program << args;
|
qDebug() << m_program << args;
|
||||||
|
|
||||||
process->start(m_program, args);
|
process->start(m_program, args);
|
||||||
process->write(p_text.toUtf8());
|
if (process->write(p_text.toUtf8()) == -1) {
|
||||||
|
qWarning() << "fail to write to QProcess:" << process->errorString();
|
||||||
|
}
|
||||||
|
|
||||||
process->closeWriteChannel();
|
process->closeWriteChannel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +57,12 @@ void VGraphvizHelper::handleProcessFinished(int p_exitCode, QProcess::ExitStatus
|
|||||||
int id = process->property(TaskIdProperty).toInt();
|
int id = process->property(TaskIdProperty).toInt();
|
||||||
QString format = process->property(TaskFormatProperty).toString();
|
QString format = process->property(TaskFormatProperty).toString();
|
||||||
TimeStamp timeStamp = process->property(TaskTimeStampProperty).toULongLong();
|
TimeStamp timeStamp = process->property(TaskTimeStampProperty).toULongLong();
|
||||||
qDebug() << "process finished" << id << timeStamp << format << p_exitCode << p_exitStatus;
|
qDebug() << QString("Graphviz finished: id %1 timestamp %2 format %3 exitcode %4 exitstatus %5")
|
||||||
|
.arg(id)
|
||||||
|
.arg(timeStamp)
|
||||||
|
.arg(format)
|
||||||
|
.arg(p_exitCode)
|
||||||
|
.arg(p_exitStatus);
|
||||||
bool failed = true;
|
bool failed = true;
|
||||||
if (p_exitStatus == QProcess::NormalExit) {
|
if (p_exitStatus == QProcess::NormalExit) {
|
||||||
if (p_exitCode < 0) {
|
if (p_exitCode < 0) {
|
||||||
@ -72,13 +80,17 @@ void VGraphvizHelper::handleProcessFinished(int p_exitCode, QProcess::ExitStatus
|
|||||||
qWarning() << "fail to start Graphviz process" << p_exitCode << p_exitStatus;
|
qWarning() << "fail to start Graphviz process" << p_exitCode << p_exitStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (failed) {
|
QByteArray errBa = process->readAllStandardError();
|
||||||
QByteArray errBa = process->readAllStandardError();
|
if (!errBa.isEmpty()) {
|
||||||
if (!errBa.isEmpty()) {
|
QString errStr(QString::fromLocal8Bit(errBa));
|
||||||
QString errStr(QString::fromLocal8Bit(errBa));
|
if (failed) {
|
||||||
qWarning() << "Graphviz stderr:" << errStr;
|
qWarning() << "Graphviz stderr:" << errStr;
|
||||||
|
} else {
|
||||||
|
qDebug() << "Graphviz stderr:" << errStr;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (failed) {
|
||||||
emit resultReady(id, timeStamp, format, "");
|
emit resultReady(id, timeStamp, format, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,10 @@ void VPlantUMLHelper::processAsync(int p_id,
|
|||||||
qDebug() << m_program << args;
|
qDebug() << m_program << args;
|
||||||
|
|
||||||
process->start(m_program, args);
|
process->start(m_program, args);
|
||||||
process->write(p_text.toUtf8());
|
if (process->write(p_text.toUtf8()) == -1) {
|
||||||
|
qWarning() << "fail to write to QProcess:" << process->errorString();
|
||||||
|
}
|
||||||
|
|
||||||
process->closeWriteChannel();
|
process->closeWriteChannel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,6 +59,7 @@ void VPlantUMLHelper::prepareCommand(QString &p_program, QStringList &p_args) co
|
|||||||
}
|
}
|
||||||
|
|
||||||
p_args << "-pipe";
|
p_args << "-pipe";
|
||||||
|
p_args << g_config->getPlantUMLArgs();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VPlantUMLHelper::handleProcessFinished(int p_exitCode, QProcess::ExitStatus p_exitStatus)
|
void VPlantUMLHelper::handleProcessFinished(int p_exitCode, QProcess::ExitStatus p_exitStatus)
|
||||||
@ -64,7 +68,12 @@ void VPlantUMLHelper::handleProcessFinished(int p_exitCode, QProcess::ExitStatus
|
|||||||
int id = process->property(TaskIdProperty).toInt();
|
int id = process->property(TaskIdProperty).toInt();
|
||||||
QString format = process->property(TaskFormatProperty).toString();
|
QString format = process->property(TaskFormatProperty).toString();
|
||||||
TimeStamp timeStamp = process->property(TaskTimeStampProperty).toULongLong();
|
TimeStamp timeStamp = process->property(TaskTimeStampProperty).toULongLong();
|
||||||
qDebug() << "process finished" << id << timeStamp << format << p_exitCode << p_exitStatus;
|
qDebug() << QString("PlantUML finished: id %1 timestamp %2 format %3 exitcode %4 exitstatus %5")
|
||||||
|
.arg(id)
|
||||||
|
.arg(timeStamp)
|
||||||
|
.arg(format)
|
||||||
|
.arg(p_exitCode)
|
||||||
|
.arg(p_exitStatus);
|
||||||
bool failed = true;
|
bool failed = true;
|
||||||
if (p_exitStatus == QProcess::NormalExit) {
|
if (p_exitStatus == QProcess::NormalExit) {
|
||||||
if (p_exitCode < 0) {
|
if (p_exitCode < 0) {
|
||||||
@ -82,13 +91,17 @@ void VPlantUMLHelper::handleProcessFinished(int p_exitCode, QProcess::ExitStatus
|
|||||||
qWarning() << "fail to start PlantUML process" << p_exitCode << p_exitStatus;
|
qWarning() << "fail to start PlantUML process" << p_exitCode << p_exitStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (failed) {
|
QByteArray errBa = process->readAllStandardError();
|
||||||
QByteArray errBa = process->readAllStandardError();
|
if (!errBa.isEmpty()) {
|
||||||
if (!errBa.isEmpty()) {
|
QString errStr(QString::fromLocal8Bit(errBa));
|
||||||
QString errStr(QString::fromLocal8Bit(errBa));
|
if (failed) {
|
||||||
qWarning() << "PlantUML stderr:" << errStr;
|
qWarning() << "PlantUML stderr:" << errStr;
|
||||||
|
} else {
|
||||||
|
qDebug() << "PlantUML stderr:" << errStr;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (failed) {
|
||||||
emit resultReady(id, timeStamp, format, "");
|
emit resultReady(id, timeStamp, format, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user