digiKam
ddatepicker_p.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 : 1997-04-21
7  * Description : A date selection widget.
8  *
9  * Copyright (C) 2011-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C) 1997 by Tim D. Gilman <tdgilman at best dot org>
11  * Copyright (C) 1998-2001 by Mirko Boehm <mirko at kde dot org>
12  * Copyright (C) 2007 by John Layt <john at layt dot net>
13  *
14  * This program is free software; you can redistribute it
15  * and/or modify it under the terms of the GNU General
16  * Public License as published by the Free Software Foundation;
17  * either version 2, or (at your option)
18  * any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  * GNU General Public License for more details.
24  *
25  * ============================================================ */
26 
27 #ifndef DIGIKAM_DDATE_PICKER_PRIVATE_H
28 #define DIGIKAM_DDATE_PICKER_PRIVATE_H
29 
30 // Qt includes
31 
32 #include <QDate>
33 #include <QLineEdit>
34 #include <QValidator>
35 #include <QApplication>
36 #include <QComboBox>
37 #include <QToolButton>
38 #include <QBoxLayout>
39 #include <QSize>
40 
41 // Local includes
42 
43 #include "ddatepicker.h"
44 
45 namespace Digikam
46 {
47 
48 class Q_DECL_HIDDEN DatePickerValidator : public QValidator
49 {
50  Q_OBJECT
51 
52 public:
53 
54  explicit DatePickerValidator(DDatePicker* const parent);
55 
56  State validate(QString& text, int&) const override;
57 
58 private:
59 
60  DDatePicker* m_picker;
61 };
62 
63 // ------------------------------------------------------------------------------
64 
65 class Q_DECL_HIDDEN DatePickerYearSelector : public QLineEdit
66 {
67  Q_OBJECT
68 
69 public:
70 
71  explicit DatePickerYearSelector(const QDate& currentDate, QWidget* const parent = nullptr);
72 
73  int year() const;
74  void setYear(int year);
75 
76 public Q_SLOTS:
77 
78  void yearEnteredSlot();
79 
80 Q_SIGNALS:
81 
82  void closeMe(int);
83 
84 protected:
85 
86  QIntValidator* val;
87  int result;
88 
89 private:
90 
91  QDate oldDate;
92 
93  Q_DISABLE_COPY(DatePickerYearSelector)
94 };
95 
96 // ------------------------------------------------------------------------------
97 
98 class Q_DECL_HIDDEN DDatePicker::Private
99 {
100 public:
101 
102  explicit Private(DDatePicker* const qq);
103 
104  void fillWeeksCombo();
105  QDate validDateInYearMonth(int year, int month);
106 
107 public:
108 
111 
112  QToolButton* closeButton;
113  QComboBox* selectWeek;
114  QToolButton* todayButton;
115  QBoxLayout* navigationLayout;
116 
118  QToolButton* yearForward;
119 
121  QToolButton* yearBackward;
122 
124  QToolButton* monthForward;
125 
127  QToolButton* monthBackward;
128 
130  QToolButton* selectMonth;
131 
133  QToolButton* selectYear;
134 
136  QLineEdit* line;
137 
140 
143 
146 
148  int fontsize;
149 };
150 
151 } // namespace Digikam
152 
153 #endif // DIGIKAM_DDATE_PICKER_PRIVATE_H
Definition: ddatepicker_p.h:99
QToolButton * yearBackward
the year backward button
Definition: ddatepicker_p.h:121
QToolButton * closeButton
Definition: ddatepicker_p.h:112
QToolButton * selectMonth
the button for selecting the month directly
Definition: ddatepicker_p.h:130
QBoxLayout * navigationLayout
Definition: ddatepicker_p.h:115
DDateTable * table
the date table
Definition: ddatepicker_p.h:142
QToolButton * todayButton
Definition: ddatepicker_p.h:114
QComboBox * selectWeek
Definition: ddatepicker_p.h:113
QToolButton * selectYear
the button for selecting the year directly
Definition: ddatepicker_p.h:133
QToolButton * monthForward
the month forward button
Definition: ddatepicker_p.h:124
QSize maxMonthRect
the widest month string in pixels:
Definition: ddatepicker_p.h:145
QToolButton * yearForward
the year forward button
Definition: ddatepicker_p.h:118
DatePickerValidator * val
the validator for the line edit:
Definition: ddatepicker_p.h:139
DDatePicker * q
the date table
Definition: ddatepicker_p.h:110
QToolButton * monthBackward
the month backward button
Definition: ddatepicker_p.h:127
QLineEdit * line
the line edit to enter the date directly
Definition: ddatepicker_p.h:136
int fontsize
the font size for the widget
Definition: ddatepicker_p.h:148
Definition: ddatepicker.h:50
Definition: ddatetable.h:50
Definition: ddatepicker_p.h:49
Definition: ddatepicker_p.h:66
QIntValidator * val
Definition: ddatepicker_p.h:86
int result
Definition: ddatepicker_p.h:87
Definition: datefolderview.cpp:43
Definition: abstractalbumtreeview_p.h:85