Cppcheck
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
ApplicationList Class Reference

List of applications user has specified to open errors with. More...

#include <applicationlist.h>

Inheritance diagram for ApplicationList:

Public Member Functions

 ApplicationList (QObject *parent=nullptr)
 
 ~ApplicationList () override
 
bool loadSettings ()
 Load all applications. More...
 
void saveSettings () const
 Save all applications. More...
 
int getApplicationCount () const
 Get the amount of applications in the list. More...
 
const ApplicationgetApplication (const int index) const
 Get specific application's name. More...
 
ApplicationgetApplication (const int index)
 
int getDefaultApplication () const
 Return the default application. More...
 
void addApplication (const Application &app)
 Add a new application. More...
 
void removeApplication (const int index)
 Remove an application from the list. More...
 
void setDefault (const int index)
 Set application as default application. More...
 
void copy (const ApplicationList *list)
 Remove all applications from this list and copy all applications from list given as a parameter. More...
 

Protected Member Functions

void clear ()
 Clear the list. More...
 

Private Member Functions

bool checkAndAddApplication (const QString &appPath, const QString &name, const QString &parameters)
 

Private Attributes

QList< ApplicationmApplications
 List of applications. More...
 
int mDefaultApplicationIndex = -1
 Index of the default application. More...
 

Detailed Description

List of applications user has specified to open errors with.

Definition at line 35 of file applicationlist.h.

Constructor & Destructor Documentation

◆ ApplicationList()

ApplicationList::ApplicationList ( QObject *  parent = nullptr)
explicit

Definition at line 29 of file applicationlist.cpp.

◆ ~ApplicationList()

ApplicationList::~ApplicationList ( )
override

Definition at line 35 of file applicationlist.cpp.

References clear().

Member Function Documentation

◆ addApplication()

void ApplicationList::addApplication ( const Application app)

Add a new application.

Parameters
appApplication to add.

Definition at line 146 of file applicationlist.cpp.

References Application::getName(), Application::getPath(), and mApplications.

Referenced by SettingsDialog::addApplication(), checkAndAddApplication(), copy(), and loadSettings().

◆ checkAndAddApplication()

bool ApplicationList::checkAndAddApplication ( const QString &  appPath,
const QString &  name,
const QString &  parameters 
)
private

◆ clear()

void ApplicationList::clear ( )
protected

Clear the list.

Definition at line 180 of file applicationlist.cpp.

References mApplications, and mDefaultApplicationIndex.

Referenced by copy(), and ~ApplicationList().

◆ copy()

void ApplicationList::copy ( const ApplicationList list)

Remove all applications from this list and copy all applications from list given as a parameter.

Parameters
listCopying source

Definition at line 166 of file applicationlist.cpp.

References addApplication(), clear(), getApplication(), getApplicationCount(), getDefaultApplication(), and mDefaultApplicationIndex.

Referenced by SettingsDialog::ok(), and SettingsDialog::SettingsDialog().

◆ getApplication() [1/2]

Application & ApplicationList::getApplication ( const int  index)

Definition at line 126 of file applicationlist.cpp.

References mApplications.

◆ getApplication() [2/2]

const Application & ApplicationList::getApplication ( const int  index) const

Get specific application's name.

Parameters
indexIndex of the application whose name to get
Returns
Name of the application

Definition at line 136 of file applicationlist.cpp.

References mApplications.

Referenced by ResultsTree::contextMenuEvent(), copy(), SettingsDialog::editApplication(), SettingsDialog::populateApplicationList(), saveSettings(), and ResultsTree::startApplication().

◆ getApplicationCount()

int ApplicationList::getApplicationCount ( ) const

Get the amount of applications in the list.

Returns
The count of applications

Definition at line 121 of file applicationlist.cpp.

References mApplications.

Referenced by ResultsTree::contextMenuEvent(), copy(), SettingsDialog::populateApplicationList(), saveSettings(), and ResultsTree::startApplication().

◆ getDefaultApplication()

int ApplicationList::getDefaultApplication ( ) const
inline

Return the default application.

Returns
Index of the default application.

Definition at line 75 of file applicationlist.h.

References mDefaultApplicationIndex.

Referenced by ResultsTree::contextMenuEvent(), copy(), SettingsDialog::editApplication(), SettingsDialog::populateApplicationList(), SettingsDialog::removeApplication(), and ResultsTree::startApplication().

◆ loadSettings()

bool ApplicationList::loadSettings ( )

Load all applications.

Returns
true if loading succeeded, false if there is problem with application list. Most probably because of older version settings need to be upgraded.

Definition at line 40 of file applicationlist.cpp.

References addApplication(), checkAndAddApplication(), mDefaultApplicationIndex, Application::setName(), Application::setParameters(), Application::setPath(), SETTINGS_APPLICATION_DEFAULT, SETTINGS_APPLICATION_NAMES, SETTINGS_APPLICATION_PARAMS, and SETTINGS_APPLICATION_PATHS.

Referenced by MainWindow::loadSettings().

◆ removeApplication()

void ApplicationList::removeApplication ( const int  index)

Remove an application from the list.

Parameters
indexIndex of the application to remove.

Definition at line 154 of file applicationlist.cpp.

References mApplications.

Referenced by SettingsDialog::removeApplication().

◆ saveSettings()

void ApplicationList::saveSettings ( ) const

◆ setDefault()

void ApplicationList::setDefault ( const int  index)

Set application as default application.

Parameters
indexIndex of the application to make the default one

Definition at line 159 of file applicationlist.cpp.

References mApplications, and mDefaultApplicationIndex.

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

Member Data Documentation

◆ mApplications

QList<Application> ApplicationList::mApplications
private

List of applications.

Definition at line 130 of file applicationlist.h.

Referenced by addApplication(), clear(), getApplication(), getApplicationCount(), removeApplication(), and setDefault().

◆ mDefaultApplicationIndex

int ApplicationList::mDefaultApplicationIndex = -1
private

Index of the default application.

Definition at line 136 of file applicationlist.h.

Referenced by clear(), copy(), getDefaultApplication(), loadSettings(), saveSettings(), and setDefault().


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