@@ -446,9 +446,7 @@ int main ( int argc, char** argv )
446446 if ( GetNumericArgument ( argc, argv, i, " -u" , " --numchannels" , 1 , MAX_NUM_CHANNELS, rDbleArgument ) )
447447 {
448448 iNumServerChannels = static_cast <int > ( rDbleArgument );
449-
450449 qInfo () << qUtf8Printable ( QString ( " - maximum number of channels: %1" ).arg ( iNumServerChannels ) );
451-
452450 CommandLineOptions << " --numchannels" ;
453451 ServerOnlyOptions << " --numchannels" ;
454452 continue ;
@@ -599,20 +597,19 @@ int main ( int argc, char** argv )
599597 bUseGUI = false ;
600598 qWarning () << " No GUI support compiled. Running in headless mode." ;
601599 }
602- #endif
603600
604- if ( bIsClient )
601+ # endif
605602#ifdef SERVER_ONLY
603+ if ( bIsClient )
606604 {
607605 qCritical () << " Only --server mode is supported in this build." ;
608606 exit ( 1 );
609607 }
610- #else
611-
612- // TODO create settings in default state, if loading from file do that next, then come back here to
613- // override from command line options, then create client or server, letting them do the validation
614608
609+ #else
610+ if ( bIsClient )
615611 {
612+
616613 if ( ServerOnlyOptions.size () != 0 )
617614 {
618615 qCritical () << qUtf8Printable ( QString ( " %1: Server only option(s) '%2' used. Did you omit '--server'?" )
@@ -639,6 +636,7 @@ int main ( int argc, char** argv )
639636 else
640637#endif
641638 {
639+
642640 if ( ClientOnlyOptions.size () != 0 )
643641 {
644642 qCritical () << qUtf8Printable (
@@ -786,12 +784,10 @@ int main ( int argc, char** argv )
786784 strServerBindIP = " " ;
787785 }
788786 }
789-
790787#ifndef NO_JSON_RPC
791- //
788+
792789 // strJsonRpcBind address defaults to loopback and should not be empty, but
793790 // in the odd chance that an empty IP is passed, we'll check for it here.
794-
795791 if ( strJsonRpcBindIP.trimmed ().isEmpty () )
796792 {
797793 qCritical () << qUtf8Printable ( QString ( " JSON-RPC is enabled but the bind address provided is empty, exiting." ) );
@@ -809,7 +805,6 @@ int main ( int argc, char** argv )
809805 exit ( 1 );
810806 }
811807 }
812-
813808#endif
814809 }
815810
@@ -937,13 +932,6 @@ int main ( int argc, char** argv )
937932 CClientSettings Settings ( &Client, strIniFileName );
938933 Settings.Load ( CommandLineOptions );
939934
940- // load translation
941- if ( bUseGUI && bUseTranslation )
942- {
943- CLocale::LoadTranslation ( Settings.strLanguage , pApp );
944- CInstPictures::UpdateTableOnLanguageChange ();
945- }
946-
947935# ifndef NO_JSON_RPC
948936 if ( pRpcServer )
949937 {
@@ -954,6 +942,13 @@ int main ( int argc, char** argv )
954942# ifndef HEADLESS
955943 if ( bUseGUI )
956944 {
945+ // load translation
946+ if ( bUseTranslation )
947+ {
948+ CLocale::LoadTranslation ( Settings.strLanguage , pApp );
949+ CInstPictures::UpdateTableOnLanguageChange ();
950+ }
951+
957952 // GUI object
958953 CClientDlg ClientDlg ( &Client,
959954 &Settings,
@@ -967,6 +962,7 @@ int main ( int argc, char** argv )
967962
968963 // show dialog
969964 ClientDlg.show ();
965+
970966 pApp->exec ();
971967 }
972968 else
@@ -1009,8 +1005,8 @@ int main ( int argc, char** argv )
10091005 {
10101006 new CServerRpc ( &Server, pRpcServer, pRpcServer );
10111007 }
1012- #endif
10131008
1009+ #endif
10141010#ifndef HEADLESS
10151011 if ( bUseGUI )
10161012 {
@@ -1019,7 +1015,7 @@ int main ( int argc, char** argv )
10191015 Settings.Load ( CommandLineOptions );
10201016
10211017 // load translation
1022- if ( bUseGUI && bUseTranslation )
1018+ if ( bUseTranslation )
10231019 {
10241020 CLocale::LoadTranslation ( Settings.strLanguage , pApp );
10251021 }
0 commit comments