digiKam
mjpegservermngr.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 : 2021-07-24
7  * Description : MJPEG server manager
8  *
9  * Copyright (C) 2021-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_MJPEG_SERVER_MNGR_H
25 #define DIGIKAM_MJPEG_SERVER_MNGR_H
26 
27 // Qt includes
28 
29 #include <QObject>
30 #include <QMap>
31 #include <QList>
32 #include <QString>
33 #include <QUrl>
34 
35 // Local includes
36 
37 #include "mjpegserver.h"
38 #include "mjpegstreamsettings.h"
39 
41 {
42 
43 class MjpegServerMngr : public QObject
44 {
45  Q_OBJECT
46 
47 public:
48 
52  void setItemsList(const QString& aname, const QList<QUrl>& urls);
53 
57  QList<QUrl> itemsList() const;
58 
62  void setCollectionMap(const MjpegServerMap&);
63 
68 
72  void setSettings(const MjpegStreamSettings& set);
73 
78 
82  bool startMjpegServer();
83 
87  void cleanUp();
88 
92  bool save();
93  bool load();
94 
98  bool loadAtStartup();
99  void saveAtShutdown();
100 
104  bool isRunning() const;
105 
109  int albumsShared() const;
110  int itemsShared() const;
111 
115  QString configGroupName() const;
116  QString configStartServerOnStartupEntry() const;
117 
121  void mjpegServerNotification(bool started);
122 
123 public:
124 
128  static MjpegServerMngr* instance();
129 
130 private:
131 
132  // Disable
133  MjpegServerMngr();
134  explicit MjpegServerMngr(QObject*) = delete;
135  ~MjpegServerMngr() override;
136 
137 private:
138 
140 
141  class Private;
142  Private* const d;
143 };
144 
145 } // namespace DigikamGenericMjpegStreamPlugin
146 
147 #endif // DIGIKAM_MJPEG_SERVER_MNGR_H
Definition: mjpegservermngr.h:44
MjpegStreamSettings settings() const
Definition: mjpegservermngr.cpp:230
friend class MjpegServerMngrCreator
Definition: mjpegservermngr.h:139
bool save()
Definition: mjpegservermngr.cpp:283
void setCollectionMap(const MjpegServerMap &)
Definition: mjpegservermngr.cpp:215
int itemsShared() const
Definition: mjpegservermngr.cpp:278
QString configGroupName() const
Definition: mjpegservermngr.cpp:119
void setItemsList(const QString &aname, const QList< QUrl > &urls)
Definition: mjpegservermngr.cpp:192
void setSettings(const MjpegStreamSettings &set)
Definition: mjpegservermngr.cpp:225
bool load()
Definition: mjpegservermngr.cpp:333
QString configStartServerOnStartupEntry() const
Definition: mjpegservermngr.cpp:124
void cleanUp()
Definition: mjpegservermngr.cpp:129
void saveAtShutdown()
Definition: mjpegservermngr.cpp:168
void mjpegServerNotification(bool started)
Definition: mjpegservermngr.cpp:184
int albumsShared() const
Definition: mjpegservermngr.cpp:268
bool loadAtStartup()
Definition: mjpegservermngr.cpp:146
bool isRunning() const
Definition: mjpegservermngr.cpp:263
QList< QUrl > itemsList() const
Definition: mjpegservermngr.cpp:198
MjpegServerMap collectionMap() const
Definition: mjpegservermngr.cpp:220
bool startMjpegServer()
Definition: mjpegservermngr.cpp:235
static MjpegServerMngr * instance()
Definition: mjpegservermngr.cpp:102
Definition: mjpegstreamsettings.h:49
Definition: mjpegframeosd.cpp:45
QMap< QString, QList< QUrl > > MjpegServerMap
A kind of map of albums with urls contents to share with MJPEG server.
Definition: mjpegserver.h:36