Fri, 10 Jan 2014 11:09:38 +0200
- use QCoreApplication::applicationDirPath instead of a custom hack to get the application path
- write the build date in the application title
- other misc tweaks
ldforge.pro | file | annotate | diff | comparison | revisions | |
src/config.cc | file | annotate | diff | comparison | revisions | |
src/document.cc | file | annotate | diff | comparison | revisions | |
src/gui.cc | file | annotate | diff | comparison | revisions | |
src/main.cc | file | annotate | diff | comparison | revisions | |
src/main.h | file | annotate | diff | comparison | revisions | |
src/primitives.cc | file | annotate | diff | comparison | revisions |
--- 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
--- 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); }
--- 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);
--- 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); }
--- 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);
--- 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<const Axis> ({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)
--- 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()); } }