1 // This file is part of Dust Racing 2D. 2 // Copyright (C) 2015 Jussi Lind <jussi.lind@iki.fi> 3 // 4 // Dust Racing 2D is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // Dust Racing 2D is distributed in the hope that it will be useful, 9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 // GNU General Public License for more details. 12 // 13 // You should have received a copy of the GNU General Public License 14 // along with Dust Racing 2D. If not, see <http://www.gnu.org/licenses/>. 15 16 #include <QDir> 17 #include <QProcessEnvironment> 18 19 //! Config variables for editor and for the game. 20 namespace Config { 21 22 namespace General { 23 //! The base data path given by -DDATA_PATH. 24 static constexpr auto dataPath = DATA_PATH; 25 26 static constexpr auto COPYRIGHT = "Copyright (c) 2011-2019 Jussi Lind"; 27 28 //! Organization name given to Qt. Affects QSettings and SQLite database file locations. 29 static constexpr auto QT_ORGANIZATION_NAME = "DustRacing2D"; 30 31 //! Path used to search "3rd party" race tracks under the home dir: ~/TRACK_SEARCH_PATH/ 32 static constexpr auto TRACK_SEARCH_PATH = "DustRacingTracks"; 33 34 static constexpr auto WEB_SITE_URL = "http://juzzlin.github.io/DustRacing2D"; 35 36 namespace Unix { 37 //! Path used to search "3rd party" race tracks under `$XDG_DATA_HOME/TRACK_SEARCH_PATH_XDG` or 38 //! $HOME/.local/share/TRACK_SEARCH_PATH_XDG` if `$XDG_DATA_HOME` is not defined. 39 //! TODO: Make this use QStandardPaths like in database.cpp ! 40 static constexpr auto TRACK_SEARCH_PATH_XDG = "DustRacing2D/tracks"; getXdgTrackSearchPath()41inline QString getXdgTrackSearchPath() 42 { 43 const auto env = QProcessEnvironment::systemEnvironment(); 44 const auto xdgDataHome = "XDG_DATA_HOME"; 45 return env.value(xdgDataHome, QDir::homePath() + "/.local/share") + "/" + TRACK_SEARCH_PATH_XDG; 46 } 47 } // namespace Unix 48 49 } // namespace General 50 51 namespace Editor { 52 static constexpr auto EDITOR_NAME = "Dust Racing 2D Track Editor"; 53 54 static constexpr auto EDITOR_VERSION = VERSION; 55 56 static constexpr auto MODEL_CONFIG_FILE_NAME = "editorModels.conf"; 57 58 static constexpr auto QT_APPLICATION_NAME = "Editor"; 59 60 static constexpr auto SELECT_ICON_PATH = ":/cursor.png"; 61 62 static constexpr auto ERASE_ICON_PATH = ":/cross.png"; 63 64 static constexpr auto CLEAR_ICON_PATH = ":/clear.png"; 65 } // namespace Editor 66 67 namespace Game { 68 static constexpr auto GAME_NAME = "Dust Racing 2D"; 69 70 static constexpr auto GAME_VERSION = VERSION; 71 72 static constexpr auto QT_APPLICATION_NAME = "Game"; 73 74 static constexpr auto SQLITE_DATABASE_FILE_NAME = "status.db"; 75 } // namespace Game 76 77 } // namespace Config 78