File indexing completed on 2025-01-05 03:52:07

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2006-04-04
0007  * Description : a tool to generate jAlbum image galleries
0008  *
0009  * SPDX-FileCopyrightText: 2013-2019 by Andrew Goodbody <ajg zero two at elfringham dot co dot uk>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #include "jalbumsettings.h"
0016 
0017 // KDE includes
0018 
0019 #include <kconfiggroup.h>
0020 
0021 namespace DigikamGenericJAlbumPlugin
0022 {
0023 
0024 JAlbumSettings::JAlbumSettings(DInfoInterface* const iface)
0025 {
0026     m_iface     = iface;
0027     m_getOption = IMAGES;
0028 
0029     QString dfltAlbumPath;
0030 
0031 #ifdef Q_OS_WIN
0032     dfltAlbumPath = QLatin1String(qgetenv("HOMEDRIVE").constData());
0033     dfltAlbumPath.append(QLatin1String(qgetenv("HOMEPATH").constData()));
0034     dfltAlbumPath.append(QLatin1String("\\Documents\\My Albums"));
0035 #else
0036     dfltAlbumPath = QLatin1String(qgetenv("HOME").constData());
0037     dfltAlbumPath.append(QLatin1String("/Documents/My Albums"));
0038 #endif
0039 
0040     m_destPath = dfltAlbumPath;
0041 }
0042 
0043 JAlbumSettings::~JAlbumSettings()
0044 {
0045 }
0046 
0047 void JAlbumSettings::readSettings(KConfigGroup& group)
0048 {
0049     m_destPath            = group.readEntry("destPath",                 QString());
0050     m_jalbumPath          = group.readEntry("jalbumPath",               QString());
0051     m_javaPath            = group.readEntry("javaPath",                 QString());
0052     m_imageSelectionTitle = group.readEntry("imageSelectionTitle",     QString());
0053     m_getOption           = (ImageGetOption)group.readEntry("SelMode", (int)IMAGES);
0054 }
0055 
0056 void JAlbumSettings::writeSettings(KConfigGroup& group)
0057 {
0058     group.writeEntry("destPath",            m_destPath);
0059     group.writeEntry("jalbumPath",          m_jalbumPath);
0060     group.writeEntry("javaPath",            m_javaPath);
0061     group.writeEntry("imageSelectionTitle", m_imageSelectionTitle);
0062     group.writeEntry("SelMode",             (int)m_getOption);
0063 }
0064 
0065 QDebug operator<<(QDebug dbg, const JAlbumSettings& t)
0066 {
0067     dbg.nospace() << "JAlbumSettings::Items: "
0068                   << t.m_imageList << ", ";
0069     dbg.nospace() << "JAlbumSettings::DestPath: "
0070                   << t.m_destPath;
0071     dbg.nospace() << "JAlbumSettings::JalbumPath: "
0072                   << t.m_jalbumPath;
0073     dbg.nospace() << "JAlbumSettings::JavaPath: "
0074                   << t.m_javaPath;
0075     dbg.nospace() << "JAlbumSettings::ImageSelectionTitle: "
0076                   << t.m_imageSelectionTitle;
0077     return dbg.space();
0078 }
0079 
0080 } // namespace DigikamGenericJAlbumPlugin