@@ -282,20 +282,16 @@ void MainWindow::loadSettings()
282282 mUI .mActionShowCppcheck ->setChecked (true );
283283 mUI .mActionShowClang ->setChecked (true );
284284
285- const bool stdCpp03 = mSettings ->value (SETTINGS_STD_CPP03 , false ).toBool ();
286- mUI .mActionCpp03 ->setChecked (stdCpp03);
287- const bool stdCpp11 = mSettings ->value (SETTINGS_STD_CPP11 , false ).toBool ();
288- mUI .mActionCpp11 ->setChecked (stdCpp11 && !stdCpp03);
289- const bool stdCpp14 = mSettings ->value (SETTINGS_STD_CPP14 , false ).toBool ();
290- mUI .mActionCpp14 ->setChecked (stdCpp14 && !stdCpp03 && !stdCpp11);
291- const bool stdCpp17 = mSettings ->value (SETTINGS_STD_CPP17 , true ).toBool ();
292- mUI .mActionCpp17 ->setChecked (stdCpp17 && !stdCpp03 && !stdCpp11 && !stdCpp14);
293- const bool stdC89 = mSettings ->value (SETTINGS_STD_C89 , false ).toBool ();
294- mUI .mActionC89 ->setChecked (stdC89);
295- const bool stdC11 = mSettings ->value (SETTINGS_STD_C11 , false ).toBool ();
296- mUI .mActionC11 ->setChecked (stdC11);
297- const bool stdC99 = mSettings ->value (SETTINGS_STD_C99 , true ).toBool ();
298- mUI .mActionC99 ->setChecked (stdC99 || (!stdC89 && !stdC11));
285+ Standards standards;
286+ standards.setC (mSettings ->value (SETTINGS_STD_C , QString ()).toString ().toStdString ());
287+ mUI .mActionC89 ->setChecked (standards.c == Standards::C89 );
288+ mUI .mActionC99 ->setChecked (standards.c == Standards::C99 );
289+ mUI .mActionC11 ->setChecked (standards.c == Standards::C11 );
290+ standards.setCPP (mSettings ->value (SETTINGS_STD_CPP , QString ()).toString ().toStdString ());
291+ mUI .mActionCpp03 ->setChecked (standards.cpp == Standards::CPP03 );
292+ mUI .mActionCpp11 ->setChecked (standards.cpp == Standards::CPP11 );
293+ mUI .mActionCpp14 ->setChecked (standards.cpp == Standards::CPP14 );
294+ mUI .mActionCpp17 ->setChecked (standards.cpp == Standards::CPP17 );
299295
300296 // Main window settings
301297 const bool showMainToolbar = mSettings ->value (SETTINGS_TOOLBARS_MAIN_SHOW , true ).toBool ();
@@ -359,13 +355,21 @@ void MainWindow::saveSettings() const
359355 mSettings ->setValue (SETTINGS_SHOW_PERFORMANCE , mUI .mActionShowPerformance ->isChecked ());
360356 mSettings ->setValue (SETTINGS_SHOW_INFORMATION , mUI .mActionShowInformation ->isChecked ());
361357
362- mSettings ->setValue (SETTINGS_STD_CPP03 , mUI .mActionCpp03 ->isChecked ());
363- mSettings ->setValue (SETTINGS_STD_CPP11 , mUI .mActionCpp11 ->isChecked ());
364- mSettings ->setValue (SETTINGS_STD_CPP14 , mUI .mActionCpp14 ->isChecked ());
365- mSettings ->setValue (SETTINGS_STD_CPP17 , mUI .mActionCpp17 ->isChecked ());
366- mSettings ->setValue (SETTINGS_STD_C89 , mUI .mActionC89 ->isChecked ());
367- mSettings ->setValue (SETTINGS_STD_C99 , mUI .mActionC99 ->isChecked ());
368- mSettings ->setValue (SETTINGS_STD_C11 , mUI .mActionC11 ->isChecked ());
358+ if (mUI .mActionC89 ->isChecked ())
359+ mSettings ->setValue (SETTINGS_STD_C , " C89" );
360+ if (mUI .mActionC99 ->isChecked ())
361+ mSettings ->setValue (SETTINGS_STD_C , " C99" );
362+ if (mUI .mActionC11 ->isChecked ())
363+ mSettings ->setValue (SETTINGS_STD_C , " C11" );
364+
365+ if (mUI .mActionCpp03 ->isChecked ())
366+ mSettings ->setValue (SETTINGS_STD_CPP , " C++03" );
367+ if (mUI .mActionCpp11 ->isChecked ())
368+ mSettings ->setValue (SETTINGS_STD_CPP , " C++11" );
369+ if (mUI .mActionCpp14 ->isChecked ())
370+ mSettings ->setValue (SETTINGS_STD_CPP , " C++14" );
371+ if (mUI .mActionCpp17 ->isChecked ())
372+ mSettings ->setValue (SETTINGS_STD_CPP , " C++17" );
369373
370374 // Main window settings
371375 mSettings ->setValue (SETTINGS_TOOLBARS_MAIN_SHOW , mUI .mToolBarMain ->isVisible ());
@@ -926,15 +930,8 @@ Settings MainWindow::getCppcheckSettings()
926930 result.inconclusive = mSettings ->value (SETTINGS_INCONCLUSIVE_ERRORS , false ).toBool ();
927931 if (result.platformType == cppcheck::Platform::Unspecified)
928932 result.platform ((cppcheck::Platform::PlatformType) mSettings ->value (SETTINGS_CHECKED_PLATFORM , 0 ).toInt ());
929- if (mSettings ->value (SETTINGS_STD_CPP03 , false ).toBool ())
930- result.standards .cpp = Standards::CPP03 ;
931- else if (mSettings ->value (SETTINGS_STD_CPP11 , false ).toBool ())
932- result.standards .cpp = Standards::CPP11 ;
933- else if (mSettings ->value (SETTINGS_STD_CPP14 , false ).toBool ())
934- result.standards .cpp = Standards::CPP14 ;
935- else if (mSettings ->value (SETTINGS_STD_CPP17 , true ).toBool ())
936- result.standards .cpp = Standards::CPP17 ;
937- result.standards .c = mSettings ->value (SETTINGS_STD_C99 , true ).toBool () ? Standards::C99 : (mSettings ->value (SETTINGS_STD_C11 , false ).toBool () ? Standards::C11 : Standards::C89 );
933+ result.standards .setCPP (mSettings ->value (SETTINGS_STD_CPP , QString ()).toString ().toStdString ());
934+ result.standards .setC (mSettings ->value (SETTINGS_STD_C , QString ()).toString ().toStdString ());
938935 result.enforcedLang = (Settings::Language)mSettings ->value (SETTINGS_ENFORCED_LANGUAGE , 0 ).toInt ();
939936
940937 if (result.jobs <= 1 ) {
0 commit comments