update Layout::Data::ActivityData namespace

pull/19/head
Michail Vourlakos 5 years ago
parent 375579a517
commit 805e37a368

@ -21,7 +21,6 @@
#include "activitydata.h"
namespace Latte {
namespace Settings {
namespace Data {
Activity::Activity()
@ -80,4 +79,3 @@ bool Activity::isRunning() const
}
}
}

@ -30,7 +30,6 @@
#include <KActivities/Info>
namespace Latte {
namespace Settings {
namespace Data {
class Activity
@ -59,11 +58,10 @@ public:
//! #activityId -> activite_information
typedef QHash<const QString, Activity> ActivitiesMap;
}
}
}
Q_DECLARE_METATYPE(Latte::Settings::Data::Activity)
Q_DECLARE_METATYPE(Latte::Settings::Data::ActivitiesMap)
Q_DECLARE_METATYPE(Latte::Data::Activity)
Q_DECLARE_METATYPE(Latte::Data::ActivitiesMap)
#endif

@ -62,12 +62,12 @@ QWidget *Activities::createEditor(QWidget *parent, const QStyleOptionViewItem &o
bool isLayoutActive = index.data(Model::Layouts::ISACTIVEROLE).toBool();
QStringList allActivities = index.data(Model::Layouts::ALLACTIVITIESSORTEDROLE).toStringList();
Data::ActivitiesMap allActivitiesData = index.data(Model::Layouts::ALLACTIVITIESDATAROLE).value<Data::ActivitiesMap>();
Latte::Data::ActivitiesMap allActivitiesData = index.data(Model::Layouts::ALLACTIVITIESDATAROLE).value<Latte::Data::ActivitiesMap>();
QStringList assignedActivities = index.data(Qt::UserRole).toStringList();
for (int i = 0; i < allActivities.count(); ++i) {
Data::Activity activitydata = allActivitiesData[allActivities[i]];
Latte::Data::Activity activitydata = allActivitiesData[allActivities[i]];
if (!activitydata.isValid()) {
continue;
@ -168,7 +168,7 @@ QWidget *Activities::createEditor(QWidget *parent, const QStyleOptionViewItem &o
void Activities::setEditorData(QWidget *editor, const QModelIndex &index) const
{
Data::ActivitiesMap allActivitiesData = index.data(Model::Layouts::ALLACTIVITIESDATAROLE).value<Data::ActivitiesMap>();
Latte::Data::ActivitiesMap allActivitiesData = index.data(Model::Layouts::ALLACTIVITIESDATAROLE).value<Latte::Data::ActivitiesMap>();
updateButton(editor, allActivitiesData);
}
@ -223,11 +223,11 @@ void Activities::paint(QPainter *painter, const QStyleOptionViewItem &option, co
if (!isSharedCapable) {
painter->save();
QList<Data::Activity> assignedActivities;
QList<Latte::Data::Activity> assignedActivities;
QStringList assignedIds = index.model()->data(index, Qt::UserRole).toStringList();
QStringList assignedOriginalIds = index.model()->data(index, Model::Layouts::ORIGINALASSIGNEDACTIVITIESROLE).toStringList();
Data::ActivitiesMap allActivitiesData = index.data(Model::Layouts::ALLACTIVITIESDATAROLE).value<Data::ActivitiesMap>();
Latte::Data::ActivitiesMap allActivitiesData = index.data(Model::Layouts::ALLACTIVITIESDATAROLE).value<Latte::Data::ActivitiesMap>();
for (int i=0; i<assignedIds.count(); ++i) {
assignedActivities << allActivitiesData[assignedIds[i]];
@ -328,7 +328,7 @@ void Activities::paint(QPainter *painter, const QStyleOptionViewItem &option, co
}
}
QString Activities::joinedActivities(const QList<Data::Activity> &activities, const QStringList &originalIds, bool isActive, bool formatText) const
QString Activities::joinedActivities(const QList<Latte::Data::Activity> &activities, const QStringList &originalIds, bool isActive, bool formatText) const
{
QString finalText;
@ -364,14 +364,14 @@ QString Activities::joinedActivities(const QList<Data::Activity> &activities, co
return finalText;
}
void Activities::updateButton(QWidget *editor, const Data::ActivitiesMap &allActivitiesData) const
void Activities::updateButton(QWidget *editor, const Latte::Data::ActivitiesMap &allActivitiesData) const
{
if (!editor) {
return;
}
QPushButton *button = static_cast<QPushButton *>(editor);
QList<Data::Activity> assignedActivities;
QList<Latte::Data::Activity> assignedActivities;
foreach (QAction *action, button->menu()->actions()) {
if (action->isChecked()) {

@ -49,9 +49,9 @@ public:
virtual bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override;
private:
void updateButton(QWidget *editor, const Data::ActivitiesMap &allActivitiesData) const;
void updateButton(QWidget *editor, const Latte::Data::ActivitiesMap &allActivitiesData) const;
QString joinedActivities(const QList<Data::Activity> &activities, const QStringList &originalIds, bool isActive = false, bool formatText = true) const;
QString joinedActivities(const QList<Latte::Data::Activity> &activities, const QStringList &originalIds, bool isActive = false, bool formatText = true) const;
};
}

@ -1090,7 +1090,7 @@ QList<Data::Layout> Layouts::alteredLayouts() const
//! Activities code
void Layouts::initActivities()
{
Data::Activity freeActivities;
Latte::Data::Activity freeActivities;
freeActivities.id = Data::Layout::FREEACTIVITIESID;
freeActivities.name = QString("[ " + i18n("All Free Activities...") + " ]");
freeActivities.icon = "favorites";
@ -1130,7 +1130,7 @@ void Layouts::on_activityAdded(const QString &id)
{
m_activitiesInfo[id] = new KActivities::Info(id, this);
Data::Activity activity;
Latte::Data::Activity activity;
activity.id = m_activitiesInfo[id]->id();
activity.name = m_activitiesInfo[id]->name();
activity.icon = m_activitiesInfo[id]->icon();
@ -1174,7 +1174,7 @@ void Layouts::on_activityChanged(const QString &id)
void Layouts::on_runningActivitiesChanged(const QStringList &runningIds)
{
Data::ActivitiesMap::iterator i;
Latte::Data::ActivitiesMap::iterator i;
for (i = m_activitiesMap.begin(); i != m_activitiesMap.end(); ++i){
if (runningIds.contains(i.key())) {

@ -181,7 +181,7 @@ private:
QString m_iconsPath;
Data::ActivitiesMap m_activitiesMap;
Latte::Data::ActivitiesMap m_activitiesMap;
QHash<QString, KActivities::Info *> m_activitiesInfo;
//! original data
@ -190,7 +190,7 @@ private:
//! current data
bool m_inMultipleMode{false};
Data::LayoutsTable m_layoutsTable;
Settings::Data::LayoutsTable m_layoutsTable;
Latte::Corona *m_corona{nullptr};
};

Loading…
Cancel
Save