@@ -92,7 +92,7 @@ static void my_terminate_handler() {
9292static void myQtMessageOutput (QtMsgType type, const QMessageLogContext &/* context*/ , const QString &msg)
9393{
9494 const std::string localMsg = msg.toStdString ();
95-
95+
9696 switch (type) {
9797 case QtDebugMsg:
9898 spdlog::get (" logger" )->debug (" QT message handler: {}" , localMsg);
@@ -116,15 +116,29 @@ static int myCvErrorCallback( int /*status*/, const char* /*func_name*/,
116116 int line, void * /* userdata*/ )
117117{
118118 spdlog::get (" logger" )->critical (" CV error :{} in {} on line {}" , err_msg, file_name, line);
119-
119+
120120 my_terminate_handler ();
121121 return 0 ; // Return value is not used
122122}
123123
124124int main (int argc, char *argv[])
125125{
126+ // DFTFringe doesn't have a good darkmode palette
127+ // one could call "DFTFringe.exe -platform windows:darkmode=1" to disable dark mode (except for app borders)
128+ // Following code adds the platform argument programmatically
129+ char *platformArg = " -platform" ;
130+ char *platformValue = " windows:darkmode=1" ;
131+ // Create a new argv array with existing args plus platform args
132+ int newArgc = argc + 2 ;
133+ char *newArgv[newArgc];
134+ for (size_t i = 0 ; i < argc; i++) {
135+ newArgv[i] = argv[i];
136+ }
137+ newArgv[argc] = platformArg;
138+ newArgv[argc + 1 ] = platformValue;
139+
126140 // Allow secondary instances
127- SingleApplication app ( argc, argv , true );
141+ SingleApplication app ( newArgc, newArgv , true );
128142
129143 MessageReceiver msgReceiver;
130144
@@ -148,7 +162,7 @@ int main(int argc, char *argv[])
148162 auto file_sink = std::make_shared<spdlog::sinks::rotating_file_sink_mt>(" DFTFringeLogs/log.txt" , 1048576 * 5 , 3 );
149163
150164 auto combined_logger = std::make_shared<spdlog::logger>(" logger" , spdlog::sinks_init_list ({console_sink, file_sink}));
151-
165+
152166 // Combined logger needs to be manually registered or it won't be found by "get"
153167 spdlog::register_logger (combined_logger);
154168
@@ -159,7 +173,7 @@ int main(int argc, char *argv[])
159173#ifndef DALE_DO_NOT_LOG
160174 // Set the logging format
161175 spdlog::get (" logger" )->set_pattern (" [%Y-%m-%d %H:%M:%S.%e] [%^%l%$] %v" );
162- #endif
176+ #endif
163177
164178 // Set logger level
165179 settingsDebug::setLogLevel (settingsDebug::getLogLevel ());
0 commit comments