diff --git a/app/data/layoutdata.cpp b/app/data/layoutdata.cpp index a7d2e318e..941a0781f 100644 --- a/app/data/layoutdata.cpp +++ b/app/data/layoutdata.cpp @@ -21,7 +21,6 @@ #include "layoutdata.h" namespace Latte { -namespace Settings { namespace Data { Layout::Layout() @@ -159,5 +158,4 @@ bool Layout::isGlobalTemplate() const } } -} diff --git a/app/data/layoutdata.h b/app/data/layoutdata.h index 65f97f5ab..a19b8cff2 100644 --- a/app/data/layoutdata.h +++ b/app/data/layoutdata.h @@ -30,7 +30,6 @@ #include namespace Latte { -namespace Settings { namespace Data { class Layout @@ -75,10 +74,9 @@ public: bool operator!=(const Layout &rhs) const; }; -} } } -Q_DECLARE_METATYPE(Latte::Settings::Data::Layout) +Q_DECLARE_METATYPE(Latte::Data::Layout) #endif diff --git a/app/data/layouticondata.cpp b/app/data/layouticondata.cpp index d85f358fc..206ddfe6d 100644 --- a/app/data/layouticondata.cpp +++ b/app/data/layouticondata.cpp @@ -22,7 +22,6 @@ namespace Latte { -namespace Settings { namespace Data { LayoutIcon::LayoutIcon() @@ -80,5 +79,4 @@ bool LayoutIcon::operator!=(const LayoutIcon &rhs) const } } -} diff --git a/app/data/layouticondata.h b/app/data/layouticondata.h index 4491a5bb9..3e9379d75 100644 --- a/app/data/layouticondata.h +++ b/app/data/layouticondata.h @@ -18,14 +18,13 @@ * */ -#ifndef SETTINGSLAYOUTICONDATA_H -#define SETTINGSLAYOUTICONDATA_H +#ifndef LAYOUTICONDATA_H +#define LAYOUTICONDATA_H #include #include namespace Latte { -namespace Settings { namespace Data { class LayoutIcon @@ -48,10 +47,9 @@ public: bool operator!=(const LayoutIcon &rhs) const; }; -} } } -Q_DECLARE_METATYPE(Latte::Settings::Data::LayoutIcon) +Q_DECLARE_METATYPE(Latte::Data::LayoutIcon) #endif diff --git a/app/data/layoutstable.cpp b/app/data/layoutstable.cpp index 4e2ef2a05..c8dfc8356 100644 --- a/app/data/layoutstable.cpp +++ b/app/data/layoutstable.cpp @@ -23,7 +23,6 @@ #include namespace Latte { -namespace Settings { namespace Data { LayoutsTable::LayoutsTable() @@ -291,4 +290,3 @@ void LayoutsTable::setLayoutForFreeActivities(const QString &id) } } -} diff --git a/app/data/layoutstable.h b/app/data/layoutstable.h index 8c8ebb89f..051d5feae 100644 --- a/app/data/layoutstable.h +++ b/app/data/layoutstable.h @@ -18,8 +18,8 @@ * */ -#ifndef SETTINGSDATALAYOUTSTABLE_H -#define SETTINGSDATALAYOUTSTABLE_H +#ifndef LAYOUTSTABLEDATA_H +#define LAYOUTSTABLEDATA_H // local #include "layoutdata.h" @@ -29,7 +29,6 @@ #include namespace Latte { -namespace Settings { namespace Data { class LayoutsTable @@ -77,10 +76,9 @@ protected: }; -} } } -Q_DECLARE_METATYPE(Latte::Settings::Data::LayoutsTable) +Q_DECLARE_METATYPE(Latte::Data::LayoutsTable) #endif diff --git a/app/settings/controllers/layoutscontroller.cpp b/app/settings/controllers/layoutscontroller.cpp index bd046cbc9..55bbdb10b 100644 --- a/app/settings/controllers/layoutscontroller.cpp +++ b/app/settings/controllers/layoutscontroller.cpp @@ -170,8 +170,8 @@ bool Layouts::hasSelectedLayout() const bool Layouts::selectedLayoutIsCurrentActive() const { - Settings::Data::Layout selectedLayoutCurrent = selectedLayoutCurrentData(); - Settings::Data::Layout selectedLayoutOriginal = selectedLayoutOriginalData(); + Latte::Data::Layout selectedLayoutCurrent = selectedLayoutCurrentData(); + Latte::Data::Layout selectedLayoutOriginal = selectedLayoutOriginalData(); selectedLayoutOriginal = selectedLayoutOriginal.isEmpty() ? selectedLayoutCurrent : selectedLayoutOriginal; return (selectedLayoutCurrent.isActive && (selectedLayoutOriginal.name == m_handler->corona()->layoutsManager()->currentLayoutName())); @@ -193,7 +193,7 @@ QString Layouts::iconsPath() const return m_iconsPath; } -const Data::Layout Layouts::selectedLayoutCurrentData() const +const Latte::Data::Layout Layouts::selectedLayoutCurrentData() const { int selectedRow = m_view->currentIndex().row(); if (selectedRow >= 0) { @@ -201,11 +201,11 @@ const Data::Layout Layouts::selectedLayoutCurrentData() const return m_model->currentData(selectedId); } else { - return Data::Layout(); + return Latte::Data::Layout(); } } -const Data::Layout Layouts::selectedLayoutOriginalData() const +const Latte::Data::Layout Layouts::selectedLayoutOriginalData() const { int selectedRow = m_view->currentIndex().row(); QString selectedId = m_proxyModel->data(m_proxyModel->index(selectedRow, Model::Layouts::IDCOLUMN), Qt::UserRole).toString(); @@ -298,7 +298,7 @@ void Layouts::removeSelected() return; } - Data::Layout selectedOriginal = selectedLayoutOriginalData(); + Latte::Data::Layout selectedOriginal = selectedLayoutOriginalData(); if (m_handler->corona()->layoutsManager()->synchronizer()->layout(selectedOriginal.name)) { return; @@ -308,7 +308,7 @@ void Layouts::removeSelected() row = qMin(row, m_proxyModel->rowCount() - 1); m_view->selectRow(row); - Data::Layout selected = selectedLayoutCurrentData(); + Latte::Data::Layout selected = selectedLayoutCurrentData(); m_model->removeLayout(selected.id); } @@ -318,7 +318,7 @@ void Layouts::toggleLockedForSelected() return; } - Data::Layout selected = selectedLayoutCurrentData(); + Latte::Data::Layout selected = selectedLayoutCurrentData(); m_proxyModel->setData(m_proxyModel->index(m_view->currentIndex().row(), Model::Layouts::NAMECOLUMN), !selected.isLocked, Settings::Model::Layouts::ISLOCKEDROLE); } @@ -331,7 +331,7 @@ void Layouts::toggleSharedForSelected() int row = m_view->currentIndex().row(); - Data::Layout selected = selectedLayoutCurrentData(); + Latte::Data::Layout selected = selectedLayoutCurrentData(); if (selected.isShared()) { m_proxyModel->setData(m_proxyModel->index(row, Model::Layouts::SHAREDCOLUMN), QStringList(), Qt::UserRole); @@ -340,8 +340,8 @@ void Layouts::toggleSharedForSelected() QStringList availableShareIds = m_model->availableShareIdsFor(selected.id); for (const auto &id : availableShareIds) { - Data::Layout iLayoutCurrent = m_model->currentData(id); - Data::Layout iLayoutOriginal = m_model->originalData(id); + Latte::Data::Layout iLayoutCurrent = m_model->currentData(id); + Latte::Data::Layout iLayoutOriginal = m_model->originalData(id); iLayoutOriginal = iLayoutOriginal.isEmpty() ? iLayoutCurrent : iLayoutOriginal; if (m_handler->corona()->layoutsManager()->synchronizer()->layout(iLayoutOriginal.name)) { @@ -363,7 +363,7 @@ void Layouts::selectRow(const QString &id) m_view->selectRow(rowForId(id)); } -void Layouts::setLayoutProperties(const Data::Layout &layout) +void Layouts::setLayoutProperties(const Latte::Data::Layout &layout) { m_model->setLayoutProperties(layout); } @@ -397,10 +397,10 @@ void Layouts::loadLayouts() m_handler->corona()->layoutsManager()->synchronizer()->syncActiveLayoutsToOriginalFiles(); } - Settings::Data::LayoutsTable layoutsBuffer; + Latte::Data::LayoutsTable layoutsBuffer; for (const auto layout : m_handler->corona()->layoutsManager()->layouts()) { - Settings::Data::Layout original; + Latte::Data::Layout original; original.id = QDir::homePath() + "/.config/latte/" + layout + ".layout.latte"; CentralLayout *central = new CentralLayout(this, original.id); @@ -508,7 +508,7 @@ void Layouts::loadLayouts() } } -const Data::Layout Layouts::addLayoutForFile(QString file, QString layoutName, bool newTempDirectory) +const Latte::Data::Layout Layouts::addLayoutForFile(QString file, QString layoutName, bool newTempDirectory) { if (layoutName.isEmpty()) { layoutName = CentralLayout::layoutName(file); @@ -516,7 +516,7 @@ const Data::Layout Layouts::addLayoutForFile(QString file, QString layoutName, b layoutName = uniqueLayoutName(layoutName); - Data::Layout copied; + Latte::Data::Layout copied; if (newTempDirectory) { copied.id = uniqueTempDirectory() + "/" + layoutName + ".layout.latte"; @@ -564,8 +564,8 @@ void Layouts::copySelectedLayout() return; } - Settings::Data::Layout selectedLayoutCurrent = selectedLayoutCurrentData(); - Settings::Data::Layout selectedLayoutOriginal = selectedLayoutOriginalData(); + Latte::Data::Layout selectedLayoutCurrent = selectedLayoutCurrentData(); + Latte::Data::Layout selectedLayoutOriginal = selectedLayoutOriginalData(); selectedLayoutOriginal = selectedLayoutOriginal.isEmpty() ? selectedLayoutCurrent : selectedLayoutOriginal; @@ -577,7 +577,7 @@ void Layouts::copySelectedLayout() } } - Settings::Data::Layout copied = selectedLayoutCurrent; + Latte::Data::Layout copied = selectedLayoutCurrent; copied.name = uniqueLayoutName(selectedLayoutCurrent.name); copied.id = uniqueTempDirectory() + "/" + copied.name + ".layout.latte";; @@ -628,14 +628,14 @@ bool Layouts::importLayoutsFromV1ConfigFile(QString file) QStringList importedlayouts; if (m_handler->corona()->layoutsManager()->importer()->importOldLayout(applets, name, false, tempDir.absolutePath())) { - Settings::Data::Layout imported = addLayoutForFile(tempDir.absolutePath() + "/" + name + ".layout.latte", name); + Latte::Data::Layout imported = addLayoutForFile(tempDir.absolutePath() + "/" + name + ".layout.latte", name); importedlayouts << imported.name; } QString alternativeName = name + "-" + i18nc("layout", "Alternative"); if (m_handler->corona()->layoutsManager()->importer()->importOldLayout(applets, alternativeName, false, tempDir.absolutePath())) { - Settings::Data::Layout imported = addLayoutForFile(tempDir.absolutePath() + "/" + alternativeName + ".layout.latte", alternativeName, false); + Latte::Data::Layout imported = addLayoutForFile(tempDir.absolutePath() + "/" + alternativeName + ".layout.latte", alternativeName, false); importedlayouts << imported.name; } @@ -684,9 +684,9 @@ void Layouts::save() QHash activeLayoutsToRename; - Settings::Data::LayoutsTable originalLayouts = m_model->originalLayoutsData(); - Settings::Data::LayoutsTable currentLayouts = m_model->currentLayoutsData(); - Settings::Data::LayoutsTable removedLayouts = originalLayouts.subtracted(currentLayouts); + Latte::Data::LayoutsTable originalLayouts = m_model->originalLayoutsData(); + Latte::Data::LayoutsTable currentLayouts = m_model->currentLayoutsData(); + Latte::Data::LayoutsTable removedLayouts = originalLayouts.subtracted(currentLayouts); //! remove layouts that have been removed from the user for (int i=0; i alteredIdsInfo; - QList alteredLayouts = m_model->alteredLayouts(); + QList alteredLayouts = m_model->alteredLayouts(); for (int i = 0; i < alteredLayouts.count(); ++i) { - Data::Layout iLayoutCurrentData = alteredLayouts[i]; - Data::Layout iLayoutOriginalData = m_model->originalData(iLayoutCurrentData.id); + Latte::Data::Layout iLayoutCurrentData = alteredLayouts[i]; + Latte::Data::Layout iLayoutOriginalData = m_model->originalData(iLayoutCurrentData.id); iLayoutOriginalData = iLayoutOriginalData.isEmpty() ? iLayoutCurrentData : iLayoutOriginalData; QStringList cleanedActivities; //!update only activities that are valid for (const auto &activity : iLayoutCurrentData.activities) { - if (knownActivities.contains(activity) && activity != Settings::Data::Layout::FREEACTIVITIESID) { + if (knownActivities.contains(activity) && activity != Latte::Data::Layout::FREEACTIVITIESID) { cleanedActivities.append(activity); } } @@ -788,7 +788,7 @@ void Layouts::save() //! updating the #SETTINGSID in the model for the layout that was renamed for (int j = 0; j < m_model->rowCount(); ++j) { - Data::Layout jLayout = m_model->at(j); + Latte::Data::Layout jLayout = m_model->at(j); if (jLayout.id == idInfo.oldId) { m_model->setData(m_model->index(j, Model::Layouts::IDCOLUMN), newFile, Qt::UserRole); @@ -806,8 +806,8 @@ void Layouts::save() //! lock layouts in the end when the user has chosen it for (int i = 0; i < alteredLayouts.count(); ++i) { - Data::Layout layoutCurrentData = alteredLayouts[i]; - Data::Layout layoutOriginalData = m_model->originalData(layoutCurrentData.id); + Latte::Data::Layout layoutCurrentData = alteredLayouts[i]; + Latte::Data::Layout layoutOriginalData = m_model->originalData(layoutCurrentData.id); layoutOriginalData = layoutOriginalData.isEmpty() ? layoutCurrentData : layoutOriginalData; Latte::Layout::GenericLayout *layoutPtr = m_handler->corona()->layoutsManager()->synchronizer()->layout(layoutOriginalData.name); @@ -861,8 +861,8 @@ void Layouts::syncActiveShares() return; } - Settings::Data::LayoutsTable currentLayoutsData = m_model->currentLayoutsData(); - Settings::Data::LayoutsTable originalLayoutsData = m_model->originalLayoutsData(); + Latte::Data::LayoutsTable currentLayoutsData = m_model->currentLayoutsData(); + Latte::Data::LayoutsTable originalLayoutsData = m_model->originalLayoutsData(); Latte::Layouts::SharesMap currentSharesNamesMap = currentLayoutsData.sharesMap(); QStringList originalSharesIds = originalLayoutsData.allSharesIds(); @@ -914,7 +914,7 @@ void Layouts::on_nameDuplicatedFrom(const QString &provenId, const QString &tria int tRow = rowForId(trialId); int originalRow = m_model->rowForId(provenId); - Data::Layout provenLayout = m_model->at(originalRow); + Latte::Data::Layout provenLayout = m_model->at(originalRow); m_handler->showInlineMessage(i18nc("settings: layout name used","Layout %0 is already used, please provide a different name...").arg(provenLayout.name), KMessageWidget::Error); diff --git a/app/settings/controllers/layoutscontroller.h b/app/settings/controllers/layoutscontroller.h index 82a3b63fd..2f40d8052 100644 --- a/app/settings/controllers/layoutscontroller.h +++ b/app/settings/controllers/layoutscontroller.h @@ -71,11 +71,11 @@ public: bool hasSelectedLayout() const; bool selectedLayoutIsCurrentActive() const; - const Data::Layout selectedLayoutCurrentData() const; - const Data::Layout selectedLayoutOriginalData() const; + const Latte::Data::Layout selectedLayoutCurrentData() const; + const Latte::Data::Layout selectedLayoutOriginalData() const; void selectRow(const QString &id); - void setLayoutProperties(const Data::Layout &layout); + void setLayoutProperties(const Latte::Data::Layout &layout); //! actions void reset(); @@ -92,7 +92,7 @@ public: void setOriginalLayoutForFreeActivities(const QString &id); void copySelectedLayout(); - const Data::Layout addLayoutForFile(QString file, QString layoutName = QString(), bool newTempDirectory = true); + const Latte::Data::Layout addLayoutForFile(QString file, QString layoutName = QString(), bool newTempDirectory = true); //! import layouts from Latte versions <= v0.7.x bool importLayoutsFromV1ConfigFile(QString file); diff --git a/app/settings/delegates/backgrounddelegate.cpp b/app/settings/delegates/backgrounddelegate.cpp index 51237e2cf..d929be3e4 100644 --- a/app/settings/delegates/backgrounddelegate.cpp +++ b/app/settings/delegates/backgrounddelegate.cpp @@ -51,7 +51,7 @@ void BackgroundDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op //! draw underlying background QStyledItemDelegate::paint(painter, myOptions, index.model()->index(index.row(), Model::Layouts::HIDDENTEXTCOLUMN)); - QList icons = index.data(Qt::UserRole).value>(); + QList icons = index.data(Qt::UserRole).value>(); if (icons.count() > 0) { int localMargin = MARGIN-1;// icons[0].isBackgroundFile && icons.count() == 1 ? qMin(option.rect.height()/4,MARGIN+5) : MARGIN-1; @@ -77,7 +77,7 @@ void BackgroundDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op } } -void BackgroundDelegate::drawIcon(QPainter *painter, const QStyleOptionViewItem &option, const QRect &target, const Data::LayoutIcon &icon) const +void BackgroundDelegate::drawIcon(QPainter *painter, const QStyleOptionViewItem &option, const QRect &target, const Latte::Data::LayoutIcon &icon) const { bool active = Latte::isActive(option); bool selected = Latte::isSelected(option); diff --git a/app/settings/delegates/backgrounddelegate.h b/app/settings/delegates/backgrounddelegate.h index 5dd3552b2..76352cb35 100644 --- a/app/settings/delegates/backgrounddelegate.h +++ b/app/settings/delegates/backgrounddelegate.h @@ -43,7 +43,7 @@ public: void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override; private: - void drawIcon(QPainter *painter, const QStyleOptionViewItem &option, const QRect &target, const Data::LayoutIcon &icon) const; + void drawIcon(QPainter *painter, const QStyleOptionViewItem &option, const QRect &target, const Latte::Data::LayoutIcon &icon) const; }; diff --git a/app/settings/delegates/layoutcmbitemdelegate.cpp b/app/settings/delegates/layoutcmbitemdelegate.cpp index 32ac4c31e..1ad75ef62 100644 --- a/app/settings/delegates/layoutcmbitemdelegate.cpp +++ b/app/settings/delegates/layoutcmbitemdelegate.cpp @@ -51,7 +51,7 @@ void LayoutCmbItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem //! draw underlying background QStyledItemDelegate::paint(painter, myOptions, index.model()->index(index.row(), Model::Layouts::HIDDENTEXTCOLUMN)); - QList icons = index.data(Model::Layouts::BACKGROUNDUSERROLE).value>(); + QList icons = index.data(Model::Layouts::BACKGROUNDUSERROLE).value>(); int iconsLength = (2 * option.rect.height() + 3 * 1); @@ -83,7 +83,7 @@ void LayoutCmbItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem QStyledItemDelegate::paint(painter, myOptions, index); } -void LayoutCmbItemDelegate::drawIcon(QPainter *painter, const QStyleOptionViewItem &option, const QRect &target, const Data::LayoutIcon &icon) const +void LayoutCmbItemDelegate::drawIcon(QPainter *painter, const QStyleOptionViewItem &option, const QRect &target, const Latte::Data::LayoutIcon &icon) const { bool active = Latte::isActive(option); bool selected = Latte::isSelected(option); diff --git a/app/settings/delegates/layoutcmbitemdelegate.h b/app/settings/delegates/layoutcmbitemdelegate.h index 841b66829..f3f6a85dc 100644 --- a/app/settings/delegates/layoutcmbitemdelegate.h +++ b/app/settings/delegates/layoutcmbitemdelegate.h @@ -43,7 +43,7 @@ public: void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override; private: - void drawIcon(QPainter *painter, const QStyleOptionViewItem &option, const QRect &target, const Data::LayoutIcon &icon) const; + void drawIcon(QPainter *painter, const QStyleOptionViewItem &option, const QRect &target, const Latte::Data::LayoutIcon &icon) const; }; diff --git a/app/settings/delegates/shareddelegate.cpp b/app/settings/delegates/shareddelegate.cpp index ff0bffc5f..f1a211564 100644 --- a/app/settings/delegates/shareddelegate.cpp +++ b/app/settings/delegates/shareddelegate.cpp @@ -58,7 +58,7 @@ QWidget *Shared::createEditor(QWidget *parent, const QStyleOptionViewItem &optio bool inMultiple = index.data(Model::Layouts::INMULTIPLELAYOUTSROLE).toBool(); QString layoutId = index.data(Model::Layouts::IDROLE).toString(); - Data::LayoutsTable allLayouts = qvariant_cast(index.data(Model::Layouts::ALLLAYOUTSROLE)); + Latte::Data::LayoutsTable allLayouts = qvariant_cast(index.data(Model::Layouts::ALLLAYOUTSROLE)); QStringList assignedShares = index.data(Qt::UserRole).toStringList(); QPushButton *button = new QPushButton(parent); @@ -118,7 +118,7 @@ QWidget *Shared::createEditor(QWidget *parent, const QStyleOptionViewItem &optio void Shared::setEditorData(QWidget *editor, const QModelIndex &index) const { - Data::LayoutsTable allLayouts = qvariant_cast(index.data(Model::Layouts::ALLLAYOUTSROLE)); + Latte::Data::LayoutsTable allLayouts = qvariant_cast(index.data(Model::Layouts::ALLLAYOUTSROLE)); updateButtonText(editor, index); } @@ -155,11 +155,11 @@ void Shared::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &o void Shared::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { bool sharedInEdit = index.data(Model::Layouts::SHAREDTOINEDITROLE).toBool(); - Data::LayoutsTable allLayouts = qvariant_cast(index.data(Model::Layouts::ALLLAYOUTSROLE)); + Latte::Data::LayoutsTable allLayouts = qvariant_cast(index.data(Model::Layouts::ALLLAYOUTSROLE)); QStringList assignedIds = index.data(Qt::UserRole).toStringList(); QStringList originalIds = index.data(Model::Layouts::ORIGINALSHARESROLE).toStringList(); - Data::LayoutsTable assignedLayouts; + Latte::Data::LayoutsTable assignedLayouts; for (const auto &id : assignedIds) { if (allLayouts.containsId(id)) { @@ -290,10 +290,10 @@ void Shared::updateButtonText(QWidget *editor, const QModelIndex &index) const return; } - Data::LayoutsTable allLayouts = qvariant_cast(index.data(Model::Layouts::ALLLAYOUTSROLE)); + Latte::Data::LayoutsTable allLayouts = qvariant_cast(index.data(Model::Layouts::ALLLAYOUTSROLE)); QPushButton *button = static_cast(editor); - Data::LayoutsTable assignedLayouts; + Latte::Data::LayoutsTable assignedLayouts; foreach (QAction *action, button->menu()->actions()) { if (action->isChecked()) { @@ -307,7 +307,7 @@ void Shared::updateButtonText(QWidget *editor, const QModelIndex &index) const button->setText(joined(assignedLayouts, QStringList(), false)); } -QString Shared::joined(const Data::LayoutsTable &layouts, const QStringList &originalIds, bool formatText) const +QString Shared::joined(const Latte::Data::LayoutsTable &layouts, const QStringList &originalIds, bool formatText) const { QString finalText; diff --git a/app/settings/delegates/shareddelegate.h b/app/settings/delegates/shareddelegate.h index 9d403265e..906d87766 100644 --- a/app/settings/delegates/shareddelegate.h +++ b/app/settings/delegates/shareddelegate.h @@ -51,7 +51,7 @@ private: void paintSharedToIndicator(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; void updateButtonText(QWidget *editor, const QModelIndex &index) const; - QString joined(const Data::LayoutsTable &layouts, const QStringList &originalIds, bool formatText = true) const; + QString joined(const Latte::Data::LayoutsTable &layouts, const QStringList &originalIds, bool formatText = true) const; private: // we need it in order to send to the model the information when the SHARETO cell is edited diff --git a/app/settings/handlers/detailshandler.cpp b/app/settings/handlers/detailshandler.cpp index 38e00f568..50e828a6b 100644 --- a/app/settings/handlers/detailshandler.cpp +++ b/app/settings/handlers/detailshandler.cpp @@ -141,7 +141,7 @@ void DetailsHandler::reload() loadLayout(c_data); } -void DetailsHandler::loadLayout(const Data::Layout &data) +void DetailsHandler::loadLayout(const Latte::Data::Layout &data) { if (data.icon.isEmpty()) { m_ui->iconBtn->setIcon(QIcon::fromTheme("add")); @@ -194,7 +194,7 @@ void DetailsHandler::loadLayout(const Data::Layout &data) updateWindowTitle(); } -Data::Layout DetailsHandler::currentData() const +Latte::Data::Layout DetailsHandler::currentData() const { return c_data; } diff --git a/app/settings/handlers/detailshandler.h b/app/settings/handlers/detailshandler.h index bcb5baafe..2cb7e2b4e 100644 --- a/app/settings/handlers/detailshandler.h +++ b/app/settings/handlers/detailshandler.h @@ -73,7 +73,7 @@ public: void resetDefaults() override; void save() override; - Data::Layout currentData() const; + Latte::Data::Layout currentData() const; signals: void currentLayoutChanged(); @@ -104,7 +104,7 @@ private: void setBackgroundStyle(const Latte::Layout::BackgroundStyle &style); - void loadLayout(const Data::Layout &data); + void loadLayout(const Latte::Data::Layout &data); private: Dialog::DetailsDialog *m_parentDialog{nullptr}; @@ -117,8 +117,8 @@ private: QButtonGroup *m_backButtonsGroup; - Data::Layout o_data; - Data::Layout c_data; + Latte::Data::Layout o_data; + Latte::Data::Layout c_data; }; } diff --git a/app/settings/handlers/tablayoutshandler.cpp b/app/settings/handlers/tablayoutshandler.cpp index 2d71b25d0..342d53d19 100644 --- a/app/settings/handlers/tablayoutshandler.cpp +++ b/app/settings/handlers/tablayoutshandler.cpp @@ -245,8 +245,8 @@ void TabLayouts::on_switch_layout() return; } - Settings::Data::Layout selectedLayoutCurrent = m_layoutsController->selectedLayoutCurrentData(); - Settings::Data::Layout selectedLayoutOriginal = m_layoutsController->selectedLayoutOriginalData(); + Latte::Data::Layout selectedLayoutCurrent = m_layoutsController->selectedLayoutCurrentData(); + Latte::Data::Layout selectedLayoutOriginal = m_layoutsController->selectedLayoutOriginalData(); selectedLayoutOriginal = selectedLayoutOriginal.isEmpty() ? selectedLayoutCurrent : selectedLayoutOriginal; if (m_layoutsController->dataAreChanged()) { @@ -296,8 +296,8 @@ void TabLayouts::on_pause_layout() setTwinProperty(m_pauseLayoutAction, TWINENABLED, false); - Settings::Data::Layout selectedLayoutCurrent = m_layoutsController->selectedLayoutCurrentData(); - Settings::Data::Layout selectedLayoutOriginal = m_layoutsController->selectedLayoutOriginalData(); + Latte::Data::Layout selectedLayoutCurrent = m_layoutsController->selectedLayoutCurrentData(); + Latte::Data::Layout selectedLayoutOriginal = m_layoutsController->selectedLayoutOriginalData(); selectedLayoutOriginal = selectedLayoutOriginal.isEmpty() ? selectedLayoutCurrent : selectedLayoutOriginal; m_corona->layoutsManager()->synchronizer()->pauseLayout(selectedLayoutOriginal.name); @@ -326,7 +326,7 @@ void TabLayouts::updatePerLayoutButtonsState() return; } - Settings::Data::Layout selectedLayout = m_layoutsController->selectedLayoutCurrentData(); + Latte::Data::Layout selectedLayout = m_layoutsController->selectedLayoutCurrentData(); //! Switch Button if ((m_layoutsController->inMultipleMode() && selectedLayout.isShared()) @@ -384,7 +384,7 @@ void TabLayouts::on_new_layout() QString presetName = CentralLayout::layoutName(preset); if (presetName == "Default") { - Settings::Data::Layout newlayout = m_layoutsController->addLayoutForFile(preset, presetName, true); + Latte::Data::Layout newlayout = m_layoutsController->addLayoutForFile(preset, presetName, true); showInlineMessage(i18nc("settings:layout added successfully","Layout %0 added successfully...").arg(newlayout.name), KMessageWidget::Information); break; @@ -421,7 +421,7 @@ void TabLayouts::on_download_layout() Latte::Layouts::Importer::LatteFileVersion version = Latte::Layouts::Importer::fileVersion(entryFile); if (version == Latte::Layouts::Importer::LayoutVersion2) { - Settings::Data::Layout downloaded = m_layoutsController->addLayoutForFile(entryFile); + Latte::Data::Layout downloaded = m_layoutsController->addLayoutForFile(entryFile); showInlineMessage(i18nc("settings:layout downloaded successfully","Layout %0 downloaded successfully...").arg(downloaded.name), KMessageWidget::Information); break; @@ -445,7 +445,7 @@ void TabLayouts::on_remove_layout() return; } - Settings::Data::Layout selectedLayout = m_layoutsController->selectedLayoutCurrentData(); + Latte::Data::Layout selectedLayout = m_layoutsController->selectedLayoutCurrentData(); if (selectedLayout.isActive) { showInlineMessage(i18nc("settings: active layout remove","Active layouts can not be removed..."), @@ -518,7 +518,7 @@ void TabLayouts::on_import_layout() qDebug() << "VERSION :::: " << version; if (version == Latte::Layouts::Importer::LayoutVersion2) { - Settings::Data::Layout importedlayout = m_layoutsController->addLayoutForFile(file); + Latte::Data::Layout importedlayout = m_layoutsController->addLayoutForFile(file); showInlineMessage(i18nc("settings:layout imported successfully","Layout %0 imported successfully...").arg(importedlayout.name), KMessageWidget::Information); } else if (version == Latte::Layouts::Importer::ConfigVersion1) { @@ -545,7 +545,7 @@ void TabLayouts::on_export_layout() return; } - Settings::Data::Layout selectedLayout = m_layoutsController->selectedLayoutCurrentData(); + Latte::Data::Layout selectedLayout = m_layoutsController->selectedLayoutCurrentData(); //! Update ALL active original layouts before exporting, m_corona->layoutsManager()->synchronizer()->syncActiveLayoutsToOriginalFiles(); @@ -567,7 +567,7 @@ void TabLayouts::on_export_layout() connect(exportFileDialog, &QFileDialog::finished, exportFileDialog, &QFileDialog::deleteLater); connect(exportFileDialog, &QFileDialog::fileSelected, this, [ &, selectedLayout](const QString & file) { - auto showExportLayoutError = [this](const Settings::Data::Layout &layout) { + auto showExportLayoutError = [this](const Latte::Data::Layout &layout) { showInlineMessage(i18nc("settings:layout export fail","Layout %0 export failed...").arg(layout.name), KMessageWidget::Error, true); @@ -656,7 +656,7 @@ void TabLayouts::on_details_action() return; } - Settings::Data::Layout selectedLayout = m_layoutsController->selectedLayoutCurrentData(); + Latte::Data::Layout selectedLayout = m_layoutsController->selectedLayoutCurrentData(); auto detailsDlg = new Settings::Dialog::DetailsDialog(m_parentDialog, m_layoutsController); @@ -671,7 +671,7 @@ void TabLayouts::on_layoutFilesDropped(const QStringList &paths) for (int i=0; iaddLayoutForFile(paths[i]); + Latte::Data::Layout importedlayout = m_layoutsController->addLayoutForFile(paths[i]); layoutNames << importedlayout.name; } } diff --git a/app/settings/models/layoutsmodel.cpp b/app/settings/models/layoutsmodel.cpp index 863c4b29d..e9ad5a3e4 100644 --- a/app/settings/models/layoutsmodel.cpp +++ b/app/settings/models/layoutsmodel.cpp @@ -127,7 +127,7 @@ void Layouts::clear() } } -void Layouts::appendLayout(const Settings::Data::Layout &layout) +void Layouts::appendLayout(const Latte::Data::Layout &layout) { beginInsertRows(QModelIndex(), m_layoutsTable.rowCount(), m_layoutsTable.rowCount()); m_layoutsTable << layout; @@ -163,7 +163,7 @@ void Layouts::removeLayout(const QString &id) } } -void Layouts::setLayoutProperties(const Data::Layout &layout) +void Layouts::setLayoutProperties(const Latte::Data::Layout &layout) { if (m_layoutsTable.containsId(layout.id) && m_layoutsTable[layout.id] != layout) { m_layoutsTable[layout.id] = layout; @@ -187,7 +187,7 @@ bool Layouts::removeRows(int row, int count, const QModelIndex &parent) bool freeActivitiesLayoutIsRemoved{false}; for(int i=firstRow; i<=lastRow; ++i) { - if (m_layoutsTable[i].activities.contains(Data::Layout::FREEACTIVITIESID)) { + if (m_layoutsTable[i].activities.contains(Latte::Data::Layout::FREEACTIVITIESID)) { //! we need to reassign it properly freeActivitiesLayoutIsRemoved = true; break; @@ -213,7 +213,7 @@ bool Layouts::removeRows(int row, int count, const QModelIndex &parent) QString Layouts::layoutNameForFreeActivities() const { for(int i=0; i Layouts::iconsForCentralLayout(const int &row) const +QList Layouts::iconsForCentralLayout(const int &row) const { - QList icons; + QList icons; QStringList activitiesIds = m_layoutsTable[row].activities; @@ -382,11 +382,11 @@ QList Layouts::iconsForCentralLayout(const int &row) const for(int i=0; i Layouts::iconsForCentralLayout(const int &row) const } if (freeActivitiesPos >= 0) { - Data::LayoutIcon freeActsData = icons.takeAt(freeActivitiesPos); + Latte::Data::LayoutIcon freeActsData = icons.takeAt(freeActivitiesPos); icons.clear(); icons << freeActsData; return icons; @@ -409,7 +409,7 @@ QList Layouts::iconsForCentralLayout(const int &row) const //! if there is specific icon set from the user for this layout //! we draw only that icon icons.clear(); - Data::LayoutIcon icon; + Latte::Data::LayoutIcon icon; icon.name = m_layoutsTable[row].icon; icon.isFreeActivities = false; icon.isBackgroundFile = false; @@ -428,7 +428,7 @@ QList Layouts::iconsForCentralLayout(const int &row) const } if (QFileInfo(colorPath).exists()) { - Data::LayoutIcon icon; + Latte::Data::LayoutIcon icon; icon.isBackgroundFile = true; icon.isFreeActivities = false; icon.name = colorPath; @@ -439,15 +439,15 @@ QList Layouts::iconsForCentralLayout(const int &row) const return icons; } -QList Layouts::iconsForSharedLayout(const int &row) const +QList Layouts::iconsForSharedLayout(const int &row) const { //! SHARED layout case - QList icons; + QList icons; if (!m_layoutsTable[row].icon.isEmpty()) { //! if there is specific icon set from the user for this layout //! we draw only that icon - Data::LayoutIcon icon; + Latte::Data::LayoutIcon icon; icon.name = m_layoutsTable[row].icon; icon.isFreeActivities = false; icon.isBackgroundFile = false; @@ -475,14 +475,14 @@ QList Layouts::iconsForSharedLayout(const int &row) const if (freeActivitiesPos >= 0) { //! Put FreeActivities icon on top of the rest icons - Data::LayoutIcon freeActsData = icons.takeAt(freeActivitiesPos); + Latte::Data::LayoutIcon freeActsData = icons.takeAt(freeActivitiesPos); icons << freeActsData; } return icons; } -QList Layouts::icons(const int &row) const +QList Layouts::icons(const int &row) const { if (!m_layoutsTable[row].isShared()) { return iconsForCentralLayout(row); @@ -531,7 +531,7 @@ QVariant Layouts::data(const QModelIndex &index, int role) const } //! original data - Data::Layout original; + Latte::Data::Layout original; if (!isNewLayout) { original = o_layoutsTable[m_layoutsTable[row].id]; @@ -553,7 +553,7 @@ QVariant Layouts::data(const QModelIndex &index, int role) const return assignedActivitiesFromShared(row); } else if (role == ALLACTIVITIESSORTEDROLE) { QStringList activities; - activities << QString(Data::Layout::FREEACTIVITIESID); + activities << QString(Latte::Data::Layout::FREEACTIVITIESID); activities << m_corona->layoutsManager()->synchronizer()->activities(); return activities; } else if (role == ALLACTIVITIESDATAROLE) { @@ -571,9 +571,9 @@ QVariant Layouts::data(const QModelIndex &index, int role) const } else if (role == LAYOUTHASCHANGESROLE) { return (isNewLayout ? true : (original != m_layoutsTable[row])); } else if (role == BACKGROUNDUSERROLE) { - QList iconsList = icons(row); + QList iconsList = icons(row); QVariant iconsVariant; - iconsVariant.setValue>(iconsList); + iconsVariant.setValue>(iconsList); return iconsVariant; } @@ -593,9 +593,9 @@ QVariant Layouts::data(const QModelIndex &index, int role) const if (role == Qt::DisplayRole) { return m_layoutsTable[row].background; } else if (role == Qt::UserRole) { - QList iconsList = icons(row); + QList iconsList = icons(row); QVariant iconsVariant; - iconsVariant.setValue>(iconsList); + iconsVariant.setValue>(iconsList); return iconsVariant; } break; @@ -651,7 +651,7 @@ QVariant Layouts::data(const QModelIndex &index, int role) const if ((m_inMultipleMode && m_layoutsTable[row].isShared())) { return sortingPriority(MEDIUMPRIORITY, row) + m_layoutsTable[row].shares.count(); } else if (m_layoutsTable[row].activities.count() > 0) { - if (m_layoutsTable[row].activities.contains(Data::Layout::FREEACTIVITIESID)) { + if (m_layoutsTable[row].activities.contains(Latte::Data::Layout::FREEACTIVITIESID)) { return sortingPriority(HIGHESTPRIORITY, row); } else { return sortingPriority(HIGHPRIORITY, row) + m_layoutsTable[row].activities.count(); @@ -676,7 +676,7 @@ QVariant Layouts::data(const QModelIndex &index, int role) const return HIGHESTPRIORITY + m_layoutsTable[row].shares.count(); } - if (m_layoutsTable[row].activities.contains(Data::Layout::FREEACTIVITIESID)) { + if (m_layoutsTable[row].activities.contains(Latte::Data::Layout::FREEACTIVITIESID)) { //! high activity priority return HIGHPRIORITY; } @@ -725,7 +725,7 @@ void Layouts::assignFreeActivitiesLayoutAt(const QString &layoutName) } int row = m_layoutsTable.indexOf(reqId); - setActivities(row, QStringList(Data::Layout::FREEACTIVITIESID)); + setActivities(row, QStringList(Latte::Data::Layout::FREEACTIVITIESID)); setShares(row, QStringList()); } @@ -740,7 +740,7 @@ void Layouts::autoAssignFreeActivitiesLayout() int row = m_layoutsTable.indexOf(activeCurrentId); if (row>=0 && !(m_inMultipleMode && m_layoutsTable[row].isShared()) && m_layoutsTable[row].activities.isEmpty()) { - m_layoutsTable[row].activities << Data::Layout::FREEACTIVITIESID; + m_layoutsTable[row].activities << Latte::Data::Layout::FREEACTIVITIESID; emit dataChanged(index(row,BACKGROUNDCOLUMN), index(row,ACTIVITYCOLUMN), roles); return; } @@ -748,7 +748,7 @@ void Layouts::autoAssignFreeActivitiesLayout() //! Active layouts with no activities have mid priority for(int i=0; i Layouts::alteredLayouts() const +QList Layouts::alteredLayouts() const { - QList layouts; + QList layouts; for(int i=0; i Layouts::alteredLayouts() const void Layouts::initActivities() { Latte::Data::Activity freeActivities; - freeActivities.id = Data::Layout::FREEACTIVITIESID; + freeActivities.id = Latte::Data::Layout::FREEACTIVITIESID; freeActivities.name = QString("[ " + i18n("All Free Activities...") + " ]"); freeActivities.icon = "favorites"; freeActivities.state = KActivities::Info::Stopped; - m_activitiesMap[Data::Layout::FREEACTIVITIESID] = freeActivities; + m_activitiesMap[Latte::Data::Layout::FREEACTIVITIESID] = freeActivities; QStringList activities = m_corona->layoutsManager()->synchronizer()->activities();; diff --git a/app/settings/models/layoutsmodel.h b/app/settings/models/layoutsmodel.h index 938211044..3d3e3ac6c 100644 --- a/app/settings/models/layoutsmodel.h +++ b/app/settings/models/layoutsmodel.h @@ -104,9 +104,9 @@ public: QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; Qt::ItemFlags flags(const QModelIndex &index) const override; - const Data::Layout &at(const int &row); - const Data::Layout ¤tData(const QString &id); - const Data::Layout originalData(const QString &id); + const Latte::Data::Layout &at(const int &row); + const Latte::Data::Layout ¤tData(const QString &id); + const Latte::Data::Layout originalData(const QString &id); bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override; @@ -119,9 +119,9 @@ public: //! all original data will become also current void resetData(); - void appendLayout(const Data::Layout &layout); + void appendLayout(const Latte::Data::Layout &layout); void removeLayout(const QString &id); - void setLayoutProperties(const Data::Layout &layout); + void setLayoutProperties(const Latte::Data::Layout &layout); QString layoutNameForFreeActivities() const; void setCurrentLayoutForFreeActivities(const QString &id); @@ -132,11 +132,11 @@ public: bool shareIsAvailable(const QString id) const; QStringList availableShareIdsFor(const QString id) const; - QList alteredLayouts() const; + QList alteredLayouts() const; - const Data::LayoutsTable ¤tLayoutsData(); - const Data::LayoutsTable &originalLayoutsData(); - void setOriginalData(Data::LayoutsTable &data, const bool &inmultiple); + const Latte::Data::LayoutsTable ¤tLayoutsData(); + const Latte::Data::LayoutsTable &originalLayoutsData(); + void setOriginalData(Latte::Data::LayoutsTable &data, const bool &inmultiple); signals: void inMultipleModeChanged(); @@ -169,9 +169,9 @@ private: QStringList assignedActivitiesFromShared(const int &row) const; - QList icons(const int &row) const; - QList iconsForCentralLayout(const int &row) const; - QList iconsForSharedLayout(const int &row) const; + QList icons(const int &row) const; + QList iconsForCentralLayout(const int &row) const; + QList iconsForSharedLayout(const int &row) const; private: //! break MVC only when a SharedTo editor is created @@ -186,11 +186,11 @@ private: //! original data bool o_inMultipleMode{false}; - Settings::Data::LayoutsTable o_layoutsTable; + Latte::Data::LayoutsTable o_layoutsTable; //! current data bool m_inMultipleMode{false}; - Settings::Data::LayoutsTable m_layoutsTable; + Latte::Data::LayoutsTable m_layoutsTable; Latte::Corona *m_corona{nullptr}; };