version fixup

This commit is contained in:
Don Bright 2016-10-29 17:01:34 -07:00
parent 061e9d2232
commit 20751c8635
6 changed files with 38 additions and 25 deletions

View file

@ -108,7 +108,10 @@ include(c++11.pri)
CONFIG += link_pkgconfig
PKGCONFIG += eigen3 glew fontconfig freetype2 harfbuzz glib-2.0 libxml-2.0
contains(OSNAME,Msys): PKGCONFIG += Qt5Core Qt5OpenGL Qt5Gui Qt5Concurrent
contains(OSNAME,Msys): {
PKGCONFIG += Qt5Core Qt5OpenGL Qt5Gui Qt5Concurrent
LIBS += -lopengl32 -lglu32
}
QT += widgets core gui concurrent
@ -538,3 +541,9 @@ man.path = $$PREFIX/share/man/man1
man.extra = cp -f doc/openscad.1 \"\$(INSTALL_ROOT)$${man.path}/$${FULLNAME}.1\"
INSTALLS += man
contains(OSNAME,Msys) {
!exists(objects/openscad_win32_res.o) {
message("please ignore WARNING: Failure to find objects/openscad_win32_res.o and proceed to run make")
}
}

View file

@ -3,6 +3,7 @@
#include "openscad.h"
#include "qtgettext.h"
#include "ui_AboutDialog.h"
#include "PlatformUtils.h"
class AboutDialog : public QDialog, public Ui::AboutDialog
{
@ -10,9 +11,9 @@ class AboutDialog : public QDialog, public Ui::AboutDialog
public:
AboutDialog(QWidget *) {
setupUi(this);
this->setWindowTitle( QString(_("About OpenSCAD")) + " " + openscad_shortversionnumber.c_str());
this->setWindowTitle( QString(_("About OpenSCAD")) + " " + PlatformUtils::shortversion().c_str());
QString tmp = this->aboutText->toHtml();
tmp.replace("__VERSION__", openscad_detailedversionnumber.c_str());
tmp.replace("__VERSION__", PlatformUtils::detailversion().c_str());
this->aboutText->setHtml(tmp);
}

View file

@ -17,26 +17,32 @@ const char *PlatformUtils::OPENSCAD_FOLDER_NAME = "OpenSCAD";
#define QUOTE(x__) # x__
#define QUOTED(x__) QUOTE(x__)
static std::string version()
static std::string shortversion()
{
return std::string(QUOTED(OPENSCAD_VERSION));
std::vector<std::string> ymd = PlatformUtils::version_ymd();
if (ymd.size()>2)
return( boost::format("%s.%s.%s") % ymd[0] % ymd[1] % ymd[2] ).str();
return( boost::format("%s.%s") % ymd[0] % ymd[1] ).str();
}
static std::vector<std::string> version_ymd()
{
std::vector<std::string> ymd;
std::string ver = PlatformUtils::version();
boost::split(ymd, ver, boost::is_any_of("."));
return ymd;
std::string ver = PlatformUtils::fullversion();
std::vector<std::string> ymd,tmp;
boost::split(tmp, ver, boost::is_any_of("-"));
boost::split(ymd, tmp[0], boost::is_any_of("."));
return ymd;
}
#ifndef OPENSCAD_COMMIT
#define OPENSCAD_COMMIT
#endif
static std::string fullversion()
{
return std::string(QUOTED(OPENSCAD_VERSION));
}
static std::string detailedversion()
{
std::string commit = QUOTED(OPENSCAD_COMMIT);
return( boost::format("%s %s") % PlatformUtils::version() % commit).str();
return( boost::format("%s %s") % PlatformUtils::fullversion() % commit).str();
}
static std::string lookupResourcesPath()

View file

@ -10,9 +10,16 @@ namespace fs=boost::filesystem;
namespace PlatformUtils {
extern const char *OPENSCAD_FOLDER_NAME;
std::string version();
extern std::string openscad_detailedversionnumber;
// Version number without any patch level indicator, 2014.03, 2015.03.23
std::string shortversion();
// Version year, month, day, will be size 2 if no day
std::vector<std::string> version_ymd();
// The full version number, e.g. 2014.03, 2015.03-1, 2014.12.23
std::string fullversion();
// Full number + git commit
std::string detailedversion();
void registerApplicationPath(const std::string &applicationpath);
std::string applicationPath();

View file

@ -137,7 +137,7 @@ void UIUtils::openHomepageURL()
static void openVersionedURL(QString url)
{
QDesktopServices::openUrl(QUrl(url.arg(openscad_shortversionnumber.c_str())));
QDesktopServices::openUrl(QUrl(url.arg(PlatformUtils::shortversion().c_str())));
}
void UIUtils::openUserManualURL()

View file

@ -36,13 +36,3 @@ extern std::string commandline_commands;
// The CWD when application started. We shouldn't change CWD, but until we stop
// doing this, use currentdir to get the original CWD.
extern std::string currentdir;
// Version number without any patch level indicator
extern std::string openscad_shortversionnumber;
// The full version number, e.g. 2014.03, 2015.03-1, 2014.12.23
extern std::string openscad_versionnumber;
// Version used for display, typically without patchlevel indicator,
// but may include git commit id for snapshot builds
extern std::string openscad_displayversionnumber;
// Version used for detailed display
extern std::string openscad_detailedversionnumber;