mirror of
https://github.com/endeavouros-team/eos-quickstart.git
synced 2026-07-29 06:55:24 +00:00
Add comments and minor refactor
This commit is contained in:
@@ -11,11 +11,6 @@ PackageManager::PackageManager(const QString &binaryPath, PackageModel *packageM
|
||||
populateInstalledPackages();
|
||||
}
|
||||
|
||||
const QStringList PackageManager::installedPackages() const
|
||||
{
|
||||
return m_installedPackages;
|
||||
}
|
||||
|
||||
bool PackageManager::installPackages()
|
||||
{
|
||||
Terminal terminal = getTerminal();
|
||||
|
||||
+19
-1
@@ -17,14 +17,32 @@ class PackageManager : public QObject
|
||||
public:
|
||||
explicit PackageManager(const QString &binaryPath, PackageModel *packageModel, Terminal terminal, QObject *parent = nullptr);
|
||||
|
||||
const QStringList installedPackages() const;
|
||||
const QStringList installedPackages() const { return m_installedPackages; }
|
||||
|
||||
public slots:
|
||||
/*
|
||||
* Installs all packages that are marked as "checked" in the package model
|
||||
*
|
||||
* Return true on success, false otherwise
|
||||
*/
|
||||
bool installPackages();
|
||||
|
||||
private:
|
||||
/*
|
||||
* Finds all installed packages on the system and saves them in m_installedPackages
|
||||
*
|
||||
* Return true on success, false otherwise
|
||||
*/
|
||||
bool populateInstalledPackages();
|
||||
|
||||
/*
|
||||
* Finds the best available terminal
|
||||
*
|
||||
* If m_preferredTerminal is valid, that will be returned. If not,
|
||||
* it iterates over the list of terminals in m_terminalList to find
|
||||
* a valid terminal. If none are available a default constructed
|
||||
* Terminal is returned.
|
||||
*/
|
||||
Terminal getTerminal();
|
||||
|
||||
QString m_pacmanBinary;
|
||||
|
||||
+1
-3
@@ -105,9 +105,7 @@ void PackageModel::refresh(const QStringList &installedPackageList)
|
||||
|
||||
beginResetModel();
|
||||
for (int i = 0; i<m_model.size(); i++) {
|
||||
if (installedPackageList.contains(m_model.at(i).packageName)) {
|
||||
m_model[i].isInstalled = true;
|
||||
}
|
||||
m_model[i].isInstalled = installedPackageList.contains(m_model.at(i).packageName);
|
||||
m_model[i].isChecked = false;
|
||||
}
|
||||
|
||||
|
||||
+15
-2
@@ -27,12 +27,10 @@ public:
|
||||
IsCheckedRole
|
||||
};
|
||||
|
||||
// Basic functionality:
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
// Editable:
|
||||
bool setData(const QModelIndex &index, const QVariant &value,
|
||||
int role = Qt::EditRole) override;
|
||||
|
||||
@@ -40,10 +38,25 @@ public:
|
||||
|
||||
virtual QHash<int, QByteArray> roleNames() const override;
|
||||
|
||||
/*
|
||||
* Populates the model from @p settings. Each group except general is treated
|
||||
* as a category, each key is a package and each value a description. All
|
||||
* packages are set as unchecked initially. To set isInstalled the package
|
||||
* names are compared to @p installedPackageList
|
||||
*
|
||||
* Returns true on success, false otherwise
|
||||
*/
|
||||
bool loadModel(QSettings &settings, const QStringList &installedPackageList);
|
||||
|
||||
/*
|
||||
* Refreshes the model by unchecking all items in the model and revaluating
|
||||
* each items installed status against @p installedPackageList
|
||||
*/
|
||||
void refresh(const QStringList &installedPackageList);
|
||||
|
||||
/*
|
||||
* Returns a QStringList of package names for package which is checked
|
||||
*/
|
||||
const QStringList getCheckedPackages();
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user