1 /* 2 * Copyright (C) 2014 Nicolas Bonnefon and other contributors 3 * 4 * This file is part of glogg. 5 * 6 * glogg is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * glogg is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with glogg. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef DBUSEXTERNALCOM_H 21 #define DBUSEXTERNALCOM_H 22 23 #include "externalcom.h" 24 25 #include <memory> 26 #include <QtDBus/QtDBus> 27 28 // An implementation of ExternalInstance using D-Bus via Qt 29 class DBusExternalInstance : public ExternalInstance { 30 public: 31 DBusExternalInstance(); 32 ~DBusExternalInstance() {} 33 34 virtual void loadFile( const std::string& file_name ) const; 35 virtual uint32_t getVersion() const; 36 37 private: 38 std::shared_ptr<QDBusInterface> dbusInterface_; 39 }; 40 41 // An implementation of ExternalCommunicator using D-Bus via Qt 42 class DBusExternalCommunicator : public ExternalCommunicator 43 { 44 public: 45 // Constructor: initialise the D-Bus connection, 46 // can throw if D-Bus is not available 47 DBusExternalCommunicator(); 48 ~DBusExternalCommunicator() {} 49 50 virtual void startListening(); 51 52 virtual ExternalInstance* otherInstance() const; 53 54 signals: 55 void loadFile( const std::string& file_name ); 56 57 public slots: 58 virtual qint32 version() const; 59 60 private: 61 }; 62 63 #endif 64