Skip to content

Commit 24ce429

Browse files
committed
GUI: Rename methods in ApplicationList
1 parent 8d704f7 commit 24ce429

5 files changed

Lines changed: 70 additions & 70 deletions

File tree

gui/applicationlist.cpp

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ ApplicationList::ApplicationList(QObject *parent) :
3636

3737
ApplicationList::~ApplicationList()
3838
{
39-
Clear();
39+
clear();
4040
}
4141

42-
bool ApplicationList::LoadSettings()
42+
bool ApplicationList::loadSettings()
4343
{
4444
QSettings settings;
4545
QStringList names = settings.value(SETTINGS_APPLICATION_NAMES, QStringList()).toStringList();
@@ -64,18 +64,18 @@ bool ApplicationList::LoadSettings()
6464
app.setName("gedit");
6565
app.setPath("/usr/bin/gedit");
6666
app.setParameters("+(line) (file)");
67-
AddApplication(app);
67+
addApplication(app);
6868
defapp = 0;
6969
}
70-
CheckAndAddApplication("/usr/bin/geany","geany","+(line) (file)");
71-
CheckAndAddApplication("/usr/bin/qtcreator","Qt Creator","-client (file):(line)");
70+
checkAndAddApplication("/usr/bin/geany","geany","+(line) (file)");
71+
checkAndAddApplication("/usr/bin/qtcreator","Qt Creator","-client (file):(line)");
7272
// use as default for kde environments
7373
if (QFileInfo("/usr/bin/kate").isExecutable()) {
7474
Application app;
7575
app.setName("kate");
7676
app.setPath("/usr/bin/kate");
7777
app.setParameters("-l(line) (file)");
78-
AddApplication(app);
78+
addApplication(app);
7979
defapp = 0;
8080
}
8181
#else
@@ -86,7 +86,7 @@ bool ApplicationList::LoadSettings()
8686
} else if (names.size() == paths.size()) {
8787
for (int i = 0; i < names.size(); i++) {
8888
const Application app(names[i], paths[i], params[i]);
89-
AddApplication(app);
89+
addApplication(app);
9090
}
9191
}
9292

@@ -100,15 +100,15 @@ bool ApplicationList::LoadSettings()
100100
return succeeded;
101101
}
102102

103-
void ApplicationList::SaveSettings() const
103+
void ApplicationList::saveSettings() const
104104
{
105105
QSettings settings;
106106
QStringList names;
107107
QStringList paths;
108108
QStringList params;
109109

110-
for (int i = 0; i < GetApplicationCount(); i++) {
111-
const Application& app = GetApplication(i);
110+
for (int i = 0; i < getApplicationCount(); i++) {
111+
const Application& app = getApplication(i);
112112
names << app.getName();
113113
paths << app.getPath();
114114
params << app.getParameters();
@@ -120,12 +120,12 @@ void ApplicationList::SaveSettings() const
120120
settings.setValue(SETTINGS_APPLICATION_DEFAULT, mDefaultApplicationIndex);
121121
}
122122

123-
int ApplicationList::GetApplicationCount() const
123+
int ApplicationList::getApplicationCount() const
124124
{
125125
return mApplications.size();
126126
}
127127

128-
Application& ApplicationList::GetApplication(const int index)
128+
Application& ApplicationList::getApplication(const int index)
129129
{
130130
if (index >= 0 && index < mApplications.size()) {
131131
return mApplications[index];
@@ -135,7 +135,7 @@ Application& ApplicationList::GetApplication(const int index)
135135
return dummy;
136136
}
137137

138-
const Application& ApplicationList::GetApplication(const int index) const
138+
const Application& ApplicationList::getApplication(const int index) const
139139
{
140140
if (index >= 0 && index < mApplications.size()) {
141141
return mApplications[index];
@@ -145,60 +145,60 @@ const Application& ApplicationList::GetApplication(const int index) const
145145
return dummy;
146146
}
147147

148-
void ApplicationList::AddApplication(const Application &app)
148+
void ApplicationList::addApplication(const Application &app)
149149
{
150150
if (app.getName().isEmpty() || app.getPath().isEmpty()) {
151151
return;
152152
}
153153
mApplications << app;
154154
}
155155

156-
void ApplicationList::RemoveApplication(const int index)
156+
void ApplicationList::removeApplication(const int index)
157157
{
158158
mApplications.removeAt(index);
159159
}
160160

161-
void ApplicationList::SetDefault(const int index)
161+
void ApplicationList::setDefault(const int index)
162162
{
163163
if (index < mApplications.size() && index >= 0) {
164164
mDefaultApplicationIndex = index;
165165
}
166166
}
167167

168-
void ApplicationList::Copy(const ApplicationList *list)
168+
void ApplicationList::copy(const ApplicationList *list)
169169
{
170170
if (!list) {
171171
return;
172172
}
173173

174-
Clear();
175-
for (int i = 0; i < list->GetApplicationCount(); i++) {
176-
const Application& app = list->GetApplication(i);
177-
AddApplication(app);
174+
clear();
175+
for (int i = 0; i < list->getApplicationCount(); i++) {
176+
const Application& app = list->getApplication(i);
177+
addApplication(app);
178178
}
179-
mDefaultApplicationIndex = list->GetDefaultApplication();
179+
mDefaultApplicationIndex = list->getDefaultApplication();
180180
}
181181

182-
void ApplicationList::Clear()
182+
void ApplicationList::clear()
183183
{
184184
mApplications.clear();
185185
mDefaultApplicationIndex = -1;
186186
}
187187

188-
bool ApplicationList::CheckAndAddApplication(QString appPath, QString name, QString parameters)
188+
bool ApplicationList::checkAndAddApplication(QString appPath, QString name, QString parameters)
189189
{
190190
if (QFileInfo(appPath).exists() && QFileInfo(appPath).isExecutable()) {
191191
Application app;
192192
app.setName(name);
193193
app.setPath("\"" + appPath + "\"");
194194
app.setParameters(parameters);
195-
AddApplication(app);
195+
addApplication(app);
196196
return true;
197197
}
198198
return false;
199199
}
200200

201-
bool ApplicationList::FindDefaultWindowsEditor()
201+
bool ApplicationList::findDefaultWindowsEditor()
202202
{
203203
bool foundOne = false;
204204
#ifdef WIN64 // As long as we do support 32-bit XP, we cannot be sure that the environment variable "ProgramFiles(x86)" exists
@@ -209,24 +209,24 @@ bool ApplicationList::FindDefaultWindowsEditor()
209209
const QString appPathx64(getenv("ProgramW6432"));
210210
const QString windowsPath(getenv("windir"));
211211

212-
if (CheckAndAddApplication(appPathx86 + "\\Notepad++\\notepad++.exe", "Notepad++", "-n(line) (file)"))
212+
if (checkAndAddApplication(appPathx86 + "\\Notepad++\\notepad++.exe", "Notepad++", "-n(line) (file)"))
213213
foundOne = true;
214-
else if (CheckAndAddApplication(appPathx64 + "\\Notepad++\\notepad++.exe", "Notepad++", "-n(line) (file)"))
214+
else if (checkAndAddApplication(appPathx64 + "\\Notepad++\\notepad++.exe", "Notepad++", "-n(line) (file)"))
215215
foundOne = true;
216216

217-
if (CheckAndAddApplication(appPathx86 + "\\Notepad2\\Notepad2.exe", "Notepad2", "/g (line) (file)"))
217+
if (checkAndAddApplication(appPathx86 + "\\Notepad2\\Notepad2.exe", "Notepad2", "/g (line) (file)"))
218218
foundOne = true;
219-
else if (CheckAndAddApplication(appPathx64 + "\\Notepad2\\Notepad2.exe", "Notepad2", "/g (line) (file)"))
219+
else if (checkAndAddApplication(appPathx64 + "\\Notepad2\\Notepad2.exe", "Notepad2", "/g (line) (file)"))
220220
foundOne = true;
221221

222-
if (CheckAndAddApplication(windowsPath + "\\system32\\notepad.exe", "Notepad", "(file)"))
222+
if (checkAndAddApplication(windowsPath + "\\system32\\notepad.exe", "Notepad", "(file)"))
223223
foundOne = true;
224224

225225
QString regPath = "HKEY_CLASSES_ROOT\\Applications\\QtProject.QtCreator.pro\\shell\\Open\\command";
226226
QSettings registry(regPath, QSettings::NativeFormat);
227227
QString qtCreatorRegistry = registry.value("Default", QString()).toString();
228228
QString qtCreatorPath = qtCreatorRegistry.left(qtCreatorRegistry.indexOf(".exe") + 4);
229-
if (!qtCreatorRegistry.isEmpty() && CheckAndAddApplication(qtCreatorPath, "Qt Creator", "-client (file):(line)")) {
229+
if (!qtCreatorRegistry.isEmpty() && checkAndAddApplication(qtCreatorPath, "Qt Creator", "-client (file):(line)")) {
230230
foundOne = true;
231231
}
232232
return foundOne;

gui/applicationlist.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,33 +43,33 @@ class ApplicationList : public QObject {
4343
* application list. Most probably because of older version settings need
4444
* to be upgraded.
4545
*/
46-
bool LoadSettings();
46+
bool loadSettings();
4747

4848
/**
4949
* @brief Save all applications
5050
*/
51-
void SaveSettings() const;
51+
void saveSettings() const;
5252

5353
/**
5454
* @brief Get the amount of applications in the list
5555
* @return The count of applications
5656
*/
57-
int GetApplicationCount() const;
57+
int getApplicationCount() const;
5858

5959
/**
6060
* @brief Get specific application's name
6161
*
6262
* @param index Index of the application whose name to get
6363
* @return Name of the application
6464
*/
65-
const Application& GetApplication(const int index) const;
66-
Application& GetApplication(const int index);
65+
const Application& getApplication(const int index) const;
66+
Application& getApplication(const int index);
6767

6868
/**
6969
* @brief Return the default application.
7070
* @return Index of the default application.
7171
*/
72-
int GetDefaultApplication() const {
72+
int getDefaultApplication() const {
7373
return mDefaultApplicationIndex;
7474
}
7575

@@ -78,45 +78,45 @@ class ApplicationList : public QObject {
7878
*
7979
* @param app Application to add.
8080
*/
81-
void AddApplication(const Application &app);
81+
void addApplication(const Application &app);
8282

8383
/**
8484
* @brief Remove an application from the list
8585
*
8686
* @param index Index of the application to remove.
8787
*/
88-
void RemoveApplication(const int index);
88+
void removeApplication(const int index);
8989

9090
/**
9191
* @brief Set application as default application.
9292
* @param index Index of the application to make the default one
9393
*/
94-
void SetDefault(const int index);
94+
void setDefault(const int index);
9595

9696
/**
9797
* @brief Remove all applications from this list and copy all applications from
9898
* list given as a parameter.
9999
* @param list Copying source
100100
*/
101-
void Copy(const ApplicationList *list);
101+
void copy(const ApplicationList *list);
102102

103103
protected:
104104

105105
/**
106106
* @brief Clear the list
107107
*
108108
*/
109-
void Clear();
109+
void clear();
110110

111111
/**
112112
* @brief Find editor used by default in Windows.
113113
* Check if Notepad++ is installed and use it. If not, use Notepad.
114114
*/
115-
bool FindDefaultWindowsEditor();
115+
bool findDefaultWindowsEditor();
116116

117117
private:
118118

119-
bool CheckAndAddApplication(QString appPath, QString name, QString parameters);
119+
bool checkAndAddApplication(QString appPath, QString name, QString parameters);
120120

121121
/**
122122
* @brief List of applications

gui/mainwindow.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ void MainWindow::LoadSettings()
298298
else
299299
mUI.mActionAutoDetectLanguage->setChecked(true);
300300

301-
bool succeeded = mApplications->LoadSettings();
301+
bool succeeded = mApplications->loadSettings();
302302
if (!succeeded) {
303303
const QString msg = tr("There was a problem with loading the editor application settings.\n\n"
304304
"This is probably because the settings were changed between the Cppcheck versions. "
@@ -349,7 +349,7 @@ void MainWindow::SaveSettings() const
349349
else
350350
mSettings->setValue(SETTINGS_ENFORCED_LANGUAGE, Settings::None);
351351

352-
mApplications->SaveSettings();
352+
mApplications->saveSettings();
353353

354354
mSettings->setValue(SETTINGS_LANGUAGE, mTranslation->GetCurrentLanguage());
355355
mUI.mResults->SaveSettings(mSettings);

gui/resultstree.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -530,12 +530,12 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
530530
//member variables
531531
QSignalMapper *signalMapper = new QSignalMapper(this);
532532

533-
if (mContextItem && mApplications->GetApplicationCount() > 0 && mContextItem->parent()) {
533+
if (mContextItem && mApplications->getApplicationCount() > 0 && mContextItem->parent()) {
534534
//Create an action for the application
535-
int defaultApplicationIndex = mApplications->GetDefaultApplication();
535+
int defaultApplicationIndex = mApplications->getDefaultApplication();
536536
if (defaultApplicationIndex < 0)
537537
defaultApplicationIndex = 0;
538-
const Application& app = mApplications->GetApplication(defaultApplicationIndex);
538+
const Application& app = mApplications->getApplication(defaultApplicationIndex);
539539
QAction *start = new QAction(app.getName(), &menu);
540540
if (multipleSelection)
541541
start->setDisabled(true);
@@ -558,7 +558,7 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
558558

559559
// Add menuitems to copy full path/filename to clipboard
560560
if (mContextItem) {
561-
if (mApplications->GetApplicationCount() > 0) {
561+
if (mApplications->getApplicationCount() > 0) {
562562
menu.addSeparator();
563563
}
564564

@@ -609,7 +609,7 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
609609
index = indexAt(e->pos());
610610
if (index.isValid()) {
611611
mContextItem = mModel.itemFromIndex(index);
612-
if (mContextItem && mApplications->GetApplicationCount() > 0 && mContextItem->parent()) {
612+
if (mContextItem && mApplications->getApplicationCount() > 0 && mContextItem->parent()) {
613613
//Disconnect all signals
614614
for (int i = 0; i < actions.size(); i++) {
615615

@@ -628,7 +628,7 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
628628
void ResultsTree::StartApplication(QStandardItem *target, int application)
629629
{
630630
//If there are no applications specified, tell the user about it
631-
if (mApplications->GetApplicationCount() == 0) {
631+
if (mApplications->getApplicationCount() == 0) {
632632
QMessageBox msg(QMessageBox::Critical,
633633
tr("Cppcheck"),
634634
tr("No editor application configured.\n\n"
@@ -640,7 +640,7 @@ void ResultsTree::StartApplication(QStandardItem *target, int application)
640640
}
641641

642642
if (application == -1)
643-
application = mApplications->GetDefaultApplication();
643+
application = mApplications->getDefaultApplication();
644644

645645
if (application == -1) {
646646
QMessageBox msg(QMessageBox::Critical,
@@ -654,7 +654,7 @@ void ResultsTree::StartApplication(QStandardItem *target, int application)
654654

655655
}
656656

657-
if (target && application >= 0 && application < mApplications->GetApplicationCount() && target->parent()) {
657+
if (target && application >= 0 && application < mApplications->getApplicationCount() && target->parent()) {
658658
// Make sure we are working with the first column
659659
if (target->column() != 0)
660660
target = target->parent()->child(target->row(), 0);
@@ -694,7 +694,7 @@ void ResultsTree::StartApplication(QStandardItem *target, int application)
694694
file.append("\"");
695695
}
696696

697-
const Application& app = mApplications->GetApplication(application);
697+
const Application& app = mApplications->getApplication(application);
698698
QString params = app.getParameters();
699699
params.replace("(file)", file, Qt::CaseInsensitive);
700700

0 commit comments

Comments
 (0)