aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/advanceddockingsystem/workspace.h
blob: c23db55d6b63b6dff3d41400f27d7ee382e2d973 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-2.1-or-later OR GPL-3.0-or-later

#pragma once

#include "ads_globals.h"

#include <utils/fileutils.h>

namespace ADS {

class ADS_EXPORT Workspace
{
public:
    Workspace();
    Workspace(const Utils::FilePath &filePath, bool isPreset = false);

    void setName(const QString &name);
    const QString &name() const;

    const Utils::FilePath &filePath() const;

    QString fileName() const;
    QString baseName() const;
    QDateTime lastModified() const;
    bool exists() const;

    bool isValid() const;

    void setPreset(bool value);
    bool isPreset() const;

    friend bool operator==(const Workspace &a, const Workspace &b)
    {
        return a.fileName() == b.fileName();
    }

    friend bool operator==(const QString &fileName, const Workspace &workspace)
    {
        return fileName == workspace.fileName();
    }
    friend bool operator==(const Workspace &workspace, const QString &fileName)
    {
        return workspace.fileName() == fileName;
    }

    explicit operator QString() const;

private:
    QString m_name;
    Utils::FilePath m_filePath;
    bool m_preset = false;
};

} // namespace ADS