digiKam
dmediaservermngr.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2012-05-28
7  * Description : Media server manager
8  *
9  * Copyright (C) 2012 by Smit Mehta <smit dot meh at gmail dot com>
10  * Copyright (C) 2012-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_DMEDIA_SERVER_MNGR_H
26 #define DIGIKAM_DMEDIA_SERVER_MNGR_H
27 
28 // Qt includes
29 
30 #include <QObject>
31 #include <QMap>
32 #include <QList>
33 #include <QString>
34 
35 // Local includes
36 
37 #include "dmediaserver.h"
38 
40 {
41 
42 class DMediaServerMngr : public QObject
43 {
44  Q_OBJECT
45 
46 public:
47 
49  void setItemsList(const QString& aname, const QList<QUrl>& urls);
50 
52  QList<QUrl> itemsList() const;
53 
55  void setCollectionMap(const MediaServerMap&);
56 
59 
61  bool startMediaServer();
62 
64  void cleanUp();
65 
67  bool save();
68  bool load();
69 
71  bool loadAtStartup();
72  void saveAtShutdown();
73 
75  bool isRunning() const;
76 
78  int albumsShared() const;
79  int itemsShared() const;
80 
82 
83  QString configGroupName() const;
84  QString configStartServerOnStartupEntry() const;
85 
87  void mediaServerNotification(bool started);
88 
89 public:
90 
92  static DMediaServerMngr* instance();
93 
94 private:
95 
96  // Disable
98  explicit DMediaServerMngr(QObject*) = delete;
99  ~DMediaServerMngr() override;
100 
101 private:
102 
104 
105  class Private;
106  Private* const d;
107 };
108 
109 } // namespace DigikamGenericMediaServerPlugin
110 
111 #endif // DIGIKAM_DMEDIA_SERVER_MNGR_H
Definition: dmediaservermngr.h:43
bool loadAtStartup()
Wrapper to check if server configuration must be saved and restored between application sessions.
Definition: dmediaservermngr.cpp:129
bool startMediaServer()
Start the DLNA server and share the contents. Return true is all is on-line.
Definition: dmediaservermngr.cpp:208
bool load()
Definition: dmediaservermngr.cpp:303
void cleanUp()
Stop the DLNA server and clean-up.
Definition: dmediaservermngr.cpp:123
bool save()
Low level methods to save and load from xml data file.
Definition: dmediaservermngr.cpp:254
static DMediaServerMngr * instance()
This manager is a singleton. Use this method to control the DLNA server instance.
Definition: dmediaservermngr.cpp:96
int albumsShared() const
Return some stats about total albums and total items shared on the network.
Definition: dmediaservermngr.cpp:239
void setItemsList(const QString &aname, const QList< QUrl > &urls)
Setup the list of items to share with the DLNA server into a single album.
Definition: dmediaservermngr.cpp:175
void mediaServerNotification(bool started)
Send a notification message if MediaServer have been started or not.
Definition: dmediaservermngr.cpp:167
friend class DMediaServerMngrCreator
Definition: dmediaservermngr.h:103
QString configStartServerOnStartupEntry() const
Definition: dmediaservermngr.cpp:118
bool isRunning() const
Return true if server is running in background.
Definition: dmediaservermngr.cpp:234
QString configGroupName() const
Config properties methods.
Definition: dmediaservermngr.cpp:113
int itemsShared() const
Definition: dmediaservermngr.cpp:249
void setCollectionMap(const MediaServerMap &)
Setup the list of albums to share with DLNA server.
Definition: dmediaservermngr.cpp:198
QList< QUrl > itemsList() const
Return a flat list of items shared.
Definition: dmediaservermngr.cpp:181
MediaServerMap collectionMap() const
Return the current album map shared.
Definition: dmediaservermngr.cpp:203
void saveAtShutdown()
Definition: dmediaservermngr.cpp:151
Definition: dmediaserverdlg.cpp:54
QMap< QString, QList< QUrl > > MediaServerMap
A kind of map of albums with urls contents to share with DLNA media server.
Definition: dmediaserver.h:38