Debian Codegraph @

core/dplugins/generic/tools/jalbum/generator/jalbumsettings.cpp

raw
1 /* ============================================================
2 *
3 * This file is a part of digiKam project
4 * https://www.digikam.org
5 *
6 * Date : 2006-04-04
7 * Description : a tool to generate jAlbum image galleries
8 *
9 * SPDX-FileCopyrightText: 2013-2019 by Andrew Goodbody <ajg zero two at elfringham dot co dot uk>
10 *
11 * SPDX-License-Identifier: GPL-2.0-or-later
12 *
13 * ============================================================ */
14
15 #include "jalbumsettings.h"
16
17 // KDE includes
18
19 #include <kconfiggroup.h>
20
21 namespace DigikamGenericJAlbumPlugin
22 {
23
24 JAlbumSettings::JAlbumSettings(DInfoInterface* const iface)
25 {
26 m_iface = iface;
27
28 QString dfltAlbumPath;
29
30 #ifdef Q_OS_WIN
31
32 dfltAlbumPath = QLatin1String(qgetenv("HOMEDRIVE").constData());
33 dfltAlbumPath.append(QLatin1String(qgetenv("HOMEPATH").constData()));
34 dfltAlbumPath.append(QLatin1String("\\Documents\\My Albums"));
35
36 #else
37
38 dfltAlbumPath = QLatin1String(qgetenv("HOME").constData());
39 dfltAlbumPath.append(QLatin1String("/Documents/My Albums"));
40
41 #endif
42
43 m_destPath = dfltAlbumPath;
44 }
45
46 void JAlbumSettings::readSettings(const KConfigGroup& group)
47 {
48 m_destPath = group.readEntry("destPath", QString());
49 m_jalbumPath = group.readEntry("jalbumPath", QString());
50 m_javaPath = group.readEntry("javaPath", QString());
51 m_imageSelectionTitle = group.readEntry("imageSelectionTitle", QString());
52 m_getOption = (ImageGetOption)group.readEntry("SelMode", (int)IMAGES);
53 }
54
55 void JAlbumSettings::writeSettings(KConfigGroup& group)
56 {
57 group.writeEntry("destPath", m_destPath);
58 group.writeEntry("jalbumPath", m_jalbumPath);
59 group.writeEntry("javaPath", m_javaPath);
60 group.writeEntry("imageSelectionTitle", m_imageSelectionTitle);
61 group.writeEntry("SelMode", (int)m_getOption);
62 }
63
64 QDebug operator<<(QDebug dbg, const JAlbumSettings& t)
65 {
66 dbg.nospace() << "JAlbumSettings::Items: "
67 << t.m_imageList << ", ";
68 dbg.nospace() << "JAlbumSettings::DestPath: "
69 << t.m_destPath;
70 dbg.nospace() << "JAlbumSettings::JalbumPath: "
71 << t.m_jalbumPath;
72 dbg.nospace() << "JAlbumSettings::JavaPath: "
73 << t.m_javaPath;
74 dbg.nospace() << "JAlbumSettings::ImageSelectionTitle: "
75 << t.m_imageSelectionTitle;
76 return dbg.space();
77 }
78
79 } // namespace DigikamGenericJAlbumPlugin