/* * Copyright (C) 2022 by Claudio Cambra * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ #pragma once #include #include "gui/accountstate.h" #include "libsync/syncresult.h" class QLocalSocket; namespace OCC { namespace Mac { class FileProviderSocketController : public QObject { Q_OBJECT public: explicit FileProviderSocketController(QLocalSocket * const socket, QObject * const parent = nullptr); [[nodiscard]] AccountStatePtr accountState() const; [[nodiscard]] SyncResult::Status latestStatus() const; signals: void socketDestroyed(const QLocalSocket * const socket);signals: void syncStateChanged(const AccountPtr &account, SyncResult::Status state) const; public slots: void sendMessage(const QString &message) const; void start(); private slots: void slotOnDisconnected(); void slotSocketDestroyed(const QObject * const object); void slotReadyRead(); void slotAccountStateChanged(const OCC::AccountState::State state); void parseReceivedLine(const QString &receivedLine); void requestFileProviderDomainInfo() const; void sendAccountDetails() const; void sendNotAuthenticated() const; void reportSyncState(const QString &receivedState); private: QPointer _socket; AccountStatePtr _accountState; SyncResult::Status _latestStatus = SyncResult::Undefined; }; } // namespace Mac } // namespace OCC