Cppcheck
Public Member Functions | Protected Slots | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
SettingsDialog Class Reference

Settings dialog. More...

#include <settingsdialog.h>

Inheritance diagram for SettingsDialog:

Public Member Functions

 SettingsDialog (ApplicationList *list, TranslationHandler *translator, bool premium, QWidget *parent=nullptr)
 
 SettingsDialog (const SettingsDialog &)=delete
 
 ~SettingsDialog () override
 
SettingsDialogoperator= (const SettingsDialog &)=delete
 
void saveSettingValues () const
 Save all values to QSettings. More...
 
bool showFullPath () const
 Get checkbox value for mShowFullPath. More...
 
bool saveFullPath () const
 Get checkbox value for mSaveFullPath. More...
 
bool showNoErrorsMessage () const
 Get checkbox value for mNoErrorsMessage. More...
 
bool showErrorId () const
 Get checkbox value for mShowIdColumn. More...
 
bool showInconclusive () const
 Get checkbox value for mEnableInconclusive. More...
 
bool saveAllErrors () const
 Get checkbox value for mSaveAllErrors. More...
 

Protected Slots

void ok ()
 Slot for clicking OK. More...
 
void validateEditPythonPath ()
 Slot for validating input value in editPythonPath. More...
 
void addApplication ()
 Slot for adding a new application to the list. More...
 
void removeApplication ()
 Slot for deleting an application from the list. More...
 
void editApplication ()
 Slot for modifying an application in the list. More...
 
void defaultApplication ()
 Slot for making the selected application as the default (first) More...
 
void browsePythonPath ()
 Slot for browsing for the python binary. More...
 
void browseClangPath ()
 Slot for browsing for the clang binary. More...
 
void browseMisraFile ()
 Browse for MISRA file. More...
 
void setCodeEditorStyleDefault ()
 Set Code Editor Style to Default. More...
 
void editCodeEditorStyle ()
 Edit Custom Code Editor Style. More...
 

Protected Member Functions

void populateApplicationList ()
 Clear all applications from the list and re insert them from mTempApplications. More...
 
void loadSettings ()
 Load saved values Loads dialog size and column widths. More...
 
void saveSettings () const
 Save settings Save dialog size and column widths. More...
 
void initTranslationsList ()
 Populate the translations list. More...
 

Static Protected Member Functions

static void saveCheckboxValue (QSettings *settings, const QCheckBox *box, const QString &name)
 Save a single checkboxes value. More...
 
static Qt::CheckState boolToCheckState (bool yes)
 Convert bool to Qt::CheckState. More...
 
static bool checkStateToBool (Qt::CheckState state)
 Converts Qt::CheckState to bool. More...
 

Protected Attributes

CodeEditorStylemCurrentStyle
 Current Code Editor Style. More...
 
ApplicationListmApplications
 List of applications user has specified. More...
 
ApplicationListmTempApplications
 Temporary list of applications This will be copied to actual list of applications (mApplications) when user clicks ok. More...
 
TranslationHandlermTranslator
 List of translations. More...
 
Ui::Settings * mUI
 Dialog from UI designer. More...
 

Private Member Functions

void manageStyleControls ()
 

Private Attributes

bool mPremium
 

Static Private Attributes

static constexpr int mLangCodeRole = Qt::UserRole
 

Detailed Description

Settings dialog.

Definition at line 45 of file settingsdialog.h.

Constructor & Destructor Documentation

◆ SettingsDialog() [1/2]

SettingsDialog::SettingsDialog ( ApplicationList list,
TranslationHandler translator,
bool  premium,
QWidget *  parent = nullptr 
)

◆ SettingsDialog() [2/2]

SettingsDialog::SettingsDialog ( const SettingsDialog )
delete

◆ ~SettingsDialog()

SettingsDialog::~SettingsDialog ( )
override

Definition at line 132 of file settingsdialog.cpp.

References mCurrentStyle, mUI, and saveSettings().

Member Function Documentation

◆ addApplication

void SettingsDialog::addApplication ( )
protectedslot

Slot for adding a new application to the list.

Definition at line 245 of file settingsdialog.cpp.

References ApplicationList::addApplication(), Application::getName(), mTempApplications, and mUI.

Referenced by SettingsDialog().

◆ boolToCheckState()

Qt::CheckState SettingsDialog::boolToCheckState ( bool  yes)
staticprotected

Convert bool to Qt::CheckState.

Parameters
yesvalue to convert
Returns
value converted to Qt::CheckState

Definition at line 152 of file settingsdialog.cpp.

Referenced by SettingsDialog().

◆ browseClangPath

void SettingsDialog::browseClangPath ( )
protectedslot

Slot for browsing for the clang binary.

Definition at line 398 of file settingsdialog.cpp.

References mUI.

Referenced by SettingsDialog().

◆ browseMisraFile

void SettingsDialog::browseMisraFile ( )
protectedslot

Browse for MISRA file.

Definition at line 368 of file settingsdialog.cpp.

References mUI.

Referenced by SettingsDialog().

◆ browsePythonPath

void SettingsDialog::browsePythonPath ( )
protectedslot

Slot for browsing for the python binary.

Definition at line 361 of file settingsdialog.cpp.

References mUI.

Referenced by SettingsDialog().

◆ checkStateToBool()

bool SettingsDialog::checkStateToBool ( Qt::CheckState  state)
staticprotected

Converts Qt::CheckState to bool.

Parameters
stateQt::CheckState to convert
Returns
converted value

Definition at line 160 of file settingsdialog.cpp.

Referenced by saveAllErrors(), saveCheckboxValue(), saveFullPath(), showErrorId(), showFullPath(), showInconclusive(), and showNoErrorsMessage().

◆ defaultApplication

void SettingsDialog::defaultApplication ( )
protectedslot

Slot for making the selected application as the default (first)

Definition at line 289 of file settingsdialog.cpp.

References mTempApplications, mUI, populateApplicationList(), and ApplicationList::setDefault().

Referenced by SettingsDialog().

◆ editApplication

void SettingsDialog::editApplication ( )
protectedslot

Slot for modifying an application in the list.

Definition at line 273 of file settingsdialog.cpp.

References ApplicationList::getApplication(), ApplicationList::getDefaultApplication(), Application::getName(), mTempApplications, and mUI.

Referenced by SettingsDialog().

◆ editCodeEditorStyle

void SettingsDialog::editCodeEditorStyle ( )
protectedslot

Edit Custom Code Editor Style.

Definition at line 388 of file settingsdialog.cpp.

References StyleEditDialog::getStyle(), manageStyleControls(), and mCurrentStyle.

Referenced by SettingsDialog().

◆ initTranslationsList()

void SettingsDialog::initTranslationsList ( )
protected

Populate the translations list.

Definition at line 139 of file settingsdialog.cpp.

References TranslationHandler::getCurrentLanguage(), TranslationHandler::getTranslations(), mLangCodeRole, mTranslator, and mUI.

Referenced by SettingsDialog().

◆ loadSettings()

void SettingsDialog::loadSettings ( )
protected

Load saved values Loads dialog size and column widths.

Definition at line 166 of file settingsdialog.cpp.

References SETTINGS_CHECK_DIALOG_HEIGHT, and SETTINGS_CHECK_DIALOG_WIDTH.

Referenced by SettingsDialog().

◆ manageStyleControls()

void SettingsDialog::manageStyleControls ( )
private

◆ ok

void SettingsDialog::ok ( )
protectedslot

Slot for clicking OK.

Definition at line 325 of file settingsdialog.cpp.

References ApplicationList::copy(), mApplications, and mTempApplications.

Referenced by SettingsDialog().

◆ operator=()

SettingsDialog& SettingsDialog::operator= ( const SettingsDialog )
delete

◆ populateApplicationList()

void SettingsDialog::populateApplicationList ( )
protected

Clear all applications from the list and re insert them from mTempApplications.

Definition at line 300 of file settingsdialog.cpp.

References ApplicationList::getApplication(), ApplicationList::getApplicationCount(), ApplicationList::getDefaultApplication(), Application::getName(), mTempApplications, and mUI.

Referenced by defaultApplication(), removeApplication(), and SettingsDialog().

◆ removeApplication

void SettingsDialog::removeApplication ( )
protectedslot

◆ saveAllErrors()

bool SettingsDialog::saveAllErrors ( ) const

Get checkbox value for mSaveAllErrors.

Returns
should all errors be saved to report

Definition at line 341 of file settingsdialog.cpp.

References checkStateToBool(), and mUI.

Referenced by MainWindow::programSettings().

◆ saveCheckboxValue()

void SettingsDialog::saveCheckboxValue ( QSettings *  settings,
const QCheckBox *  box,
const QString &  name 
)
staticprotected

Save a single checkboxes value.

Parameters
settingsPointer to Settings.
boxcheckbox to save
namename for QSettings to store the value

Definition at line 217 of file settingsdialog.cpp.

References checkStateToBool().

Referenced by saveSettingValues().

◆ saveFullPath()

bool SettingsDialog::saveFullPath ( ) const

Get checkbox value for mSaveFullPath.

Returns
should full path of files be saved when creating a report

Definition at line 336 of file settingsdialog.cpp.

References checkStateToBool(), and mUI.

Referenced by MainWindow::programSettings().

◆ saveSettings()

void SettingsDialog::saveSettings ( ) const
protected

Save settings Save dialog size and column widths.

Definition at line 173 of file settingsdialog.cpp.

References SETTINGS_CHECK_DIALOG_HEIGHT, and SETTINGS_CHECK_DIALOG_WIDTH.

Referenced by ~SettingsDialog().

◆ saveSettingValues()

void SettingsDialog::saveSettingValues ( ) const

◆ setCodeEditorStyleDefault

void SettingsDialog::setCodeEditorStyleDefault ( )
protectedslot

Set Code Editor Style to Default.

Definition at line 376 of file settingsdialog.cpp.

References defaultStyleDark(), defaultStyleLight(), CodeEditorStyle::getSystemTheme(), manageStyleControls(), mCurrentStyle, and mUI.

Referenced by SettingsDialog().

◆ showErrorId()

bool SettingsDialog::showErrorId ( ) const

Get checkbox value for mShowIdColumn.

Returns
Should error id column be displayed

Definition at line 351 of file settingsdialog.cpp.

References checkStateToBool(), and mUI.

Referenced by MainWindow::programSettings().

◆ showFullPath()

bool SettingsDialog::showFullPath ( ) const

Get checkbox value for mShowFullPath.

Returns
should full path of errors be shown in the tree

Definition at line 331 of file settingsdialog.cpp.

References checkStateToBool(), and mUI.

Referenced by MainWindow::programSettings().

◆ showInconclusive()

bool SettingsDialog::showInconclusive ( ) const

Get checkbox value for mEnableInconclusive.

Returns
Should inconclusive column be displayed

Definition at line 356 of file settingsdialog.cpp.

References checkStateToBool(), and mUI.

Referenced by MainWindow::programSettings().

◆ showNoErrorsMessage()

bool SettingsDialog::showNoErrorsMessage ( ) const

Get checkbox value for mNoErrorsMessage.

Returns
Should "no errors message" be hidden

Definition at line 346 of file settingsdialog.cpp.

References checkStateToBool(), and mUI.

Referenced by MainWindow::programSettings().

◆ validateEditPythonPath

void SettingsDialog::validateEditPythonPath ( )
protectedslot

Slot for validating input value in editPythonPath.

Definition at line 223 of file settingsdialog.cpp.

References mUI.

Referenced by SettingsDialog().

Member Data Documentation

◆ mApplications

ApplicationList* SettingsDialog::mApplications
protected

List of applications user has specified.

Definition at line 220 of file settingsdialog.h.

Referenced by ok().

◆ mCurrentStyle

CodeEditorStyle* SettingsDialog::mCurrentStyle
protected

◆ mLangCodeRole

constexpr int SettingsDialog::mLangCodeRole = Qt::UserRole
staticconstexprprivate

Definition at line 243 of file settingsdialog.h.

Referenced by initTranslationsList(), and saveSettingValues().

◆ mPremium

bool SettingsDialog::mPremium
private

Definition at line 245 of file settingsdialog.h.

Referenced by saveSettingValues().

◆ mTempApplications

ApplicationList* SettingsDialog::mTempApplications
protected

Temporary list of applications This will be copied to actual list of applications (mApplications) when user clicks ok.

Definition at line 227 of file settingsdialog.h.

Referenced by addApplication(), defaultApplication(), editApplication(), ok(), populateApplicationList(), removeApplication(), and SettingsDialog().

◆ mTranslator

TranslationHandler* SettingsDialog::mTranslator
protected

List of translations.

Definition at line 233 of file settingsdialog.h.

Referenced by initTranslationsList().

◆ mUI

Ui::Settings* SettingsDialog::mUI
protected

The documentation for this class was generated from the following files: