mirror of
https://github.com/KDE/latte-dock.git
synced 2025-01-11 13:18:13 +03:00
provide view templates through manager
This commit is contained in:
parent
578a42b991
commit
1f5f6cd69a
@ -302,6 +302,7 @@ void GenericTable<T>::remove(const int &row)
|
||||
//! but that would drop readability
|
||||
template class GenericTable<Data::Activity>;
|
||||
template class GenericTable<Data::Applet>;
|
||||
template class GenericTable<Data::Generic>;
|
||||
template class GenericTable<Data::Layout>;
|
||||
|
||||
}
|
||||
|
@ -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<systemViewTemplates.count(); ++i) {
|
||||
QString systemViewTemplatePath = systemTemplatesDir.path() + "/" + systemViewTemplates[i];
|
||||
if (!m_viewTemplates.containsId(systemViewTemplatePath)) {
|
||||
Data::Generic vdata;
|
||||
vdata.id = systemViewTemplatePath;
|
||||
vdata.name = QFileInfo(systemViewTemplatePath).baseName();
|
||||
|
||||
m_viewTemplates << vdata;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Data::Layout Manager::layoutTemplateForName(const QString &layoutName)
|
||||
@ -98,6 +113,11 @@ Data::LayoutsTable Manager::systemLayoutTemplates()
|
||||
return templates;
|
||||
}
|
||||
|
||||
Data::GenericTable<Data::Generic> Manager::viewTemplates()
|
||||
{
|
||||
return m_viewTemplates;
|
||||
}
|
||||
|
||||
QString Manager::newLayout(QString layoutName, QString layoutTemplate)
|
||||
{
|
||||
if (!m_layoutTemplates.containsName(layoutTemplate)) {
|
||||
|
@ -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 <QObject>
|
||||
@ -55,6 +57,7 @@ public:
|
||||
Data::Layout layoutTemplateForName(const QString &layoutName);
|
||||
|
||||
Data::LayoutsTable systemLayoutTemplates();
|
||||
Data::GenericTable<Data::Generic> 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<Data::Generic> m_viewTemplates;
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user