summaryrefslogtreecommitdiff
path: root/libopie/otimepicker.cpp
authorzecke <zecke>2003-04-13 16:57:28 (UTC)
committer zecke <zecke>2003-04-13 16:57:28 (UTC)
commit0b311079ff19798866291034663757103c6ba935 (patch) (side-by-side diff)
tree70ddccf3a3147475050fa06cc2d807a71ab1d5ee /libopie/otimepicker.cpp
parent1537ccb435ca725c793db6e94e0b9e83484b57e7 (diff)
downloadopie-0b311079ff19798866291034663757103c6ba935.zip
opie-0b311079ff19798866291034663757103c6ba935.tar.gz
opie-0b311079ff19798866291034663757103c6ba935.tar.bz2
Jumbo API documentation update
and some API fixed ColorDialog is now OColorDialog!!! keep the namespace tidy! ColorPopupMenu is now OColorPopupMenu!!! keep the namespace tidy ColorDialog TT couldn't break bc we can so make it const QColor& OTimePicker add some convience methods more I might have forgot
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
@@ -8,8 +8,16 @@
#include <qlineedit.h>
-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) :
QWidget(parent,name,fl)
{
+
QVBoxLayout *vbox=new QVBoxLayout(this);
@@ -21,6 +29,6 @@ OTimePicker::OTimePicker(QWidget* parent, const char* name,
QHBoxLayout *l=new QHBoxLayout(row);
vbox->addWidget(row);
-
-
+
+
for (int i=0; i<24; i++) {
r=new OClickableLabel(row);
@@ -45,5 +53,5 @@ OTimePicker::OTimePicker(QWidget* parent, const char* name,
l=new QHBoxLayout(row);
vbox->addWidget(row);
-
+
for (int i=0; i<60; i+=5) {
r=new OClickableLabel(row);
@@ -59,4 +67,12 @@ 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) {
@@ -93,4 +109,30 @@ 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) {
@@ -102,9 +144,12 @@ void OTimePicker::setMinute(int m) {
if ((*it)->text() == minute) (*it)->setOn(true);
else (*it)->setOn(false);
- }
+ }
tm.setHMS(tm.hour(),m,0);
}
+/**
+ * Method to set the hour
+ */
void OTimePicker::setHour(int h) {
@@ -116,9 +161,16 @@ void OTimePicker::setHour(int h) {
if ((*it)->text() == hour) (*it)->setOn(true);
else (*it)->setOn(false);
- }
+ }
tm.setHMS(h,tm.minute(),0);
}
+/**
+ * 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 )
: OTimePickerDialogBase (parent , name, true , fl)
@@ -134,8 +186,16 @@ OTimePickerDialog::OTimePickerDialog ( QWidget* parent, const char* name, WFlags
}
-QTime& OTimePickerDialog::time()
+/**
+ * @return the time
+ */
+QTime OTimePickerDialog::time()const
{
return m_time;
}
+
+/**
+ * Set the time to time
+ * @param time The time to be set
+ */
void OTimePickerDialog::setTime( const QTime& time )
{
@@ -155,7 +215,12 @@ void OTimePickerDialog::setTime( const QTime& time )
else
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 )
{
@@ -167,4 +232,9 @@ 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 )
{