r24486 by craig - Add API for version handling. Clean up changed files, move usage of

scribus-commit scribus-commit at lists.scribus.net
Mon Feb 15 16:40:55 UTC 2021


Author: craig
Date: Mon Feb 15 16:40:55 2021
New Revision: 24486

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24486
Log:
Add API for version handling. Clean up changed files, move usage of
VERSION to API

Modified:
    trunk/Scribus/scribus/iconmanager.cpp
    trunk/Scribus/scribus/pluginmanager.h
    trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
    trunk/Scribus/scribus/plugins/myplugin/myplugin.cpp
    trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.cpp
    trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
    trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdcolor.cpp
    trunk/Scribus/scribus/plugins/scriptplugin_py2x/scriptplugin.cpp
    trunk/Scribus/scribus/pslib.cpp
    trunk/Scribus/scribus/scdocoutput_ps2.cpp
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/styles/charstyle.cpp
    trunk/Scribus/scribus/third_party/CMakeLists.txt
    trunk/Scribus/scribus/ui/about.cpp
    trunk/Scribus/scribus/ui/splash.cpp
    trunk/Scribus/scribus/upgradechecker.cpp
    trunk/Scribus/scribus/upgradechecker.h

Modified: trunk/Scribus/scribus/iconmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24486&path=/trunk/Scribus/scribus/iconmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/iconmanager.cpp	(original)
+++ trunk/Scribus/scribus/iconmanager.cpp	Mon Feb 15 16:40:55 2021
@@ -20,6 +20,7 @@
 #include <QTextStream>
 #include <QDomDocument>
 
+#include "api/api_application.h"
 #include "iconmanager.h"
 #include "prefsmanager.h"
 #include "scpaths.h"
@@ -154,9 +155,9 @@
 			int curr_minor = m_activeSetVersion.section(".", 1, 1).toInt();
 			int curr_patch = m_activeSetVersion.section(".", 2, 2).toInt();
 			int curr_fullver = curr_major * 10000 + curr_minor * 100 + curr_patch;
-			int ver_major = QString(VERSION).section(".", 0, 0).toInt();
-			int ver_minor = QString(VERSION).section(".", 1, 1).toInt();
-			int ver_patch = QString(VERSION).section(".", 2, 2).toInt();
+			int ver_major = ScribusAPI::getVersionMajor();
+			int ver_minor = ScribusAPI::getVersionMinor();
+			int ver_patch = ScribusAPI::getVersionPatch();
 			int ver_fullver = ver_major * 10000 + ver_minor * 100 + ver_patch;
 			//If iconset version <= app version, and iconset version >= current active iconset version
 			if ((av_fullver <= ver_fullver) && (av_fullver >= curr_fullver))

Modified: trunk/Scribus/scribus/pluginmanager.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24486&path=/trunk/Scribus/scribus/pluginmanager.h
==============================================================================
--- trunk/Scribus/scribus/pluginmanager.h	(original)
+++ trunk/Scribus/scribus/pluginmanager.h	Mon Feb 15 16:40:55 2021
@@ -43,7 +43,7 @@
 	/*! \brief Static methods for loading, unloading plugins and resolving symbols
 	 These methods are platform independent, but each platform uses a different
 	 implementation. */
-	static void* loadDLL(const QString& plugin );
+	static void* loadDLL(const QString& plugin);
 	static void* resolveSym( void* plugin, const char* sym );
 	static void  unloadDLL( void* plugin );
 
@@ -165,6 +165,7 @@
 		ScPlugin* plugin;
 		bool enableOnStartup;
 		bool enabled;
+		QString version;
 	};
 
 	/*! \brief Init one plugin.

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24486&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp	(original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp	Mon Feb 15 16:40:55 2021
@@ -33,6 +33,8 @@
 #include "pageitem_spiral.h"
 #include "pageitem_table.h"
 
+#include "api/api_application.h"
+
 #include "units.h"
 #include "util.h"
 #include "util_math.h"
@@ -64,7 +66,7 @@
 	writer.writeAttribute("W", wp);
 	writer.writeAttribute("H", hp);
 	writer.writeAttribute("COUNT",   selection->count());
-	writer.writeAttribute("Version", QString(VERSION));
+	writer.writeAttribute("Version", ScribusAPI::getVersion());
 	writer.writeAttribute("previewData", QString(prevData));
 	writeColors(writer, true);
 	writeGradients(writer, true);
@@ -172,7 +174,7 @@
 	writer.setAutoFormatting(true);
 //	writer.writeStartDocument();
 	writer.writeStartElement("ScribusStory");
-	writer.writeAttribute("Version", QString(VERSION));
+	writer.writeAttribute("Version", ScribusAPI::getVersion());
 
 	writeColors(writer, lists.colorNames());
 	writeGradients(writer, lists.gradientNames());
@@ -317,7 +319,7 @@
 	docu.setDevice(outputFile.data());
 	docu.writeStartDocument();
 	docu.writeStartElement("SCRIBUSUTF8NEW");
-	docu.writeAttribute("Version", QString(VERSION));
+	docu.writeAttribute("Version", ScribusAPI::getVersion());
 
 	docu.writeStartElement("DOCUMENT");
 	docu.writeAttribute("ANZPAGES"    , m_Doc->DocPages.count());

Modified: trunk/Scribus/scribus/plugins/myplugin/myplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24486&path=/trunk/Scribus/scribus/plugins/myplugin/myplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/myplugin/myplugin.cpp	(original)
+++ trunk/Scribus/scribus/plugins/myplugin/myplugin.cpp	Mon Feb 15 16:40:55 2021
@@ -49,6 +49,14 @@
 {
 	AboutData* about = new AboutData;
 	Q_CHECK_PTR(about);
+	// about->authors = QString::fromUtf8("";
+	// about->shortDescription = tr("");
+	// about->description = tr("Write me!")
+	// about->version;
+	// about->releaseDate
+	// about->copyright
+	// about->license
+	// about->provide
 	return about;
 }
 

Modified: trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24486&path=/trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.cpp	(original)
+++ trunk/Scribus/scribus/plugins/saveastemplateplugin/satemplate.cpp	Mon Feb 15 16:40:55 2021
@@ -10,6 +10,7 @@
 #include "satemplate.h"
 #include "satdialog.h"
 
+#include "api/api_application.h"
 #include "scpaths.h"
 #include "ui/scmessagebox.h"
 #include "scribuscore.h"
@@ -287,7 +288,7 @@
 	QString usage = QString(dia->usageEdit->toPlainText());
 	replaceIllegalChars(usage);
 	tag += "\t\t<usage>"+usage+"</usage>\n";
-	QString scribus_version = QString(VERSION);
+	QString scribus_version(ScribusAPI::getVersion());
 	replaceIllegalChars(scribus_version);
 	tag += "\t\t<scribus_version>" + scribus_version + "</scribus_version>\n";
 	QString date = QString(now.toString(Qt::ISODate));

Modified: trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24486&path=/trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp	Mon Feb 15 16:40:55 2021
@@ -58,6 +58,7 @@
 #include "ui/scmwmenumanager.h"
 #include "units.h"
 
+#include "api/api_application.h"
 
 #include <QApplication>
 #include <QMessageBox>
@@ -146,7 +147,6 @@
 			"Craig Ringer <craig at scribus.info>");
 	about->shortDescription = tr("Embedded Python scripting support for Python 3.x.");
 	// about->description = tr("Write me!")
-	// about->version
 	// about->releaseDate
 	// about->copyright
 	// about->license
@@ -935,28 +935,20 @@
 	}
 
 	// Export the Scribus version into the module namespace so scripts know what they're running in
-	PyDict_SetItemString(d, const_cast<char*>("scribus_version"), PyUnicode_FromString(const_cast<char*>(VERSION)));
+	PyDict_SetItemString(d, const_cast<char*>("scribus_version"), PyUnicode_FromString(ScribusAPI::getVersion().toLatin1().constData()));
 	// Now build a version tuple like that provided by Python in sys.version_info
 	// The tuple is of the form (major, minor, patchlevel, extraversion, reserved)
-	QRegExp version_re("(\\d+)\\.(\\d+)\\.(\\d+)(.*)");
-	int pos = version_re.indexIn(QString(VERSION));
-	// We ignore errors, causing the scribus_version_info attribute to simply not be created.
-	// This will make acceses raise AttrbuteError.
-	if (pos > -1)
-	{
-		int majorVersion = version_re.cap(1).toInt();
-		int minorVersion = version_re.cap(2).toInt();
-		int patchVersion = version_re.cap(3).toInt();
-		QString extraVersion = version_re.cap(4);
-		PyObject* versionTuple = Py_BuildValue(const_cast<char*>("(iiisi)"),\
-				majorVersion, minorVersion, patchVersion, (const char*)extraVersion.toUtf8(), 0);
-		if (versionTuple != nullptr)
-			PyDict_SetItemString(d, const_cast<char*>("scribus_version_info"), versionTuple);
-		else
-			qDebug("Failed to build version tuple for version string '%s' in scripter", VERSION);
-	}
+	int majorVersion = ScribusAPI::getVersionMajor();
+	int minorVersion = ScribusAPI::getVersionMinor();
+	int patchVersion = ScribusAPI::getVersionPatch();
+	QString extraVersion = ScribusAPI::getVersionSuffix();
+
+	PyObject* versionTuple = Py_BuildValue(const_cast<char*>("(iiisi)"), majorVersion, minorVersion, patchVersion, (const char*)extraVersion.toUtf8(), 0);
+	if (versionTuple != nullptr)
+		PyDict_SetItemString(d, const_cast<char*>("scribus_version_info"), versionTuple);
 	else
-		qDebug("Couldn't parse version string '%s' in scripter", VERSION);
+		qDebug("Failed to build version tuple for version string '%s' in scripter", VERSION);
+
 
 	// Function aliases for compatibility
 	// We need to import the __builtins__, warnings and exceptions modules to be able to run

Modified: trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdcolor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24486&path=/trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdcolor.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdcolor.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin_py2x/cmdcolor.cpp	Mon Feb 15 16:40:55 2021
@@ -4,6 +4,7 @@
 a copyright and/or license notice that predates the release of Scribus 1.3.2
 for which a new license (GPL+exception) is in place.
 */
+//#include "api/api_color.h"
 #include "cmdcolor.h"
 #include "cmdutil.h"
 #include "prefsmanager.h"
@@ -620,6 +621,20 @@
 	
 	if (!PyArg_ParseTuple(args, "es", "utf-8", &Name))
 		return nullptr;
+
+//	QString errorMsg;
+//	QString colorName = QString::fromUtf8(Name);
+//	if (!ScribusAPI::existsColor(colorName, errorMsg))
+//	{
+//		PyErr_SetString(PyExc_ValueError, errorMsg.toLocal8Bit().constData());
+//		return nullptr;
+//	}
+//	return PyBool_FromLong(static_cast<long>(ScribusAPI::isSpotColor(Name)));
+
+
+
+
+
 	if (!checkHaveDocument())
 		return nullptr;
 	if (strcmp(Name, "") == 0)

Modified: trunk/Scribus/scribus/plugins/scriptplugin_py2x/scriptplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24486&path=/trunk/Scribus/scribus/plugins/scriptplugin_py2x/scriptplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin_py2x/scriptplugin.cpp	(original)
+++ trunk/Scribus/scribus/plugins/scriptplugin_py2x/scriptplugin.cpp	Mon Feb 15 16:40:55 2021
@@ -58,6 +58,7 @@
 #include "ui/scmwmenumanager.h"
 #include "units.h"
 
+#include "api/api_application.h"
 
 #include <QApplication>
 #include <QMessageBox>
@@ -133,7 +134,7 @@
 
 QString ScriptPlugin::fullTrName() const
 {
-	return QObject::tr("Scripter");
+	return QObject::tr("Scripter for Python 2.x");
 }
 
 const ScActionPlugin::AboutData* ScriptPlugin::getAboutData() const
@@ -146,7 +147,6 @@
 			"Craig Ringer <craig at scribus.info>");
 	about->shortDescription = tr("Embedded Python scripting support for Python 2.x.");
 	// about->description = tr("Write me!")
-	// about->version
 	// about->releaseDate
 	// about->copyright
 	// about->license
@@ -895,28 +895,18 @@
 	}
 
 	// Export the Scribus version into the module namespace so scripts know what they're running in
-	PyDict_SetItemString(d, const_cast<char*>("scribus_version"), PyString_FromString(const_cast<char*>(VERSION)));
+	PyDict_SetItemString(d, const_cast<char*>("scribus_version"), PyString_FromString(ScribusAPI::getVersion().toLatin1().constData()));
 	// Now build a version tuple like that provided by Python in sys.version_info
 	// The tuple is of the form (major, minor, patchlevel, extraversion, reserved)
-	QRegExp version_re("(\\d+)\\.(\\d+)\\.(\\d+)(.*)");
-	int pos = version_re.indexIn(QString(VERSION));
-	// We ignore errors, causing the scribus_version_info attribute to simply not be created.
-	// This will make acceses raise AttrbuteError.
-	if (pos > -1)
-	{
-		int majorVersion = version_re.cap(1).toInt();
-		int minorVersion = version_re.cap(2).toInt();
-		int patchVersion = version_re.cap(3).toInt();
-		QString extraVersion = version_re.cap(4);
-		PyObject* versionTuple = Py_BuildValue(const_cast<char*>("(iiisi)"),\
-				majorVersion, minorVersion, patchVersion, (const char*)extraVersion.toUtf8(), 0);
-		if (versionTuple != nullptr)
-			PyDict_SetItemString(d, const_cast<char*>("scribus_version_info"), versionTuple);
-		else
-			qDebug("Failed to build version tuple for version string '%s' in scripter", VERSION);
-	}
+	int majorVersion = ScribusAPI::getVersionMajor();
+	int minorVersion = ScribusAPI::getVersionMinor();
+	int patchVersion = ScribusAPI::getVersionPatch();
+	QString extraVersion = ScribusAPI::getVersionSuffix();
+	PyObject* versionTuple = Py_BuildValue(const_cast<char*>("(iiisi)"), majorVersion, minorVersion, patchVersion, (const char*)extraVersion.toUtf8(), 0);
+	if (versionTuple != nullptr)
+		PyDict_SetItemString(d, const_cast<char*>("scribus_version_info"), versionTuple);
 	else
-		qDebug("Couldn't parse version string '%s' in scripter", VERSION);
+		qDebug()<<"Failed to build version tuple for version string "<< ScribusAPI::getVersion() << " in scripter";
 
 	// Function aliases for compatibility
 	// We need to import the __builtins__, warnings and exceptions modules to be able to run

Modified: trunk/Scribus/scribus/pslib.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24486&path=/trunk/Scribus/scribus/pslib.cpp
==============================================================================
--- trunk/Scribus/scribus/pslib.cpp	(original)
+++ trunk/Scribus/scribus/pslib.cpp	Mon Feb 15 16:40:55 2021
@@ -35,6 +35,7 @@
 #include <QBuffer>
 #include <QStack>
 
+#include "api/api_application.h"
 #include "cmsettings.h"
 #include "commonstrings.h"
 #include "scconfig.h"
@@ -82,11 +83,11 @@
 	void drawObject(PageItem* item) override;
 
 	private:
-		ScribusDoc* m_Doc;
+		ScribusDoc* m_Doc {nullptr};
 		uint m_argh;
-		ScPage* m_page;
+		ScPage* m_page {nullptr};
 		bool m_master;
-		PSLib* m_ps;
+		PSLib* m_ps {nullptr};
 
 		void applyTransform()
 		{
@@ -245,7 +246,7 @@
 {
 	Options = options;
 	User = "";
-	Creator = "Scribus" + QString(VERSION);
+	Creator = ScribusAPI::getVersionScribus();
 	Title = "";
 	FillColor = "0.0 0.0 0.0 0.0";
 	StrokeColor = "0.0 0.0 0.0 0.0";

Modified: trunk/Scribus/scribus/scdocoutput_ps2.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24486&path=/trunk/Scribus/scribus/scdocoutput_ps2.cpp
==============================================================================
--- trunk/Scribus/scribus/scdocoutput_ps2.cpp	(original)
+++ trunk/Scribus/scribus/scdocoutput_ps2.cpp	Mon Feb 15 16:40:55 2021
@@ -7,6 +7,7 @@
 
 #include "scdocoutput_ps2.h"
 
+#include "api/api_application.h"
 #include "commonstrings.h"
 #include "scpage.h"
 #include "scpageoutput_ps2.h"
@@ -26,7 +27,7 @@
 	m_status = 0;
 	m_author = doc->documentInfo().author();
 	m_title  = doc->documentInfo().title();
-	m_creator = QString("Scribus ") + QString(VERSION);
+	m_creator = ScribusAPI::getVersionScribus();
 }
 
 ScDocOutput_Ps2::~ScDocOutput_Ps2()

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24486&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp	(original)
+++ trunk/Scribus/scribus/scribus.cpp	Mon Feb 15 16:40:55 2021
@@ -96,6 +96,7 @@
 
 #include "actionmanager.h"
 #include "actionsearch.h"
+#include "api/api_application.h"
 #include "appmodehelper.h"
 #include "appmodes.h"
 #include "canvasmode.h"
@@ -333,11 +334,9 @@
 	m_doc->addPage(0);
 	m_doc->setGUI(false, this, nullptr);
 	CurrStED = nullptr;
-	QString scribusTitle(tr("Scribus") + " " + QString(VERSION));
-#if defined(HAVE_SVNVERSION) && defined(SVNVERSION)
-	if (QString(VERSION).contains("svn", Qt::CaseInsensitive))
-		scribusTitle.append(QString(" (r%1)").arg(SVNVERSION));
-#endif
+	QString scribusTitle(ScribusAPI::getVersionScribusTranslated());
+	if (ScribusAPI::isSVN())
+		scribusTitle.append(QString(" (r%1)").arg(ScribusAPI::getSVNRevision()));
 	setWindowTitle(scribusTitle);
 	setAttribute(Qt::WA_KeyCompression, false);
 	setAttribute(Qt::WA_InputMethodEnabled, true);

Modified: trunk/Scribus/scribus/styles/charstyle.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24486&path=/trunk/Scribus/scribus/styles/charstyle.cpp
==============================================================================
--- trunk/Scribus/scribus/styles/charstyle.cpp	(original)
+++ trunk/Scribus/scribus/styles/charstyle.cpp	Mon Feb 15 16:40:55 2021
@@ -394,7 +394,7 @@
 
 void CharStyle::getNamedResources(ResourceCollection& lists) const
 {
-	QString colorName;
+//	QString colorName;
 
 	for (const BaseStyle* sty = parentStyle(); sty != nullptr; sty = sty->parentStyle())
 		lists.collectCharStyle(sty->name());

Modified: trunk/Scribus/scribus/third_party/CMakeLists.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24486&path=/trunk/Scribus/scribus/third_party/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/third_party/CMakeLists.txt	(original)
+++ trunk/Scribus/scribus/third_party/CMakeLists.txt	Mon Feb 15 16:40:55 2021
@@ -10,3 +10,4 @@
 add_subdirectory(pgf)
 add_subdirectory(rtf-qt)
 add_subdirectory(zip)
+

Modified: trunk/Scribus/scribus/ui/about.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24486&path=/trunk/Scribus/scribus/ui/about.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/about.cpp	(original)
+++ trunk/Scribus/scribus/ui/about.cpp	Mon Feb 15 16:40:55 2021
@@ -26,9 +26,10 @@
 #include <QToolTip>
 #include <QWidget>
 
-#include <cairo.h>
+
 
 #include "about.h"
+#include "api/api_application.h"
 #include "commonstrings.h"
 #include "scconfig.h"
 #include "scpaths.h"
@@ -94,7 +95,7 @@
 {
 	m_mode = diaMode;
 	m_firstShow = true;
-	setWindowTitle( tr("About Scribus %1").arg(VERSION) );
+	setWindowTitle( tr("About Scribus %1").arg(ScribusAPI::getVersion()) );
 	setWindowIcon(IconManager::instance().loadIcon("AppIcon.png", true));
 	setModal(true);
 	aboutLayout = new QVBoxLayout( this );
@@ -137,56 +138,28 @@
 	QString BUILD_NAME = "";
 
 	QString built = tr("%1 %2 %3").arg(BUILD_DAY, BUILD_MONTH, BUILD_YEAR);
-	QString version = VERSION;
+	QString version(ScribusAPI::getVersion());
 	if (BUILD_NAME != "")
 		version += " \"" + BUILD_NAME + "\"";
 	if (BUILD_NAME == "BleedingEdge")
 		built = tr("%3-%2-%1 %4 %5").arg(BUILD_DAY, BUILD_MONTH, BUILD_YEAR, BUILD_TIME, BUILD_TZ);
 
-#if defined(HAVE_SVNVERSION) && defined(SVNVERSION)
-	QString revText;
-	revText=QString(tr("SVN Revision: %1")).arg(SVNVERSION);
-	built+=" - ";
-	built+=revText;
-#endif
-	QString bu;
-	bu += "C";
-	bu += "-";
-	bu += "-";
-	bu += "T";
-	bu += "-";
-#ifdef HAVE_FONTCONFIG
-	bu += "F";
-#else
-	bu += "*";
-#endif
-	bu += "-";
-	bu += "C";
-	bu += cairo_version_string();
-
-// Some more information if we are not on a 32bit little endian Unix machine
-#if defined(Q_OS_WIN)
-	bu += "-Windows";
-#elif defined(Q_OS_MAC)
-	bu += "-Mac/";
-#elif defined(Q_OS_DARWIN)
-	// dunno if anyone uses this...
-	bu += "-Darwin";
-#endif
-	if (QSysInfo::WordSize != 32)
-		bu += QString("-%1bit").arg(QSysInfo::WordSize);
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
-	if (QSysInfo::ByteOrder==QSysInfo::BigEndian)
-		bu += "-Big";
-#endif
+	if (ScribusAPI::haveSVNRevision())
+	{
+		QString revText(tr("SVN Revision: "));
+		revText += ScribusAPI::getSVNRevision();
+		built += " - ";
+		built += revText;
+	}
+
 	QString gsver(getGSVersion());
 	if (!gsver.isEmpty())
 		gsver = tr("Using Ghostscript version %1").arg(gsver);
 	else
 		gsver = tr("No Ghostscript version available");
-	buildID->setText( tr("<p align=\"center\"><b>%1 %2</b></p><p align=\"center\">%3<br>%4 %5<br>%6</p>").arg( tr("Scribus Version"), version, built, tr("Build ID:"), bu, gsver));
+	buildID->setText( tr("<p align=\"center\"><b>%1 %2</b></p><p align=\"center\">%3<br>%4 %5<br>%6</p>").arg( tr("Scribus Version"), version, built, tr("Build ID:"), ScribusAPI::getBuildInformation(), gsver));
 	tabLayout1->addWidget( buildID, 0, Qt::AlignHCenter );
-	tabWidget2->addTab( tab, tr( "&About" ) );
+	tabWidget2->addTab( tab, tr("&About") );
 
 	/*! AUTHORS tab */
 	tab_2 = new QWidget( tabWidget2 );
@@ -206,7 +179,7 @@
 	transView = new QTextBrowser( tab_3);
 	transView->setHtml(About::parseTranslationFile(ScPaths::instance().docDir() + "TRANSLATION"));
 	tabLayout_2->addWidget( transView );
-	tabWidget2->addTab( tab_3, tr( "&Translations" ) );
+	tabWidget2->addTab( tab_3, tr("&Translations") );
 
 	/*! ONLINE tab (03/04/2004 petr vanek) */
 	tab_4 = new QWidget( tabWidget2 );
@@ -217,23 +190,23 @@
 	tabLayout_4->setSpacing(6);
 	tabLayout_4->setContentsMargins(9, 9, 9, 9);
 	tabLayout_4->addWidget( onlineView );
-	tabWidget2->addTab( tab_4, tr( "&Online" ) );
+	tabWidget2->addTab( tab_4, tr("&Online") );
 
 
 	/*! UPDATE tab */
 	tab_5 = new QWidget( tabWidget2 );
-	tabWidget2->addTab( tab_5, tr( "&Updates" ) );
+	tabWidget2->addTab( tab_5, tr("&Updates") );
 	updateLayout = new QVBoxLayout( tab_5 );
 	updateLayout->setSpacing(6);
 	updateLayout->setContentsMargins(9, 9, 9, 9);
-	checkForUpdateButton = new QPushButton( tr( "Check for Updates" ), tab_5 );
+	checkForUpdateButton = new QPushButton( tr("Check for Updates"), tab_5 );
 	updateView = new QTextBrowser( tab_5);
 	updateLayout->addWidget( checkForUpdateButton );
 	updateLayout->addWidget( updateView );
 	
 	/*! LICENCE tab */
 	tab_Licence = new QWidget( tabWidget2 );
-	tabWidget2->addTab( tab_Licence, tr( "&Licence" ) );
+	tabWidget2->addTab( tab_Licence, tr("&Licence") );
 	licenceLayout = new QVBoxLayout( tab_Licence );
 	licenceLayout->setSpacing(6);
 	licenceLayout->setContentsMargins(9, 9, 9, 9);
@@ -260,7 +233,7 @@
 	layout2->setContentsMargins(0, 0, 0, 0);
 	QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
 	layout2->addItem( spacer );
-	okButton = new QPushButton( tr( "&Close" ), this );
+	okButton = new QPushButton( tr("&Close"), this );
 	okButton->setDefault( true );
 	layout2->addWidget( okButton );
 	aboutLayout->addLayout( layout2 );
@@ -268,11 +241,11 @@
 
 
 	//tooltips
-	buildID->setToolTip( "<qt>" + tr( "This panel shows the version, build date and compiled in library support in Scribus.")+"<br>"
+	buildID->setToolTip( "<qt>" + tr("This panel shows the version, build date and compiled in library support in Scribus.")+"<br>"
 	+ tr("The C-C-T-F equates to C=littlecms C=CUPS T=TIFF support F=Fontconfig support.Last Letter is the renderer C=cairo or Q=Qt")+"<br>"
 	+ tr("Missing library support is indicated by a *. This also indicates the version of Ghostscript which Scribus has detected.")+"<br>"
-	+ tr("The Windows version does not use fontconfig or CUPS libraries." ) + "</qt>" );
-	checkForUpdateButton->setToolTip( "<qt>" + tr( "Check for updates to Scribus. No data from your machine will be transferred off it." ) + "</qt>" );
+	+ tr("The Windows version does not use fontconfig or CUPS libraries.") + "</qt>");
+	checkForUpdateButton->setToolTip( "<qt>" + tr("Check for updates to Scribus. No data from your machine will be transferred off it.") + "</qt>");
 	// signals and slots connections
 	connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
 	connect( checkForUpdateButton, SIGNAL( clicked() ), this, SLOT( runUpdateCheck() ) );
@@ -292,33 +265,35 @@
 QString About::trAuthorTitle(const QString& title)
 {
 	QString result;
-	if ( title == "Development Team:" )
+	if (title == "Development Team:")
 		result = tr("Development Team:");
-	else if ( title == "Mac OS® X Aqua Port:" )
+	else if (title == "Mac OS® X Aqua Port:")
 		result = tr("Mac OS® X Aqua Port:");
-	else if ( title == "OS/2®/eComStation™ Port:" )
+	else if (title == "OS/2®/eComStation™ Port:")
 		result = tr("OS/2®/eComStation™ Port:");
-	else if ( title == "Windows® Port:" )
+	else if (title == "Windows® Port:")
 		result = tr("Windows® Port:");
-	else if ( title == "Haiku Port:" )
+	else if (title == "Haiku Port:")
 		result = tr("Haiku Port:");
-	else if ( title == "Contributions from:" )
+	else if (title == "Contributions from:")
 		result = tr("Contributions from:");
-	else if ( title == "Official Documentation:" )
+	else if (title == "Official Documentation:")
 		result = tr("Official Documentation:");
-	else if ( title == "Doc Translators:" )
+	else if (title == "Doc Translators:")
 		result = tr("Doc Translators:");
-	else if ( title == "Other Documentation:" )
+	else if (title == "Other Documentation:")
 		result = tr("Other Documentation:");
-	else if ( title == "Webmasters:" )
+	else if (title == "Webmasters:")
 		result = tr("Webmasters:");
-	else if ( title == "Splash Screen:" )
+	else if (title == "Splash Screen:")
 		result = tr("Splash Screen:");
-	else if ( title == "Tango Project Icons:" )
+	else if (title == "Tango Project Icons:")
 		result = tr("Tango Project Icons:");
-	else if ( title == "Scribus 1.5.1+ Icon Set:" )
+	else if (title == "Scribus 1.5.1+ Icon Set:")
 		result = tr("Scribus 1.5.1+ Icon Set:");
-	else if ( title == "Refactoring text layout code, the new boxes model & CTL text layout, Oman House of Open Source Technology team:" )
+	else if (title == "AppImage for Linux:")
+		result = tr("AppImage for Linux:");
+	else if (title == "Refactoring text layout code, the new boxes model & CTL text layout, Oman House of Open Source Technology team:")
 		result = tr("Refactoring text layout code, the new boxes model & CTL text layout, Oman House of Open Source Technology team:");
 	else
 	{
@@ -330,9 +305,9 @@
 QString About::trTranslationTitle(const QString& title)
 {
 	QString result;
-	if ( title == "Official Translations and Translators (in order of locale shortcode):" )
+	if (title == "Official Translations and Translators (in order of locale shortcode):")
 		result = tr("Official Translations and Translators (in order of locale shortcode):");
-	else if ( title == "Previous Translation Contributors:" )
+	else if (title == "Previous Translation Contributors:")
 		result = tr("Previous Translation Contributors:");
 	else
 	{
@@ -346,17 +321,17 @@
 QString About::trLinksTitle(const QString& title)
 {
 	QString result;
-	if ( title == "Homepage" )
+	if (title == "Homepage")
 		result = tr("Homepage");
-	else if ( title == "Online Reference" )
+	else if (title == "Online Reference")
 		result = tr("Online Reference");
-	else if ( title == "Wiki" )
+	else if (title == "Wiki")
 		result = tr("Wiki");
-	else if ( title == "Bugs and Feature Requests" )
+	else if (title == "Bugs and Feature Requests")
 		result = tr("Bugs and Feature Requests");
-	else if ( title == "Developer Blog" )
+	else if (title == "Developer Blog")
 		result = tr("Developer Blog");
-	else if ( title == "Mailing List" )
+	else if (title == "Mailing List")
 		result = tr("Mailing List");
 	else
 	{

Modified: trunk/Scribus/scribus/ui/splash.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24486&path=/trunk/Scribus/scribus/ui/splash.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/splash.cpp	(original)
+++ trunk/Scribus/scribus/ui/splash.cpp	Mon Feb 15 16:40:55 2021
@@ -13,13 +13,10 @@
 #include <QRegExp>
 
 #include "scconfig.h"
+
+#include "api/api_application.h"
 #include "splash.h"
-
 #include "util.h"
-
-#ifdef HAVE_SVNVERSION
-	#include "svnversion.h"
-#endif
 
 ScSplashScreen::ScSplashScreen( const QPixmap & pixmap, Qt::WindowFlags f ) : QSplashScreen( pixmap, f)
 {
@@ -70,18 +67,18 @@
 #else
 	lgf.setPointSize(29);
 #endif
-	QString versionText(VERSION);
 	painter->setFont(lgf);
-	painter->drawText(r, Qt::AlignRight | Qt::AlignAbsolute | Qt::AlignBottom, versionText );
+	painter->drawText(r, Qt::AlignRight | Qt::AlignAbsolute | Qt::AlignBottom, ScribusAPI::getVersion() );
 
-	if (versionText.contains("svn"))
+	if (ScribusAPI::isSVN())
 	{
-#if defined(HAVE_SVNVERSION) && defined(SVNVERSION)
-		QString revText=QString("SVN Revision: %1").arg(SVNVERSION);
-		QRect r2 = rect().adjusted(0, 0, -15, -30);
-		painter->setFont(f);
-		painter->drawText(r2, Qt::AlignRight | Qt::AlignAbsolute | Qt::AlignBottom, revText );
-#endif
+		if (ScribusAPI::haveSVNRevision())
+		{
+			QString revText=QString("SVN Revision: %1").arg(ScribusAPI::getSVNRevision());
+			QRect r2 = rect().adjusted(0, 0, -15, -30);
+			painter->setFont(f);
+			painter->drawText(r2, Qt::AlignRight | Qt::AlignAbsolute | Qt::AlignBottom, revText );
+		}
 		QFont wf(font());
 #if defined _WIN32
 		wf.setPointSize(10);

Modified: trunk/Scribus/scribus/upgradechecker.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24486&path=/trunk/Scribus/scribus/upgradechecker.cpp
==============================================================================
--- trunk/Scribus/scribus/upgradechecker.cpp	(original)
+++ trunk/Scribus/scribus/upgradechecker.cpp	Mon Feb 15 16:40:55 2021
@@ -21,21 +21,18 @@
 
 #include "prefsmanager.h"
 #include "scpaths.h"
+#include "api/api_application.h"
 #include "scribuscore.h"
 #include "upgradechecker.h"
 
 UpgradeChecker::UpgradeChecker()
 {
-	m_version = (VERSION);
 	m_stability = "unstablesvn";
-	QString versionStripped = m_version.toLower();
-	m_isCVS = versionStripped.contains("svn");
-	if (m_isCVS)
-		versionStripped.remove("svn");
-	major = versionStripped.section('.', 0, 0).toInt();
-	minor = versionStripped.section('.', 1, 1).toInt();
-	m_revision1 = versionStripped.section('.', 2, 2).toInt();
-	m_revision2 = versionStripped.section('.', 3, 4).toInt();
+	m_isSVN = ScribusAPI::isSVN();
+	major = ScribusAPI::getVersionMajor();
+	minor = ScribusAPI::getVersionMinor();
+	m_patchLevel = ScribusAPI::getVersionPatch();
+	m_versionSuffix = ScribusAPI::getVersionSuffix().toLower().remove("svn").toInt();
 #if defined(Q_OS_MAC)
 	m_platform = "MacOSX";
 #elif defined(Q_OS_WIN32)
@@ -127,7 +124,7 @@
 	QString errorMsg;
 	int eline;
 	int ecol;
-	QDomDocument doc( "scribusversions" );
+	QDomDocument doc("scribusversions");
 	QString data(ts.readAll());
 	if (!doc.setContent( data, &errorMsg, &eline, &ecol )) 
 	{
@@ -162,15 +159,15 @@
 			uint verRevsion1 = verAStripped.section('.', 2, 2).toInt();
 			uint verRevsion2 = verAStripped.section('.', 3, 3).toInt();
 			//If we found a release whe a user is running an old CVS version
-			if (verMajor == major && verMinor == minor && verRevsion1 == m_revision1 && verRevsion2 == m_revision2 && m_isCVS && !verIsCVS && !m_updates.contains(verA))
+			if (verMajor == major && verMinor == minor && verRevsion1 == m_patchLevel && verRevsion2 == m_versionSuffix && m_isSVN && !verIsCVS && !m_updates.contains(verA))
 				newVersion = true;
-			else if (!(verMajor == major && verMinor == minor && verRevsion1 == m_revision1 && verRevsion2 == m_revision2))
+			else if (!(verMajor == major && verMinor == minor && verRevsion1 == m_patchLevel && verRevsion2 == m_versionSuffix))
 			{
 				//If we found a version that is not the same as what we are running
 				if (((verMajor > major) ||
 					(verMajor == major && verMinor > minor) ||
-					(verMajor == major && verMinor == minor && verRevsion1 > m_revision1) ||
-					(verMajor == major && verMinor == minor && verRevsion1 == m_revision1 && verRevsion2 > m_revision2))
+					(verMajor == major && verMinor == minor && verRevsion1 > m_patchLevel) ||
+					(verMajor == major && verMinor == minor && verRevsion1 == m_patchLevel && verRevsion2 > m_versionSuffix))
 					&& !m_updates.contains(verA))
 				{
 					newVersion = true;
@@ -210,10 +207,10 @@
 		return;
 	}
 	if (m_updates.isEmpty())
-		outputText("<b>" + tr("No updates are available for your version of Scribus %1").arg(m_version) + "</b>");
+		outputText("<b>" + tr("No updates are available for your version of Scribus %1").arg(ScribusAPI::getVersion()) + "</b>");
 	else
 	{
-		outputText("<b>" + tr("One or more updates for your version of Scribus (%1) are available:").arg(m_version) + "</b>");
+		outputText("<b>" + tr("One or more updates for your version of Scribus (%1) are available:").arg(ScribusAPI::getVersion()) + "</b>");
 		outputText( tr("This list may contain development/unstable versions."));
 		for ( QStringList::Iterator it = m_updates.begin(); it != m_updates.end(); ++it )
 			outputText(*it);

Modified: trunk/Scribus/scribus/upgradechecker.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24486&path=/trunk/Scribus/scribus/upgradechecker.h
==============================================================================
--- trunk/Scribus/scribus/upgradechecker.h	(original)
+++ trunk/Scribus/scribus/upgradechecker.h	Mon Feb 15 16:40:55 2021
@@ -49,9 +49,9 @@
 	QStringList m_updates;
 	bool m_errorReported {false};
 	bool m_fin {false};
-	bool m_isCVS {false};
+	bool m_isSVN {false};
 	bool m_writeToConsole {true};
-	uint major, minor, m_revision1, m_revision2;
+	uint major, minor, m_patchLevel, m_versionSuffix;
 };
 
 class UpgradeCheckerGUI : public UpgradeChecker




More information about the scribus-commit mailing list