mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-21 18:22:29 +01:00
Formatting
This commit is contained in:
parent
48dac9001e
commit
a46bf9a2e0
@ -39,8 +39,8 @@ public:
|
||||
Q_INVOKABLE bool removeAllRunningWidgets(bool saveToProfile = false);
|
||||
Q_INVOKABLE QCoro::QmlTask removeWallpaperAt(const int timelineIndex, const QString sectionIdentifier, const int monitorIndex);
|
||||
Q_INVOKABLE WallpaperData getWallpaperData(const int monitorIndex,
|
||||
const int timelineIndex,
|
||||
const QString sectionIdentifier);
|
||||
const int timelineIndex,
|
||||
const QString sectionIdentifier);
|
||||
|
||||
Q_INVOKABLE bool moveTimelineAt(
|
||||
const int timelineIndex,
|
||||
@ -57,13 +57,13 @@ public:
|
||||
|
||||
Q_INVOKABLE QCoro::QmlTask setWallpaperAtTimelineIndex(
|
||||
const ScreenPlay::ContentTypes::InstalledType type,
|
||||
const QString &absolutePath,
|
||||
const QString &previewImage,
|
||||
const QString &file,
|
||||
const QString &title,
|
||||
const QVector<int> &monitorIndex,
|
||||
const QString& absolutePath,
|
||||
const QString& previewImage,
|
||||
const QString& file,
|
||||
const QString& title,
|
||||
const QVector<int>& monitorIndex,
|
||||
const int timelineIndex,
|
||||
const QString &identifier,
|
||||
const QString& identifier,
|
||||
const bool saveToProfilesConfigFile);
|
||||
|
||||
Q_INVOKABLE bool startWidget(
|
||||
@ -76,7 +76,7 @@ public:
|
||||
const bool saveToProfilesConfigFile);
|
||||
|
||||
Q_INVOKABLE bool requestProjectSettingsAtMonitorIndex(const int index);
|
||||
Q_INVOKABLE QCoro::QmlTask setValueAtMonitorTimelineIndex(
|
||||
Q_INVOKABLE QCoro::QmlTask setValueAtMonitorTimelineIndex(
|
||||
const int monitorIndex,
|
||||
const int timelineIndex,
|
||||
const QString sectionIdentifier,
|
||||
|
@ -16,13 +16,13 @@ class ScreenPlayTimelineManager : public QObject {
|
||||
Q_PROPERTY(int selectedTimelineIndex READ selectedTimelineIndex WRITE setSelectedTimelineIndex NOTIFY selectedTimelineIndexChanged FINAL)
|
||||
|
||||
public:
|
||||
explicit ScreenPlayTimelineManager(QObject *parent = nullptr);
|
||||
explicit ScreenPlayTimelineManager(QObject* parent = nullptr);
|
||||
|
||||
std::shared_ptr<WallpaperTimelineSection> findActiveWallpaperTimelineSection();
|
||||
std::shared_ptr<WallpaperTimelineSection> findTimelineSectionForCurrentTime();
|
||||
std::shared_ptr<WallpaperTimelineSection> findTimelineSection(const int monitorIndex,
|
||||
const int timelineIndex,
|
||||
const QString sectionIdentifier);
|
||||
const int timelineIndex,
|
||||
const QString sectionIdentifier);
|
||||
|
||||
void startup();
|
||||
bool addTimelineFromSettings(const QJsonObject& timelineObj);
|
||||
@ -44,10 +44,10 @@ public:
|
||||
const int timelineIndex,
|
||||
const QString& sectionIdentifier);
|
||||
QCoro::Task<bool> setValueAtMonitorTimelineIndex(const int monitorIndex,
|
||||
const int timelineIndex,
|
||||
const QString sectionIdentifier,
|
||||
const QString &key,
|
||||
const QString &value);
|
||||
const int timelineIndex,
|
||||
const QString sectionIdentifier,
|
||||
const QString& key,
|
||||
const QString& value);
|
||||
QJsonArray timelineSections();
|
||||
QJsonArray timelineWallpaperList();
|
||||
void setGlobalVariables(const std::shared_ptr<GlobalVariables>& globalVariables);
|
||||
|
@ -47,16 +47,16 @@ public:
|
||||
|
||||
// Setters
|
||||
void setIsLooping(bool value) { m_isLooping = value; }
|
||||
void setAbsolutePath(const QString &value) { m_absolutePath = value; }
|
||||
void setPreviewImage(const QString &value) { m_previewImage = value; }
|
||||
void setAbsolutePath(const QString& value) { m_absolutePath = value; }
|
||||
void setPreviewImage(const QString& value) { m_previewImage = value; }
|
||||
void setPlaybackRate(float value) { m_playbackRate = value; }
|
||||
void setVolume(float value) { m_volume = value; }
|
||||
void setFile(const QString &value) { m_file = value; }
|
||||
void setProperties(const QJsonObject &value) { m_properties = value; }
|
||||
void setFile(const QString& value) { m_file = value; }
|
||||
void setProperties(const QJsonObject& value) { m_properties = value; }
|
||||
void setType(ContentTypes::InstalledType value) { m_type = value; }
|
||||
void setFillMode(Video::FillMode value) { m_fillMode = value; }
|
||||
void setMonitors(const QVector<int> &value) { m_monitors = value; }
|
||||
void setTitle(const QString &title) { m_title = title; }
|
||||
void setMonitors(const QVector<int>& value) { m_monitors = value; }
|
||||
void setTitle(const QString& title) { m_title = title; }
|
||||
|
||||
Q_INVOKABLE QString toString() const;
|
||||
|
||||
|
@ -240,8 +240,6 @@ QRect MonitorListModel::absoluteDesktopSize() const
|
||||
return totalRect;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
\brief Removes all items and loads them vida loadMonitors() again.
|
||||
*/
|
||||
|
@ -74,13 +74,13 @@ void ScreenPlayManager::init(
|
||||
*/
|
||||
QCoro::QmlTask ScreenPlayManager::setWallpaperAtTimelineIndex(
|
||||
const ScreenPlay::ContentTypes::InstalledType type,
|
||||
const QString &absolutePath,
|
||||
const QString &previewImage,
|
||||
const QString &file,
|
||||
const QString &title,
|
||||
const QVector<int> &monitorIndex,
|
||||
const QString& absolutePath,
|
||||
const QString& previewImage,
|
||||
const QString& file,
|
||||
const QString& title,
|
||||
const QVector<int>& monitorIndex,
|
||||
const int timelineIndex,
|
||||
const QString &identifier,
|
||||
const QString& identifier,
|
||||
const bool saveToProfilesConfigFile)
|
||||
{
|
||||
WallpaperData wallpaperData;
|
||||
@ -130,7 +130,7 @@ QCoro::QmlTask ScreenPlayManager::setWallpaperAtTimelineIndex(
|
||||
// ScreenPlayTimelineManager::checkActiveWallpaperTimeline decide
|
||||
// if the wallpaper
|
||||
requestSaveProfiles();
|
||||
co_return Result{success};
|
||||
co_return Result { success };
|
||||
});
|
||||
co_return result;
|
||||
}());
|
||||
@ -282,10 +282,10 @@ QCoro::QmlTask ScreenPlayManager::setValueAtMonitorTimelineIndex(
|
||||
[this, monitorIndex, timelineIndex, sectionIdentifier, key, value]() -> QCoro::Task<Result> {
|
||||
auto result = co_await m_screenPlayTimelineManager
|
||||
.setValueAtMonitorTimelineIndex(monitorIndex,
|
||||
timelineIndex,
|
||||
sectionIdentifier,
|
||||
key,
|
||||
value)
|
||||
timelineIndex,
|
||||
sectionIdentifier,
|
||||
key,
|
||||
value)
|
||||
.then([this](bool success) -> QCoro::Task<Result> {
|
||||
qDebug() << "Task: setValueAtMonitorTimelineIndex" << success;
|
||||
if (success) {
|
||||
@ -293,7 +293,7 @@ QCoro::QmlTask ScreenPlayManager::setValueAtMonitorTimelineIndex(
|
||||
selectedTimelineIndex());
|
||||
emit requestSaveProfiles();
|
||||
}
|
||||
co_return Result{success};
|
||||
co_return Result { success };
|
||||
});
|
||||
co_return result;
|
||||
}());
|
||||
@ -318,10 +318,10 @@ QCoro::QmlTask ScreenPlayManager::setWallpaperFillModeAtMonitorIndex(
|
||||
[this, monitorIndex, timelineIndex, sectionIdentifier, key, value]() -> QCoro::Task<Result> {
|
||||
auto result = co_await m_screenPlayTimelineManager
|
||||
.setValueAtMonitorTimelineIndex(monitorIndex,
|
||||
timelineIndex,
|
||||
sectionIdentifier,
|
||||
key,
|
||||
value)
|
||||
timelineIndex,
|
||||
sectionIdentifier,
|
||||
key,
|
||||
value)
|
||||
.then([this](bool success) -> QCoro::Task<Result> {
|
||||
qDebug() << "Task: setValueAtMonitorTimelineIndex" << success;
|
||||
if (success) {
|
||||
@ -329,7 +329,7 @@ QCoro::QmlTask ScreenPlayManager::setWallpaperFillModeAtMonitorIndex(
|
||||
selectedTimelineIndex());
|
||||
emit requestSaveProfiles();
|
||||
}
|
||||
co_return Result{success};
|
||||
co_return Result { success };
|
||||
});
|
||||
co_return result;
|
||||
}());
|
||||
@ -356,16 +356,16 @@ bool ScreenPlayManager::setAllWallpaperValue(const QString& key, const QString&
|
||||
This function is only used in QML.
|
||||
*/
|
||||
WallpaperData ScreenPlayManager::getWallpaperData(const int monitorIndex,
|
||||
const int timelineIndex,
|
||||
const QString sectionIdentifier)
|
||||
const int timelineIndex,
|
||||
const QString sectionIdentifier)
|
||||
{
|
||||
auto timelineSection = m_screenPlayTimelineManager.findTimelineSection(monitorIndex,
|
||||
timelineIndex,
|
||||
sectionIdentifier);
|
||||
timelineIndex,
|
||||
sectionIdentifier);
|
||||
if (!timelineSection) {
|
||||
return {};
|
||||
}
|
||||
for (auto &wallpaperData : timelineSection->wallpaperDataList) {
|
||||
for (auto& wallpaperData : timelineSection->wallpaperDataList) {
|
||||
if (wallpaperData.monitors().first() == monitorIndex) {
|
||||
// TODO COPY?
|
||||
return wallpaperData;
|
||||
|
@ -69,7 +69,7 @@ ScreenPlayTimelineManager::findTimelineSectionForCurrentTime()
|
||||
std::shared_ptr<WallpaperTimelineSection> ScreenPlayTimelineManager::findTimelineSection(
|
||||
const int monitorIndex, const int timelineIndex, const QString sectionIdentifier)
|
||||
{
|
||||
for (const auto §ion : m_wallpaperTimelineSectionsList) {
|
||||
for (const auto& section : m_wallpaperTimelineSectionsList) {
|
||||
if (section->identifier == sectionIdentifier && section->index == timelineIndex) {
|
||||
return section;
|
||||
}
|
||||
@ -196,13 +196,13 @@ void ScreenPlayTimelineManager::checkActiveWallpaperTimeline()
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<std::shared_ptr<WallpaperTimelineSection>> ScreenPlayTimelineManager::wallpaperSection(const int timelineIndex, const QString §ionIdentifier)
|
||||
std::optional<std::shared_ptr<WallpaperTimelineSection>> ScreenPlayTimelineManager::wallpaperSection(const int timelineIndex, const QString& sectionIdentifier)
|
||||
{
|
||||
for (const auto& section : m_wallpaperTimelineSectionsList) {
|
||||
const bool indexMatches = section->index == timelineIndex;
|
||||
const bool sectionIdentifierMatches = section->identifier == sectionIdentifier;
|
||||
if (indexMatches && sectionIdentifierMatches) {
|
||||
return {section};
|
||||
return { section };
|
||||
}
|
||||
}
|
||||
qCritical() << "No matching timeline for index:" << timelineIndex << "sectionIdentifier: " << sectionIdentifier;
|
||||
@ -311,13 +311,13 @@ void ScreenPlayTimelineManager::updateMonitorListModelData(const int selectedTim
|
||||
if (wallpaper->monitors().contains(monitorIndex)) {
|
||||
const auto& wallpaperData = wallpaper->wallpaperData();
|
||||
const auto previewImg = wallpaperData.absolutePath() + "/"
|
||||
+ wallpaperData.previewImage();
|
||||
+ wallpaperData.previewImage();
|
||||
m_monitorListModel->setData(modelIndex, wallpaper->appID(), (int)MonitorListModel::MonitorRole::AppID);
|
||||
m_monitorListModel->setData(modelIndex, (int)wallpaper->state(), (int)MonitorListModel::MonitorRole::AppState);
|
||||
m_monitorListModel->setData(modelIndex, previewImg, (int)MonitorListModel::MonitorRole::PreviewImage);
|
||||
m_monitorListModel->setData(modelIndex,
|
||||
(int) wallpaperData.type(),
|
||||
(int) MonitorListModel::MonitorRole::InstalledType);
|
||||
(int)wallpaperData.type(),
|
||||
(int)MonitorListModel::MonitorRole::InstalledType);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -328,15 +328,15 @@ void ScreenPlayTimelineManager::updateMonitorListModelData(const int selectedTim
|
||||
for (const auto& wallpaperData : timeline->wallpaperDataList) {
|
||||
if (wallpaperData.monitors().contains(monitorIndex)) {
|
||||
const auto previewImg = wallpaperData.absolutePath() + "/"
|
||||
+ wallpaperData.previewImage();
|
||||
+ wallpaperData.previewImage();
|
||||
m_monitorListModel->setData(modelIndex,
|
||||
wallpaperData.file(),
|
||||
(int) MonitorListModel::MonitorRole::AppID);
|
||||
wallpaperData.file(),
|
||||
(int)MonitorListModel::MonitorRole::AppID);
|
||||
m_monitorListModel->setData(modelIndex, (int)timeline->state, (int)MonitorListModel::MonitorRole::AppState);
|
||||
m_monitorListModel->setData(modelIndex, previewImg, (int)MonitorListModel::MonitorRole::PreviewImage);
|
||||
m_monitorListModel->setData(modelIndex,
|
||||
(int) wallpaperData.type(),
|
||||
(int) MonitorListModel::MonitorRole::InstalledType);
|
||||
(int)wallpaperData.type(),
|
||||
(int)MonitorListModel::MonitorRole::InstalledType);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -659,19 +659,19 @@ void ScreenPlayTimelineManager::printTimelines() const
|
||||
|
||||
/*!
|
||||
* \brief ScreenPlayTimelineManager::setValueAtMonitorTimelineIndex
|
||||
* sets the given key, value at the selected wallpaper.
|
||||
* Note:
|
||||
* \return
|
||||
* sets the given key, value at the selected wallpaper.
|
||||
* Note:
|
||||
* \return
|
||||
*/
|
||||
QCoro::Task<bool> ScreenPlayTimelineManager::setValueAtMonitorTimelineIndex(
|
||||
const int monitorIndex,
|
||||
const int timelineIndex,
|
||||
const QString sectionIdentifier,
|
||||
const QString &key,
|
||||
const QString &value)
|
||||
const QString& key,
|
||||
const QString& value)
|
||||
{
|
||||
auto wallpaperSectionOpt = wallpaperSection(timelineIndex, sectionIdentifier);
|
||||
if(!wallpaperSectionOpt.has_value())
|
||||
if (!wallpaperSectionOpt.has_value())
|
||||
co_return false;
|
||||
|
||||
auto wallpaperSection = wallpaperSectionOpt.value();
|
||||
@ -693,15 +693,15 @@ QCoro::Task<bool> ScreenPlayTimelineManager::setValueAtMonitorTimelineIndex(
|
||||
}
|
||||
|
||||
// Skip when the values was changed on an not running wallpaper
|
||||
if(!found){
|
||||
if (!found) {
|
||||
co_return true;
|
||||
}
|
||||
|
||||
// Now set the value in the ScreenPlayWallpaper class so it does
|
||||
// get propagated to the running wallpaper.
|
||||
for (auto &activeWallpaper : wallpaperSection->activeWallpaperList) {
|
||||
if(activeWallpaper->monitors().contains(monitorIndex)){
|
||||
activeWallpaper->setWallpaperValue(key,value);
|
||||
for (auto& activeWallpaper : wallpaperSection->activeWallpaperList) {
|
||||
if (activeWallpaper->monitors().contains(monitorIndex)) {
|
||||
activeWallpaper->setWallpaperValue(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -722,15 +722,15 @@ QCoro::Task<bool> ScreenPlayTimelineManager::setWallpaperAtTimelineIndex(
|
||||
|
||||
// Check if we already have a wallpaper at the same position or on one or more of the specified monitors
|
||||
auto it = std::find_if(timelineSection->wallpaperDataList.begin(),
|
||||
timelineSection->wallpaperDataList.end(),
|
||||
[&wallpaperData](const WallpaperData &existingWallpaper) {
|
||||
return std::any_of(wallpaperData.monitors().begin(),
|
||||
wallpaperData.monitors().end(),
|
||||
[&existingWallpaper](int monitor) {
|
||||
return existingWallpaper.monitors()
|
||||
.contains(monitor);
|
||||
});
|
||||
});
|
||||
timelineSection->wallpaperDataList.end(),
|
||||
[&wallpaperData](const WallpaperData& existingWallpaper) {
|
||||
return std::any_of(wallpaperData.monitors().begin(),
|
||||
wallpaperData.monitors().end(),
|
||||
[&existingWallpaper](int monitor) {
|
||||
return existingWallpaper.monitors()
|
||||
.contains(monitor);
|
||||
});
|
||||
});
|
||||
|
||||
if (it != timelineSection->wallpaperDataList.end()) {
|
||||
// TODO
|
||||
|
@ -33,7 +33,7 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(
|
||||
{
|
||||
Util util;
|
||||
std::optional<QJsonObject> projectOpt = util.openJsonFileToObject(m_wallpaperData.absolutePath()
|
||||
+ "/project.json");
|
||||
+ "/project.json");
|
||||
if (projectOpt.has_value()) {
|
||||
m_projectJson = projectOpt.value();
|
||||
}
|
||||
@ -44,7 +44,7 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(
|
||||
} else {
|
||||
if (m_wallpaperData.properties().isEmpty()) {
|
||||
if (auto obj = util.openJsonFileToObject(m_wallpaperData.absolutePath()
|
||||
+ "/project.json")) {
|
||||
+ "/project.json")) {
|
||||
if (obj->contains("properties"))
|
||||
projectSettingsListModelProperties = obj->value("properties").toObject();
|
||||
}
|
||||
@ -75,22 +75,22 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(
|
||||
|
||||
const QString screens = "{" + tmpScreenNumber + "}";
|
||||
|
||||
m_appArgumentsList = QStringList{"--screens",
|
||||
screens,
|
||||
"--projectpath",
|
||||
m_wallpaperData.absolutePath(),
|
||||
"--appID",
|
||||
m_appID,
|
||||
"--volume",
|
||||
QString::number(static_cast<double>(m_wallpaperData.volume())),
|
||||
"--fillmode",
|
||||
QVariant::fromValue(m_wallpaperData.fillMode()).toString(),
|
||||
"--type",
|
||||
QVariant::fromValue(m_wallpaperData.type()).toString(),
|
||||
"--check",
|
||||
QString::number(m_settings->checkWallpaperVisible()),
|
||||
"--mainapppid",
|
||||
QString::number(m_processManager.getCurrentPID())};
|
||||
m_appArgumentsList = QStringList { "--screens",
|
||||
screens,
|
||||
"--projectpath",
|
||||
m_wallpaperData.absolutePath(),
|
||||
"--appID",
|
||||
m_appID,
|
||||
"--volume",
|
||||
QString::number(static_cast<double>(m_wallpaperData.volume())),
|
||||
"--fillmode",
|
||||
QVariant::fromValue(m_wallpaperData.fillMode()).toString(),
|
||||
"--type",
|
||||
QVariant::fromValue(m_wallpaperData.type()).toString(),
|
||||
"--check",
|
||||
QString::number(m_settings->checkWallpaperVisible()),
|
||||
"--mainapppid",
|
||||
QString::number(m_processManager.getCurrentPID()) };
|
||||
|
||||
// Fixes issue 84 media key overlay in Qt apps
|
||||
if (m_wallpaperData.type() != ContentTypes::InstalledType::GodotWallpaper) {
|
||||
|
@ -133,7 +133,7 @@ std::optional<ScreenPlay::WallpaperData> ScreenPlay::WallpaperData::loadTimeline
|
||||
|
||||
wallpaperData.setType(
|
||||
QStringToEnum<ContentTypes::InstalledType>(typeString,
|
||||
ContentTypes::InstalledType::VideoWallpaper));
|
||||
ContentTypes::InstalledType::VideoWallpaper));
|
||||
wallpaperData.setFillMode(
|
||||
QStringToEnum<Video::FillMode>(fillModeString, Video::FillMode::Cover));
|
||||
|
||||
|
@ -158,9 +158,9 @@ QCoro::Task<bool> WallpaperTimelineSection::removeWallpaper(const int monitorInd
|
||||
{
|
||||
// Remove WallpaperData first
|
||||
size_t removedCount = std::erase_if(wallpaperDataList,
|
||||
[monitorIndex](const auto &wallpaperData) {
|
||||
return wallpaperData.monitors().contains(monitorIndex);
|
||||
});
|
||||
[monitorIndex](const auto& wallpaperData) {
|
||||
return wallpaperData.monitors().contains(monitorIndex);
|
||||
});
|
||||
if (removedCount == 0) {
|
||||
qCritical() << "No wallpaper data found for monitor index:" << monitorIndex;
|
||||
co_return false;
|
||||
|
Loading…
Reference in New Issue
Block a user