Commit 31cf7123 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Revert "Revert "Remove tabs and fix spelling error""

This reverts commit a772c8aa968e85b950d86659ef31020ef0dbd57a.

I shouldn't try to debug stuff during a busy conference.
parent 796c792e
...@@ -29,9 +29,9 @@ struct CompositeOpModelInitializer ...@@ -29,9 +29,9 @@ struct CompositeOpModelInitializer
{ {
CompositeOpModelInitializer() { CompositeOpModelInitializer() {
model.addEntries(KoCompositeOpRegistry::instance().getCompositeOps(), false, true); model.addEntries(KoCompositeOpRegistry::instance().getCompositeOps(), false, true);
model.expandAllCategories(false); model.expandAllCategories(false);
model.addCategory(KoID("favorites", i18n("Favorites"))); model.addCategory(KoID("favorites", i18n("Favorites")));
model.readFavriteCompositeOpsFromConfig(); model.readFavoriteCompositeOpsFromConfig();
model.expandCategory(KoID("favorites"), true); model.expandCategory(KoID("favorites"), true);
} }
...@@ -62,19 +62,19 @@ void KisCompositeOpListModel::validateCompositeOps(const KoColorSpace* colorSpac ...@@ -62,19 +62,19 @@ void KisCompositeOpListModel::validateCompositeOps(const KoColorSpace* colorSpac
bool KisCompositeOpListModel::setData(const QModelIndex& idx, const QVariant& value, int role) bool KisCompositeOpListModel::setData(const QModelIndex& idx, const QVariant& value, int role)
{ {
KoID entry; KoID entry;
bool result = BaseClass::setData(idx, value, role); bool result = BaseClass::setData(idx, value, role);
if(role == Qt::CheckStateRole && BaseClass::entryAt(entry, idx.row())) { if(role == Qt::CheckStateRole && BaseClass::entryAt(entry, idx.row())) {
if(value.toInt() == Qt::Checked) if(value.toInt() == Qt::Checked)
BaseClass::addEntry(KoID("favorites"), entry); BaseClass::addEntry(KoID("favorites"), entry);
else else
BaseClass::removeEntry(KoID("favorites"), entry); BaseClass::removeEntry(KoID("favorites"), entry);
writeFavoriteCompositeOpsToConfig(); writeFavoriteCompositeOpsToConfig();
} }
return result; return result;
} }
QVariant KisCompositeOpListModel::data(const QModelIndex& idx, int role) const QVariant KisCompositeOpListModel::data(const QModelIndex& idx, int role) const
...@@ -89,30 +89,30 @@ QVariant KisCompositeOpListModel::data(const QModelIndex& idx, int role) const ...@@ -89,30 +89,30 @@ QVariant KisCompositeOpListModel::data(const QModelIndex& idx, int role) const
return BaseClass::data(idx, role); return BaseClass::data(idx, role);
} }
void KisCompositeOpListModel::readFavriteCompositeOpsFromConfig() void KisCompositeOpListModel::readFavoriteCompositeOpsFromConfig()
{ {
KisConfig config; KisConfig config;
QStringList compositeOps = config.favoriteCompositeOps(); QStringList compositeOps = config.favoriteCompositeOps();
BaseClass::clearCategory(KoID("favorites")); BaseClass::clearCategory(KoID("favorites"));
for(QStringList::iterator i=compositeOps.begin(); i!=compositeOps.end(); ++i) { for(QStringList::iterator i=compositeOps.begin(); i!=compositeOps.end(); ++i) {
KoID entry = KoCompositeOpRegistry::instance().getKoID(*i); KoID entry = KoCompositeOpRegistry::instance().getKoID(*i);
setData(BaseClass::indexOf(entry), Qt::Checked, Qt::CheckStateRole); setData(BaseClass::indexOf(entry), Qt::Checked, Qt::CheckStateRole);
} }
} }
void KisCompositeOpListModel::writeFavoriteCompositeOpsToConfig() const void KisCompositeOpListModel::writeFavoriteCompositeOpsToConfig() const
{ {
QList<KoID> compositeOps; QList<KoID> compositeOps;
if(BaseClass::getCategory(compositeOps, KoID("favorites"))) { if(BaseClass::getCategory(compositeOps, KoID("favorites"))) {
QStringList list; QStringList list;
KisConfig config; KisConfig config;
for(QList<KoID>::iterator i=compositeOps.begin(); i!=compositeOps.end(); ++i) for(QList<KoID>::iterator i=compositeOps.begin(); i!=compositeOps.end(); ++i)
list.push_back(i->id()); list.push_back(i->id());
config.setFavoriteCompositeOps(list); config.setFavoriteCompositeOps(list);
} }
} }
...@@ -29,8 +29,8 @@ class KoColorSpace; ...@@ -29,8 +29,8 @@ class KoColorSpace;
class KRITAUI_EXPORT KisCompositeOpListModel: public KisCategorizedListModel<KoID,KoID> class KRITAUI_EXPORT KisCompositeOpListModel: public KisCategorizedListModel<KoID,KoID>
{ {
typedef KisCategorizedListModel<KoID,KoID> BaseClass; typedef KisCategorizedListModel<KoID,KoID> BaseClass;
public: public:
static KisCompositeOpListModel* sharedInstance(); static KisCompositeOpListModel* sharedInstance();
...@@ -40,8 +40,8 @@ public: ...@@ -40,8 +40,8 @@ public:
virtual QVariant data (const QModelIndex& idx, int role=Qt::DisplayRole) const; virtual QVariant data (const QModelIndex& idx, int role=Qt::DisplayRole) const;
void validateCompositeOps(const KoColorSpace* colorSpace); void validateCompositeOps(const KoColorSpace* colorSpace);
void readFavriteCompositeOpsFromConfig(); void readFavoriteCompositeOpsFromConfig();
void writeFavoriteCompositeOpsToConfig() const; void writeFavoriteCompositeOpsToConfig() const;
}; };
#endif #endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment