File indexing completed on 2024-04-28 04:49:00
0001 /* 0002 SPDX-FileCopyrightText: 2017 (c) Matthieu Gallien <matthieu_gallien@yahoo.fr> 0003 0004 SPDX-License-Identifier: LGPL-3.0-or-later 0005 */ 0006 0007 #if !defined ELISACONFIGURATIONDIALOG_H_ 0008 #define ELISACONFIGURATIONDIALOG_H_ 0009 0010 #include "elisaLib_export.h" 0011 0012 #include "elisautils.h" 0013 0014 #include <QStringList> 0015 #include <QFileSystemWatcher> 0016 0017 class ELISALIB_EXPORT ElisaConfigurationDialog : public QObject 0018 { 0019 0020 Q_OBJECT 0021 0022 Q_PROPERTY(QStringList rootPath 0023 READ rootPath 0024 WRITE setRootPath 0025 NOTIFY rootPathChanged) 0026 0027 Q_PROPERTY(bool alwaysUseAbsolutePlaylistPaths 0028 READ alwaysUseAbsolutePlaylistPaths 0029 WRITE setAlwaysUseAbsolutePlaylistPaths 0030 NOTIFY alwaysUseAbsolutePlaylistPathsChanged) 0031 0032 Q_PROPERTY(bool showNowPlayingBackground 0033 READ showNowPlayingBackground 0034 WRITE setShowNowPlayingBackground 0035 NOTIFY showNowPlayingBackgroundChanged) 0036 0037 Q_PROPERTY(bool showProgressInTaskBar 0038 READ showProgressInTaskBar 0039 WRITE setShowProgressInTaskBar 0040 NOTIFY showProgressInTaskBarChanged) 0041 0042 Q_PROPERTY(bool showSystemTrayIcon 0043 READ showSystemTrayIcon 0044 WRITE setShowSystemTrayIcon 0045 NOTIFY showSystemTrayIconChanged) 0046 0047 Q_PROPERTY(ElisaUtils::PlayListEntryType embeddedView 0048 READ embeddedView 0049 WRITE setEmbeddedView 0050 NOTIFY embeddedViewChanged) 0051 0052 Q_PROPERTY(int initialViewIndex 0053 READ initialViewIndex 0054 WRITE setInitialViewIndex 0055 NOTIFY initialViewIndexChanged) 0056 0057 Q_PROPERTY(QString initialFilesViewPath 0058 READ initialFilesViewPath 0059 WRITE setInitialFilesViewPath 0060 NOTIFY initialFilesViewPathChanged) 0061 0062 Q_PROPERTY(bool isDirty 0063 READ isDirty 0064 NOTIFY isDirtyChanged) 0065 0066 Q_PROPERTY(bool playAtStartup 0067 READ playAtStartup 0068 WRITE setPlayAtStartup 0069 NOTIFY playAtStartupChanged) 0070 0071 Q_PROPERTY(bool scanAtStartup 0072 READ scanAtStartup 0073 WRITE setScanAtStartup 0074 NOTIFY scanAtStartupChanged) 0075 0076 Q_PROPERTY(QString colorScheme 0077 READ colorScheme 0078 WRITE setColorScheme 0079 NOTIFY colorSchemeChanged) 0080 0081 Q_PROPERTY(bool useFavoriteStyleRatings 0082 READ useFavoriteStyleRatings 0083 WRITE setUseFavoriteStyleRatings 0084 NOTIFY useFavoriteStyleRatingsChanged) 0085 0086 public: 0087 0088 explicit ElisaConfigurationDialog(QObject *parent = nullptr); 0089 0090 ~ElisaConfigurationDialog() override; 0091 0092 [[nodiscard]] QStringList rootPath() const; 0093 0094 [[nodiscard]] bool isDirty() const 0095 { 0096 return mIsDirty; 0097 } 0098 0099 [[nodiscard]] bool showNowPlayingBackground() const 0100 { 0101 return mShowNowPlayingBackground; 0102 } 0103 0104 0105 [[nodiscard]] bool showProgressInTaskBar() const 0106 { 0107 return mShowProgressInTaskBar; 0108 } 0109 0110 [[nodiscard]] bool showSystemTrayIcon() const 0111 { 0112 return mShowSystemTrayIcon; 0113 } 0114 0115 [[nodiscard]] bool alwaysUseAbsolutePlaylistPaths() const 0116 { 0117 return mAlwaysUseAbsolutePlaylistPaths; 0118 } 0119 0120 [[nodiscard]] ElisaUtils::PlayListEntryType embeddedView() const 0121 { 0122 return mEmbeddedView; 0123 } 0124 0125 [[nodiscard]] int initialViewIndex() const 0126 { 0127 return mInitialViewIndex; 0128 } 0129 0130 [[nodiscard]] QString initialFilesViewPath() const 0131 { 0132 return mInitialFilesViewPath; 0133 } 0134 0135 [[nodiscard]] bool playAtStartup() const 0136 { 0137 return mPlayAtStartup; 0138 } 0139 0140 [[nodiscard]] bool scanAtStartup() const 0141 { 0142 return mScanAtStartup; 0143 } 0144 0145 [[nodiscard]] QString colorScheme() const 0146 { 0147 return mColorScheme; 0148 } 0149 0150 [[nodiscard]] bool useFavoriteStyleRatings() const 0151 { 0152 return mUseFavoriteStyleRatings; 0153 } 0154 0155 Q_INVOKABLE void removeMusicLocation(QString location); 0156 0157 0158 Q_SIGNALS: 0159 0160 void rootPathChanged(const QStringList &rootPath); 0161 0162 void isDirtyChanged(); 0163 0164 void showNowPlayingBackgroundChanged(); 0165 0166 void showProgressInTaskBarChanged(); 0167 0168 void showSystemTrayIconChanged(); 0169 0170 void alwaysUseAbsolutePlaylistPathsChanged(); 0171 0172 void embeddedViewChanged(); 0173 0174 void initialViewIndexChanged(); 0175 0176 void initialFilesViewPathChanged(); 0177 0178 void playAtStartupChanged(); 0179 0180 void scanAtStartupChanged(); 0181 0182 void colorSchemeChanged(); 0183 0184 void useFavoriteStyleRatingsChanged(); 0185 0186 public Q_SLOTS: 0187 0188 void setRootPath(const QStringList &rootPath); 0189 0190 void save(); 0191 0192 void cancel(); 0193 0194 void setShowNowPlayingBackground(bool showNowPlayingBackground); 0195 0196 void setShowProgressInTaskBar(bool showProgressInTaskBar); 0197 0198 void setShowSystemTrayIcon(bool showSystemTrayIcon); 0199 0200 void setAlwaysUseAbsolutePlaylistPaths(bool alwaysUseAbsolutePlaylistPaths); 0201 0202 void setEmbeddedView(ElisaUtils::PlayListEntryType embeddedView); 0203 0204 void setInitialViewIndex(int initialViewIndex); 0205 0206 void setInitialFilesViewPath(const QString &path); 0207 0208 void setPlayAtStartup(bool playAtStartup); 0209 0210 void setScanAtStartup(bool scanAtStartup); 0211 0212 void setColorScheme(const QString &scheme); 0213 0214 void setUseFavoriteStyleRatings(bool useFavoriteStyleRatings); 0215 0216 private Q_SLOTS: 0217 0218 void configChanged(); 0219 0220 private: 0221 0222 void setDirty(); 0223 0224 QStringList mRootPath; 0225 0226 QFileSystemWatcher mConfigFileWatcher; 0227 0228 bool mIsDirty = false; 0229 0230 bool mShowNowPlayingBackground = true; 0231 0232 bool mShowProgressInTaskBar = true; 0233 0234 bool mShowSystemTrayIcon = false; 0235 0236 bool mAlwaysUseAbsolutePlaylistPaths = false; 0237 0238 bool mPlayAtStartup = false; 0239 0240 bool mScanAtStartup = true; 0241 0242 bool mUseFavoriteStyleRatings = false; 0243 0244 QString mColorScheme; 0245 0246 ElisaUtils::PlayListEntryType mEmbeddedView = ElisaUtils::Unknown; 0247 0248 int mInitialViewIndex = 2; 0249 0250 QString mInitialFilesViewPath; 0251 }; 0252 0253 #endif