2021-12-26 23:18:28 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2021-04-11 21:33:08 +08:00
|
|
|
#ifndef SYSTEMCONSTS_H
|
|
|
|
#define SYSTEMCONSTS_H
|
|
|
|
|
|
|
|
#include <QStringList>
|
|
|
|
|
2021-04-13 22:17:18 +08:00
|
|
|
#define APP_SETTSINGS_FILENAME "redpandacpp.ini"
|
2021-10-20 11:14:49 +08:00
|
|
|
#ifdef Q_OS_WIN
|
2022-12-30 09:06:39 +08:00
|
|
|
#define CONSOLE_PAUSER "consolepauser.exe"
|
2021-04-15 11:18:14 +08:00
|
|
|
#define GCC_PROGRAM "gcc.exe"
|
|
|
|
#define GPP_PROGRAM "g++.exe"
|
|
|
|
#define GDB_PROGRAM "gdb.exe"
|
2021-12-25 18:09:50 +08:00
|
|
|
#define GDB_SERVER_PROGRAM "gdbserver.exe"
|
2021-04-15 11:18:14 +08:00
|
|
|
#define GDB32_PROGRAM "gdb32.exe"
|
|
|
|
#define MAKE_PROGRAM "mingw32-make.exe"
|
|
|
|
#define WINDRES_PROGRAM "windres.exe"
|
2021-09-13 22:45:50 +08:00
|
|
|
#define CLEAN_PROGRAM "del /q /f"
|
2021-04-15 11:18:14 +08:00
|
|
|
#define CPP_PROGRAM "cpp.exe"
|
2022-02-15 00:01:50 +08:00
|
|
|
#define GIT_PROGRAM "git.exe"
|
2022-04-27 11:24:40 +08:00
|
|
|
#define CLANG_PROGRAM "clang.exe"
|
|
|
|
#define CLANG_CPP_PROGRAM "clang++.exe"
|
|
|
|
#define LLDB_MI_PROGRAM "lldb-mi.exe"
|
2023-01-22 22:19:19 +08:00
|
|
|
#define LLDB_SERVER_PROGRAM "lldb-server.exe"
|
2023-08-13 14:46:53 +08:00
|
|
|
#define SDCC_PROGRAM "sdcc.exe"
|
2023-08-13 18:53:48 +08:00
|
|
|
#define PACKIHX_PROGRAM "packihx.exe"
|
|
|
|
#define MAKEBIN_PROGRAM "makebin.exe"
|
2023-09-05 19:14:08 +08:00
|
|
|
#else // Unix
|
2022-12-30 09:06:39 +08:00
|
|
|
#define CONSOLE_PAUSER "consolepauser"
|
2021-10-20 11:14:49 +08:00
|
|
|
#define GCC_PROGRAM "gcc"
|
|
|
|
#define GPP_PROGRAM "g++"
|
|
|
|
#define GDB_PROGRAM "gdb"
|
2021-12-25 18:09:50 +08:00
|
|
|
#define GDB_SERVER_PROGRAM "gdbserver"
|
2021-10-20 11:14:49 +08:00
|
|
|
#define GDB32_PROGRAM "gdb32"
|
|
|
|
#define MAKE_PROGRAM "make"
|
2021-12-24 23:18:20 +08:00
|
|
|
#define WINDRES_PROGRAM ""
|
2021-10-20 11:14:49 +08:00
|
|
|
#define GPROF_PROGRAM "gprof"
|
|
|
|
#define CLEAN_PROGRAM "rm -rf"
|
|
|
|
#define CPP_PROGRAM "cpp"
|
2022-02-15 00:01:50 +08:00
|
|
|
#define GIT_PROGRAM "git"
|
2022-04-27 11:24:40 +08:00
|
|
|
#define CLANG_PROGRAM "clang"
|
|
|
|
#define CLANG_CPP_PROGRAM "clang++"
|
|
|
|
#define LLDB_MI_PROGRAM "lldb-mi"
|
2023-01-22 22:19:19 +08:00
|
|
|
#define LLDB_SERVER_PROGRAM "lldb-server"
|
2023-08-13 14:46:53 +08:00
|
|
|
#define SDCC_PROGRAM "sdcc"
|
2023-08-17 22:08:31 +08:00
|
|
|
#define PACKIHX_PROGRAM "packihx"
|
|
|
|
#define MAKEBIN_PROGRAM "makebin"
|
2021-04-24 15:57:45 +08:00
|
|
|
#endif
|
2021-04-15 11:18:14 +08:00
|
|
|
|
2021-09-07 10:28:40 +08:00
|
|
|
#define DEV_PROJECT_EXT "dev"
|
2022-10-11 21:51:33 +08:00
|
|
|
#define PROJECT_BOOKMARKS_EXT "bookmarks"
|
2022-10-16 23:10:57 +08:00
|
|
|
#define PROJECT_DEBUG_EXT "debug"
|
2021-09-07 10:28:40 +08:00
|
|
|
#define RC_EXT "rc"
|
2021-09-15 11:23:42 +08:00
|
|
|
#define RES_EXT "res"
|
2021-09-07 10:28:40 +08:00
|
|
|
#define H_EXT "h"
|
2021-09-13 10:48:44 +08:00
|
|
|
#define OBJ_EXT "o"
|
2023-02-12 12:53:14 +08:00
|
|
|
#define LST_EXT "lst"
|
2021-09-13 19:09:15 +08:00
|
|
|
#define DEF_EXT "def"
|
|
|
|
#define LIB_EXT "a"
|
|
|
|
#define GCH_EXT "gch"
|
2021-09-16 12:03:10 +08:00
|
|
|
#define TEMPLATE_EXT "template"
|
2022-08-07 12:09:22 +08:00
|
|
|
#define TEMPLATE_INFO_FILE "info.template"
|
2021-09-07 16:49:35 +08:00
|
|
|
#define DEV_INTERNAL_OPEN "$__DEV_INTERNAL_OPEN"
|
2022-10-17 23:23:05 +08:00
|
|
|
#define DEV_LASTOPENS_FILE "lastopens.json"
|
2021-09-30 11:20:43 +08:00
|
|
|
#define DEV_SYMBOLUSAGE_FILE "symbolusage.json"
|
|
|
|
#define DEV_CODESNIPPET_FILE "codesnippets.json"
|
2021-10-20 12:11:36 +08:00
|
|
|
#define DEV_NEWFILETEMPLATES_FILE "newfiletemplate.txt"
|
2023-02-22 22:18:21 +08:00
|
|
|
#define DEV_NEWCFILETEMPLATES_FILE "newcfiletemplate.txt"
|
|
|
|
#define DEV_NEWGASFILETEMPLATES_FILE "newgasfiletemplate.txt"
|
2021-10-06 23:19:18 +08:00
|
|
|
#define DEV_AUTOLINK_FILE "autolink.json"
|
|
|
|
#define DEV_SHORTCUT_FILE "shortcuts.json"
|
2021-10-08 00:06:41 +08:00
|
|
|
#define DEV_TOOLS_FILE "tools.json"
|
2021-10-21 17:31:25 +08:00
|
|
|
#define DEV_BOOKMARK_FILE "bookmarks.json"
|
2022-10-16 23:10:57 +08:00
|
|
|
#define DEV_DEBUGGER_FILE "debugger.json"
|
2022-10-17 23:23:05 +08:00
|
|
|
#define DEV_HISTORY_FILE "history.json"
|
2022-11-14 19:10:32 +08:00
|
|
|
#define DEV_PROBLEM_SET_FILE "problemset.json"
|
|
|
|
|
2021-10-06 23:19:18 +08:00
|
|
|
|
2021-04-20 22:24:33 +08:00
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
# define PATH_SENSITIVITY Qt::CaseInsensitive
|
2021-09-14 12:10:43 +08:00
|
|
|
# define PATH_SEPARATOR ";"
|
2021-12-09 11:22:28 +08:00
|
|
|
# define LINE_BREAKER "\r\n"
|
2021-04-20 22:24:33 +08:00
|
|
|
# define NULL_FILE "NUL"
|
2022-10-12 19:48:35 +08:00
|
|
|
# define DEFAULT_EXECUTABLE_SUFFIX "exe"
|
|
|
|
# define DEFAULT_PREPROCESSING_SUFFIX "p"
|
|
|
|
# define DEFAULT_COMPILATION_SUFFIX "s"
|
|
|
|
# define DEFAULT_ASSEMBLING_SUFFIX "o"
|
2021-09-06 08:45:53 +08:00
|
|
|
# define STATIC_LIB_EXT "a"
|
|
|
|
# define DYNAMIC_LIB_EXT "dll"
|
2021-09-06 12:58:29 +08:00
|
|
|
# define MAKEFILE_NAME "makefile.win"
|
2023-02-16 22:27:04 +08:00
|
|
|
# define XMAKEFILE_NAME "xmake.lua"
|
2021-12-27 22:46:54 +08:00
|
|
|
# define ALL_FILE_WILDCARD "*.*"
|
2023-09-05 19:14:08 +08:00
|
|
|
#else // Unix
|
2021-04-20 22:24:33 +08:00
|
|
|
# define PATH_SENSITIVITY Qt::CaseSensitive
|
2021-09-14 12:10:43 +08:00
|
|
|
# define PATH_SEPARATOR ":"
|
2021-12-09 11:22:28 +08:00
|
|
|
# define LINE_BREAKER "\n"
|
2021-04-20 22:24:33 +08:00
|
|
|
# define NULL_FILE "/dev/null"
|
2022-10-12 19:48:35 +08:00
|
|
|
# define DEFAULT_EXECUTABLE_SUFFIX ""
|
|
|
|
# define DEFAULT_PREPROCESSING_SUFFIX "p"
|
|
|
|
# define DEFAULT_COMPILATION_SUFFIX "s"
|
|
|
|
# define DEFAULT_ASSEMBLING_SUFFIX "o"
|
2021-09-06 08:45:53 +08:00
|
|
|
# define STATIC_LIB_EXT "a"
|
|
|
|
# define DYNAMIC_LIB_EXT "d"
|
2021-09-06 12:58:29 +08:00
|
|
|
# define MAKEFILE_NAME "makefile"
|
2023-02-16 22:27:04 +08:00
|
|
|
# define XMAKEFILE_NAME "xmake.lua"
|
2021-12-27 22:46:54 +08:00
|
|
|
# define ALL_FILE_WILDCARD "*"
|
2021-04-20 22:24:33 +08:00
|
|
|
#endif
|
2021-04-13 22:17:18 +08:00
|
|
|
|
2023-08-13 18:53:48 +08:00
|
|
|
#define SDCC_IHX_SUFFIX "ihx"
|
|
|
|
#define SDCC_BIN_SUFFIX "bin"
|
|
|
|
#define SDCC_HEX_SUFFIX "hex"
|
2023-08-15 00:29:48 +08:00
|
|
|
#define SDCC_REL_SUFFIX "rel"
|
2023-08-13 18:53:48 +08:00
|
|
|
|
2023-09-05 19:14:08 +08:00
|
|
|
#if defined(Q_OS_WIN)
|
|
|
|
# define DEFAULT_UI_FONT "Segoe UI"
|
|
|
|
# define CJK_UI_FONT_SC "Microsoft YaHei UI"
|
|
|
|
# define CJK_UI_FONT_TC "Microsoft JhengHei UI"
|
|
|
|
# define CJK_UI_FONT_J "Yu Gothic UI"
|
|
|
|
# define CJK_UI_FONT_K "Malgun Gothic"
|
|
|
|
# define DEFAULT_MONO_FONT "Consolas"
|
|
|
|
# define CJK_MONO_FONT_SC "Microsoft YaHei"
|
|
|
|
# define CJK_MONO_FONT_TC "Microsoft JhengHei"
|
|
|
|
# define CJK_MONO_FONT_J "Yu Gothic"
|
|
|
|
# define CJK_MONO_FONT_K "Malgun Gothic"
|
|
|
|
#elif defined(Q_OS_MACOS)
|
|
|
|
# define DEFAULT_UI_FONT "Helvetica Neue"
|
|
|
|
# define CJK_UI_FONT_SC "PingFang SC"
|
|
|
|
# define CJK_UI_FONT_TC "PingFang TC"
|
|
|
|
# define CJK_UI_FONT_J "Hiragino Sans"
|
|
|
|
# define CJK_UI_FONT_K "Apple SD Gothic Neo"
|
|
|
|
# define DEFAULT_MONO_FONT "Menlo"
|
|
|
|
# define CJK_MONO_FONT_SC CJK_UI_FONT_SC
|
|
|
|
# define CJK_MONO_FONT_TC CJK_UI_FONT_TC
|
|
|
|
# define CJK_MONO_FONT_J CJK_UI_FONT_J
|
|
|
|
# define CJK_MONO_FONT_K CJK_UI_FONT_K
|
|
|
|
#else // XDG desktop
|
|
|
|
# define DEFAULT_UI_FONT "Sans" // use fontconfig default
|
|
|
|
# define CJK_UI_FONT_SC "Noto Sans CJK SC"
|
|
|
|
# define CJK_UI_FONT_TC "Noto Sans CJK TC"
|
|
|
|
# define CJK_UI_FONT_J "Noto Sans CJK JP"
|
|
|
|
# define CJK_UI_FONT_K "Noto Sans CJK KR"
|
|
|
|
# define DEFAULT_MONO_FONT "Monospace" // use fontconfig default
|
|
|
|
# define CJK_MONO_FONT_SC CJK_UI_FONT_SC // intentionally: the "Mono" version is not stricly monospaced either, and has less weights
|
|
|
|
# define CJK_MONO_FONT_TC CJK_UI_FONT_TC
|
|
|
|
# define CJK_MONO_FONT_J CJK_UI_FONT_J
|
|
|
|
# define CJK_MONO_FONT_K CJK_UI_FONT_K
|
|
|
|
#endif
|
2023-08-13 18:53:48 +08:00
|
|
|
|
2021-04-11 21:33:08 +08:00
|
|
|
class SystemConsts
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SystemConsts();
|
|
|
|
const QStringList& defaultFileFilters() const noexcept;
|
2021-08-30 18:36:44 +08:00
|
|
|
const QString& defaultCFileFilter() const noexcept;
|
|
|
|
const QString& defaultCPPFileFilter() const noexcept;
|
2021-08-30 19:52:38 +08:00
|
|
|
const QString& defaultAllFileFilter() const noexcept;
|
2023-02-12 22:33:34 +08:00
|
|
|
QString fileFilterFor(const QString& suffix);
|
2021-04-11 21:33:08 +08:00
|
|
|
void addDefaultFileFilter(const QString& name, const QString& fileExtensions);
|
2021-09-14 23:56:08 +08:00
|
|
|
const QStringList &iconFileFilters() const;
|
|
|
|
const QString& iconFileFilter() const;
|
|
|
|
void setIconFileFilters(const QStringList &newIconFileFilters);
|
|
|
|
|
|
|
|
const QStringList &codecNames() const;
|
|
|
|
|
2022-02-28 22:40:09 +08:00
|
|
|
const QStringList &defaultFileNameFilters() const;
|
|
|
|
|
2021-04-11 21:33:08 +08:00
|
|
|
private:
|
2021-09-16 23:51:05 +08:00
|
|
|
void addFileFilter(QStringList& filters, const QString& name, const QString& fileExtensions);
|
2021-04-11 21:33:08 +08:00
|
|
|
QStringList mDefaultFileFilters;
|
2021-09-14 23:56:08 +08:00
|
|
|
QStringList mIconFileFilters;
|
2022-02-28 22:40:09 +08:00
|
|
|
QStringList mDefaultFileNameFilters;
|
2021-09-14 23:56:08 +08:00
|
|
|
QStringList mCodecNames;
|
2021-04-11 21:33:08 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
extern SystemConsts* pSystemConsts;
|
|
|
|
#endif // SYSTEMCONSTS_H
|