From 1f5f6cd69a2d6c2d37e6f098bc6e00cf7f0bf1ec Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Fri, 5 Feb 2021 18:38:58 +0200 Subject: [PATCH] provide view templates through manager --- app/data/generictable.cpp | 1 + app/templates/templatesmanager.cpp | 20 ++++++++++++++++++++ app/templates/templatesmanager.h | 4 ++++ 3 files changed, 25 insertions(+) diff --git a/app/data/generictable.cpp b/app/data/generictable.cpp index 3e0051976..18fca642e 100644 --- a/app/data/generictable.cpp +++ b/app/data/generictable.cpp @@ -302,6 +302,7 @@ void GenericTable::remove(const int &row) //! but that would drop readability template class GenericTable; template class GenericTable; +template class GenericTable; template class GenericTable; } diff --git a/app/templates/templatesmanager.cpp b/app/templates/templatesmanager.cpp index c27efce22..6d406828c 100644 --- a/app/templates/templatesmanager.cpp +++ b/app/templates/templatesmanager.cpp @@ -66,6 +66,21 @@ void Manager::init() m_layoutTemplates << tdata; } } + + filter.clear(); + filter.append(QString("*.view.latte")); + QStringList systemViewTemplates = systemTemplatesDir.entryList(filter, QDir::Files | QDir::Hidden | QDir::NoSymLinks); + + for (int i=0; i Manager::viewTemplates() +{ + return m_viewTemplates; +} + QString Manager::newLayout(QString layoutName, QString layoutTemplate) { if (!m_layoutTemplates.containsName(layoutTemplate)) { diff --git a/app/templates/templatesmanager.h b/app/templates/templatesmanager.h index ad992a94c..73a3e79ab 100644 --- a/app/templates/templatesmanager.h +++ b/app/templates/templatesmanager.h @@ -24,6 +24,8 @@ #include "../lattecorona.h" #include "../data/layoutdata.h" #include "../data/layoutstable.h" +#include "../data/genericdata.h" +#include "../data/generictable.h" // Qt #include @@ -55,6 +57,7 @@ public: Data::Layout layoutTemplateForName(const QString &layoutName); Data::LayoutsTable systemLayoutTemplates(); + Data::GenericTable viewTemplates(); //! creates a new layout with layoutName based on specific layout template and returns the new layout path QString newLayout(QString layoutName, QString layoutTemplate = i18n(DEFAULTLAYOUTTEMPLATENAME)); @@ -71,6 +74,7 @@ private: Latte::Corona *m_corona; Data::LayoutsTable m_layoutTemplates; + Data::GenericTable m_viewTemplates; };