File indexing completed on 2025-01-05 03:53:06
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2021-07-24 0007 * Description : MJPEG stream settings container. 0008 * 0009 * SPDX-FileCopyrightText: 2021-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * SPDX-FileCopyrightText: 2021 by Quoc Hưng Tran <quochungtran1999 at gmail dot com> 0011 * 0012 * SPDX-License-Identifier: GPL-2.0-or-later 0013 * 0014 * ============================================================ */ 0015 0016 #include "mjpegstreamsettings.h" 0017 0018 // Qt includes 0019 0020 #include <QFontDatabase> 0021 0022 // KDE includes 0023 0024 #include <kconfiggroup.h> 0025 0026 // Local includes 0027 0028 #include "vidslidesettings.h" 0029 0030 namespace DigikamGenericMjpegStreamPlugin 0031 { 0032 0033 MjpegStreamSettings::MjpegStreamSettings() 0034 : port (8080), 0035 loop (true), 0036 quality (75), 0037 delay (5), 0038 outSize (VidSlideSettings::BLUERAY), 0039 rate (10), 0040 transition (TransitionMngr::None), 0041 effect (EffectMngr::None), 0042 iface (nullptr) 0043 { 0044 } 0045 0046 MjpegStreamSettings::~MjpegStreamSettings() 0047 { 0048 } 0049 0050 void MjpegStreamSettings::setCollectionMap(const MjpegServerMap& map) 0051 { 0052 inputImages.clear(); 0053 0054 for (MjpegServerMap::const_iterator it = map.constBegin() ; it != map.constEnd() ; ++it) 0055 { 0056 inputImages.append(it.value()); 0057 } 0058 } 0059 0060 void MjpegStreamSettings::readSettings(KConfigGroup& group) 0061 { 0062 port = group.readEntry("MJPEGStreamPort", 8080); 0063 loop = group.readEntry("MJPEGStreamLoop", true); 0064 quality = group.readEntry("MJPEGStreamQuality", 75); 0065 delay = group.readEntry("MJPEGStreamDelay", 5); 0066 rate = group.readEntry("MJPEGStreamRate", 10); 0067 outSize = group.readEntry("MJPEGStreamOutSize", (int)VidSlideSettings::BLUERAY); 0068 effect = (EffectMngr::EffectType)group.readEntry("MJPEGStreamEffect", (int)EffectMngr::None); 0069 transition = (TransitionMngr::TransType)group.readEntry("MJPEGStreamTransition", (int)TransitionMngr::None); 0070 0071 osdSettings.readSettings(group); 0072 } 0073 0074 void MjpegStreamSettings::writeSettings(KConfigGroup& group) 0075 { 0076 group.writeEntry("MJPEGStreamPort", port); 0077 group.writeEntry("MJPEGStreamLoop", loop); 0078 group.writeEntry("MJPEGStreamQuality", quality); 0079 group.writeEntry("MJPEGStreamRate", rate); 0080 group.writeEntry("MJPEGStreamDelay", delay); 0081 group.writeEntry("MJPEGStreamOutSize", outSize); 0082 group.writeEntry("MJPEGStreamEffect", (int)effect); 0083 group.writeEntry("MJPEGStreamTransition", (int)transition); 0084 0085 osdSettings.writeSettings(group); 0086 } 0087 0088 } // namespace DigikamGenericMjpegStreamPlugin