File indexing completed on 2024-05-12 05:14:58

0001 /*
0002  *  timeselector.h  -  widget to optionally set a time period
0003  *  Program:  kalarm
0004  *  SPDX-FileCopyrightText: 2004-2019 David Jarvie <djarvie@kde.org>
0005  *
0006  *  SPDX-License-Identifier: GPL-2.0-or-later
0007  */
0008 
0009 #pragma once
0010 
0011 #include "lib/timeperiod.h"
0012 
0013 #include <QFrame>
0014 
0015 class CheckBox;
0016 class ComboBox;
0017 
0018 
0019 class TimeSelector : public QFrame
0020 {
0021     Q_OBJECT
0022 public:
0023     TimeSelector(const QString& selectText, const QString& selectWhatsThis,
0024                  const QString& valueWhatsThis, bool allowHourMinute, QWidget* parent);
0025     ComboBox*    createSignCombo();
0026     bool         isChecked() const;
0027     void         setChecked(bool on);
0028     KCalendarCore::Duration period() const;
0029     void         setPeriod(const KCalendarCore::Duration&, bool dateOnly, TimePeriod::Units defaultUnits);
0030     TimePeriod::Units units() const   { return mPeriod->units(); }
0031     void         setUnits(TimePeriod::Units units)  { mPeriod->setUnits(units); }
0032     void         setReadOnly(bool);
0033     bool         isDateOnly() const   { return mPeriod->isDateOnly(); }
0034     void         setDateOnly(bool dateOnly = true);
0035     void         setMaximum(int hourmin, int days);
0036     void         setFocusOnCount();
0037 
0038 Q_SIGNALS:
0039     void         toggled(bool);             // selection checkbox has been toggled
0040     void         valueChanged(const KCalendarCore::Duration&); // value has changed
0041 
0042 protected Q_SLOTS:
0043     void         selectToggled(bool);
0044     void         periodChanged(const KCalendarCore::Duration&);
0045 
0046 private:
0047     CheckBox*    mSelect;
0048     TimePeriod*  mPeriod;
0049     ComboBox*    mSignWidget {nullptr};
0050     bool         mReadOnly {false};         // the widget is read only
0051 };
0052 
0053 // vim: et sw=4: