File: cppchecksettingsdlg.cpp

package info (click to toggle)
codelite 2.6.0.4189~dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 30,868 kB
  • ctags: 32,563
  • sloc: cpp: 237,275; ansic: 20,775; lex: 2,114; yacc: 2,007; xml: 1,274; sh: 1,064; makefile: 566; python: 163
file content (75 lines) | stat: -rw-r--r-- 2,147 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include "cppchecksettingsdlg.h"
#include "windowattrmanager.h"
#include <wx/filedlg.h>

CppCheckSettingsDialog::CppCheckSettingsDialog(wxWindow* parent, CppCheckSettings* settings, IConfigTool *conf)
		: CppCheckSettingsDialogBase(parent)
		, m_settings(settings)
		, m_conf(conf)
{
	m_cbOptionAll->SetValue(settings->All());
	m_cbOptionForce->SetValue(settings->Force());
	m_cbOptionStyle->SetValue(settings->Style());
	m_cbOptionUnusedFunctions->SetValue(settings->UnusedFunctions());
	m_listBoxExcludelist->Append(settings->GetExcludeFiles());
	WindowAttrManager::Load(this, wxT("CppCheckSettingsDialog"), m_conf);
}

void CppCheckSettingsDialog::OnBtnOK(wxCommandEvent& e)
{
	m_settings->All( m_cbOptionAll->IsChecked() );
	m_settings->Force( m_cbOptionForce->IsChecked() );
	m_settings->Style( m_cbOptionStyle->IsChecked() );
	m_settings->UnusedFunctions( m_cbOptionUnusedFunctions->IsChecked() );
	m_settings->SetExcludeFiles( m_listBoxExcludelist->GetStrings() );
	e.Skip();
}

CppCheckSettingsDialog::~CppCheckSettingsDialog()
{
	WindowAttrManager::Save(this, wxT("CppCheckSettingsDialog"), m_conf);
}

void CppCheckSettingsDialog::OnAddFile(wxCommandEvent& e)
{
	const wxString ALL(wxT("All Files (*)|*"));
	wxFileDialog dlg(this,
					 wxT("Add File:"),
					 wxEmptyString,
					 wxEmptyString,
					 ALL,
					 wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE , wxDefaultPosition);

	if (dlg.ShowModal() == wxID_OK) {
		wxArrayString paths;
		dlg.GetPaths( paths );

		m_listBoxExcludelist->Append( paths );
	}
}

void CppCheckSettingsDialog::OnRemoveFile(wxCommandEvent& e)
{
	int sel = m_listBoxExcludelist->GetSelection();
	if ( sel != wxNOT_FOUND ) {
		m_listBoxExcludelist->Delete((unsigned int) sel);
	}
}

void CppCheckSettingsDialog::OnRemoveFileUI(wxUpdateUIEvent& e)
{
	e.Enable( m_listBoxExcludelist->GetSelection() != wxNOT_FOUND );
}


void CppCheckSettingsDialog::OnClearList(wxCommandEvent& e)
{
	wxUnusedVar(e);
	m_listBoxExcludelist->Clear();
}

void CppCheckSettingsDialog::OnClearListUI(wxUpdateUIEvent& e)
{
	e.Enable( !m_listBoxExcludelist->IsEmpty() );
}