# HG changeset patch # User Santeri Piippo # Date 1389344978 -7200 # Node ID 2d01590da2863f296adfe3f556212233b3686563 # Parent ad1ba9509ba36f86fc58c23af0f986dad591052c - use QCoreApplication::applicationDirPath instead of a custom hack to get the application path - write the build date in the application title - other misc tweaks diff -r ad1ba9509ba3 -r 2d01590da286 ldforge.pro --- a/ldforge.pro Fri Jan 10 03:36:21 2014 +0200 +++ b/ldforge.pro Fri Jan 10 11:09:38 2014 +0200 @@ -24,7 +24,8 @@ OBJECTS_DIR = ./build_release/ } -exists(.git): DEFINES += GIT_DESCRIBE="\\\"$$system(git describe --tags --long)\\\"" +exists(.git): DEFINES += GIT_DESCRIBE="\"\\\"$$system(git describe --tags --long)\\\"\"" +DEFINES += COMPILE_DATE="\"\\\"$$system(LC_ALL=C date \"+%d %h %Y %H:%M:%S\")\\\"\"" unix { LIBS += -lGLU diff -r ad1ba9509ba3 -r 2d01590da286 src/config.cc --- a/src/config.cc Fri Jan 10 03:36:21 2014 +0200 +++ b/src/config.cc Fri Jan 10 11:09:38 2014 +0200 @@ -48,12 +48,7 @@ // ----------------------------------------------------------------------------- static QSettings* getSettingsObject() { - QString path = getApplicationDirectory() + DIRSLASH UNIXNAME EXTENSION; - -#if DIRSLASH_CHAR != '/' - path.replace (DIRSLASH, "/"); -#endif - + QString path = qApp->applicationDirPath() + "/" UNIXNAME EXTENSION; return new QSettings (path, QSettings::IniFormat); } diff -r ad1ba9509ba3 -r 2d01590da286 src/document.cc --- a/src/document.cc Fri Jan 10 03:36:21 2014 +0200 +++ b/src/document.cc Fri Jan 10 11:09:38 2014 +0200 @@ -372,7 +372,7 @@ // Trim the trailing newline QChar c; - while (!line.isEmpty() && ((c = line[line.length() - 1]) == '\n' || c == '\r')) + while (line.endsWith ("\n") || line.endsWith ("\r")) line.chop (1); LDObject* obj = parseLine (line); diff -r ad1ba9509ba3 -r 2d01590da286 src/gui.cc --- a/src/gui.cc Fri Jan 10 03:36:21 2014 +0200 +++ b/src/gui.cc Fri Jan 10 11:09:38 2014 +0200 @@ -285,6 +285,8 @@ title += " [pre-release build]"; #endif // DEBUG + title += " (built " COMPILE_DATE ")"; + setWindowTitle (title); } diff -r ad1ba9509ba3 -r 2d01590da286 src/main.cc --- a/src/main.cc Fri Jan 10 03:36:21 2014 +0200 +++ b/src/main.cc Fri Jan 10 11:09:38 2014 +0200 @@ -43,18 +43,6 @@ cfg (Bool, firststart, true); -static QString g_argv0; - -QString getApplicationDirectory() -{ - assert (g_argv0.isEmpty() == false); - - if (g_argv0.indexOf (DIRSLASH) != -1) - return dirname (g_argv0); - - return "."; -} - // ============================================================================= // ----------------------------------------------------------------------------- int main (int argc, char* argv[]) @@ -62,7 +50,6 @@ QApplication app (argc, argv); app.setOrganizationName (APPNAME); app.setApplicationName (APPNAME); - g_argv0 = argv[0]; initCrashCatcher(); LDDocument::setCurrent (null); diff -r ad1ba9509ba3 -r 2d01590da286 src/main.h --- a/src/main.h Fri Jan 10 03:36:21 2014 +0200 +++ b/src/main.h Fri Jan 10 11:09:38 2014 +0200 @@ -44,6 +44,11 @@ #define BUILD_RELEASE 1 // ============================================= +#ifndef COMPILE_DATE +# error COMPILE_DATE is not set (qmake should have done this) +#endif // COMPILE_DATE + +// ============================================= #ifdef DEBUG # undef RELEASE #endif // DEBUG @@ -99,8 +104,6 @@ QString versionString(); QString fullVersionString(); -QString getApplicationDirectory(); - #define properties private #define typedefs public #define for_axes(AX) for (const Axis AX : std::initializer_list ({X, Y, Z})) @@ -108,6 +111,7 @@ // ----------------------------------------------------------------------------- #ifdef IN_IDE_PARSER // KDevelop workarounds: # error IN_IDE_PARSER is defined (this code is only for KDevelop workarounds) +# define COMPILE_DATE "14-01-10 10:31:09" # ifndef va_start # define va_start(va, arg) diff -r ad1ba9509ba3 -r 2d01590da286 src/primitives.cc --- a/src/primitives.cc Fri Jan 10 03:36:21 2014 +0200 +++ b/src/primitives.cc Fri Jan 10 11:09:38 2014 +0200 @@ -70,6 +70,10 @@ while (conf.atEnd() == false) { QString line = conf.readLine(); + + if (line.endsWith ("\n")) + line.chop (1); + int space = line.indexOf (" "); if (space == -1) @@ -81,6 +85,7 @@ g_primitives << info; } + PrimitiveCategory::populateCategories(); log ("%1 primitives loaded.\n", g_primitives.size()); } }