r20220 by craig - #13095: Change alignment of console help output and half of thd code to do it

scribus-commit scribus-commit at lists.scribus.net
Mon Jun 29 21:24:48 UTC 2015


Author: craig
Date: Mon Jun 29 21:24:48 2015
New Revision: 20220

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20220
Log:
#13095: Change alignment of console help output and half of thd code to do it

Modified:
    trunk/Scribus/scribus/scribusapp.cpp

Modified: trunk/Scribus/scribus/scribusapp.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20220&path=/trunk/Scribus/scribus/scribusapp.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusapp.cpp (original)
+++ trunk/Scribus/scribus/scribusapp.cpp Mon Jun 29 21:24:48 2015
@@ -23,6 +23,7 @@
 
 #include <iostream>
 #include <cstdlib>
+
 
 #include <QDir>
 #include <QFile>
@@ -473,18 +474,9 @@
 
 /*! \brief Format an arguments line for printing
 Helper procedure */
-static void printArgLine(QTextStream & ts, const char * smallArg,
-						  const char* fullArg, const QString desc)
-{
-	const char* lineformat = "  %1, %2 %3";
-	const int saw = 4;   // Short argument width
-	const int aw = -18;   // Argument width (negative is left aligned)
-	QString line = QString(lineformat)
-		.arg(smallArg, saw)
-		.arg(fullArg, aw)
-		.arg(desc);
-	ts << line;
-	endl(ts);
+static void printArgLine(QTextStream & ts, const char * smallArg, const char* fullArg, const QString desc)
+{
+	ts << qPrintable(QString("     %1 %2 %3").arg(QString("%1,").arg(smallArg), -5).arg(fullArg, -28).arg(desc)) << endl;
 }
 
 void ScribusQApp::showUsage()
@@ -499,12 +491,12 @@
 	printArgLine(ts, ARG_LANG_SHORT, ARG_LANG, tr("Uses xx as shortcut for a language, eg `en' or `de'") );
 	printArgLine(ts, ARG_AVAILLANG_SHORT, ARG_AVAILLANG, tr("List the currently installed interface languages") );
 	printArgLine(ts, ARG_NOSPLASH_SHORT, ARG_NOSPLASH, tr("Do not show the splashscreen on startup") );
-	printArgLine(ts, ARG_NEVERSPLASH_SHORT, ARG_NEVERSPLASH, tr("Stop the showing of the splashscreen on startup. Writes an empty file called .neversplash in ~/.scribus.") );
-	printArgLine(ts, ARG_PREFS_SHORT, QString(QString(ARG_PREFS) + QString(" ") + tr("filename")).toLocal8Bit().constData(), tr("Use filename as path for user given preferences") );
-	printArgLine(ts, ARG_PROFILEINFO_SHORT, ARG_PROFILEINFO, tr("Show location ICC profile information on console while starting") );
-	printArgLine(ts, ARG_UPGRADECHECK_SHORT, ARG_UPGRADECHECK, tr("Download a file from the Scribus website and show the latest available version.") );
+	printArgLine(ts, ARG_NEVERSPLASH_SHORT, ARG_NEVERSPLASH, tr("Stop showing the splashscreen on startup. Writes an empty file called .neversplash in ~/.scribus") );
+	printArgLine(ts, ARG_PREFS_SHORT, qPrintable(QString("%1 <%2>").arg(ARG_PREFS).arg(tr("filename"))), tr("Use filename as path for user given preferences") );
+	printArgLine(ts, ARG_PROFILEINFO_SHORT, ARG_PROFILEINFO, tr("Show location of ICC profile information on console while starting") );
+	printArgLine(ts, ARG_UPGRADECHECK_SHORT, ARG_UPGRADECHECK, tr("Download a file from the Scribus website and show the latest available version") );
 	printArgLine(ts, ARG_VERSION_SHORT, ARG_VERSION, tr("Output version information and exit") );
-	printArgLine(ts, ARG_PYTHONSCRIPT_SHORT, QString(QString(ARG_PYTHONSCRIPT) + QString(" ") + tr("filename")).toLocal8Bit().constData(), tr("Run filename in Python scripter") );
+	printArgLine(ts, ARG_PYTHONSCRIPT_SHORT, qPrintable(QString("%1 <%2>").arg(ARG_PYTHONSCRIPT).arg(tr("filename"))), tr("Run filename in Python scripter") );
 	printArgLine(ts, ARG_NOGUI_SHORT, ARG_NOGUI, tr("Do not start GUI") );
 	
 #if defined(_WIN32) && !defined(_CONSOLE)




More information about the scribus-commit mailing list