1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-24 19:52:40 +01:00

Formatting

This commit is contained in:
Elias Steurer 2024-10-25 17:48:43 +02:00
parent 48dac9001e
commit a46bf9a2e0
9 changed files with 96 additions and 98 deletions

View File

@ -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(

View File

@ -16,7 +16,7 @@ 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();
@ -46,8 +46,8 @@ public:
QCoro::Task<bool> setValueAtMonitorTimelineIndex(const int monitorIndex,
const int timelineIndex,
const QString sectionIdentifier,
const QString &key,
const QString &value);
const QString& key,
const QString& value);
QJsonArray timelineSections();
QJsonArray timelineWallpaperList();
void setGlobalVariables(const std::shared_ptr<GlobalVariables>& globalVariables);

View File

@ -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;

View File

@ -240,8 +240,6 @@ QRect MonitorListModel::absoluteDesktopSize() const
return totalRect;
}
/*!
\brief Removes all items and loads them vida loadMonitors() again.
*/

View File

@ -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;
}());
@ -293,7 +293,7 @@ QCoro::QmlTask ScreenPlayManager::setValueAtMonitorTimelineIndex(
selectedTimelineIndex());
emit requestSaveProfiles();
}
co_return Result{success};
co_return Result { success };
});
co_return result;
}());
@ -329,7 +329,7 @@ QCoro::QmlTask ScreenPlayManager::setWallpaperFillModeAtMonitorIndex(
selectedTimelineIndex());
emit requestSaveProfiles();
}
co_return Result{success};
co_return Result { success };
});
co_return result;
}());
@ -365,7 +365,7 @@ WallpaperData ScreenPlayManager::getWallpaperData(const int monitorIndex,
if (!timelineSection) {
return {};
}
for (auto &wallpaperData : timelineSection->wallpaperDataList) {
for (auto& wallpaperData : timelineSection->wallpaperDataList) {
if (wallpaperData.monitors().first() == monitorIndex) {
// TODO COPY?
return wallpaperData;

View File

@ -69,7 +69,7 @@ ScreenPlayTimelineManager::findTimelineSectionForCurrentTime()
std::shared_ptr<WallpaperTimelineSection> ScreenPlayTimelineManager::findTimelineSection(
const int monitorIndex, const int timelineIndex, const QString sectionIdentifier)
{
for (const auto &section : 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 &sectionIdentifier)
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;
@ -316,8 +316,8 @@ void ScreenPlayTimelineManager::updateMonitorListModelData(const int selectedTim
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;
}
}
@ -331,12 +331,12 @@ void ScreenPlayTimelineManager::updateMonitorListModelData(const int selectedTim
+ wallpaperData.previewImage();
m_monitorListModel->setData(modelIndex,
wallpaperData.file(),
(int) MonitorListModel::MonitorRole::AppID);
(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;
}
}
@ -667,11 +667,11 @@ 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);
}
}
@ -723,7 +723,7 @@ 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) {
[&wallpaperData](const WallpaperData& existingWallpaper) {
return std::any_of(wallpaperData.monitors().begin(),
wallpaperData.monitors().end(),
[&existingWallpaper](int monitor) {

View File

@ -75,7 +75,7 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(
const QString screens = "{" + tmpScreenNumber + "}";
m_appArgumentsList = QStringList{"--screens",
m_appArgumentsList = QStringList { "--screens",
screens,
"--projectpath",
m_wallpaperData.absolutePath(),
@ -90,7 +90,7 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(
"--check",
QString::number(m_settings->checkWallpaperVisible()),
"--mainapppid",
QString::number(m_processManager.getCurrentPID())};
QString::number(m_processManager.getCurrentPID()) };
// Fixes issue 84 media key overlay in Qt apps
if (m_wallpaperData.type() != ContentTypes::InstalledType::GodotWallpaper) {

View File

@ -158,7 +158,7 @@ QCoro::Task<bool> WallpaperTimelineSection::removeWallpaper(const int monitorInd
{
// Remove WallpaperData first
size_t removedCount = std::erase_if(wallpaperDataList,
[monitorIndex](const auto &wallpaperData) {
[monitorIndex](const auto& wallpaperData) {
return wallpaperData.monitors().contains(monitorIndex);
});
if (removedCount == 0) {