1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
/* ============================================================
 *
 * This file is a part of digiKam project
 * https://www.digikam.org
 *
 * Date        : 2017-06-27
 * Description : page visualizing photos user choosing to upload and
 *               user albums list to upload photos to. Creating new album
 *               is also available on this page.
 *
 * SPDX-FileCopyrightText: 2017-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
 * SPDX-FileCopyrightText: 2018      by Thanh Trung Dinh <dinhthanhtrung1996 at gmail dot com>
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 *
 * ============================================================ */

#ifndef DIGIKAM_WS_IMAGES_PAGE_H
#define DIGIKAM_WS_IMAGES_PAGE_H

// Qt includes

#include <QObject>
#include <QList>
#include <QUrl>
#include <QString>
#include <QStringList>
#include <QTreeWidget>
#include <QTreeWidgetItem>

// Local includes

#include "dwizardpage.h"
#include "wsitem.h"

using namespace Digikam;

namespace DigikamGenericUnifiedPlugin
{

class WSImagesPage : public DWizardPage
{
    Q_OBJECT

public:

    explicit WSImagesPage(QWizard* const dialog, const QString& title);
    ~WSImagesPage();

    void    initializePage();
    bool    validatePage();
    bool    isComplete() const;<--- Function in derived class

    void    setItemsList(const QList<QUrl>& urls);

private:

    /*
     * Get a structure from albums list and add it recursively to albums view
     */
    void addChildToTreeView(QTreeWidgetItem* const parent,
                            const QMap<QString, AlbumSimplified>& albumTree,
                            const QStringList& childrenAlbums);

    /*
     * Set id for album chosen to upload photos.
     *
     * This method should be called in validatePage(), so that talker can get it
     * from d->wizard later.
     */
    void setCurrentAlbumId(const QString& currentAlbumId);

Q_SIGNALS:

    /*
     * Signal to inform talker to list albums.
     */
    void signalListAlbumsRequest();

private Q_SLOTS:

    /*
     * Connected to signal signalListAlbumsDone of WSAuthentication to visualize albums list
     */
    void slotListAlbumsDone(const QMap<QString, AlbumSimplified>& albumTree,
                            const QStringList& rootAlbums,
                            const QString& currentAlbumId);

    /*
     * Connected to signalCreatAlbumDone of WSAuthentication to refresh album list and point
     * pre-selected album to new album
     */
    void slotCreateAlbumDone(int errCode, const QString& errMsg, const QString& newAlbumId);

private:

    class Private;
    Private* const d = nullptr;
};

} // namespace DigikamGenericUnifiedPlugin

#endif // DIGIKAM_WS_IMAGES_PAGE_H