summaryrefslogtreecommitdiff
path: root/libopie/otimepicker.cpp
Side-by-side diff
Diffstat (limited to 'libopie/otimepicker.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/otimepicker.cpp86
1 files changed, 78 insertions, 8 deletions
diff --git a/libopie/otimepicker.cpp b/libopie/otimepicker.cpp
index 8e8a4e7..115d39b 100644
--- a/libopie/otimepicker.cpp
+++ b/libopie/otimepicker.cpp
@@ -9,3 +9,10 @@
-OTimePicker::OTimePicker(QWidget* parent, const char* name,
+
+/**
+ * Constructs the widget
+ * @param parent The parent of the OTimePicker
+ * @param name The name of the object
+ * @param fl Window Flags
+ */
+OTimePicker::OTimePicker(QWidget* parent, const char* name,
WFlags fl) :
@@ -13,2 +20,3 @@ OTimePicker::OTimePicker(QWidget* parent, const char* name,
{
+
QVBoxLayout *vbox=new QVBoxLayout(this);
@@ -22,4 +30,4 @@ OTimePicker::OTimePicker(QWidget* parent, const char* name,
vbox->addWidget(row);
-
-
+
+
for (int i=0; i<24; i++) {
@@ -46,3 +54,3 @@ OTimePicker::OTimePicker(QWidget* parent, const char* name,
vbox->addWidget(row);
-
+
for (int i=0; i<60; i+=5) {
@@ -60,2 +68,10 @@ OTimePicker::OTimePicker(QWidget* parent, const char* name,
+/**
+ * This method return the current time
+ * @return the time
+ */
+QTime OTimePicker::time()const {
+ return tm;
+}
+
void OTimePicker::slotHour(bool b) {
@@ -94,2 +110,28 @@ void OTimePicker::slotMinute(bool b) {
+/**
+ * Method to set the time. No signal gets emitted during this method call
+ * Minutes must be within 5 minutes step starting at 0 ( 0,5,10,15,20... )
+ * @param t The time to be set
+ */
+void OTimePicker::setTime( const QTime& t) {
+ setTime( t.hour(), t.minute() );
+}
+
+/**
+ * Method to set the time. No signal gets emitted during this method call
+ * @param h The hour
+ * @param m The minute. Minutes need to set by 5 minute steps
+ */
+void OTimePicker::setTime( int h, int m ) {
+ setHour(h);
+ setMinute(m);
+}
+
+/*
+ * FIXME round minutes to the 5 minute arrangement -zecke
+ */
+/**
+ * Method to set the minutes
+ * @param m minutes
+ */
void OTimePicker::setMinute(int m) {
@@ -103,3 +145,3 @@ void OTimePicker::setMinute(int m) {
else (*it)->setOn(false);
- }
+ }
@@ -108,2 +150,5 @@ void OTimePicker::setMinute(int m) {
+/**
+ * Method to set the hour
+ */
void OTimePicker::setHour(int h) {
@@ -117,3 +162,3 @@ void OTimePicker::setHour(int h) {
else (*it)->setOn(false);
- }
+ }
tm.setHMS(h,tm.minute(),0);
@@ -122,2 +167,9 @@ void OTimePicker::setHour(int h) {
+/**
+ * This is a modal Dialog.
+ *
+ * @param parent The parent widget
+ * @param name The name of the object
+ * @param fl Possible window flags
+ */
OTimePickerDialog::OTimePickerDialog ( QWidget* parent, const char* name, WFlags fl )
@@ -135,3 +187,6 @@ OTimePickerDialog::OTimePickerDialog ( QWidget* parent, const char* name, WFlags
-QTime& OTimePickerDialog::time()
+/**
+ * @return the time
+ */
+QTime OTimePickerDialog::time()const
{
@@ -139,2 +194,7 @@ QTime& OTimePickerDialog::time()
}
+
+/**
+ * Set the time to time
+ * @param time The time to be set
+ */
void OTimePickerDialog::setTime( const QTime& time )
@@ -156,5 +216,10 @@ void OTimePickerDialog::setTime( const QTime& time )
minuteField->setText( QString::number( time.minute() ) );
-
+
}
+/**
+ * This method takes the current minute and tries to set hour
+ * to hour. This succeeds if the resulting date is valid
+ * @param hour The hour as a string
+ */
void OTimePickerDialog::setHour ( const QString& hour )
@@ -168,2 +233,7 @@ void OTimePickerDialog::setHour ( const QString& hour )
+/**
+ * Method to set a new minute. It tries to convert the string to int and
+ * if the resulting date is valid a new date is set.
+ * @see setHour
+ */
void OTimePickerDialog::setMinute ( const QString& minute )