summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-12-20 07:59:50 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-12-20 07:59:50 -0800
commit2882a1ef412643ae29bf4dca12195063764393ff (patch)
tree3be133bc03d231755e22923fe611ca42e2ddabc9
parentc819d40c19e4983f0deac4dff671bb25aabfc116 (diff)
downloadsubsurface-2882a1ef412643ae29bf4dca12195063764393ff.tar.gz
Remove the non-canonical Subusrface version
It no longer makes sense to lie about the version. If you are running a product build, then the canonical version is the same version as the plain version used to be. And in either case it makes much more sense to simply log the full version information. We used to have the differently styled versions for different OSs, but I don't think this is needed anymore. Let's hope this doesn't go down as one of these "famous last words" moments... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--cmake/Modules/HandleVersionGeneration.cmake3
-rw-r--r--cmake/Modules/version.cmake11
-rw-r--r--desktop-widgets/mainwindow.cpp1
-rw-r--r--desktop-widgets/usersurvey.cpp4
-rw-r--r--subsurface-core/qthelper.cpp11
-rw-r--r--subsurface-core/qthelperfromc.h1
-rw-r--r--subsurface-core/save-git.c2
-rw-r--r--subsurface-core/version.c5
-rw-r--r--subsurface-core/version.h1
9 files changed, 14 insertions, 25 deletions
diff --git a/cmake/Modules/HandleVersionGeneration.cmake b/cmake/Modules/HandleVersionGeneration.cmake
index beb4e49a2..4ef42e71f 100644
--- a/cmake/Modules/HandleVersionGeneration.cmake
+++ b/cmake/Modules/HandleVersionGeneration.cmake
@@ -1,7 +1,6 @@
# Generate the ssrf-config.h every 'make'
file(WRITE ${CMAKE_BINARY_DIR}/version.h.in
-"#define VERSION_STRING \"@VERSION_STRING@\"
-#define GIT_VERSION_STRING \"@GIT_VERSION_STRING@\"
+"#define GIT_VERSION_STRING \"@GIT_VERSION_STRING@\"
#define CANONICAL_VERSION_STRING \"@CANONICAL_VERSION_STRING@\"
")
diff --git a/cmake/Modules/version.cmake b/cmake/Modules/version.cmake
index decb7c568..2fc011ffd 100644
--- a/cmake/Modules/version.cmake
+++ b/cmake/Modules/version.cmake
@@ -1,14 +1,3 @@
-if(${APPLE})
- set(VER_OS darwin)
-elseif(${WIN32})
- set(VER_OS win)
-else()
- set(VER_OS linux)
-endif()
-
-if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
- set(VER_OS win)
-endif()
execute_process(
COMMAND sh ${CMAKE_TOP_SRC_DIR}/scripts/get-version linux
WORKING_DIRECTORY ${CMAKE_TOP_SRC_DIR}
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index 62b72441f..c029687fa 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -1286,7 +1286,6 @@ void MainWindow::checkSurvey(QSettings *s)
s->setValue("FirstUse42", value);
}
// wait a week for production versions, but not at all for non-tagged builds
- QString ver(subsurface_version());
int waitTime = 7;
QDate firstUse42 = s->value("FirstUse42").toDate();
if (run_survey || (firstUse42.daysTo(QDate().currentDate()) > waitTime && !s->contains("SurveyDone"))) {
diff --git a/desktop-widgets/usersurvey.cpp b/desktop-widgets/usersurvey.cpp
index 2d5d5b07e..6dba30d8b 100644
--- a/desktop-widgets/usersurvey.cpp
+++ b/desktop-widgets/usersurvey.cpp
@@ -22,7 +22,7 @@ UserSurvey::UserSurvey(QWidget *parent) : QDialog(parent),
QShortcut *quitKey = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this);
connect(quitKey, SIGNAL(activated()), parent, SLOT(close()));
- os = QString("ssrfVers=%1").arg(subsurface_version());
+ os = QString("ssrfVers=%1").arg(subsurface_canonical_version());
os.append(QString("&prettyOsName=%1").arg(SubsurfaceSysInfo::prettyOsName()));
QString arch = SubsurfaceSysInfo::buildCpuArchitecture();
os.append(QString("&appCpuArch=%1").arg(arch));
@@ -39,7 +39,7 @@ QString UserSurvey::getVersion()
{
QString arch;
// fill in the system data
- QString sysInfo = QString("Subsurface %1").arg(subsurface_version());
+ QString sysInfo = QString("Subsurface %1").arg(subsurface_canonical_version());
sysInfo.append(tr("\nOperating system: %1").arg(SubsurfaceSysInfo::prettyOsName()));
arch = SubsurfaceSysInfo::buildCpuArchitecture();
sysInfo.append(tr("\nCPU architecture: %1").arg(arch));
diff --git a/subsurface-core/qthelper.cpp b/subsurface-core/qthelper.cpp
index a840f4dd2..d55e8438f 100644
--- a/subsurface-core/qthelper.cpp
+++ b/subsurface-core/qthelper.cpp
@@ -791,9 +791,9 @@ QString getUserAgent()
// fill in the system data - use ':' as separator
// replace all other ':' with ' ' so that this is easy to parse
#ifdef SUBSURFACE_MOBILE
- QString userAgent = QString("Subsurface-mobile:%1:").arg(subsurface_version());
+ QString userAgent = QString("Subsurface-mobile:%1:").arg(subsurface_canonical_version());
#else
- QString userAgent = QString("Subsurface:%1:").arg(subsurface_version());
+ QString userAgent = QString("Subsurface:%1:").arg(subsurface_canonical_version());
#endif
userAgent.append(SubsurfaceSysInfo::prettyOsName().replace(':', ' ') + ":");
arch = SubsurfaceSysInfo::buildCpuArchitecture().replace(':', ' ');
@@ -805,6 +805,13 @@ QString getUserAgent()
}
+extern "C" const char *subsurface_user_agent()
+{
+ static QString uA = getUserAgent();
+
+ return strdup(qPrintable(uA));
+}
+
QString uiLanguage(QLocale *callerLoc)
{
QString shortDateFormat;
diff --git a/subsurface-core/qthelperfromc.h b/subsurface-core/qthelperfromc.h
index d2e80144c..32aed8949 100644
--- a/subsurface-core/qthelperfromc.h
+++ b/subsurface-core/qthelperfromc.h
@@ -17,5 +17,6 @@ void cache_picture(struct picture *picture);
char *cloud_url();
char *hashfile_name_string();
char *picturedir_string();
+const char *subsurface_user_agent();
#endif // QTHELPERFROMC_H
diff --git a/subsurface-core/save-git.c b/subsurface-core/save-git.c
index 9bdf9dfd0..310882606 100644
--- a/subsurface-core/save-git.c
+++ b/subsurface-core/save-git.c
@@ -1047,7 +1047,7 @@ static void create_commit_message(struct membuffer *msg)
} while ((dc = dc->next) != NULL);
put_format(msg, "\n");
}
- put_format(msg, "Created by subsurface %s\n", subsurface_version());
+ put_format(msg, "Created by subsurface %s\n", subsurface_user_agent());
}
static int create_new_commit(git_repository *repo, const char *remote, const char *branch, git_oid *tree_id)
diff --git a/subsurface-core/version.c b/subsurface-core/version.c
index 5b54bf4c7..98207efe2 100644
--- a/subsurface-core/version.c
+++ b/subsurface-core/version.c
@@ -1,10 +1,5 @@
#include "ssrf-version.h"
-const char *subsurface_version(void)
-{
- return VERSION_STRING;
-}
-
const char *subsurface_git_version(void)
{
return GIT_VERSION_STRING;
diff --git a/subsurface-core/version.h b/subsurface-core/version.h
index bc0aac00d..98385e970 100644
--- a/subsurface-core/version.h
+++ b/subsurface-core/version.h
@@ -5,7 +5,6 @@
extern "C" {
#endif
-const char *subsurface_version(void);
const char *subsurface_git_version(void);
const char *subsurface_canonical_version(void);