aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/squish/squishfilehandler.h
blob: 960374059b9e248380d06e75b036a22ff52c5439 (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
56
57
58
59
// Copyright (C) 2022 The Qt Company Ltd
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#pragma once

#include "squishtesttreemodel.h"

#include <utils/filepath.h>

#include <QMap>
#include <QObject>
#include <QString>

namespace Squish {
namespace Internal {

class SquishFileHandler : public QObject
{
    Q_OBJECT
public:
    explicit SquishFileHandler(QObject *parent = nullptr);
    ~SquishFileHandler() override = default;
    static SquishFileHandler *instance();
    void openTestSuites();
    void openTestSuite(const Utils::FilePath &suiteConfPath, bool isReopen = false);
    void closeTestSuite(const QString &suiteName);
    void closeAllTestSuites();
    void runTestCase(const QString &suiteName, const QString &testCaseName);
    void runTestSuite(const QString &suiteName);
    void recordTestCase(const QString &suiteName, const QString &testCaseName);
    void addSharedFolder();
    void setSharedFolders(const Utils::FilePaths &folders);
    bool removeSharedFolder(const Utils::FilePath &folder);
    void removeAllSharedFolders();
    void openObjectsMap(const QString &suiteName);

signals:
    void clearedSharedFolders();
    void testTreeItemCreated(SquishTestTreeItem *item);
    void suiteTreeItemRemoved(const QString &suiteName);
    void suiteTreeItemModified(SquishTestTreeItem *item, const QString &displayName);
    void suitesOpened();

private:
    void closeAllInternal();
    void onSessionLoaded();
    void updateSquishServerGlobalScripts();
    QStringList suitePathsAsStringList() const;

    void modifySuiteItem(const QString &suiteName,
                         const Utils::FilePath &suiteConf,
                         const QStringList &cases);

    QMap<QString, Utils::FilePath> m_suites;
    Utils::FilePaths m_sharedFolders;
};

} // namespace Internal
} // namespace Squish