Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
static void myQtMessageOutput(QtMsgType type, const QMessageLogContext &/*context*/, const QString &msg)
{
const std::string localMsg = msg.toStdString();

switch (type) {
case QtDebugMsg:
spdlog::get("logger")->debug("QT message handler: {}", localMsg);
Expand All @@ -116,15 +116,29 @@
int line, void* /*userdata*/ )
{
spdlog::get("logger")->critical("CV error :{} in {} on line {}", err_msg, file_name, line);

my_terminate_handler();
return 0; //Return value is not used
}

int main(int argc, char *argv[])
{
// DFTFringe doesn't have a good darkmode palette
// one could call "DFTFringe.exe -platform windows:darkmode=1" to disable dark mode (except for app borders)
// Following code adds the platform argument programmatically
char *platformArg = "-platform";

Check warning on line 129 in main.cpp

View workflow job for this annotation

GitHub Actions / build-linux (ubuntu-24.04)

ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]

Check warning on line 129 in main.cpp

View workflow job for this annotation

GitHub Actions / build-linux (ubuntu-22.04)

ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]

Check warning on line 129 in main.cpp

View workflow job for this annotation

GitHub Actions / build-linux-clazy (ubuntu-24.04)

ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]

Check warning on line 129 in main.cpp

View workflow job for this annotation

GitHub Actions / build-DFTFringe

ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
char *platformValue = "windows:darkmode=1";

Check warning on line 130 in main.cpp

View workflow job for this annotation

GitHub Actions / build-linux (ubuntu-24.04)

ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]

Check warning on line 130 in main.cpp

View workflow job for this annotation

GitHub Actions / build-linux (ubuntu-22.04)

ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]

Check warning on line 130 in main.cpp

View workflow job for this annotation

GitHub Actions / build-linux-clazy (ubuntu-24.04)

ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]

Check warning on line 130 in main.cpp

View workflow job for this annotation

GitHub Actions / build-DFTFringe

ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
// Create a new argv array with existing args plus platform args
int newArgc = argc + 2;
char *newArgv[newArgc];
for(size_t i = 0; i < argc; i++) {

Check warning on line 134 in main.cpp

View workflow job for this annotation

GitHub Actions / build-linux (ubuntu-24.04)

comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]

Check warning on line 134 in main.cpp

View workflow job for this annotation

GitHub Actions / build-linux (ubuntu-22.04)

comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]

Check warning on line 134 in main.cpp

View workflow job for this annotation

GitHub Actions / build-linux-clazy (ubuntu-24.04)

comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Wsign-compare]

Check warning on line 134 in main.cpp

View workflow job for this annotation

GitHub Actions / build-DFTFringe

comparison of integer expressions of different signedness: 'size_t' {aka 'long long unsigned int'} and 'int' [-Wsign-compare]
newArgv[i] = argv[i];
}
newArgv[argc] = platformArg;
newArgv[argc + 1] = platformValue;

// Allow secondary instances
SingleApplication app( argc, argv, true );
SingleApplication app( newArgc, newArgv, true );

MessageReceiver msgReceiver;

Expand All @@ -148,7 +162,7 @@
auto file_sink = std::make_shared<spdlog::sinks::rotating_file_sink_mt>("DFTFringeLogs/log.txt", 1048576 * 5, 3);

auto combined_logger = std::make_shared<spdlog::logger>("logger", spdlog::sinks_init_list({console_sink, file_sink}));

// Combined logger needs to be manually registered or it won't be found by "get"
spdlog::register_logger(combined_logger);

Expand All @@ -159,7 +173,7 @@
#ifndef DALE_DO_NOT_LOG
// Set the logging format
spdlog::get("logger")->set_pattern("[%Y-%m-%d %H:%M:%S.%e] [%^%l%$] %v");
#endif
#endif

// Set logger level
settingsDebug::setLogLevel(settingsDebug::getLogLevel());
Expand Down
Loading