File indexing completed on 2025-01-19 03:55:43
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2009-12-23 0007 * Description : a widget to manage preview. 0008 * 0009 * SPDX-FileCopyrightText: 2009-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * SPDX-FileCopyrightText: 2012 by Benjamin Girault <benjamin dot girault at gmail dot com> 0011 * 0012 * SPDX-License-Identifier: GPL-2.0-or-later 0013 * 0014 * ============================================================ */ 0015 0016 #ifndef DIGIKAM_DPREVIEW_MANAGER_H 0017 #define DIGIKAM_DPREVIEW_MANAGER_H 0018 0019 // Qt includes 0020 0021 #include <QStackedWidget> 0022 #include <QString> 0023 #include <QColor> 0024 #include <QImage> 0025 #include <QUrl> 0026 0027 // Local includes 0028 0029 #include "digikam_export.h" 0030 0031 namespace Digikam 0032 { 0033 0034 class DIGIKAM_EXPORT DPreviewManager : public QStackedWidget 0035 { 0036 Q_OBJECT 0037 0038 public: 0039 0040 enum DisplayMode 0041 { 0042 MessageMode = 0, 0043 PreviewMode 0044 }; 0045 0046 public: 0047 0048 explicit DPreviewManager(QWidget* const parent); 0049 ~DPreviewManager() override; 0050 0051 bool load(const QUrl& file, bool fit = true); 0052 void setImage(const QImage& img, bool fit = true); 0053 void setText(const QString& text, const QColor& color = Qt::white); 0054 void setBusy(bool b, const QString& text = QString()); 0055 void setThumbnail(const QPixmap& preview = QPixmap()); 0056 void setButtonText(const QString& text); 0057 void setButtonVisible(bool b); 0058 void setSelectionAreaPossible(bool b); 0059 0060 ///@{ 0061 /** 0062 * Manage a selection area and show it 0063 * 0064 * @param rectangle This rectangle should have height and width of 1.0 0065 */ 0066 void setSelectionArea(const QRectF& rectangle); 0067 QRectF getSelectionArea() const; 0068 ///@} 0069 0070 Q_SIGNALS: 0071 0072 void signalButtonClicked(); 0073 0074 public Q_SLOTS: 0075 0076 void slotLoad(const QUrl& url); 0077 0078 private Q_SLOTS: 0079 0080 void slotProgressTimerDone(); 0081 0082 private: 0083 0084 class Private; 0085 Private* const d; 0086 }; 0087 0088 } // namespace Digikam 0089 0090 #endif // DIGIKAM_DPREVIEW_MANAGER_H