xref: /glogg/src/dbusexternalcom.h (revision 557fb9d8925f3772c017d921d356ab742ec51021)
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 
36   private:
37     std::shared_ptr<QDBusInterface> dbusInterface_;
38 };
39 
40 // An implementation of ExternalCommunicator using D-Bus via Qt
41 class DBusExternalCommunicator : public ExternalCommunicator
42 {
43   public:
44     // Constructor: initialise the D-Bus connection,
45     // can throw if D-Bus is not available
46     DBusExternalCommunicator();
47     ~DBusExternalCommunicator() {}
48 
49     virtual ExternalInstance* otherInstance() const;
50 
51   signals:
52     void loadFile( const std::string& file_name );
53 
54   public slots:
55     QString version() const;
56 
57   private:
58 };
59 
60 #endif
61