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
|
/*
* SPDX-FileCopyrightText: 2012 Jonathan Thomas <echidnaman@kubuntu.org>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#include "AddonList.h"
#include <QDebug>
AddonList::AddonList()
{
}
bool AddonList::isEmpty() const
{
return m_toInstall.isEmpty() && m_toRemove.isEmpty();
}
QStringList AddonList::addonsToInstall() const
{
return m_toInstall;
}
QStringList AddonList::addonsToRemove() const
{
return m_toRemove;
}
void AddonList::addAddon(const QString &addon, bool toInstall)
{
if (toInstall) {
m_toInstall.append(addon);
m_toRemove.removeAll(addon);
} else {
m_toInstall.removeAll(addon);
m_toRemove.append(addon);
}
}
void AddonList::resetAddon(const QString &addon)
{
m_toInstall.removeAll(addon);
m_toRemove.removeAll(addon);
}
void AddonList::clear()
{
m_toInstall.clear();
m_toRemove.clear();
}
AddonList::State AddonList::addonState(const QString &addonName) const
{
if (m_toInstall.contains(addonName)) {
return ToInstall;
} else if (m_toRemove.contains(addonName)) {
return ToRemove;
} else {
return None;
}
}
QDebug operator<<(QDebug debug, const AddonList &addons)
{
QDebugStateSaver saver(debug);
debug.nospace() << "AddonsList(";
debug.nospace() << "install:" << addons.addonsToInstall() << ',';
debug.nospace() << "remove:" << addons.addonsToRemove() << ')';
return debug;
}
|