File indexing completed on 2024-06-23 05:49:21

0001 /*
0002     This file is part of the Kasten Framework, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2007-2008 Friedrich W. H. Kossebau <kossebau@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007 */
0008 
0009 #ifndef KASTEN_ABSTRACTMODELSYNCHRONIZERFACTORY_HPP
0010 #define KASTEN_ABSTRACTMODELSYNCHRONIZERFACTORY_HPP
0011 
0012 // lib
0013 #include "abstractmodelsynchronizer.hpp"
0014 // Qt
0015 #include <QObject>
0016 
0017 namespace Kasten {
0018 
0019 // not really a classic factory, functions do some more, instead it is what?
0020 // TODO: improve the whole vodoo, especially linking document and synchronizer
0021 // make it foolproof
0022 // make a simple tutorial with an example program
0023 // TODO: should the load/connect/export jobs be created here or from the synchronizer?
0024 // putting jobs to synchronizer keeps factory simple, but forces synchronizer to be
0025 // in invalid states, like with simple constructor
0026 class KASTENCORE_EXPORT AbstractModelSynchronizerFactory : public QObject
0027 {
0028     Q_OBJECT
0029 
0030 public:
0031     ~AbstractModelSynchronizerFactory() override;
0032 
0033 public: // API to be implemented
0034     virtual AbstractModelSynchronizer* createSynchronizer() const = 0;
0035 
0036 //     virtual AbstractDocument* loadNewDocument( const QUrl& originUrl ) const = 0;
0037 //     virtual AbstractLoadJob* startLoad( const QUrl& url ) = 0;
0038     // TODO: better name than connect: bind?
0039 
0040 //     virtual bool connectDocument( AbstractDocument* document, const QUrl& originUrl,
0041 //                                   AbstractDocumentSynchronizer::ConnectOption option ) const = 0;
0042 //     virtual AbstractConnectJob* startConnect( AbstractDocument* document,
0043 //                                               const QUrl& url, AbstractDocumentSynchronizer::ConnectOption option ) = 0;
0044 
0045 //     virtual bool exportDocument( AbstractDocument* document, const QUrl& originUrl ) const = 0;
0046 //     virtual AbstractExportJob* startExport( AbstractDocument* document, const QUrl& originUrl ) const = 0;
0047 
0048     /** returns the id of the work model type */
0049     // TODO: is QByteArray enough?
0050     virtual QString supportedWorkType() const = 0;
0051     /** returns the id of the remote model type */
0052     virtual QString supportedRemoteType() const = 0;
0053 };
0054 
0055 }
0056 
0057 #endif