File indexing completed on 2025-01-05 03:52:00
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2003-11-03 0007 * Description : Calendar month image selection widget. 0008 * 0009 * SPDX-FileCopyrightText: 2003-2005 by Renchi Raju <renchi dot raju at gmail dot com> 0010 * SPDX-FileCopyrightText: 2006 by Tom Albers <tomalbers at kde dot nl> 0011 * SPDX-FileCopyrightText: 2007-2008 by Orgad Shaneh <orgads at gmail dot com> 0012 * SPDX-FileCopyrightText: 2012 by Angelo Naselli <anaselli at linux dot it> 0013 * SPDX-FileCopyrightText: 2012-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0014 * 0015 * SPDX-License-Identifier: GPL-2.0-or-later 0016 * 0017 * ============================================================ */ 0018 0019 #ifndef DIGIKAM_CAL_MONTH_WIDGET_H 0020 #define DIGIKAM_CAL_MONTH_WIDGET_H 0021 0022 // Qt includes 0023 0024 #include <QPixmap> 0025 #include <QPushButton> 0026 #include <QUrl> 0027 0028 // Local includes 0029 0030 #include "loadingdescription.h" 0031 #include "thumbnailloadthread.h" 0032 0033 class QDragEnterEvent; 0034 class QDropEvent; 0035 class QMouseEvent; 0036 class QPaintEvent; 0037 0038 using namespace Digikam; 0039 0040 namespace DigikamGenericCalendarPlugin 0041 { 0042 0043 class CalMonthWidget : public QPushButton 0044 { 0045 Q_OBJECT 0046 0047 public: 0048 0049 explicit CalMonthWidget(QWidget* const parent, int month); 0050 ~CalMonthWidget() override; 0051 0052 QUrl imagePath() const; 0053 void setImage(const QUrl& url); 0054 int month(); 0055 0056 Q_SIGNALS: 0057 0058 void monthSelected(int); 0059 0060 protected: 0061 0062 void dragEnterEvent(QDragEnterEvent* e) override; 0063 void dropEvent(QDropEvent* e) override; 0064 void paintEvent(QPaintEvent* e) override; 0065 void mouseReleaseEvent(QMouseEvent* e) override; 0066 0067 private Q_SLOTS: 0068 0069 void slotThumbnail(const LoadingDescription&, const QPixmap&); 0070 void slotMonthSelected(); 0071 0072 private: 0073 0074 QPixmap thumb() const; 0075 void setThumb(const QPixmap& pic); 0076 0077 Q_PROPERTY(QPixmap thumb READ thumb WRITE setThumb) 0078 0079 private: 0080 0081 class Private; 0082 Private* const d; 0083 }; 0084 0085 } // Namespace Digikam 0086 0087 #endif // DIGIKAM_CAL_MONTH_WIDGET_H