digiKam
ddatepickerpopup.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2004-04-21
7  * Description : a menu widget to pick a date.
8  *
9  * Copyright (C) 2004 by Bram Schoenmakers <bramschoenmakers at kde dot nl>
10  * Copyright (C) 2006 by Mikolaj Machowski <mikmach at wp dot pl>
11  * Copyright (C) 2011-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General
15  * Public License as published by the Free Software Foundation;
16  * either version 2, or (at your option)
17  * any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * ============================================================ */
25 
26 #ifndef DIGIKAM_DDATE_PICKER_POP_UP_H
27 #define DIGIKAM_DDATE_PICKER_POP_UP_H
28 
29 // Qt includes
30 
31 #include <QDateTime>
32 #include <QMenu>
33 
34 // Local includes
35 
36 #include "ddatepicker.h"
37 
38 namespace Digikam
39 {
40 
54 class DDatePickerPopup : public QMenu
55 {
56  Q_OBJECT
57 
58 public:
59 
60  enum ItemFlag
61  {
62  NoDate = 1,
64  Words = 4
65  };
66 
67  Q_DECLARE_FLAGS(Items, ItemFlag)
68 
69 public:
70 
78  explicit DDatePickerPopup(Items items,
79  const QDate& date = QDate::currentDate(),
80  QWidget* const parent = nullptr);
81  ~DDatePickerPopup() override;
82 
87  DDatePicker* datePicker() const;
88 
89  void setDate(const QDate& date);
90 
91 #if 0
96  void setItems(int items = 1);
97 #endif
98 
102  int items() const;
103 
104 Q_SIGNALS:
105 
110  void dateChanged(const QDate&);
111 
112 protected Q_SLOTS:
113 
114  void slotDateChanged(const QDate&);
115  void slotToday();
116  void slotTomorrow();
117  void slotNextWeek();
118  void slotNextMonth();
119 
120  void slotYesterday();
121  void slotPrevMonday();
122  void slotPrevFriday();
123  void slotPrevWeek();
124  void slotPrevMonth();
125 
126  void slotNoDate();
127 
128 private:
129 
130  void buildMenu();
131 
132 private:
133 
134  // Disable
135  DDatePickerPopup() = delete;
136 
137 private:
138 
139  class Private;
140  Private* const d;
141 };
142 
143 Q_DECLARE_OPERATORS_FOR_FLAGS(DDatePickerPopup::Items)
144 
145 } // namespace Digikam
146 
147 #endif // DIGIKAM_DDATE_PICKER_POP_UP_H
This menu helps the user to select a date quickly.
Definition: ddatepickerpopup.h:55
ItemFlag
Definition: ddatepickerpopup.h:61
@ NoDate
Definition: ddatepickerpopup.h:62
@ Words
Definition: ddatepickerpopup.h:64
@ DatePicker
Definition: ddatepickerpopup.h:63
int items() const
Definition: ddatepickerpopup.cpp:178
void slotToday()
Definition: ddatepickerpopup.cpp:189
void setDate(const QDate &date)
Definition: ddatepickerpopup.cpp:165
void slotNextWeek()
Definition: ddatepickerpopup.cpp:204
void slotPrevWeek()
Definition: ddatepickerpopup.cpp:242
void slotPrevFriday()
Definition: ddatepickerpopup.cpp:219
void dateChanged(const QDate &)
void slotDateChanged(const QDate &)
Definition: ddatepickerpopup.cpp:183
void slotYesterday()
Definition: ddatepickerpopup.cpp:214
~DDatePickerPopup() override
Definition: ddatepickerpopup.cpp:112
void slotPrevMonth()
Definition: ddatepickerpopup.cpp:247
void slotNextMonth()
Definition: ddatepickerpopup.cpp:209
void slotTomorrow()
Definition: ddatepickerpopup.cpp:194
DDatePicker * datePicker() const
Definition: ddatepickerpopup.cpp:160
void slotNoDate()
Definition: ddatepickerpopup.cpp:199
void slotPrevMonday()
Definition: ddatepickerpopup.cpp:236
Definition: ddatepicker.h:50
Definition: datefolderview.cpp:43