File indexing completed on 2025-01-19 03:50:44

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2009-12-05
0007  * Description : base class for sidebar widgets
0008  *
0009  * SPDX-FileCopyrightText: 2009      by Johannes Wienke <languitar at semipol dot de>
0010  * SPDX-FileCopyrightText: 2010-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_SIDE_BAR_WIDGET_H
0017 #define DIGIKAM_SIDE_BAR_WIDGET_H
0018 
0019 // QT includes
0020 
0021 #include <QPixmap>
0022 #include <QWidget>
0023 
0024 // Local includes
0025 
0026 #include "album.h"
0027 #include "iteminfo.h"
0028 #include "statesavingobject.h"
0029 
0030 namespace Digikam
0031 {
0032 
0033 /**
0034  * Abstract base class for widgets that are use in one of digikams's sidebars.
0035  */
0036 class SidebarWidget : public QWidget, public StateSavingObject
0037 {
0038     Q_OBJECT
0039 
0040 public:
0041 
0042     /**
0043      * Constructor.
0044      *
0045      * @param parent the parent of this widget, may be null
0046      */
0047     explicit SidebarWidget(QWidget* const parent);
0048 
0049     /**
0050      * Destructor.
0051      */
0052     ~SidebarWidget() override;
0053 
0054     /**
0055      * This method is called if the visible sidebar widget is changed.
0056      *
0057      * @param active if true, this widget is the new active widget, if false another
0058      *        widget is active
0059      */
0060     virtual void setActive(bool active)                             = 0;
0061 
0062     /**
0063      * This method is invoked when the application settings should be (re-)
0064      * applied to this widget.
0065      */
0066     virtual void applySettings()                                    = 0;
0067 
0068     /**
0069      * This is called on this widget when the history requires to move back to
0070      * the specified album
0071      */
0072     virtual void changeAlbumFromHistory(const QList<Album*>& album) = 0;
0073 
0074     /**
0075      * Must be implemented and return the icon that shall be visible for this
0076      * sidebar widget.
0077      *
0078      * @return pixmap icon
0079      */
0080     virtual const QIcon getIcon()                                   = 0;
0081 
0082     /**
0083      * Must be implemented to return the title of this sidebar's tab.
0084      *
0085      * @return localized title string
0086      */
0087     virtual const QString getCaption()                              = 0;
0088 
0089 Q_SIGNALS:
0090 
0091     /**
0092      * This signal can be emitted if this sidebar widget wants to be the one
0093      * that is active.
0094      */
0095     void requestActiveTab(SidebarWidget*);
0096 
0097     /**
0098      * To dispatch error message to temporized pop-up notification widget hosted with icon-view.
0099      */
0100     void signalNotificationError(const QString& message, int type);
0101 };
0102 
0103 } // namespace Digikam
0104 
0105 #endif // DIGIKAM_SIDE_BAR_WIDGET_H