1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-07 03:22:33 +01:00

Move projectfile to be used elsewhere

This commit is contained in:
Elias Steurer 2021-02-03 17:52:29 +01:00
parent 394237d11d
commit 3dd2ff0852
8 changed files with 16 additions and 20 deletions

View File

@ -55,7 +55,6 @@ set(headers
src/settings.h src/settings.h
src/profilelistmodel.h src/profilelistmodel.h
src/profile.h src/profile.h
src/projectfile.h
src/installedlistfilter.h src/installedlistfilter.h
src/projectsettingslistmodel.h src/projectsettingslistmodel.h
src/screenplaymanager.h src/screenplaymanager.h

View File

@ -100,12 +100,12 @@ Popup {
id: delegate id: delegate
focus: true focus: true
width: gridView.cellWidth - 30 width: gridView.cellWidth - 30
customTitle: screenTitle customTitle: m_title
type: screenType type: m_type
screenId: screenFolderId screenId: m_folderId
absoluteStoragePath: screenAbsoluteStoragePath absoluteStoragePath: m_absoluteStoragePath
publishedFileID: screenPublishedFileID publishedFileID: m_publishedFileID
preview: screenPreview preview: m_preview
itemIndex: index itemIndex: index
onItemClicked: { onItemClicked: {
for (let childItem in gridView.contentItem.children) { for (let childItem in gridView.contentItem.children) {

View File

@ -21,7 +21,7 @@ Item {
property string absoluteStoragePath: "" property string absoluteStoragePath: ""
property string screenId: "" property string screenId: ""
property string preview: "" property string preview: ""
property string type: "" property var type
property bool hasMenuOpen: false property bool hasMenuOpen: false
property var publishedFileID: 0 property var publishedFileID: 0
property int itemIndex property int itemIndex
@ -103,7 +103,7 @@ Item {
Text { Text {
id: name id: name
text: screenTitle text: m_title
color: Material.foreground color: Material.foreground
font.pointSize: 18 font.pointSize: 18
font.family: ScreenPlay.settings.font font.family: ScreenPlay.settings.font
@ -111,7 +111,7 @@ Item {
} }
Text { Text {
text: qsTr("Type: ") + screenType text: qsTr("Type: ") + m_type
color: Material.foreground color: Material.foreground
font.family: ScreenPlay.settings.font font.family: ScreenPlay.settings.font
} }

View File

@ -89,7 +89,7 @@ QVariant InstalledListModel::data(const QModelIndex& index, int role) const
if (!index.isValid()) if (!index.isValid())
return QVariant(); return QVariant();
int row = index.row(); const int row = index.row();
if (row < 0 || row >= m_screenPlayFiles.count()) { if (row < 0 || row >= m_screenPlayFiles.count()) {
return QVariant(); return QVariant();
} }
@ -127,8 +127,7 @@ QVariant InstalledListModel::data(const QModelIndex& index, int role) const
*/ */
QHash<int, QByteArray> InstalledListModel::roleNames() const QHash<int, QByteArray> InstalledListModel::roleNames() const
{ {
return {
static const QHash<int, QByteArray> roles {
{ static_cast<int>(ScreenPlayItem::Title), "m_title" }, { static_cast<int>(ScreenPlayItem::Title), "m_title" },
{ static_cast<int>(ScreenPlayItem::Type), "m_type" }, { static_cast<int>(ScreenPlayItem::Type), "m_type" },
{ static_cast<int>(ScreenPlayItem::Preview), "m_preview" }, { static_cast<int>(ScreenPlayItem::Preview), "m_preview" },
@ -140,7 +139,6 @@ QHash<int, QByteArray> InstalledListModel::roleNames() const
{ static_cast<int>(ScreenPlayItem::Tags), "m_tags" }, { static_cast<int>(ScreenPlayItem::Tags), "m_tags" },
{ static_cast<int>(ScreenPlayItem::SearchType), "m_searchType" }, { static_cast<int>(ScreenPlayItem::SearchType), "m_searchType" },
}; };
return roles;
} }
/*! /*!
@ -161,9 +159,9 @@ void InstalledListModel::loadInstalledContent()
QtConcurrent::run([this]() { QtConcurrent::run([this]() {
QFileInfoList list = QDir(m_globalVariables->localStoragePath().toLocalFile()).entryInfoList(QDir::NoDotAndDotDot | QDir::AllDirs); QFileInfoList list = QDir(m_globalVariables->localStoragePath().toLocalFile()).entryInfoList(QDir::NoDotAndDotDot | QDir::AllDirs);
QString projectItemPath; QString projectItemPath;
int counter {}; int counter = 0;
for (auto&& item : list) { for (const auto& item : list) {
projectItemPath = m_globalVariables->localStoragePath().toLocalFile() + "/" + item.baseName() + "/project.json"; projectItemPath = m_globalVariables->localStoragePath().toLocalFile() + "/" + item.baseName() + "/project.json";
if (auto obj = ScreenPlayUtil::openJsonFileToObject(projectItemPath)) { if (auto obj = ScreenPlayUtil::openJsonFileToObject(projectItemPath)) {

View File

@ -55,7 +55,7 @@
#include "globalvariables.h" #include "globalvariables.h"
#include "profilelistmodel.h" #include "profilelistmodel.h"
#include "projectfile.h" #include "ScreenPlayUtil/projectfile.h"
#include "util.h" #include "util.h"
#include <memory> #include <memory>

View File

@ -45,7 +45,7 @@
#include "installedlistmodel.h" #include "installedlistmodel.h"
#include "monitorlistmodel.h" #include "monitorlistmodel.h"
#include "profilelistmodel.h" #include "profilelistmodel.h"
#include "projectfile.h" #include "ScreenPlayUtil/projectfile.h"
#include "projectsettingslistmodel.h" #include "projectsettingslistmodel.h"
#include "screenplaywallpaper.h" #include "screenplaywallpaper.h"
#include "screenplaywidget.h" #include "screenplaywidget.h"

View File

@ -17,6 +17,7 @@ set(SOURCES
set(HEADER set(HEADER
inc/public/ScreenPlayUtil/util.h inc/public/ScreenPlayUtil/util.h
inc/public/ScreenPlayUtil/contenttypes.h inc/public/ScreenPlayUtil/contenttypes.h
inc/public/ScreenPlayUtil/projectfile.h
) )
add_library(${PROJECT_NAME} STATIC ${SOURCES} ${HEADER}) add_library(${PROJECT_NAME} STATIC ${SOURCES} ${HEADER})

View File

@ -44,8 +44,6 @@
#include <QVariantList> #include <QVariantList>
#include "ScreenPlayUtil/util.h" #include "ScreenPlayUtil/util.h"
#include "globalvariables.h"
#include "util.h"
/*! /*!
\class ProjectFile \class ProjectFile