Skip to content

Commit

Permalink
Add pipx tpl; minor tpl changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
ElTh0r0 committed Jul 17, 2024
1 parent 8195fe3 commit b9e5cd1
Show file tree
Hide file tree
Showing 13 changed files with 86 additions and 45 deletions.
12 changes: 6 additions & 6 deletions application/inyokaedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1446,12 +1446,12 @@ void InyokaEdit::showSyntaxOverview() {
void InyokaEdit::showAbout() {
QMessageBox::about(
this, tr("About") + " " + qApp->applicationName(),
QString::fromLatin1("<big><b>%1 %2</b></big><br />"
"%3<br />"
"<small>%4</small><br /><br />"
"%5<br />"
"%6<br />"
"<small>%7</small><br /><br />"
QString::fromLatin1("<big><b>%1 %2</b></big><br>"
"%3<br>"
"<small>%4</small><br><br>"
"%5<br>"
"%6<br>"
"<small>%7</small><br><br>"
"%8")
.arg(qApp->applicationName(), qApp->applicationVersion(),
tr("Editor for Inyoka-based portals"), APP_COPY,
Expand Down
2 changes: 1 addition & 1 deletion application/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ auto main(int argc, char *argv[]) -> int {
app.setApplicationName(QStringLiteral(APP_NAME));
app.setApplicationVersion(QStringLiteral(APP_VERSION));
app.setApplicationDisplayName(QStringLiteral(APP_NAME));
#if !defined(Q_OS_WIN) && !defined(Q_OS_MAC)
#if !defined(Q_OS_WIN) && !defined(Q_OS_MACOS)
app.setWindowIcon(QIcon::fromTheme(
QStringLiteral("inyokaedit"), QIcon(QStringLiteral(":/inyokaedit.png"))));
app.setDesktopFileName(QStringLiteral("org.inyokaproject.inyokaedit"));
Expand Down
6 changes: 3 additions & 3 deletions application/parser/macros.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ void Macros::replaceDates(QTextDocument *pRawDoc, const QString &sTrans) {

void Macros::replaceNewline(QTextDocument *pRawDoc, const QString &sTrans) {
QString sDoc(pRawDoc->toPlainText());
sDoc.replace("[[" + sTrans + "]]", QLatin1String("<br />"));
sDoc.replace(QLatin1String("\\\\"), QLatin1String("<br />"));
sDoc.replace("[[" + sTrans + "]]", QLatin1String("<br>"));
sDoc.replace(QLatin1String("\\\\"), QLatin1String("<br>"));
pRawDoc->setPlainText(sDoc);
}

Expand Down Expand Up @@ -346,7 +346,7 @@ void Macros::replacePictures(QTextDocument *pRawDoc, const QString &sTrans,
sTmpImage += "<img src=\"" + sExt + sImageUrl + "\" alt=\"" + sImageUrl +
"\" height=\"" + QString::number(tmpH) + "\" width=\"" +
QString::number(tmpW) + "\" ";
sTmpImage += "class=\"image-" + sImageAlign + "\" /></a>";
sTmpImage += "class=\"image-" + sImageAlign + "\"></a>";

sDoc.replace(nIndex, match.capturedLength(), sTmpImage);
// Go on with RegExp-Search
Expand Down
2 changes: 1 addition & 1 deletion application/parser/parseimgmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void ParseImgMap::startParsing(QTextDocument *pRawDoc,
while (i.hasNext()) {
i.next();
sDoc.replace(i.key(), "<img src=\"" + sSharePath + "/community/" +
sCommunity + "/" + i.value() + "\" />");
sCommunity + "/" + i.value() + "\">");
}
} else {
qCritical() << "Error while parsing image map - map is empty!";
Expand Down
6 changes: 3 additions & 3 deletions application/parser/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,8 @@ void Parser::replaceCodeblocks(QTextDocument *pRawDoc) {
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------

auto Parser::highlightCode(const QString &sLanguage, const QString &sCode)
-> QString {
auto Parser::highlightCode(const QString &sLanguage,
const QString &sCode) -> QString {
static bool bChecked(false);
static bool bPygmentize(false);
static QFile sPygmentize(m_sPygmentize);
Expand Down Expand Up @@ -543,7 +543,7 @@ void Parser::replaceHorLines(QTextDocument *pRawDoc) {
block.isValid() && !(pRawDoc->lastBlock() < block);
block = block.next()) {
if ("----" == block.text()) {
sDoc += QLatin1String("\n<hr />\n");
sDoc += QLatin1String("\n<hr>\n");
} else {
sDoc += block.text() + "\n";
}
Expand Down
70 changes: 55 additions & 15 deletions application/parser/provisionaltplparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ auto ProvisionalTplParser::parseTpl(const QStringList &sListArgs,
sArgs.removeFirst();
return this->parsePipInstall(sArgs);
}
if (sArgs[0].toLower() == QString::fromUtf8("PipxInstallation").toLower()) {
sArgs.removeFirst();
return this->parsePipxInstall(sArgs);
}
if (sArgs[0].toLower() ==
QString::fromUtf8("Paketinstallation").toLower()) {
sArgs.removeFirst();
Expand Down Expand Up @@ -548,16 +552,16 @@ auto ProvisionalTplParser::parseForeignWarning(const QStringList &sListArg)
// Package
if (sListArg[0].toLower() == QString::fromUtf8("Paket").toLower()) {
sOutput = QString::fromUtf8(
"<p>[:Fremdquellen:Fremdpakete] können das System gefährden.</p>\n");
"[:Fremdquellen:Fremdpakete] können das System gefährden.\n");
} else if (sListArg[0].toLower() == QString::fromUtf8("Quelle").toLower()) {
// Source
sOutput = QString::fromUtf8(
"<p>Zusätzliche [:Fremdquellen:] können das System gefährden.</p>\n");
"Zusätzliche [:Fremdquellen:] können das System gefährden.\n");
} else if (sListArg[0].toLower() ==
QString::fromUtf8("Software").toLower()) {
// Software
sOutput = QString::fromUtf8(
"<p>[:Fremdsoftware:] kann das System gefährden.</p>\n");
sOutput =
QString::fromUtf8("[:Fremdsoftware:] kann das System gefährden.\n");
}
// Remark available
if (sListArg.size() >= 2) {
Expand Down Expand Up @@ -771,7 +775,7 @@ auto ProvisionalTplParser::parseImageCollect(const QStringList &sListArgs)
"\" alt=\"" + sImageUrl + "\" class=\"image-default\" width=\"" +
QString::number(static_cast<int>(iImgWidth)) + "\" height=\"" +
sColHeight +
"\"/></a></td>\n</tr>\n<tr>\n<td style=\"text-"
"\"></a></td>\n</tr>\n<tr>\n<td style=\"text-"
"align: center; background-color: #F9EAAF; "
"border: none\">" +
sDescription + "</td>\n</tr>\n</tbody>\n</table>\n";
Expand All @@ -782,7 +786,7 @@ auto ProvisionalTplParser::parseImageCollect(const QStringList &sListArgs)
sImageUrl + "\" alt=\"" + sImageUrl +
"\" class=\"image-default\" width=\"" +
QString::number(static_cast<int>(iImgWidth)) + "\" height=\"" +
sColHeight + "\"/></td>\n";
sColHeight + "\"></td>\n";
bContinue = true;
}
}
Expand Down Expand Up @@ -907,7 +911,7 @@ auto ProvisionalTplParser::parseImageSub(const QStringList &sListArgs)
"<img src=\"" + sImageUrl + "\" alt=\"" + sImageUrl +
"\" class=\"image-default\" height=\"" +
QString::number(static_cast<int>(iImgHeight)) + "\" width=\"" +
sImageWidth + "\"/>\n</a>\n</td>\n</tr>\n";
sImageWidth + "\">\n</a>\n</td>\n</tr>\n";

// No style info -> default
if (sImageStyle.isEmpty()) {
Expand Down Expand Up @@ -1360,7 +1364,7 @@ auto ProvisionalTplParser::parseOBS(const QStringList &sListArgs) -> QString {
"class=\"notranslate\">wget http://download.opensuse.org"
"/repositories/" +
sListArgs[0] +
"/xUbuntu_VERSION/Release.key<br />sudo apt-key add - &lt; Release.key "
"/xUbuntu_VERSION/Release.key<br>sudo apt-key add - &lt; Release.key "
"</pre></div></div><p></p></div></div>";
}

Expand Down Expand Up @@ -1505,21 +1509,57 @@ auto ProvisionalTplParser::parsePackage(const QStringList &sListArgs)
auto ProvisionalTplParser::parsePipInstall(const QStringList &sListArgs)
-> QString {
return QString::fromUtf8(
"Der Python Paketmanager [:pip:] stellt häufig aktuellere "
"<p>Der Python-Paketmanager [:pip:] stellt häufig aktuellere "
"Versionen von Programmen als in den Paketquellen bereit. "
"Folgendermaßen lässt sich das Programm darüber installieren:\n"
"Folgendermaßen lässt sich das Programm darüber "
"installieren:</p>\n"
"<div class=\"bash\">\n"
"<div class=\"contents\">\n"
"<pre>pip3 install ") +
"<pre class=\"notranslate\">pip3 install ") +
sListArgs.join(' ') +
" # Programm wird nur für den aktuellen Nutzer "
"installiert</pre>\n</div>\n</div>\n" +
QString::fromUtf8(
" # Programm wird nur für den aktuellen Nutzer "
"installiert</pre>\n</div>\n</div>\n"
"<p>[:pip#Ab-Ubuntu-23-04:Ab Ubuntu 23.04] muss in eine "
"[:venv:virtuelle "
"Umgebung für Python] installiert werden:</p>\n"
"<div class=\"bash\">\n"
"<div class=\"contents\">\n"
"<pre class=\"notranslate\">"
"python3 -m venv venv-name && source venv-name/bin/activate # "
"venv-name durch den gewünschten Namen ersetzen\n"
"pip3 install ") +
sListArgs.join(' ') +
QString::fromUtf8(
" # Programm wird nur für den aktuellen Nutzer "
"installiert</pre>\n</div>\n</div>\n") +
this->parseForeignWarning(QStringList() << "Software");
}

// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------

auto ProvisionalTplParser::parsePipxInstall(const QStringList &sListArgs)
-> QString {
return QString::fromUtf8(
"<p>[:pipx:], als [wikipedia:Wrapper_(Software):Wrapper-Programm] "
"des Python-Paketmanagers [:pip:], stellt eine einfache "
"Möglichkeit dar, in Python geschriebene "
"Kommandozeilen-Applikationen in [:venv:isolierten Umgebungen] zu "
"installieren:</p>\n"
"<div class=\"bash\">\n"
"<div class=\"contents\">\n"
"<pre class=\"notranslate\">"
"pipx install ") +
sListArgs.join(' ') +
QString::fromUtf8(
" # Programm wird nur für den aktuellen Nutzer "
"installiert</pre>\n</div>\n</div>\n");
}

// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------

auto ProvisionalTplParser::parsePkgInstall(const QStringList &sListArgs)
-> QString {
QStringList sListPackages;
Expand Down Expand Up @@ -1570,7 +1610,7 @@ auto ProvisionalTplParser::parsePkgInstallBut(const QStringList &sListArgs)
"\" rel=\"nofollow\" class=\"external\"><img src=\"" + m_sSharePath +
"/community/" + m_sCommunity +
"/web/Wiki/Vorlagen/Installbutton/button.png\" "
"alt=\"Wiki-Installbutton\" class=\"image-default\" /></a> "
"alt=\"Wiki-Installbutton\" class=\"image-default\"></a> "
"mit [:apturl:]</p>";
}

Expand Down Expand Up @@ -2240,7 +2280,7 @@ auto ProvisionalTplParser::insertBox(const QString &sClass,
sReturn += "<p>" + sContents + "</p>\n";
// Remark available
if (!sRemark.isEmpty() && sRemark != " ") {
sReturn += QString::fromUtf8("<hr />\n<p><strong>Anmerkung:</strong> ") +
sReturn += QString::fromUtf8("<hr>\n<p><strong>Anmerkung:</strong> ") +
sRemark + "</p>\n";
}
sReturn +=
Expand Down
5 changes: 3 additions & 2 deletions application/parser/provisionaltplparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class ProvisionalTplParser {
const QHash<QString, QString> &TestedWithTouchMap,
const QString &sCommunity);

auto parseTpl(const QStringList &sListArgs, const QString &sCurrentFile)
-> QString;
auto parseTpl(const QStringList &sListArgs,
const QString &sCurrentFile) -> QString;

private:
static auto parseAdvanced() -> QString;
Expand Down Expand Up @@ -75,6 +75,7 @@ class ProvisionalTplParser {
static auto parseOverview2(const QStringList &sListArgs) -> QString;
static auto parsePackage(const QStringList &sListArgs) -> QString;
auto parsePipInstall(const QStringList &sListArgs) -> QString;
auto parsePipxInstall(const QStringList &sListArgs) -> QString;
static auto parsePkgInstall(const QStringList &sListArgs) -> QString;
auto parsePkgInstallBut(const QStringList &sListArgs) -> QString;
static auto parsePPA(const QStringList &sListArgs) -> QString;
Expand Down
4 changes: 2 additions & 2 deletions plugins/highlighter/highlighter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1026,9 +1026,9 @@ void Highlighter::showAbout() {
}
*/
aboutbox.setText(
QString::fromLatin1("<p><b>%1</b><br />"
QString::fromLatin1("<p><b>%1</b><br>"
"%2</p>"
"<p>%3<br />"
"<p>%3<br>"
"%4</p>"
"<p><i>%5</i></p>")
.arg(this->getCaption(), tr("Version") + ": " + PLUGIN_VERSION,
Expand Down
4 changes: 2 additions & 2 deletions plugins/hotkey/hotkey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,9 @@ void Hotkey::showAbout() {
QPixmap(QStringLiteral(":/configure-shortcuts.png")));
}
aboutbox.setText(
QString::fromLatin1("<p><b>%1</b><br />"
QString::fromLatin1("<p><b>%1</b><br>"
"%2</p>"
"<p>%3<br />"
"<p>%3<br>"
"%4</p>"
"<p><i>%5</i></p>")
.arg(this->getCaption(), tr("Version") + ": " + PLUGIN_VERSION,
Expand Down
6 changes: 3 additions & 3 deletions plugins/spellchecker-hunspell/spellchecker-hunspell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -576,16 +576,16 @@ void SpellChecker_Hunspell::showAbout() {
QPixmap(QStringLiteral(":/tools-check-spelling.png")));
}
aboutbox.setText(
QString::fromLatin1("<p><b>%1</b><br />"
QString::fromLatin1("<p><b>%1</b><br>"
"%2</p>"
"<p>%3<br />"
"<p>%3<br>"
"%4</p>"
"<p><i>%5</i></p>")
.arg(this->getCaption(), tr("Version") + ": " + PLUGIN_VERSION,
PLUGIN_COPY,
tr("Licence") + ": " +
"<a href=\"https://www.gnu.org/licenses/gpl-3.0.html\">"
"GNU General Public License Version 3</a> and<br />"
"GNU General Public License Version 3</a> and<br>"
"incorporates work covered by <a href=\""
"https://opensource.org/licenses/BSD-2-Clause\">"
"2-Clause BSD License</a>",
Expand Down
6 changes: 3 additions & 3 deletions plugins/spellchecker-nuspell/spellchecker-nuspell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,16 +476,16 @@ void SpellChecker_Nuspell::showAbout() {
QPixmap(QStringLiteral(":/tools-check-spelling.png")));
}
aboutbox.setText(
QString::fromLatin1("<p><b>%1</b><br />"
QString::fromLatin1("<p><b>%1</b><br>"
"%2</p>"
"<p>%3<br />"
"<p>%3<br>"
"%4</p>"
"<p><i>%5</i></p>")
.arg(this->getCaption(), tr("Version") + ": " + PLUGIN_VERSION,
PLUGIN_COPY,
tr("Licence") + ": " +
"<a href=\"https://www.gnu.org/licenses/gpl-3.0.html\">"
"GNU General Public License Version 3</a> and<br />"
"GNU General Public License Version 3</a> and<br>"
"incorporates work covered by <a href=\""
"https://opensource.org/licenses/BSD-2-Clause\">"
"2-Clause BSD License</a>",
Expand Down
4 changes: 2 additions & 2 deletions plugins/uu_knowledgebox/uu_knowledgebox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,9 @@ void Uu_KnowledgeBox::showAbout() {
aboutbox.setIconPixmap(QPixmap(QStringLiteral(":/view-list-details.png")));
}
aboutbox.setText(
QString::fromLatin1("<p><b>%1</b><br />"
QString::fromLatin1("<p><b>%1</b><br>"
"%2</p>"
"<p>%3<br />"
"<p>%3<br>"
"%4</p>"
"<p><i>%5</i></p>")
.arg(
Expand Down
4 changes: 2 additions & 2 deletions plugins/uu_tabletemplate/uu_tabletemplate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,9 +479,9 @@ void Uu_TableTemplate::showAbout() {
aboutbox.setIconPixmap(QPixmap(QStringLiteral(":/folder-table.png")));
}
aboutbox.setText(
QString::fromLatin1("<p><b>%1</b><br />"
QString::fromLatin1("<p><b>%1</b><br>"
"%2</p>"
"<p>%3<br />"
"<p>%3<br>"
"%4</p>"
"<p><i>%5</i></p>")
.arg(this->getCaption(), tr("Version") + ": " + PLUGIN_VERSION,
Expand Down

0 comments on commit b9e5cd1

Please sign in to comment.