File indexing completed on 2025-01-05 03:53:17

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2019-04-02
0007  * Description : plugin to export image as wallpaper
0008  *
0009  * SPDX-FileCopyrightText: 2019      by Igor Antropov <antropovi at yahoo dot com>
0010  * SPDX-FileCopyrightText: 2019-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_WALLPAPER_PLUGIN_H
0017 #define DIGIKAM_WALLPAPER_PLUGIN_H
0018 
0019 // Qt includes
0020 
0021 #include <QString>
0022 #include <QIcon>
0023 #include <QList>
0024 
0025 // Local includes
0026 
0027 #include "dplugingeneric.h"
0028 
0029 #define DPLUGIN_IID "org.kde.digikam.plugin.generic.Wallpaper"
0030 
0031 using namespace Digikam;
0032 
0033 namespace DigikamGenericWallpaperPlugin
0034 {
0035 
0036 class WallpaperPlugin : public DPluginGeneric
0037 {
0038     Q_OBJECT
0039     Q_PLUGIN_METADATA(IID DPLUGIN_IID)
0040     Q_INTERFACES(Digikam::DPluginGeneric)
0041 
0042 public:
0043 
0044     /**
0045      * Default values for Plasma Wallpaper plugin.
0046      */
0047     enum WallpaperLayout
0048     {
0049         Adjusted            = 0,
0050         AdjustedAspectRatio = 1,
0051         AdjustedCropped     = 2,
0052         Mosaic              = 3,
0053         Centered            = 6
0054     };
0055 
0056 public:
0057 
0058     explicit WallpaperPlugin(QObject* const parent = nullptr);
0059     ~WallpaperPlugin()                   override;
0060 
0061     QString name()                 const override;
0062     QString iid()                  const override;
0063     QIcon   icon()                 const override;
0064     QString details()              const override;
0065     QString description()          const override;
0066     QList<DPluginAuthor> authors() const override;
0067     QString handbookSection()      const override;
0068     QString handbookChapter()      const override;
0069 
0070     void setup(QObject* const)           override;
0071 
0072 private Q_SLOTS:
0073 
0074     void slotWallpaper();
0075 
0076 private:
0077 
0078     bool setWallpaper(const QString& path, int layout = AdjustedCropped) const;
0079 };
0080 
0081 } // namespace DigikamGenericWallpaperPlugin
0082 
0083 #endif // DIGIKAM_WALLPAPER_PLUGIN_H