File: setupdetection.h

package info (click to toggle)
syncthingtray 1.7.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,804 kB
  • sloc: cpp: 31,085; xml: 1,694; java: 570; sh: 81; javascript: 53; makefile: 25
file content (78 lines) | stat: -rw-r--r-- 2,188 bytes parent folder | download
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#ifndef SETTINGS_SETUP_DETECTION_H
#define SETTINGS_SETUP_DETECTION_H

#include "./settings.h"

#include "../misc/syncthinglauncher.h"

#include <syncthingconnector/syncthingconfig.h>
#include <syncthingconnector/syncthingconnection.h>
#include <syncthingconnector/syncthingconnectionsettings.h>
#include <syncthingconnector/syncthingprocess.h>
#include <syncthingconnector/syncthingservice.h>

#include <QByteArray>
#include <QStringBuilder>
#include <QTimer>

#include <optional>

namespace QtGui {

class SYNCTHINGWIDGETS_EXPORT SetupDetection : public QObject {
    Q_OBJECT

public:
    explicit SetupDetection(QObject *parent = nullptr);
    bool hasConfig() const;
    bool isDone() const;

public Q_SLOTS:
    void determinePaths();
    void restoreConfig();
    void initConnection();
    void reset();
    void startTest();

Q_SIGNALS:
    void done();

private Q_SLOTS:
    void handleConnectionError(const QString &error);
    void handleLauncherExit(int exitCode, QProcess::ExitStatus exitStatus);
    void handleLauncherError(QProcess::ProcessError error);
    void handleLauncherOutput(const QByteArray &output);
    void handleTimeout();
    void checkDone();

public:
    QString configFilePath;
    QString certPath;
    QStringList connectionErrors;
    Data::SyncthingConfig config;
    Data::SyncthingConnection connection;
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
    Data::SyncthingService userService = Data::SyncthingService(Data::SystemdScope::User);
    Data::SyncthingService systemService = Data::SyncthingService(Data::SystemdScope::System);
#endif
    Settings::Launcher launcherSettings;
    QString defaultSyncthingArgs;
    Data::SyncthingLauncher launcher;
    std::optional<int> launcherExitCode;
    std::optional<QProcess::ExitStatus> launcherExitStatus;
    std::optional<QProcess::ProcessError> launcherError;
    QByteArray launcherOutput;
    QTimer timeout;
    bool timedOut = false;
    bool configOk = false;
    bool autostartEnabled = false;
    std::optional<QString> autostartConfiguredPath;
    QString autostartSupposedPath;

private:
    bool m_testStarted = false;
};

} // namespace QtGui

#endif // SETTINGS_SETUP_DETECTION_H