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

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2017-06-27
0007  * Description : page visualizing photos user choosing to upload and
0008  *               user albums list to upload photos to. Creating new album
0009  *               is also available on this page.
0010  *
0011  * SPDX-FileCopyrightText: 2017-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0012  * SPDX-FileCopyrightText: 2018      by Thanh Trung Dinh <dinhthanhtrung1996 at gmail dot com>
0013  *
0014  * SPDX-License-Identifier: GPL-2.0-or-later
0015  *
0016  * ============================================================ */
0017 
0018 #ifndef DIGIKAM_WS_IMAGES_PAGE_H
0019 #define DIGIKAM_WS_IMAGES_PAGE_H
0020 
0021 // Qt includes
0022 
0023 #include <QObject>
0024 #include <QList>
0025 #include <QUrl>
0026 #include <QString>
0027 #include <QStringList>
0028 #include <QTreeWidget>
0029 #include <QTreeWidgetItem>
0030 
0031 // Local includes
0032 
0033 #include "dwizardpage.h"
0034 #include "wsitem.h"
0035 
0036 using namespace Digikam;
0037 
0038 namespace DigikamGenericUnifiedPlugin
0039 {
0040 
0041 class WSImagesPage : public DWizardPage
0042 {
0043     Q_OBJECT
0044 
0045 public:
0046 
0047     explicit WSImagesPage(QWizard* const dialog, const QString& title);
0048     ~WSImagesPage();
0049 
0050     void    initializePage();
0051     bool    validatePage();
0052     bool    isComplete() const;
0053 
0054     void    setItemsList(const QList<QUrl>& urls);
0055 
0056 private:
0057 
0058     /*
0059      * Get a structure from albums list and add it recursively to albums view
0060      */
0061     void addChildToTreeView(QTreeWidgetItem* const parent,
0062                             const QMap<QString, AlbumSimplified>& albumTree,
0063                             const QStringList& childrenAlbums);
0064 
0065     /*
0066      * Set id for album chosen to upload photos.
0067      *
0068      * This method should be called in validatePage(), so that talker can get it
0069      * from d->wizard later.
0070      */
0071     void setCurrentAlbumId(const QString& currentAlbumId);
0072 
0073 Q_SIGNALS:
0074 
0075     /*
0076      * Signal to inform talker to list albums.
0077      */
0078     void signalListAlbumsRequest();
0079 
0080 private Q_SLOTS:
0081 
0082     /*
0083      * Connected to signal signalListAlbumsDone of WSAuthentication to visualize albums list
0084      */
0085     void slotListAlbumsDone(const QMap<QString, AlbumSimplified>& albumTree,
0086                             const QStringList& rootAlbums,
0087                             const QString& currentAlbumId);
0088 
0089     /*
0090      * Connected to signalCreatAlbumDone of WSAuthentication to refresh album list and point
0091      * pre-selected album to new album
0092      */
0093     void slotCreateAlbumDone(int errCode, const QString& errMsg, const QString& newAlbumId);
0094 
0095 private:
0096 
0097     class Private;
0098     Private* const d;
0099 };
0100 
0101 } // namespace DigikamGenericUnifiedPlugin
0102 
0103 #endif // DIGIKAM_WS_IMAGES_PAGE_H