mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-07 03:22:33 +01:00
Refactor code for const and explicitly disable qml creation
This commit is contained in:
parent
972bdc6db3
commit
226fddd722
@ -32,6 +32,7 @@ namespace ScreenPlay {
|
||||
class Create : public QObject {
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
QML_UNCREATABLE("")
|
||||
|
||||
Q_PROPERTY(QString workingDir READ workingDir WRITE setWorkingDir NOTIFY workingDirChanged)
|
||||
Q_PROPERTY(float progress READ progress WRITE setProgress NOTIFY progressChanged)
|
||||
|
@ -16,6 +16,7 @@ namespace ScreenPlay {
|
||||
class GlobalVariables : public QObject {
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
QML_UNCREATABLE("")
|
||||
|
||||
Q_PROPERTY(QVersionNumber version READ version CONSTANT)
|
||||
Q_PROPERTY(QUrl localStoragePath READ localStoragePath WRITE setLocalStoragePath NOTIFY localStoragePathChanged FINAL)
|
||||
|
@ -41,6 +41,7 @@ struct Monitor {
|
||||
class MonitorListModel : public QAbstractListModel {
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
QML_UNCREATABLE("")
|
||||
|
||||
public:
|
||||
explicit MonitorListModel(QObject* parent = nullptr);
|
||||
|
@ -24,6 +24,7 @@ namespace ScreenPlay {
|
||||
class ScreenPlayManager : public QObject {
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
QML_UNCREATABLE("")
|
||||
|
||||
Q_PROPERTY(int activeWallpaperCounter READ activeWallpaperCounter WRITE setActiveWallpaperCounter NOTIFY activeWallpaperCounterChanged)
|
||||
Q_PROPERTY(int activeWidgetsCounter READ activeWidgetsCounter WRITE setActiveWidgetsCounter NOTIFY activeWidgetsCounterChanged)
|
||||
|
@ -22,27 +22,21 @@ namespace ScreenPlay {
|
||||
class ScreenPlayWallpaper : public QObject {
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
QML_UNCREATABLE("")
|
||||
|
||||
Q_PROPERTY(bool isConnected READ isConnected WRITE setIsConnected NOTIFY isConnectedChanged)
|
||||
|
||||
Q_PROPERTY(QVector<int> screenNumber READ screenNumber WRITE setScreenNumber NOTIFY screenNumberChanged)
|
||||
|
||||
Q_PROPERTY(float volume READ volume WRITE setVolume NOTIFY volumeChanged)
|
||||
Q_PROPERTY(float playbackRate READ playbackRate WRITE setPlaybackRate NOTIFY playbackRateChanged)
|
||||
Q_PROPERTY(bool isLooping READ isLooping WRITE setIsLooping NOTIFY isLoopingChanged)
|
||||
|
||||
Q_PROPERTY(QString file READ file WRITE setFile NOTIFY fileChanged)
|
||||
Q_PROPERTY(QString absolutePath READ absolutePath WRITE setAbsolutePath NOTIFY absolutePathChanged)
|
||||
Q_PROPERTY(QString previewImage READ previewImage WRITE setPreviewImage NOTIFY previewImageChanged)
|
||||
Q_PROPERTY(QString appID READ appID WRITE setAppID NOTIFY appIDChanged)
|
||||
|
||||
Q_PROPERTY(FillMode::FillMode fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged)
|
||||
Q_PROPERTY(InstalledType::InstalledType type READ type WRITE setType NOTIFY typeChanged)
|
||||
|
||||
public:
|
||||
// Default constructor needed for qml engine
|
||||
ScreenPlayWallpaper() { }
|
||||
|
||||
explicit ScreenPlayWallpaper(
|
||||
const QVector<int>& screenNumber,
|
||||
const std::shared_ptr<GlobalVariables>& globalVariables,
|
||||
|
@ -23,6 +23,7 @@ namespace ScreenPlay {
|
||||
class ScreenPlayWidget : public QObject {
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
QML_UNCREATABLE("")
|
||||
|
||||
Q_PROPERTY(QString absolutePath READ absolutePath WRITE setAbsolutePath NOTIFY absolutePathChanged)
|
||||
Q_PROPERTY(QString previewImage READ previewImage WRITE setPreviewImage NOTIFY previewImageChanged)
|
||||
|
@ -303,7 +303,7 @@ bool ScreenPlayManager::removeWallpaperAt(int index)
|
||||
*/
|
||||
bool ScreenPlayManager::requestProjectSettingsAtMonitorIndex(const int index)
|
||||
{
|
||||
for (const std::shared_ptr<ScreenPlayWallpaper>& uPtrWallpaper : qAsConst(m_screenPlayWallpapers)) {
|
||||
for (const std::shared_ptr<ScreenPlayWallpaper>& uPtrWallpaper : std::as_const(m_screenPlayWallpapers)) {
|
||||
if (uPtrWallpaper->screenNumber()[0] == index) {
|
||||
|
||||
emit projectSettingsListModelResult(
|
||||
@ -514,12 +514,12 @@ bool ScreenPlayManager::saveProfiles()
|
||||
m_saveLimiter.stop();
|
||||
|
||||
QJsonArray wallpaper {};
|
||||
for (const auto& activeWallpaper : qAsConst(m_screenPlayWallpapers)) {
|
||||
for (const auto& activeWallpaper : std::as_const(m_screenPlayWallpapers)) {
|
||||
wallpaper.append(activeWallpaper->getActiveSettingsJson());
|
||||
}
|
||||
|
||||
QJsonArray widgets {};
|
||||
for (const auto& activeWidget : qAsConst(m_screenPlayWidgets)) {
|
||||
for (const auto& activeWidget : std::as_const(m_screenPlayWidgets)) {
|
||||
widgets.append(activeWidget->getActiveSettingsJson());
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ bool ScreenPlayWallpaper::start()
|
||||
QJsonObject ScreenPlayWallpaper::getActiveSettingsJson()
|
||||
{
|
||||
QJsonArray screenNumber;
|
||||
for (const int i : qAsConst(m_screenNumber)) {
|
||||
for (const int i : std::as_const(m_screenNumber)) {
|
||||
screenNumber.append(i);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user