File indexing completed on 2024-04-14 05:41:24

0001 /***********************************************************************
0002  * SPDX-FileCopyrightText: 2003-2004 Max Howell <max.howell@methylblue.com>
0003  * SPDX-FileCopyrightText: 2008-2009 Martin Sandsmark <martin.sandsmark@kde.org>
0004  * SPDX-FileCopyrightText: 2022 Harald Sitter <sitter@kde.org>
0005  *
0006  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0007  ***********************************************************************/
0008 
0009 #pragma once
0010 
0011 #include <QObject>
0012 #include <QSet>
0013 #include <QStringList>
0014 
0015 namespace Filelight
0016 {
0017 Q_NAMESPACE
0018 enum class Dirty {
0019     Layout = 1,
0020     Colors = 3,
0021 };
0022 Q_ENUM_NS(Dirty)
0023 
0024 enum MapScheme { Rainbow, KDE, HighContrast };
0025 Q_ENUM_NS(MapScheme)
0026 } // namespace Filelight
0027 
0028 Q_DECLARE_METATYPE(Filelight::Dirty)
0029 
0030 class Config : public QObject
0031 {
0032     Q_OBJECT
0033     Q_PROPERTY(bool scanAcrossMounts MEMBER scanAcrossMounts NOTIFY changed)
0034     Q_PROPERTY(bool scanRemoteMounts MEMBER scanRemoteMounts NOTIFY changed)
0035     Q_PROPERTY(bool showSmallFiles MEMBER showSmallFiles NOTIFY changed)
0036     Q_PROPERTY(uint contrast MEMBER contrast NOTIFY changed)
0037     Q_PROPERTY(uint defaultRingDepth MEMBER defaultRingDepth NOTIFY changed)
0038     Q_PROPERTY(Filelight::MapScheme scheme MEMBER scheme NOTIFY changed)
0039     Q_PROPERTY(QStringList skipList MEMBER skipList NOTIFY changed)
0040 public:
0041     static Config *instance();
0042     void read();
0043     Q_INVOKABLE void write() const;
0044     Q_SIGNAL void changed();
0045 
0046     Q_INVOKABLE void addFolder();
0047     Q_INVOKABLE void removeFolder(const QString &url);
0048 
0049     // keep everything positive, avoid using DON'T, NOT or NO
0050 
0051     bool scanAcrossMounts;
0052     bool scanRemoteMounts;
0053     bool showSmallFiles;
0054     uint contrast;
0055     uint defaultRingDepth = 4;
0056 
0057     Filelight::MapScheme scheme;
0058     QStringList skipList;
0059 
0060     const QSet<QByteArray> remoteFsTypes = {"smbfs", "nfs", "afs"};
0061 };