123abd45aSNicolas Bonnefon /* 2557fb9d8SNicolas Bonnefon * Copyright (C) 2014 Nicolas Bonnefon and other contributors 323abd45aSNicolas Bonnefon * 423abd45aSNicolas Bonnefon * This file is part of glogg. 523abd45aSNicolas Bonnefon * 623abd45aSNicolas Bonnefon * glogg is free software: you can redistribute it and/or modify 723abd45aSNicolas Bonnefon * it under the terms of the GNU General Public License as published by 823abd45aSNicolas Bonnefon * the Free Software Foundation, either version 3 of the License, or 923abd45aSNicolas Bonnefon * (at your option) any later version. 1023abd45aSNicolas Bonnefon * 1123abd45aSNicolas Bonnefon * glogg is distributed in the hope that it will be useful, 1223abd45aSNicolas Bonnefon * but WITHOUT ANY WARRANTY; without even the implied warranty of 1323abd45aSNicolas Bonnefon * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1423abd45aSNicolas Bonnefon * GNU General Public License for more details. 1523abd45aSNicolas Bonnefon * 1623abd45aSNicolas Bonnefon * You should have received a copy of the GNU General Public License 1723abd45aSNicolas Bonnefon * along with glogg. If not, see <http://www.gnu.org/licenses/>. 1823abd45aSNicolas Bonnefon */ 1923abd45aSNicolas Bonnefon 2023abd45aSNicolas Bonnefon #ifndef EXTERNALCOM_H 2123abd45aSNicolas Bonnefon #define EXTERNALCOM_H 2223abd45aSNicolas Bonnefon 23557fb9d8SNicolas Bonnefon #include <QObject> 24557fb9d8SNicolas Bonnefon 25557fb9d8SNicolas Bonnefon class CantCreateExternalErr {}; 26557fb9d8SNicolas Bonnefon 27e07da50aSNicolas Bonnefon /* 28e07da50aSNicolas Bonnefon * Virtual class representing another instance of glogg. 29e07da50aSNicolas Bonnefon * Sending messages to an object of this class will forward 30e07da50aSNicolas Bonnefon * them to the instance using the underlying IPC. 31e07da50aSNicolas Bonnefon */ 32557fb9d8SNicolas Bonnefon class ExternalInstance 33557fb9d8SNicolas Bonnefon { 34557fb9d8SNicolas Bonnefon public: ExternalInstance()35557fb9d8SNicolas Bonnefon ExternalInstance() {} ~ExternalInstance()36557fb9d8SNicolas Bonnefon virtual ~ExternalInstance() {} 37557fb9d8SNicolas Bonnefon 38*09aff35dSNicolas Bonnefon virtual void loadFile( const QString& file_name ) const = 0; 39e07da50aSNicolas Bonnefon virtual uint32_t getVersion() const = 0; 4023abd45aSNicolas Bonnefon }; 4123abd45aSNicolas Bonnefon 42e07da50aSNicolas Bonnefon /* 43e07da50aSNicolas Bonnefon * Class receiving messages from another instance of glogg. 44e07da50aSNicolas Bonnefon * Messages are forwarded to the application by signals. 45e07da50aSNicolas Bonnefon */ 46557fb9d8SNicolas Bonnefon class ExternalCommunicator : public QObject 47557fb9d8SNicolas Bonnefon { 48557fb9d8SNicolas Bonnefon Q_OBJECT 49557fb9d8SNicolas Bonnefon 5023abd45aSNicolas Bonnefon public: ExternalCommunicator()51557fb9d8SNicolas Bonnefon ExternalCommunicator() : QObject() {} 5223abd45aSNicolas Bonnefon 53557fb9d8SNicolas Bonnefon virtual ExternalInstance* otherInstance() const = 0; 5423abd45aSNicolas Bonnefon 55e07da50aSNicolas Bonnefon /* Instruct the communicator to start listening for 56e07da50aSNicolas Bonnefon * remote initiated operations */ 57e07da50aSNicolas Bonnefon virtual void startListening() = 0; 58e07da50aSNicolas Bonnefon 59557fb9d8SNicolas Bonnefon signals: 60*09aff35dSNicolas Bonnefon void loadFile( const QString& file_name ); 61e07da50aSNicolas Bonnefon 62e07da50aSNicolas Bonnefon public slots: 63e07da50aSNicolas Bonnefon virtual qint32 version() const = 0; 6423abd45aSNicolas Bonnefon }; 6523abd45aSNicolas Bonnefon 6623abd45aSNicolas Bonnefon #endif 67