GUI: Rename methods.

We don't need the 'type' postfix. We are handling applications,
not application types.
This commit is contained in:
Kimmo Varis 2011-02-25 13:07:42 +02:00
parent e6e616e542
commit 166e5248db
3 changed files with 17 additions and 18 deletions

View File

@ -52,14 +52,14 @@ void ApplicationList::LoadSettings(QSettings *programSettings)
// use as default for gnome environments // use as default for gnome environments
if (QFileInfo("/usr/bin/gedit").isExecutable()) if (QFileInfo("/usr/bin/gedit").isExecutable())
{ {
AddApplicationType("gedit", "/usr/bin/gedit +(line) (file)"); AddApplication("gedit", "/usr/bin/gedit +(line) (file)");
defapp = 0; defapp = 0;
break; break;
} }
// use as default for kde environments // use as default for kde environments
if (QFileInfo("/usr/bin/kate").isExecutable()) if (QFileInfo("/usr/bin/kate").isExecutable())
{ {
AddApplicationType("kate", "/usr/bin/kate -l(line) (file)"); AddApplication("kate", "/usr/bin/kate -l(line) (file)");
defapp = 0; defapp = 0;
break; break;
} }
@ -77,7 +77,7 @@ void ApplicationList::LoadSettings(QSettings *programSettings)
{ {
for (int i = 0; i < names.size(); i++) for (int i = 0; i < names.size(); i++)
{ {
AddApplicationType(names[i], paths[i]); AddApplication(names[i], paths[i]);
} }
mDefaultApplicationIndex = 1; mDefaultApplicationIndex = 1;
} }
@ -126,7 +126,7 @@ QString ApplicationList::GetApplicationPath(const int index) const
} }
void ApplicationList::SetApplicationType(const int index, void ApplicationList::SetApplication(const int index,
const QString &name, const QString &name,
const QString &path) const QString &path)
{ {
@ -137,7 +137,7 @@ void ApplicationList::SetApplicationType(const int index,
} }
} }
void ApplicationList::AddApplicationType(const QString &name, const QString &path) void ApplicationList::AddApplication(const QString &name, const QString &path)
{ {
if (name.isEmpty() || path.isEmpty()) if (name.isEmpty() || path.isEmpty())
{ {
@ -163,7 +163,7 @@ void ApplicationList::SetDefault(const int index)
} }
} }
void ApplicationList::Copy(ApplicationList *list) void ApplicationList::Copy(const ApplicationList *list)
{ {
if (!list) if (!list)
{ {
@ -173,7 +173,7 @@ void ApplicationList::Copy(ApplicationList *list)
Clear(); Clear();
for (int i = 0; i < list->GetApplicationCount(); i++) for (int i = 0; i < list->GetApplicationCount(); i++)
{ {
AddApplicationType(list->GetApplicationName(i), list->GetApplicationPath(i)); AddApplication(list->GetApplicationName(i), list->GetApplicationPath(i));
} }
mDefaultApplicationIndex = list->GetDefaultApplication(); mDefaultApplicationIndex = list->GetDefaultApplication();
} }
@ -190,7 +190,7 @@ bool ApplicationList::FindDefaultWindowsEditor()
const QString notepadppPath = appPath + "\\Notepad++\\notepad++.exe"; const QString notepadppPath = appPath + "\\Notepad++\\notepad++.exe";
if (QFileInfo(notepadppPath).isExecutable()) if (QFileInfo(notepadppPath).isExecutable())
{ {
AddApplicationType("Notepad++", "\"" + notepadppPath + "\" -n(line) (file)"); AddApplication("Notepad++", "\"" + notepadppPath + "\" -n(line) (file)");
return true; return true;
} }
@ -198,7 +198,7 @@ bool ApplicationList::FindDefaultWindowsEditor()
const QString notepadPath = windowsPath + "\\system32\\notepad.exe"; const QString notepadPath = windowsPath + "\\system32\\notepad.exe";
if (QFileInfo(notepadPath).isExecutable()) if (QFileInfo(notepadPath).isExecutable())
{ {
AddApplicationType("Notepad", notepadPath + " (file)"); AddApplication("Notepad", notepadPath + " (file)");
return true; return true;
} }
return false; return false;

View File

@ -122,8 +122,7 @@ public:
* @param name New name for the application * @param name New name for the application
* @param path New path for the application * @param path New path for the application
*/ */
void SetApplicationType(const int index, void SetApplication(const int index, const QString &name,
const QString &name,
const QString &path); const QString &path);
/** /**
@ -132,7 +131,7 @@ public:
* @param name Name of the application * @param name Name of the application
* @param path Path to the application * @param path Path to the application
*/ */
void AddApplicationType(const QString &name, const QString &path); void AddApplication(const QString &name, const QString &path);
/** /**
* @brief Remove an application from the list * @brief Remove an application from the list
@ -152,7 +151,7 @@ public:
* list given as a parameter. * list given as a parameter.
* @param list Copying source * @param list Copying source
*/ */
void Copy(ApplicationList *list); void Copy(const ApplicationList *list);
protected: protected:

View File

@ -202,7 +202,7 @@ void SettingsDialog::AddApplication()
if (dialog.exec() == QDialog::Accepted) if (dialog.exec() == QDialog::Accepted)
{ {
mTempApplications->AddApplicationType(dialog.GetName(), dialog.GetPath()); mTempApplications->AddApplication(dialog.GetName(), dialog.GetPath());
mUI.mListWidget->addItem(dialog.GetName()); mUI.mListWidget->addItem(dialog.GetName());
} }
} }
@ -240,7 +240,7 @@ void SettingsDialog::EditApplication()
if (dialog.exec() == QDialog::Accepted) if (dialog.exec() == QDialog::Accepted)
{ {
mTempApplications->SetApplicationType(row, dialog.GetName(), dialog.GetPath()); mTempApplications->SetApplication(row, dialog.GetName(), dialog.GetPath());
item->setText(dialog.GetName()); item->setText(dialog.GetName());
} }
} }