mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-25 12:13:00 +01:00
Merge commit '68e940d9746fa43c8e3a2c37accb93fa3f958835' into 47-mark-new-wallpapers-with-a-banner
This commit is contained in:
commit
3675170d06
@ -130,5 +130,6 @@
|
||||
<file>assets/icons/brand_reddit.svg</file>
|
||||
<file>assets/icons/steam_default_avatar.png</file>
|
||||
<file>assets/macos/app.screenplay.plist</file>
|
||||
<file>assets/icons/item_banner_new.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
7
ScreenPlay/assets/icons/item_banner_new.svg
Normal file
7
ScreenPlay/assets/icons/item_banner_new.svg
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg width="100%" height="100%" viewBox="0 0 320 180" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
||||
<g transform="matrix(0.319516,0.319516,-0.498372,0.498372,302.434,-166.795)">
|
||||
<path d="M350.406,189.405L226.597,189.405L189.603,213.123L387.4,213.123L350.406,189.405Z" style="fill:rgb(255,152,0);"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 672 B |
@ -207,6 +207,7 @@ Item {
|
||||
focus: true
|
||||
customTitle: m_title
|
||||
type: m_type
|
||||
isNew: m_isNew
|
||||
screenId: m_folderId
|
||||
absoluteStoragePath: m_absoluteStoragePath
|
||||
publishedFileID: m_publishedFileID
|
||||
|
@ -17,7 +17,8 @@ Item {
|
||||
property var publishedFileID: 0
|
||||
property int itemIndex
|
||||
property bool isScrolling: false
|
||||
|
||||
property bool isNew:false
|
||||
Component.onCompleted:print(isNew)
|
||||
signal openContextMenu(point position)
|
||||
|
||||
width: 320
|
||||
@ -189,7 +190,26 @@ Item {
|
||||
}
|
||||
|
||||
}
|
||||
Image {
|
||||
id: new_banner
|
||||
source: "qrc:/assets/icons/item_banner_new.svg"
|
||||
visible: root.isNew
|
||||
|
||||
Text
|
||||
{
|
||||
|
||||
font.family:"Helvetica";font.bold: true;font.pointSize:9.5; font.italic: true
|
||||
color: "#AAffffff"
|
||||
text: qsTr("NEW")
|
||||
anchors{
|
||||
right: new_banner.right
|
||||
top: new_banner.TopLeft
|
||||
|
||||
}
|
||||
transform: Rotation{ origin.y:12; angle:45}
|
||||
visible: root.isNew
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OpacityMask {
|
||||
|
@ -1,4 +1,6 @@
|
||||
#include "installedlistmodel.h"
|
||||
#include<QDebug>
|
||||
|
||||
|
||||
namespace ScreenPlay {
|
||||
|
||||
@ -111,8 +113,9 @@ QVariant InstalledListModel::data(const QModelIndex& index, int role) const
|
||||
return m_screenPlayFiles.at(row).m_publishedFileID;
|
||||
case static_cast<int>(ScreenPlayItem::Tags):
|
||||
return m_screenPlayFiles.at(row).m_tags;
|
||||
case static_cast<int>(ScreenPlayItem::LastModified):
|
||||
return m_screenPlayFiles.at(row).m_lastModified;
|
||||
case static_cast<int>(ScreenPlayItem::IsNew):
|
||||
return m_screenPlayFiles.at(row).m_isNew;
|
||||
|
||||
case static_cast<int>(ScreenPlayItem::SearchType):
|
||||
return QVariant::fromValue(m_screenPlayFiles.at(row).m_searchType);
|
||||
default:
|
||||
@ -137,17 +140,18 @@ QHash<int, QByteArray> InstalledListModel::roleNames() const
|
||||
{ static_cast<int>(ScreenPlayItem::PublishedFileID), "m_publishedFileID" },
|
||||
{ static_cast<int>(ScreenPlayItem::Tags), "m_tags" },
|
||||
{ static_cast<int>(ScreenPlayItem::SearchType), "m_searchType" },
|
||||
{ static_cast<int>(ScreenPlayItem::LastModified), "m_lastModified" },
|
||||
{ static_cast<int>(ScreenPlayItem::IsNew), "m_isNew" }
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Append an ProjectFile to the list.
|
||||
*/
|
||||
void InstalledListModel::append(const QJsonObject& obj, const QString& folderName, const QDateTime& lastModified)
|
||||
void InstalledListModel::append(const QJsonObject& obj, const QString& folderName, const bool isNew)
|
||||
{
|
||||
beginInsertRows(QModelIndex(), m_screenPlayFiles.size(), m_screenPlayFiles.size());
|
||||
m_screenPlayFiles.append(ProjectFile(obj, folderName, m_globalVariables->localStoragePath(), lastModified));
|
||||
m_screenPlayFiles.append(ProjectFile(obj, folderName, m_globalVariables->localStoragePath(), isNew));
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
@ -164,7 +168,16 @@ void InstalledListModel::loadInstalledContent()
|
||||
const QString absoluteFilePath = m_globalVariables->localStoragePath().toLocalFile() + "/" + item.baseName() + "/project.json";
|
||||
|
||||
if (!QFile::exists(absoluteFilePath))
|
||||
continue;
|
||||
continue;
|
||||
bool isNew=false;
|
||||
QDateTime date=QDateTime::currentDateTime();
|
||||
qDebug()<<date.date();
|
||||
if(item.birthTime().date()==date.date())
|
||||
{
|
||||
qDebug()<<item.birthTime()<<date.date();
|
||||
isNew=true;
|
||||
qDebug()<<isNew;
|
||||
}
|
||||
|
||||
if (auto obj = ScreenPlayUtil::openJsonFileToObject(absoluteFilePath)) {
|
||||
|
||||
@ -176,12 +189,15 @@ void InstalledListModel::loadInstalledContent()
|
||||
|
||||
if (ScreenPlayUtil::getAvailableTypes().contains(obj->value("type").toString())) {
|
||||
if (ScreenPlayUtil::getAvailableTypes().contains(obj->value("type").toString(), Qt::CaseInsensitive)) {
|
||||
append(*obj, item.baseName(), item.lastModified());
|
||||
append(*obj, item.baseName(),isNew);
|
||||
|
||||
}
|
||||
|
||||
|
||||
counter += 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
setCount(counter);
|
||||
emit installedLoadingFinished();
|
||||
@ -208,7 +224,7 @@ QVariantMap InstalledListModel::get(const QString& folderId) const
|
||||
map.insert("m_type", QVariant::fromValue(m_screenPlayFiles[i].m_type));
|
||||
map.insert("m_absoluteStoragePath", m_screenPlayFiles[i].m_absoluteStoragePath);
|
||||
map.insert("m_publishedFileID", m_screenPlayFiles[i].m_publishedFileID);
|
||||
map.insert("m_lastModified", m_screenPlayFiles[i].m_lastModified);
|
||||
map.insert("m_isNew",m_screenPlayFiles[i].m_isNew);
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
@ -89,6 +89,7 @@ public:
|
||||
Tags,
|
||||
SearchType,
|
||||
LastModified,
|
||||
IsNew,
|
||||
};
|
||||
Q_ENUM(ScreenPlayItem)
|
||||
|
||||
@ -101,7 +102,7 @@ public slots:
|
||||
QVariantMap get(const QString& folderId) const;
|
||||
|
||||
void loadInstalledContent();
|
||||
void append(const QJsonObject&, const QString&, const QDateTime& lastModified);
|
||||
void append(const QJsonObject&, const QString&,const bool isNew);
|
||||
void reset();
|
||||
void init();
|
||||
bool deinstallItemAt(const int index);
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include <QUrl>
|
||||
#include <QVariant>
|
||||
#include <QVariantList>
|
||||
#include <QDateTime>
|
||||
|
||||
#include "ScreenPlayUtil/util.h"
|
||||
|
||||
@ -58,7 +59,7 @@ struct ProjectFile {
|
||||
const QJsonObject& obj,
|
||||
const QString& folderName,
|
||||
const QUrl& absolutePath,
|
||||
const QDateTime& lastModified)
|
||||
const bool isNew)
|
||||
{
|
||||
|
||||
if (obj.contains("description"))
|
||||
@ -100,6 +101,8 @@ struct ProjectFile {
|
||||
|
||||
m_folderId = folderName;
|
||||
|
||||
|
||||
|
||||
if (!obj.contains("type"))
|
||||
return;
|
||||
|
||||
@ -114,7 +117,7 @@ struct ProjectFile {
|
||||
m_preview = m_previewGIF;
|
||||
}
|
||||
m_searchType = ScreenPlayUtil::getSearchTypeFromInstalledType(m_type);
|
||||
m_lastModified = lastModified;
|
||||
m_isNew = isNew;
|
||||
}
|
||||
|
||||
ProjectFile() { }
|
||||
@ -135,6 +138,6 @@ struct ProjectFile {
|
||||
|
||||
InstalledType::InstalledType m_type = InstalledType::InstalledType::Unknown;
|
||||
SearchType::SearchType m_searchType = SearchType::SearchType::All;
|
||||
QDateTime m_lastModified;
|
||||
bool m_isNew = false;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user