author | zecke <zecke> | 2003-04-13 16:57:28 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-04-13 16:57:28 (UTC) |
commit | 0b311079ff19798866291034663757103c6ba935 (patch) (unidiff) | |
tree | 70ddccf3a3147475050fa06cc2d807a71ab1d5ee | |
parent | 1537ccb435ca725c793db6e94e0b9e83484b57e7 (diff) | |
download | opie-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
31 files changed, 738 insertions, 80 deletions
diff --git a/libopie/colordialog.cpp b/libopie/colordialog.cpp index 684d6ea..35f15d6 100644 --- a/libopie/colordialog.cpp +++ b/libopie/colordialog.cpp | |||
@@ -56,8 +56,13 @@ static inline void rgb2hsv( QRgb rgb, int&h, int&s, int&v ) | |||
56 | c.setRgb( rgb ); | 56 | c.setRgb( rgb ); |
57 | c.getHsv(h,s,v); | 57 | c.getHsv(h,s,v); |
58 | } | 58 | } |
59 | 59 | ||
60 | /* | ||
61 | * avoid clashes with the original Qt | ||
62 | */ | ||
63 | namespace { | ||
64 | |||
60 | class QColorPicker : public QFrame | 65 | class QColorPicker : public QFrame |
61 | { | 66 | { |
62 | Q_OBJECT | 67 | Q_OBJECT |
63 | public: | 68 | public: |
@@ -606,15 +611,17 @@ void QColorShower::setHsv( int h, int s, int v ) | |||
606 | 611 | ||
607 | showCurrentColor(); | 612 | showCurrentColor(); |
608 | } | 613 | } |
609 | 614 | ||
615 | } | ||
616 | |||
610 | class OColorDialogPrivate : public QObject | 617 | class OColorDialogPrivate : public QObject |
611 | { | 618 | { |
612 | Q_OBJECT | 619 | Q_OBJECT |
613 | public: | 620 | public: |
614 | OColorDialogPrivate( OColorDialog *p ); | 621 | OColorDialogPrivate( OColorDialog *p ); |
615 | QRgb currentColor() const { return cs->currentColor(); } | 622 | QRgb currentColor() const { return cs->currentColor(); } |
616 | void setCurrentColor( QRgb rgb ); | 623 | void setCurrentColor( const QRgb& rgb ); |
617 | 624 | ||
618 | int currentAlpha() const { return cs->currentAlpha(); } | 625 | int currentAlpha() const { return cs->currentAlpha(); } |
619 | void setCurrentAlpha( int a ) { cs->setCurrentAlpha( a ); } | 626 | void setCurrentAlpha( int a ) { cs->setCurrentAlpha( a ); } |
620 | void showAlpha( bool b ) { cs->showAlpha( b ); } | 627 | void showAlpha( bool b ) { cs->showAlpha( b ); } |
@@ -636,9 +643,9 @@ void OColorDialogPrivate::newHsv( int h, int s, int v ) | |||
636 | lp->setCol( h, s, v ); | 643 | lp->setCol( h, s, v ); |
637 | } | 644 | } |
638 | 645 | ||
639 | //sets all widgets to display rgb | 646 | //sets all widgets to display rgb |
640 | void OColorDialogPrivate::setCurrentColor( QRgb rgb ) | 647 | void OColorDialogPrivate::setCurrentColor( const QRgb& rgb ) |
641 | { | 648 | { |
642 | cs->setRgb( rgb ); | 649 | cs->setRgb( rgb ); |
643 | newColorTypedIn( rgb ); | 650 | newColorTypedIn( rgb ); |
644 | } | 651 | } |
@@ -725,9 +732,9 @@ OColorDialog::OColorDialog(QWidget* parent, const char* name, bool modal) : | |||
725 | the dialog. All colors allocated by the dialog will be deallocated | 732 | the dialog. All colors allocated by the dialog will be deallocated |
726 | before this function returns. | 733 | before this function returns. |
727 | */ | 734 | */ |
728 | 735 | ||
729 | QColor OColorDialog::getColor( QColor initial, QWidget *parent, | 736 | QColor OColorDialog::getColor( const QColor& initial, QWidget *parent, |
730 | const char *name ) | 737 | const char *name ) |
731 | { | 738 | { |
732 | int allocContext = QColor::enterAllocContext(); | 739 | int allocContext = QColor::enterAllocContext(); |
733 | OColorDialog *dlg = new OColorDialog( parent, name, TRUE ); //modal | 740 | OColorDialog *dlg = new OColorDialog( parent, name, TRUE ); //modal |
@@ -762,9 +769,9 @@ QColor OColorDialog::getColor( QColor initial, QWidget *parent, | |||
762 | 769 | ||
763 | If the user clicks Cancel the \a initial value is returned. | 770 | If the user clicks Cancel the \a initial value is returned. |
764 | */ | 771 | */ |
765 | 772 | ||
766 | QRgb OColorDialog::getRgba( QRgb initial, bool *ok, | 773 | QRgb OColorDialog::getRgba( const QRgb& initial, bool *ok, |
767 | QWidget *parent, const char* name ) | 774 | QWidget *parent, const char* name ) |
768 | { | 775 | { |
769 | int allocContext = QColor::enterAllocContext(); | 776 | int allocContext = QColor::enterAllocContext(); |
770 | OColorDialog *dlg = new OColorDialog( parent, name, TRUE ); //modal | 777 | OColorDialog *dlg = new OColorDialog( parent, name, TRUE ); //modal |
@@ -818,9 +825,9 @@ OColorDialog::~OColorDialog() | |||
818 | 825 | ||
819 | \sa color() | 826 | \sa color() |
820 | */ | 827 | */ |
821 | 828 | ||
822 | void OColorDialog::setColor( QColor c ) | 829 | void OColorDialog::setColor( const QColor& c ) |
823 | { | 830 | { |
824 | d->setCurrentColor( c.rgb() ); | 831 | d->setCurrentColor( c.rgb() ); |
825 | } | 832 | } |
826 | 833 | ||
diff --git a/libopie/colordialog.h b/libopie/colordialog.h index 926f8f2..e9bb7ed 100644 --- a/libopie/colordialog.h +++ b/libopie/colordialog.h | |||
@@ -60,17 +60,17 @@ class Q_EXPORT OColorDialog : public QDialog | |||
60 | { | 60 | { |
61 | Q_OBJECT | 61 | Q_OBJECT |
62 | 62 | ||
63 | public: | 63 | public: |
64 | static QColor getColor( QColor, QWidget *parent=0, const char* name=0 ); // ### 3.0: make const QColor& | 64 | static QColor getColor( const QColor&, QWidget *parent=0, const char* name=0 ); |
65 | static QRgb getRgba( QRgb, bool* ok = 0, | 65 | static QRgb getRgba( const QRgb&, bool* ok = 0, |
66 | QWidget *parent=0, const char* name=0 ); | 66 | QWidget *parent=0, const char* name=0 ); |
67 | 67 | ||
68 | private: | 68 | private: |
69 | ~OColorDialog(); | 69 | ~OColorDialog(); |
70 | 70 | ||
71 | OColorDialog( QWidget* parent=0, const char* name=0, bool modal=FALSE ); | 71 | OColorDialog( QWidget* parent=0, const char* name=0, bool modal=FALSE ); |
72 | void setColor( QColor ); // ### 3.0: make const QColor& | 72 | void setColor( const QColor& ); |
73 | QColor color() const; | 73 | QColor color() const; |
74 | 74 | ||
75 | private: | 75 | private: |
76 | void setSelectedAlpha( int ); | 76 | void setSelectedAlpha( int ); |
diff --git a/libopie/colorpopupmenu.cpp b/libopie/colorpopupmenu.cpp index 510a2ad..dac10e9 100644 --- a/libopie/colorpopupmenu.cpp +++ b/libopie/colorpopupmenu.cpp | |||
@@ -36,22 +36,22 @@ | |||
36 | #include <qaction.h> | 36 | #include <qaction.h> |
37 | #include <qlayout.h> | 37 | #include <qlayout.h> |
38 | #include <qpainter.h> | 38 | #include <qpainter.h> |
39 | 39 | ||
40 | ColorPanelButton::ColorPanelButton( const QColor& color, QWidget* parent, const char* name ) | 40 | OColorPanelButton::OColorPanelButton( const QColor& color, QWidget* parent, const char* name ) |
41 | : QFrame( parent, name ) | 41 | : QFrame( parent, name ) |
42 | { | 42 | { |
43 | m_color = color; | 43 | m_color = color; |
44 | 44 | ||
45 | setFixedSize( 16, 16 ); | 45 | setFixedSize( 16, 16 ); |
46 | setActive( FALSE ); | 46 | setActive( FALSE ); |
47 | } | 47 | } |
48 | 48 | ||
49 | ColorPanelButton::~ColorPanelButton() | 49 | OColorPanelButton::~OColorPanelButton() |
50 | { | 50 | { |
51 | } | 51 | } |
52 | 52 | ||
53 | void ColorPanelButton::setActive( bool active ) | 53 | void OColorPanelButton::setActive( bool active ) |
54 | { | 54 | { |
55 | m_active = active; | 55 | m_active = active; |
56 | 56 | ||
57 | if ( m_active ) { | 57 | if ( m_active ) { |
@@ -60,27 +60,23 @@ void ColorPanelButton::setActive( bool active ) | |||
60 | setFrameStyle( NoFrame ); | 60 | setFrameStyle( NoFrame ); |
61 | } | 61 | } |
62 | } | 62 | } |
63 | 63 | ||
64 | void ColorPanelButton::enterEvent( QEvent* e ) | 64 | void OColorPanelButton::enterEvent( QEvent* ) |
65 | { | 65 | { |
66 | Q_UNUSED( e ) | ||
67 | |||
68 | if ( !m_active ) { | 66 | if ( !m_active ) { |
69 | setFrameStyle( Panel | Sunken ); | 67 | setFrameStyle( Panel | Sunken ); |
70 | } | 68 | } |
71 | } | 69 | } |
72 | 70 | ||
73 | void ColorPanelButton::leaveEvent( QEvent* e ) | 71 | void OColorPanelButton::leaveEvent( QEvent* ) |
74 | { | 72 | { |
75 | Q_UNUSED( e ) | ||
76 | |||
77 | if ( !m_active ) { | 73 | if ( !m_active ) { |
78 | setFrameStyle( NoFrame ); | 74 | setFrameStyle( NoFrame ); |
79 | } | 75 | } |
80 | } | 76 | } |
81 | 77 | ||
82 | void ColorPanelButton::paintEvent( QPaintEvent* e ) | 78 | void OColorPanelButton::paintEvent( QPaintEvent* e ) |
83 | { | 79 | { |
84 | QFrame::paintEvent( e ); | 80 | QFrame::paintEvent( e ); |
85 | 81 | ||
86 | QPainter painter; | 82 | QPainter painter; |
@@ -90,16 +86,14 @@ void ColorPanelButton::paintEvent( QPaintEvent* e ) | |||
90 | painter.drawRect( 2, 2, 12, 12 ); | 86 | painter.drawRect( 2, 2, 12, 12 ); |
91 | painter.end(); | 87 | painter.end(); |
92 | } | 88 | } |
93 | 89 | ||
94 | void ColorPanelButton::mouseReleaseEvent( QMouseEvent* e ) | 90 | void OColorPanelButton::mouseReleaseEvent( QMouseEvent* ) |
95 | { | 91 | { |
96 | Q_UNUSED( e ) | ||
97 | |||
98 | emit selected( m_color ); | 92 | emit selected( m_color ); |
99 | } | 93 | } |
100 | 94 | ||
101 | ColorPopupMenu::ColorPopupMenu( const QColor& color, QWidget* parent, const char* name ) | 95 | OColorPopupMenu::OColorPopupMenu( const QColor& color, QWidget* parent, const char* name ) |
102 | : QPopupMenu( parent, name ) | 96 | : QPopupMenu( parent, name ) |
103 | { | 97 | { |
104 | m_color = color; | 98 | m_color = color; |
105 | 99 | ||
@@ -148,27 +142,27 @@ ColorPopupMenu::ColorPopupMenu( const QColor& color, QWidget* parent, const char | |||
148 | chooseColorAction->addTo( this ); | 142 | chooseColorAction->addTo( this ); |
149 | activateItemAt( 0 ); | 143 | activateItemAt( 0 ); |
150 | } | 144 | } |
151 | 145 | ||
152 | ColorPopupMenu::~ColorPopupMenu() | 146 | OColorPopupMenu::~OColorPopupMenu() |
153 | { | 147 | { |
154 | } | 148 | } |
155 | 149 | ||
156 | void ColorPopupMenu::addColor( const QColor& color, int row, int col ) | 150 | void OColorPopupMenu::addColor( const QColor& color, int row, int col ) |
157 | { | 151 | { |
158 | ColorPanelButton* panelButton = new ColorPanelButton( color, colorPanel ); | 152 | OColorPanelButton* panelButton = new OColorPanelButton( color, colorPanel ); |
159 | connect( panelButton, SIGNAL( selected( const QColor& ) ), this, SLOT( buttonSelected( const QColor& ) ) ); | 153 | connect( panelButton, SIGNAL( selected( const QColor& ) ), this, SLOT( buttonSelected( const QColor& ) ) ); |
160 | colorLayout->addWidget( panelButton, row, col ); | 154 | colorLayout->addWidget( panelButton, row, col ); |
161 | } | 155 | } |
162 | 156 | ||
163 | void ColorPopupMenu::buttonSelected( const QColor& color ) | 157 | void OColorPopupMenu::buttonSelected( const QColor& color ) |
164 | { | 158 | { |
165 | m_color = color; | 159 | m_color = color; |
166 | emit colorSelected( color ); | 160 | emit colorSelected( color ); |
167 | hide(); | 161 | hide(); |
168 | } | 162 | } |
169 | 163 | ||
170 | void ColorPopupMenu::moreColorClicked() | 164 | void OColorPopupMenu::moreColorClicked() |
171 | { | 165 | { |
172 | QColor color = OColorDialog::getColor( m_color ); | 166 | QColor color = OColorDialog::getColor( m_color ); |
173 | m_color = color; | 167 | m_color = color; |
174 | emit colorSelected( color ); | 168 | emit colorSelected( color ); |
diff --git a/libopie/colorpopupmenu.h b/libopie/colorpopupmenu.h index b0453b2..184b132 100644 --- a/libopie/colorpopupmenu.h +++ b/libopie/colorpopupmenu.h | |||
@@ -39,40 +39,40 @@ | |||
39 | class QWidget; | 39 | class QWidget; |
40 | class QGridLayout; | 40 | class QGridLayout; |
41 | 41 | ||
42 | /** | 42 | /** |
43 | * @class ColorPanelButton | 43 | * @class OColorPanelButton |
44 | * @brief The ColorPanelButton class provides a button for color selection. | 44 | * @brief The OColorPanelButton class provides a button for color selection. |
45 | * | 45 | * |
46 | * @see ColorPopupMenu | 46 | * @see OColorPopupMenu |
47 | * | 47 | * |
48 | * The ColorPanelButton class provides a button for color selection. The button | 48 | * The OColorPanelButton class provides a button for color selection. The button |
49 | * is drawn with the desired color and no border. This class is used internally | 49 | * is drawn with the desired color and no border. This class is used internally |
50 | * by the ColorPopupMenu class to displaying colors in its menu. | 50 | * by the OColorPopupMenu class to displaying colors in its menu. |
51 | */ | 51 | */ |
52 | class ColorPanelButton : public QFrame | 52 | class OColorPanelButton : public QFrame |
53 | { | 53 | { |
54 | Q_OBJECT | 54 | Q_OBJECT |
55 | 55 | ||
56 | public: | 56 | public: |
57 | 57 | ||
58 | /** | 58 | /** |
59 | * @fn ColorPanelButton( const QColor& color, QWidget* parent = 0, const char* name = 0 ) | 59 | * @fn OColorPanelButton( const QColor& color, QWidget* parent = 0, const char* name = 0 ) |
60 | * @brief Object constructor. | 60 | * @brief Object constructor. |
61 | * | 61 | * |
62 | * @param color Desired color. | 62 | * @param color Desired color. |
63 | * @param parent Pointer to parent of this control. | 63 | * @param parent Pointer to parent of this control. |
64 | * @param name Name of control. | 64 | * @param name Name of control. |
65 | * | 65 | * |
66 | * Constructs a new ColorPanelButton control with parent, name and desired color. | 66 | * Constructs a new ColorPanelButton control with parent, name and desired color. |
67 | */ | 67 | */ |
68 | ColorPanelButton(const QColor& color, QWidget* parent = 0, const char* name = 0); | 68 | OColorPanelButton(const QColor& color, QWidget* parent = 0, const char* name = 0); |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * @fn ~ColorPanelButton() | 71 | * @fn ~ColorPanelButton() |
72 | * @brief Object destructor. | 72 | * @brief Object destructor. |
73 | */ | 73 | */ |
74 | ~ColorPanelButton(); | 74 | ~OColorPanelButton(); |
75 | 75 | ||
76 | /** | 76 | /** |
77 | * @fn setActive( bool active ) | 77 | * @fn setActive( bool active ) |
78 | * @brief Sets button selection state. | 78 | * @brief Sets button selection state. |
@@ -149,43 +149,43 @@ private: | |||
149 | ColorPanelButtonPrivate *d; | 149 | ColorPanelButtonPrivate *d; |
150 | }; | 150 | }; |
151 | 151 | ||
152 | /** | 152 | /** |
153 | * @class ColorPopupMenu | 153 | * @class OColorPopupMenu |
154 | * @brief The ColorPopupMenu class provides a small color selection | 154 | * @brief The OColorPopupMenu class provides a small color selection |
155 | * popup menu. | 155 | * popup menu. |
156 | * | 156 | * |
157 | * ColorPopupMenu is a derivation of TrollTech's QPopupMenu and provides | 157 | * OColorPopupMenu is a derivation of TrollTech's QPopupMenu and provides |
158 | * a small color selection popup menu which can be attached to another control | 158 | * a small color selection popup menu which can be attached to another control |
159 | * such as a toolbar button of menu item. | 159 | * such as a toolbar button of menu item. |
160 | * | 160 | * |
161 | * The popup menu displays 30 default colors available in a grid, and also | 161 | * The popup menu displays 30 default colors available in a grid, and also |
162 | * includes an option at the bottom to display a color selection dialog box for | 162 | * includes an option at the bottom to display a color selection dialog box for |
163 | * finer color control. | 163 | * finer color control. |
164 | */ | 164 | */ |
165 | class ColorPopupMenu : public QPopupMenu | 165 | class OColorPopupMenu : public QPopupMenu |
166 | { | 166 | { |
167 | Q_OBJECT | 167 | Q_OBJECT |
168 | 168 | ||
169 | public: | 169 | public: |
170 | 170 | ||
171 | /** | 171 | /** |
172 | * @fn ColorPopupMenu( const QColor& color, QWidget* parent = 0, const char* name = 0 ) | 172 | * @fn OColorPopupMenu( const QColor& color, QWidget* parent = 0, const char* name = 0 ) |
173 | * @brief Object constructor. | 173 | * @brief Object constructor. |
174 | * | 174 | * |
175 | * @param color Initial color selected in menu. | 175 | * @param color Initial color selected in menu. |
176 | * @param parent Pointer to parent of this control. | 176 | * @param parent Pointer to parent of this control. |
177 | * @param name Name of control. | 177 | * @param name Name of control. |
178 | * | 178 | * |
179 | * Constructs a new ColorPopupMenu control with parent, name and initial color selected. | 179 | * Constructs a new OColorPopupMenu control with parent, name and initial color selected. |
180 | */ | 180 | */ |
181 | ColorPopupMenu( const QColor& color, QWidget* parent = 0, const char* name = 0 ); | 181 | OColorPopupMenu( const QColor& color, QWidget* parent = 0, const char* name = 0 ); |
182 | 182 | ||
183 | /** | 183 | /** |
184 | * @fn ~ColorPopupMenu() | 184 | * @fn ~OColorPopupMenu() |
185 | * @brief Object destructor. | 185 | * @brief Object destructor. |
186 | */ | 186 | */ |
187 | ~ColorPopupMenu(); | 187 | ~OColorPopupMenu(); |
188 | 188 | ||
189 | private: | 189 | private: |
190 | class ColorPopupMenuPrivate; | 190 | class ColorPopupMenuPrivate; |
191 | ColorPopupMenuPrivate *d; | 191 | ColorPopupMenuPrivate *d; |
diff --git a/libopie/ocheckitem.cpp b/libopie/ocheckitem.cpp index d6ddc79..082d7a2 100644 --- a/libopie/ocheckitem.cpp +++ b/libopie/ocheckitem.cpp | |||
@@ -13,34 +13,65 @@ | |||
13 | #include <qpainter.h> | 13 | #include <qpainter.h> |
14 | 14 | ||
15 | #include "ocheckitem.h" | 15 | #include "ocheckitem.h" |
16 | 16 | ||
17 | /** | ||
18 | * Constructs an CheckItem with a QTable as parent | ||
19 | * and a sort key for. | ||
20 | * The sort key will be used by QTable to sort the table later | ||
21 | * @param t The parent QTable where the check item belongs | ||
22 | * @param key A sort key | ||
23 | */ | ||
17 | OCheckItem::OCheckItem( QTable *t, const QString &key ) | 24 | OCheckItem::OCheckItem( QTable *t, const QString &key ) |
18 | : QTableItem( t, Never, "" ), m_checked( FALSE ), m_sortKey( key ) | 25 | : QTableItem( t, Never, "" ), m_checked( FALSE ), m_sortKey( key ) |
19 | { | 26 | { |
20 | } | 27 | } |
21 | 28 | ||
29 | /** | ||
30 | * reimplemted for internal reasons | ||
31 | * @return Returns the sort key of the Item | ||
32 | * @see QTableItem | ||
33 | */ | ||
22 | QString OCheckItem::key() const | 34 | QString OCheckItem::key() const |
23 | { | 35 | { |
24 | return m_sortKey; | 36 | return m_sortKey; |
25 | } | 37 | } |
26 | 38 | ||
39 | /** | ||
40 | * This method can check or uncheck the item. It will | ||
41 | * call QTable to update the cell. | ||
42 | * | ||
43 | * @param b Whether to check or uncheck the item | ||
44 | */ | ||
27 | void OCheckItem::setChecked( bool b ) | 45 | void OCheckItem::setChecked( bool b ) |
28 | { | 46 | { |
29 | m_checked = b; | 47 | m_checked = b; |
30 | table()->updateCell( row(), col() ); | 48 | table()->updateCell( row(), col() ); |
31 | } | 49 | } |
32 | 50 | ||
51 | /** | ||
52 | * This will toggle the item. If it is checked it'll get | ||
53 | * unchecked by this method or vice versa. | ||
54 | */ | ||
33 | void OCheckItem::toggle() | 55 | void OCheckItem::toggle() |
34 | { | 56 | { |
35 | m_checked = !m_checked; | 57 | m_checked = !m_checked; |
36 | } | 58 | } |
37 | 59 | ||
60 | /** | ||
61 | * This will return the state of the item. | ||
62 | * | ||
63 | * @return Returns true if the item is checked | ||
64 | */ | ||
38 | bool OCheckItem::isChecked() const | 65 | bool OCheckItem::isChecked() const |
39 | { | 66 | { |
40 | return m_checked; | 67 | return m_checked; |
41 | } | 68 | } |
42 | 69 | ||
70 | /** | ||
71 | * @internal | ||
72 | * This paints the item | ||
73 | */ | ||
43 | void OCheckItem::paint( QPainter *p, const QColorGroup &cg, const QRect &cr, | 74 | void OCheckItem::paint( QPainter *p, const QColorGroup &cg, const QRect &cr, |
44 | bool ) | 75 | bool ) |
45 | { | 76 | { |
46 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); | 77 | p->fillRect( 0, 0, cr.width(), cr.height(), cg.brush( QColorGroup::Base ) ); |
diff --git a/libopie/ocheckitem.h b/libopie/ocheckitem.h index 7885032..2387134 100644 --- a/libopie/ocheckitem.h +++ b/libopie/ocheckitem.h | |||
@@ -13,8 +13,20 @@ | |||
13 | 13 | ||
14 | #ifndef CHECKITEM_H__ | 14 | #ifndef CHECKITEM_H__ |
15 | #define CHECKITEM_H__ | 15 | #define CHECKITEM_H__ |
16 | 16 | ||
17 | /** | ||
18 | * This class represents a checkable QTableItem. This can | ||
19 | * be added to any QTable. | ||
20 | * | ||
21 | * | ||
22 | * @see QTable | ||
23 | * @see QTableItem | ||
24 | * @short An checkable QTableItem | ||
25 | * @version 1.0 | ||
26 | * @author Stefan Eilers ( eilers@handhelds.org ) | ||
27 | */ | ||
28 | |||
17 | class OCheckItem : public QTableItem | 29 | class OCheckItem : public QTableItem |
18 | { | 30 | { |
19 | public: | 31 | public: |
20 | enum Size { BoxSize = 10 }; | 32 | enum Size { BoxSize = 10 }; |
diff --git a/libopie/oclickablelabel.cpp b/libopie/oclickablelabel.cpp index 5768529..bc7037b 100644 --- a/libopie/oclickablelabel.cpp +++ b/libopie/oclickablelabel.cpp | |||
@@ -1,7 +1,14 @@ | |||
1 | #include "oclickablelabel.h" | 1 | #include "oclickablelabel.h" |
2 | #include <stdio.h> | 2 | #include <stdio.h> |
3 | 3 | ||
4 | /** | ||
5 | * This constructs the clickable ButtonLabel | ||
6 | * | ||
7 | * @param parent The parent of this label | ||
8 | * @param name A name of this label @see QObject | ||
9 | * @param fl The windowing flags | ||
10 | */ | ||
4 | OClickableLabel::OClickableLabel(QWidget* parent, | 11 | OClickableLabel::OClickableLabel(QWidget* parent, |
5 | const char* name, | 12 | const char* name, |
6 | WFlags fl) : | 13 | WFlags fl) : |
7 | QLabel(parent,name,fl) | 14 | QLabel(parent,name,fl) |
@@ -12,20 +19,31 @@ OClickableLabel::OClickableLabel(QWidget* parent, | |||
12 | showState(false); | 19 | showState(false); |
13 | setFrameShadow(Sunken); | 20 | setFrameShadow(Sunken); |
14 | } | 21 | } |
15 | 22 | ||
23 | /** | ||
24 | * This method makes the label behave as a toggle button | ||
25 | * | ||
26 | * @param t Whether or not to behave like a toggle button | ||
27 | */ | ||
16 | void OClickableLabel::setToggleButton(bool t) { | 28 | void OClickableLabel::setToggleButton(bool t) { |
17 | isToggle=t; | 29 | isToggle=t; |
18 | } | 30 | } |
19 | 31 | ||
32 | /** | ||
33 | * @internal | ||
34 | */ | ||
20 | void OClickableLabel::mousePressEvent( QMouseEvent * /*e*/ ) { | 35 | void OClickableLabel::mousePressEvent( QMouseEvent * /*e*/ ) { |
21 | if (isToggle && isDown) { | 36 | if (isToggle && isDown) { |
22 | showState(false); | 37 | showState(false); |
23 | } else { | 38 | } else { |
24 | showState(true); | 39 | showState(true); |
25 | } | 40 | } |
26 | } | 41 | } |
27 | 42 | ||
43 | /** | ||
44 | * @internal | ||
45 | */ | ||
28 | void OClickableLabel::mouseReleaseEvent( QMouseEvent *e ) { | 46 | void OClickableLabel::mouseReleaseEvent( QMouseEvent *e ) { |
29 | if (rect().contains(e->pos()) && isToggle) isDown=!isDown; | 47 | if (rect().contains(e->pos()) && isToggle) isDown=!isDown; |
30 | 48 | ||
31 | if (isToggle && isDown) { | 49 | if (isToggle && isDown) { |
@@ -41,8 +59,11 @@ void OClickableLabel::mouseReleaseEvent( QMouseEvent *e ) { | |||
41 | emit clicked(); | 59 | emit clicked(); |
42 | } | 60 | } |
43 | } | 61 | } |
44 | 62 | ||
63 | /** | ||
64 | * @internal | ||
65 | */ | ||
45 | void OClickableLabel::mouseMoveEvent( QMouseEvent *e ) { | 66 | void OClickableLabel::mouseMoveEvent( QMouseEvent *e ) { |
46 | if (rect().contains(e->pos())) { | 67 | if (rect().contains(e->pos())) { |
47 | if (isToggle && isDown) { | 68 | if (isToggle && isDown) { |
48 | showState(false); | 69 | showState(false); |
@@ -57,8 +78,13 @@ void OClickableLabel::mouseMoveEvent( QMouseEvent *e ) { | |||
57 | } | 78 | } |
58 | } | 79 | } |
59 | } | 80 | } |
60 | 81 | ||
82 | /** | ||
83 | * this toggles the label and inverts the color of | ||
84 | * the label | ||
85 | * @param on | ||
86 | */ | ||
61 | void OClickableLabel::showState(bool on) { | 87 | void OClickableLabel::showState(bool on) { |
62 | if (on) { | 88 | if (on) { |
63 | //setFrameShape(Panel); | 89 | //setFrameShape(Panel); |
64 | setInverted(true); | 90 | setInverted(true); |
@@ -81,8 +107,11 @@ void OClickableLabel::setInverted(bool on) { | |||
81 | textInverted=!textInverted; | 107 | textInverted=!textInverted; |
82 | } | 108 | } |
83 | } | 109 | } |
84 | 110 | ||
111 | /** | ||
112 | * @param on if the Label is down or up | ||
113 | */ | ||
85 | void OClickableLabel::setOn(bool on) { | 114 | void OClickableLabel::setOn(bool on) { |
86 | isDown=on; | 115 | isDown=on; |
87 | showState(isDown); | 116 | showState(isDown); |
88 | } | 117 | } |
diff --git a/libopie/oclickablelabel.h b/libopie/oclickablelabel.h index f65c440..4b6dcbc 100644 --- a/libopie/oclickablelabel.h +++ b/libopie/oclickablelabel.h | |||
@@ -2,29 +2,52 @@ | |||
2 | #define CLICKABLELABEL | 2 | #define CLICKABLELABEL |
3 | 3 | ||
4 | #include <qlabel.h> | 4 | #include <qlabel.h> |
5 | 5 | ||
6 | /** | ||
7 | * This class is a special QLabel which can behave | ||
8 | * as a QPushButton or QToggleButton. | ||
9 | * The reason to use a clickable is if you want to save space | ||
10 | * or you want to skip the border of a normal button | ||
11 | * | ||
12 | * <pre> | ||
13 | * QLabel* lbl = new OClickableLabel( parent, "PushLabel" ); | ||
14 | * lbl->setPixmap( "config" ); | ||
15 | * QWhatsThis::add( lbl, tr("Click here to do something") ); | ||
16 | * </pre> | ||
17 | * | ||
18 | * @short A Label behaving as button | ||
19 | * @author Hakan Ardo, Maximillian Reiß ( harlekin@handhelds.org ) | ||
20 | * @see QLabel | ||
21 | * @see QPushButton | ||
22 | * @see QToggleButton | ||
23 | * @version 1.0 | ||
24 | */ | ||
25 | |||
6 | class OClickableLabel: public QLabel | 26 | class OClickableLabel: public QLabel |
7 | { | 27 | { |
8 | Q_OBJECT | 28 | Q_OBJECT |
9 | public: | 29 | public: |
10 | OClickableLabel(QWidget* parent = 0, const char* name = 0, | 30 | OClickableLabel(QWidget* parent = 0, const char* name = 0, |
11 | WFlags fl = 0); | 31 | WFlags fl = 0); |
12 | void setToggleButton(bool t); | 32 | void setToggleButton(bool t); |
33 | |||
13 | protected: | 34 | protected: |
14 | void mousePressEvent( QMouseEvent *e ); | 35 | void mousePressEvent( QMouseEvent *e ); |
15 | void mouseReleaseEvent( QMouseEvent *e ); | 36 | void mouseReleaseEvent( QMouseEvent *e ); |
16 | void mouseMoveEvent( QMouseEvent *e ); | 37 | void mouseMoveEvent( QMouseEvent *e ); |
38 | |||
17 | public slots: | 39 | public slots: |
18 | void setOn(bool on); | 40 | void setOn(bool on); |
19 | signals: | 41 | signals: |
20 | void clicked(); | 42 | void clicked(); |
21 | void toggled(bool on); | 43 | void toggled(bool on); |
22 | private: | 44 | private: |
23 | bool isToggle; | 45 | bool isToggle : 1; |
24 | bool isDown; | 46 | bool isDown : 1; |
47 | bool textInverted : 1; | ||
48 | |||
25 | void showState(bool on); | 49 | void showState(bool on); |
26 | bool textInverted; | ||
27 | void setInverted(bool on); | 50 | void setInverted(bool on); |
28 | }; | 51 | }; |
29 | 52 | ||
30 | #endif | 53 | #endif |
diff --git a/libopie/ocolorbutton.cpp b/libopie/ocolorbutton.cpp index ddb6c4f..113a77a 100644 --- a/libopie/ocolorbutton.cpp +++ b/libopie/ocolorbutton.cpp | |||
@@ -33,20 +33,28 @@ | |||
33 | #include <qimage.h> | 33 | #include <qimage.h> |
34 | 34 | ||
35 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
36 | 36 | ||
37 | class OColorButtonPrivate { | 37 | struct OColorButtonPrivate { |
38 | public: | ||
39 | QPopupMenu *m_menu; | 38 | QPopupMenu *m_menu; |
40 | QColor m_color; | 39 | QColor m_color; |
41 | }; | 40 | }; |
42 | 41 | ||
42 | |||
43 | /** | ||
44 | * This concstructs a Color Button with @param color as the start color | ||
45 | * It'll use a OColorPopupMenu internally | ||
46 | * | ||
47 | * @param parent The parent of the Color Button | ||
48 | * @param color The color from where to start on | ||
49 | * @param name @see QObject | ||
50 | */ | ||
43 | OColorButton::OColorButton ( QWidget *parent, const QColor &color, const char *name ) | 51 | OColorButton::OColorButton ( QWidget *parent, const QColor &color, const char *name ) |
44 | : QPushButton ( parent, name ) | 52 | : QPushButton ( parent, name ) |
45 | { | 53 | { |
46 | d = new OColorButtonPrivate; | 54 | d = new OColorButtonPrivate; |
47 | 55 | ||
48 | d-> m_menu = new ColorPopupMenu ( color, 0, 0 ); | 56 | d-> m_menu = new OColorPopupMenu ( color, 0, 0 ); |
49 | setPopup ( d-> m_menu ); | 57 | setPopup ( d-> m_menu ); |
50 | //setPopupDelay ( 0 ); | 58 | //setPopupDelay ( 0 ); |
51 | connect ( d-> m_menu, SIGNAL( colorSelected ( const QColor & )), this, SLOT( updateColor ( const QColor & ))); | 59 | connect ( d-> m_menu, SIGNAL( colorSelected ( const QColor & )), this, SLOT( updateColor ( const QColor & ))); |
52 | 60 | ||
@@ -56,23 +64,36 @@ OColorButton::OColorButton ( QWidget *parent, const QColor &color, const char *n | |||
56 | setMinimumSize ( s ); | 64 | setMinimumSize ( s ); |
57 | setMaximumSize ( s. width ( ) * 2, s. height ( )); | 65 | setMaximumSize ( s. width ( ) * 2, s. height ( )); |
58 | } | 66 | } |
59 | 67 | ||
68 | /** | ||
69 | * This destructs the object | ||
70 | */ | ||
60 | OColorButton::~OColorButton ( ) | 71 | OColorButton::~OColorButton ( ) |
61 | { | 72 | { |
62 | delete d; | 73 | delete d; |
63 | } | 74 | } |
64 | 75 | ||
76 | /** | ||
77 | * @return Returns the current color of the button | ||
78 | */ | ||
65 | QColor OColorButton::color ( ) const | 79 | QColor OColorButton::color ( ) const |
66 | { | 80 | { |
67 | return d-> m_color; | 81 | return d-> m_color; |
68 | } | 82 | } |
69 | 83 | ||
84 | /** | ||
85 | * This method sets the color of the button | ||
86 | * @param c The color to be set. | ||
87 | */ | ||
70 | void OColorButton::setColor ( const QColor &c ) | 88 | void OColorButton::setColor ( const QColor &c ) |
71 | { | 89 | { |
72 | updateColor ( c ); | 90 | updateColor ( c ); |
73 | } | 91 | } |
74 | 92 | ||
93 | /** | ||
94 | * @internal | ||
95 | */ | ||
75 | void OColorButton::updateColor ( const QColor &c ) | 96 | void OColorButton::updateColor ( const QColor &c ) |
76 | { | 97 | { |
77 | d-> m_color = c; | 98 | d-> m_color = c; |
78 | 99 | ||
diff --git a/libopie/ocolorbutton.h b/libopie/ocolorbutton.h index fe40fae..338e654 100644 --- a/libopie/ocolorbutton.h +++ b/libopie/ocolorbutton.h | |||
@@ -33,8 +33,15 @@ | |||
33 | 33 | ||
34 | class OColorButtonPrivate; | 34 | class OColorButtonPrivate; |
35 | class QColor; | 35 | class QColor; |
36 | 36 | ||
37 | /** | ||
38 | * | ||
39 | * @short A Button which will show a OColorPopupMenu | ||
40 | * @author Robert Griebl ( sandman@handhelds.org ) | ||
41 | * @version 1.0 | ||
42 | * @see QPushButton | ||
43 | */ | ||
37 | class OColorButton : public QPushButton { | 44 | class OColorButton : public QPushButton { |
38 | Q_OBJECT | 45 | Q_OBJECT |
39 | public: | 46 | public: |
40 | OColorButton ( QWidget *parent = 0, const QColor & = black, const char *name = 0 ); | 47 | OColorButton ( QWidget *parent = 0, const QColor & = black, const char *name = 0 ); |
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 9b2a954..8f954b1 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -52,9 +52,9 @@ | |||
52 | using namespace Opie; | 52 | using namespace Opie; |
53 | 53 | ||
54 | class ODeviceData { | 54 | class ODeviceData { |
55 | public: | 55 | public: |
56 | bool m_qwsserver; | 56 | bool m_qwsserver : 1; |
57 | 57 | ||
58 | QString m_vendorstr; | 58 | QString m_vendorstr; |
59 | OVendor m_vendor; | 59 | OVendor m_vendor; |
60 | 60 | ||
@@ -269,8 +269,11 @@ void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) | |||
269 | void ODevice::init ( ) | 269 | void ODevice::init ( ) |
270 | { | 270 | { |
271 | } | 271 | } |
272 | 272 | ||
273 | /** | ||
274 | * This method initialises the button mapping | ||
275 | */ | ||
273 | void ODevice::initButtons ( ) | 276 | void ODevice::initButtons ( ) |
274 | { | 277 | { |
275 | if ( d-> m_buttons ) | 278 | if ( d-> m_buttons ) |
276 | return; | 279 | return; |
@@ -312,9 +315,19 @@ bool ODevice::setSoftSuspend ( bool /*soft*/ ) | |||
312 | //#include <linux/apm_bios.h> | 315 | //#include <linux/apm_bios.h> |
313 | 316 | ||
314 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) | 317 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) |
315 | 318 | ||
316 | 319 | /** | |
320 | * This method will try to suspend the device | ||
321 | * It only works if the user is the QWS Server and the apm application | ||
322 | * is installed. | ||
323 | * It tries to suspend and then waits some time cause some distributions | ||
324 | * do have asynchronus apm implementations. | ||
325 | * This method will either fail and return false or it'll suspend the | ||
326 | * device and return once the device got woken up | ||
327 | * | ||
328 | * @return if the device got suspended | ||
329 | */ | ||
317 | bool ODevice::suspend ( ) | 330 | bool ODevice::suspend ( ) |
318 | { | 331 | { |
319 | if ( !d-> m_qwsserver ) // only qwsserver is allowed to suspend | 332 | if ( !d-> m_qwsserver ) // only qwsserver is allowed to suspend |
320 | return false; | 333 | return false; |
@@ -353,9 +366,11 @@ bool ODevice::suspend ( ) | |||
353 | #define VESA_VSYNC_SUSPEND 1 | 366 | #define VESA_VSYNC_SUSPEND 1 |
354 | #define VESA_HSYNC_SUSPEND 2 | 367 | #define VESA_HSYNC_SUSPEND 2 |
355 | #define VESA_POWERDOWN 3 | 368 | #define VESA_POWERDOWN 3 |
356 | 369 | ||
357 | 370 | /** | |
371 | * This sets the display on or off | ||
372 | */ | ||
358 | bool ODevice::setDisplayStatus ( bool on ) | 373 | bool ODevice::setDisplayStatus ( bool on ) |
359 | { | 374 | { |
360 | if ( d-> m_model == Model_Unknown ) | 375 | if ( d-> m_model == Model_Unknown ) |
361 | return false; | 376 | return false; |
@@ -369,58 +384,93 @@ bool ODevice::setDisplayStatus ( bool on ) | |||
369 | } | 384 | } |
370 | return res; | 385 | return res; |
371 | } | 386 | } |
372 | 387 | ||
373 | bool ODevice::setDisplayBrightness ( int ) | 388 | /** |
389 | * This sets the display brightness | ||
390 | * @return success or failure | ||
391 | */ | ||
392 | bool ODevice::setDisplayBrightness ( int p) | ||
374 | { | 393 | { |
394 | Q_UNUSED( p ) | ||
375 | return false; | 395 | return false; |
376 | } | 396 | } |
377 | 397 | ||
378 | int ODevice::displayBrightnessResolution ( ) const | 398 | int ODevice::displayBrightnessResolution ( ) const |
379 | { | 399 | { |
380 | return 16; | 400 | return 16; |
381 | } | 401 | } |
382 | 402 | ||
403 | /** | ||
404 | * This returns the vendor as string | ||
405 | * @return Vendor as QString | ||
406 | */ | ||
383 | QString ODevice::vendorString ( ) const | 407 | QString ODevice::vendorString ( ) const |
384 | { | 408 | { |
385 | return d-> m_vendorstr; | 409 | return d-> m_vendorstr; |
386 | } | 410 | } |
387 | 411 | ||
412 | /** | ||
413 | * This returns the vendor as one of the values of OVendor | ||
414 | * @return OVendor | ||
415 | */ | ||
388 | OVendor ODevice::vendor ( ) const | 416 | OVendor ODevice::vendor ( ) const |
389 | { | 417 | { |
390 | return d-> m_vendor; | 418 | return d-> m_vendor; |
391 | } | 419 | } |
392 | 420 | ||
421 | /** | ||
422 | * This returns the model as a string | ||
423 | * @return A string representing the model | ||
424 | */ | ||
393 | QString ODevice::modelString ( ) const | 425 | QString ODevice::modelString ( ) const |
394 | { | 426 | { |
395 | return d-> m_modelstr; | 427 | return d-> m_modelstr; |
396 | } | 428 | } |
397 | 429 | ||
430 | /** | ||
431 | * This does return the OModel used | ||
432 | */ | ||
398 | OModel ODevice::model ( ) const | 433 | OModel ODevice::model ( ) const |
399 | { | 434 | { |
400 | return d-> m_model; | 435 | return d-> m_model; |
401 | } | 436 | } |
402 | 437 | ||
438 | /** | ||
439 | * This does return the systen name | ||
440 | */ | ||
403 | QString ODevice::systemString ( ) const | 441 | QString ODevice::systemString ( ) const |
404 | { | 442 | { |
405 | return d-> m_systemstr; | 443 | return d-> m_systemstr; |
406 | } | 444 | } |
407 | 445 | ||
446 | /** | ||
447 | * Return System as OSystem value | ||
448 | */ | ||
408 | OSystem ODevice::system ( ) const | 449 | OSystem ODevice::system ( ) const |
409 | { | 450 | { |
410 | return d-> m_system; | 451 | return d-> m_system; |
411 | } | 452 | } |
412 | 453 | ||
454 | /** | ||
455 | * @return the version string of the base system | ||
456 | */ | ||
413 | QString ODevice::systemVersionString ( ) const | 457 | QString ODevice::systemVersionString ( ) const |
414 | { | 458 | { |
415 | return d-> m_sysverstr; | 459 | return d-> m_sysverstr; |
416 | } | 460 | } |
417 | 461 | ||
462 | /** | ||
463 | * @return the current Transformation | ||
464 | */ | ||
418 | Transformation ODevice::rotation ( ) const | 465 | Transformation ODevice::rotation ( ) const |
419 | { | 466 | { |
420 | return d-> m_rotation; | 467 | return d-> m_rotation; |
421 | } | 468 | } |
422 | 469 | ||
470 | /** | ||
471 | * This plays an alarmSound | ||
472 | */ | ||
423 | void ODevice::alarmSound ( ) | 473 | void ODevice::alarmSound ( ) |
424 | { | 474 | { |
425 | #ifndef QT_NO_SOUND | 475 | #ifndef QT_NO_SOUND |
426 | static Sound snd ( "alarm" ); | 476 | static Sound snd ( "alarm" ); |
@@ -429,8 +479,11 @@ void ODevice::alarmSound ( ) | |||
429 | snd. play ( ); | 479 | snd. play ( ); |
430 | #endif | 480 | #endif |
431 | } | 481 | } |
432 | 482 | ||
483 | /** | ||
484 | * This plays a key sound | ||
485 | */ | ||
433 | void ODevice::keySound ( ) | 486 | void ODevice::keySound ( ) |
434 | { | 487 | { |
435 | #ifndef QT_NO_SOUND | 488 | #ifndef QT_NO_SOUND |
436 | static Sound snd ( "keysound" ); | 489 | static Sound snd ( "keysound" ); |
@@ -439,8 +492,11 @@ void ODevice::keySound ( ) | |||
439 | snd. play ( ); | 492 | snd. play ( ); |
440 | #endif | 493 | #endif |
441 | } | 494 | } |
442 | 495 | ||
496 | /** | ||
497 | * This plays a touch sound | ||
498 | */ | ||
443 | void ODevice::touchSound ( ) | 499 | void ODevice::touchSound ( ) |
444 | { | 500 | { |
445 | 501 | ||
446 | #ifndef QT_NO_SOUND | 502 | #ifndef QT_NO_SOUND |
@@ -450,56 +506,96 @@ void ODevice::touchSound ( ) | |||
450 | snd. play ( ); | 506 | snd. play ( ); |
451 | #endif | 507 | #endif |
452 | } | 508 | } |
453 | 509 | ||
454 | 510 | /** | |
511 | * This method will return a list of leds | ||
512 | * available on this device | ||
513 | * @return a list of LEDs. | ||
514 | */ | ||
455 | QValueList <OLed> ODevice::ledList ( ) const | 515 | QValueList <OLed> ODevice::ledList ( ) const |
456 | { | 516 | { |
457 | return QValueList <OLed> ( ); | 517 | return QValueList <OLed> ( ); |
458 | } | 518 | } |
459 | 519 | ||
520 | /** | ||
521 | * This does return the state of the LEDs | ||
522 | */ | ||
460 | QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const | 523 | QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const |
461 | { | 524 | { |
462 | return QValueList <OLedState> ( ); | 525 | return QValueList <OLedState> ( ); |
463 | } | 526 | } |
464 | 527 | ||
528 | /** | ||
529 | * @return the state for a given OLed | ||
530 | */ | ||
465 | OLedState ODevice::ledState ( OLed /*which*/ ) const | 531 | OLedState ODevice::ledState ( OLed /*which*/ ) const |
466 | { | 532 | { |
467 | return Led_Off; | 533 | return Led_Off; |
468 | } | 534 | } |
469 | 535 | ||
470 | bool ODevice::setLedState ( OLed /*which*/, OLedState /*st*/ ) | 536 | /** |
537 | * Set the state for a LED | ||
538 | * @param which Which OLed to use | ||
539 | * @param st The state to set | ||
540 | * @return success or failure | ||
541 | */ | ||
542 | bool ODevice::setLedState ( OLed which, OLedState st ) | ||
471 | { | 543 | { |
544 | Q_UNUSED( which ) | ||
545 | Q_UNUSED( st ) | ||
472 | return false; | 546 | return false; |
473 | } | 547 | } |
474 | 548 | ||
549 | /** | ||
550 | * @return if the device has a light sensor | ||
551 | */ | ||
475 | bool ODevice::hasLightSensor ( ) const | 552 | bool ODevice::hasLightSensor ( ) const |
476 | { | 553 | { |
477 | return false; | 554 | return false; |
478 | } | 555 | } |
479 | 556 | ||
557 | /** | ||
558 | * @return a value from the light senso | ||
559 | */ | ||
480 | int ODevice::readLightSensor ( ) | 560 | int ODevice::readLightSensor ( ) |
481 | { | 561 | { |
482 | return -1; | 562 | return -1; |
483 | } | 563 | } |
484 | 564 | ||
565 | /** | ||
566 | * @return the light sensor resolution whatever that is ;) | ||
567 | */ | ||
485 | int ODevice::lightSensorResolution ( ) const | 568 | int ODevice::lightSensorResolution ( ) const |
486 | { | 569 | { |
487 | return 0; | 570 | return 0; |
488 | } | 571 | } |
489 | 572 | ||
573 | /** | ||
574 | * @return a list of hardware buttons | ||
575 | */ | ||
490 | const QValueList <ODeviceButton> &ODevice::buttons ( ) | 576 | const QValueList <ODeviceButton> &ODevice::buttons ( ) |
491 | { | 577 | { |
492 | initButtons ( ); | 578 | initButtons ( ); |
493 | 579 | ||
494 | return *d-> m_buttons; | 580 | return *d-> m_buttons; |
495 | } | 581 | } |
496 | 582 | ||
583 | /** | ||
584 | * @return The amount of time that would count as a hold | ||
585 | */ | ||
497 | uint ODevice::buttonHoldTime ( ) const | 586 | uint ODevice::buttonHoldTime ( ) const |
498 | { | 587 | { |
499 | return d-> m_holdtime; | 588 | return d-> m_holdtime; |
500 | } | 589 | } |
501 | 590 | ||
591 | /** | ||
592 | * This method return a ODeviceButton for a key code | ||
593 | * or 0 if no special hardware button is available for the device | ||
594 | * | ||
595 | * @return The devicebutton or 0l | ||
596 | * @see ODeviceButton | ||
597 | */ | ||
502 | const ODeviceButton *ODevice::buttonForKeycode ( ushort code ) | 598 | const ODeviceButton *ODevice::buttonForKeycode ( ushort code ) |
503 | { | 599 | { |
504 | initButtons ( ); | 600 | initButtons ( ); |
505 | 601 | ||
diff --git a/libopie/odevice.h b/libopie/odevice.h index ff578d8..45a790b 100644 --- a/libopie/odevice.h +++ b/libopie/odevice.h | |||
@@ -31,10 +31,13 @@ | |||
31 | class ODeviceData; | 31 | class ODeviceData; |
32 | 32 | ||
33 | namespace Opie { | 33 | namespace Opie { |
34 | 34 | ||
35 | /** | ||
36 | * The available devices | ||
37 | */ | ||
35 | enum OModel { | 38 | enum OModel { |
36 | Model_Unknown, | 39 | Model_Unknown, // = 0 |
37 | 40 | ||
38 | Model_Series_Mask = 0xff000000, | 41 | Model_Series_Mask = 0xff000000, |
39 | 42 | ||
40 | Model_iPAQ = ( 1 << 24 ), | 43 | Model_iPAQ = ( 1 << 24 ), |
@@ -54,15 +57,21 @@ enum OModel { | |||
54 | Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ), | 57 | Model_Zaurus_SLB600 = ( Model_Zaurus | 0x000004 ), |
55 | Model_Zaurus_SLC700 = ( Model_Zaurus | 0x000005 ), | 58 | Model_Zaurus_SLC700 = ( Model_Zaurus | 0x000005 ), |
56 | }; | 59 | }; |
57 | 60 | ||
61 | /** | ||
62 | * The vendor of the device | ||
63 | */ | ||
58 | enum OVendor { | 64 | enum OVendor { |
59 | Vendor_Unknown, | 65 | Vendor_Unknown, |
60 | 66 | ||
61 | Vendor_HP, | 67 | Vendor_HP, |
62 | Vendor_Sharp | 68 | Vendor_Sharp |
63 | }; | 69 | }; |
64 | 70 | ||
71 | /** | ||
72 | * The System used | ||
73 | */ | ||
65 | enum OSystem { | 74 | enum OSystem { |
66 | System_Unknown, | 75 | System_Unknown, |
67 | 76 | ||
68 | System_Familiar, | 77 | System_Familiar, |
@@ -93,12 +102,24 @@ enum OHardKey { | |||
93 | HardKey_Suspend = Qt::Key_F34, | 102 | HardKey_Suspend = Qt::Key_F34, |
94 | HardKey_Backlight = Qt::Key_F35, | 103 | HardKey_Backlight = Qt::Key_F35, |
95 | }; | 104 | }; |
96 | 105 | ||
106 | /** | ||
107 | * A singleton which gives informations about device specefic option | ||
108 | * like the Hardware used, LEDs, the Base Distribution and | ||
109 | * hardware key mappings. | ||
110 | * | ||
111 | * | ||
112 | * @short A small class for device specefic options | ||
113 | * @see QObject | ||
114 | * @author Robert Griebl | ||
115 | * @version 1.0 | ||
116 | */ | ||
97 | class ODevice : public QObject { | 117 | class ODevice : public QObject { |
98 | Q_OBJECT | 118 | Q_OBJECT |
99 | 119 | ||
100 | private: | 120 | private: |
121 | /* disable copy */ | ||
101 | ODevice ( const ODevice & ); | 122 | ODevice ( const ODevice & ); |
102 | 123 | ||
103 | protected: | 124 | protected: |
104 | ODevice ( ); | 125 | ODevice ( ); |
@@ -107,10 +128,12 @@ protected: | |||
107 | 128 | ||
108 | ODeviceData *d; | 129 | ODeviceData *d; |
109 | 130 | ||
110 | public: | 131 | public: |
132 | // sandman do we want to allow destructions? -zecke? | ||
111 | virtual ~ODevice ( ); | 133 | virtual ~ODevice ( ); |
112 | 134 | ||
135 | |||
113 | static ODevice *inst ( ); | 136 | static ODevice *inst ( ); |
114 | 137 | ||
115 | // information | 138 | // information |
116 | 139 | ||
@@ -137,9 +160,9 @@ public: | |||
137 | virtual bool setDisplayBrightness ( int brightness ); | 160 | virtual bool setDisplayBrightness ( int brightness ); |
138 | virtual int displayBrightnessResolution ( ) const; | 161 | virtual int displayBrightnessResolution ( ) const; |
139 | 162 | ||
140 | // input / output | 163 | // input / output |
141 | 164 | //FIXME playAlarmSound and al might be better -zecke | |
142 | virtual void alarmSound ( ); | 165 | virtual void alarmSound ( ); |
143 | virtual void keySound ( ); | 166 | virtual void keySound ( ); |
144 | virtual void touchSound ( ); | 167 | virtual void touchSound ( ); |
145 | 168 | ||
diff --git a/libopie/odevicebutton.h b/libopie/odevicebutton.h index 5281ab2..cf91bbd 100644 --- a/libopie/odevicebutton.h +++ b/libopie/odevicebutton.h | |||
@@ -57,8 +57,12 @@ private: | |||
57 | * This class represents a physical button on a Qtopia device. A device may | 57 | * This class represents a physical button on a Qtopia device. A device may |
58 | * have n "user programmable" buttons, which are number 1..n. The location | 58 | * have n "user programmable" buttons, which are number 1..n. The location |
59 | * and number of buttons will vary from device to device. userText() and pixmap() | 59 | * and number of buttons will vary from device to device. userText() and pixmap() |
60 | * may be used to describe this button to the user in help documentation. | 60 | * may be used to describe this button to the user in help documentation. |
61 | * | ||
62 | * @version 1.0 | ||
63 | * @author Trolltech | ||
64 | * @short A representation of buttons | ||
61 | */ | 65 | */ |
62 | 66 | ||
63 | class ODeviceButton | 67 | class ODeviceButton |
64 | { | 68 | { |
diff --git a/libopie/ofiledialog.cc b/libopie/ofiledialog.cc index 4783004..9e725c2 100644 --- a/libopie/ofiledialog.cc +++ b/libopie/ofiledialog.cc | |||
@@ -32,8 +32,19 @@ | |||
32 | #include <qlayout.h> | 32 | #include <qlayout.h> |
33 | 33 | ||
34 | #include "ofiledialog.h" | 34 | #include "ofiledialog.h" |
35 | 35 | ||
36 | /** | ||
37 | * This constructs a modal dialog | ||
38 | * | ||
39 | * @param caption The caption of the dialog | ||
40 | * @param wid The parent widget | ||
41 | * @param mode The mode of the OFileSelector @see OFileSelector | ||
42 | * @param selector The selector of the OFileSelector | ||
43 | * @param dirName the dir or resource to start from | ||
44 | * @param fileName a proposed or existing filename | ||
45 | * @param mimetypes The mimeTypes | ||
46 | */ | ||
36 | OFileDialog::OFileDialog(const QString &caption, | 47 | OFileDialog::OFileDialog(const QString &caption, |
37 | QWidget *wid, int mode, int selector, | 48 | QWidget *wid, int mode, int selector, |
38 | const QString &dirName, | 49 | const QString &dirName, |
39 | const QString &fileName, | 50 | const QString &fileName, |
@@ -59,20 +70,44 @@ OFileDialog::OFileDialog(const QString &caption, | |||
59 | 70 | ||
60 | 71 | ||
61 | file->setYesCancelVisible( false ); // relayout | 72 | file->setYesCancelVisible( false ); // relayout |
62 | } | 73 | } |
74 | /** | ||
75 | * @returns the mimetype of the selected | ||
76 | * currently it return QString::null | ||
77 | */ | ||
63 | QString OFileDialog::mimetype()const | 78 | QString OFileDialog::mimetype()const |
64 | { | 79 | { |
65 | return QString::null; | 80 | return QString::null; |
66 | } | 81 | } |
82 | |||
83 | /** | ||
84 | * @return the fileName | ||
85 | */ | ||
67 | QString OFileDialog::fileName()const | 86 | QString OFileDialog::fileName()const |
68 | { | 87 | { |
69 | return file->selectedName(); | 88 | return file->selectedName(); |
70 | } | 89 | } |
90 | |||
91 | /** | ||
92 | * return a DocLnk to the current file | ||
93 | */ | ||
71 | DocLnk OFileDialog::selectedDocument()const | 94 | DocLnk OFileDialog::selectedDocument()const |
72 | { | 95 | { |
73 | return file->selectedDocument(); | 96 | return file->selectedDocument(); |
74 | } | 97 | } |
98 | |||
99 | /** | ||
100 | * This opens up a filedialog in Open mode | ||
101 | * | ||
102 | * @param selector the Selector Mode | ||
103 | * @param startDir Where to start from | ||
104 | * @param file A proposed filename | ||
105 | * @param mimes A list of MimeTypes | ||
106 | * @param wid the parent | ||
107 | * @param caption of the dialog if QString::null tr("Open") will be used | ||
108 | * @return the fileName or QString::null | ||
109 | */ | ||
75 | QString OFileDialog::getOpenFileName(int selector, | 110 | QString OFileDialog::getOpenFileName(int selector, |
76 | const QString &startDir, | 111 | const QString &startDir, |
77 | const QString &file, | 112 | const QString &file, |
78 | const MimeTypes &mimes, | 113 | const MimeTypes &mimes, |
@@ -87,8 +122,13 @@ QString OFileDialog::getOpenFileName(int selector, | |||
87 | ret = dlg.fileName(); | 122 | ret = dlg.fileName(); |
88 | 123 | ||
89 | return ret; | 124 | return ret; |
90 | } | 125 | } |
126 | |||
127 | /** | ||
128 | * This opens up a file dialog in save mode | ||
129 | * @see getOpenFileName | ||
130 | */ | ||
91 | QString OFileDialog::getSaveFileName(int selector, | 131 | QString OFileDialog::getSaveFileName(int selector, |
92 | const QString &startDir, | 132 | const QString &startDir, |
93 | const QString &file, | 133 | const QString &file, |
94 | const MimeTypes &mimes, | 134 | const MimeTypes &mimes, |
diff --git a/libopie/ofiledialog.h b/libopie/ofiledialog.h index e14253c..309086b 100644 --- a/libopie/ofiledialog.h +++ b/libopie/ofiledialog.h | |||
@@ -33,8 +33,31 @@ | |||
33 | #include <qdialog.h> | 33 | #include <qdialog.h> |
34 | 34 | ||
35 | #include <opie/ofileselector.h> | 35 | #include <opie/ofileselector.h> |
36 | 36 | ||
37 | /** | ||
38 | * This class places a OFileSelector inside a QDialog. | ||
39 | * It provides static method for letting a user chose | ||
40 | * a file for either opening or saving. | ||
41 | * Most of the time the c'tor will not be used instead using | ||
42 | * the static member functions is prefered. | ||
43 | * | ||
44 | * <pre> | ||
45 | * QMap<QString, QStringList> mimeTypes; | ||
46 | * QStringList types; | ||
47 | * types << "text/* "; | ||
48 | * mimeTypes.insert( tr("Text"), types ); | ||
49 | * mimeTypes.insert( tr("All"), " * / * " ); // remove the spaces in the 2nd comment | ||
50 | * QString fileName= OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, | ||
51 | * "foo","bar", mimeTypes); | ||
52 | * </pre> | ||
53 | * | ||
54 | * @short A small QDialog swalloing a FileSelector | ||
55 | * @see QDialog | ||
56 | * @see OFileSelector | ||
57 | * @version 0.1-unfinished | ||
58 | * @author Holger Freyther ( zecke@handhelds.org ) | ||
59 | */ | ||
37 | class OFileDialog : public QDialog { | 60 | class OFileDialog : public QDialog { |
38 | Q_OBJECT | 61 | Q_OBJECT |
39 | public: | 62 | public: |
40 | OFileDialog(const QString &caption, | 63 | OFileDialog(const QString &caption, |
diff --git a/libopie/ofileselector.h b/libopie/ofileselector.h index 17c494e..06ac806 100644 --- a/libopie/ofileselector.h +++ b/libopie/ofileselector.h | |||
@@ -120,8 +120,10 @@ class OFileSelector : public QWidget { | |||
120 | 120 | ||
121 | ~OFileSelector(); | 121 | ~OFileSelector(); |
122 | 122 | ||
123 | // currently only for the FILESELECTOR Mode | 123 | // currently only for the FILESELECTOR Mode |
124 | /** | ||
125 | */ | ||
124 | void setNewVisible( bool /*b*/ ); | 126 | void setNewVisible( bool /*b*/ ); |
125 | void setCloseVisible(bool /*b*/ ); | 127 | void setCloseVisible(bool /*b*/ ); |
126 | 128 | ||
127 | // end file selector mode | 129 | // end file selector mode |
diff --git a/libopie/ofontmenu.cc b/libopie/ofontmenu.cc index 52ff3ee..d16c5e5 100644 --- a/libopie/ofontmenu.cc +++ b/libopie/ofontmenu.cc | |||
@@ -3,9 +3,15 @@ | |||
3 | #include <qpe/config.h> | 3 | #include <qpe/config.h> |
4 | #include "ofontmenu.h" | 4 | #include "ofontmenu.h" |
5 | 5 | ||
6 | 6 | ||
7 | 7 | /** | |
8 | * Constructs the FontMenu. | ||
9 | * | ||
10 | * @param parent The parent widget | ||
11 | * @param name A name for this widget | ||
12 | * @param list The list of widgets to be controlled | ||
13 | */ | ||
8 | OFontMenu::OFontMenu(QWidget *parent, const char *name, const QList<QWidget> &list ) | 14 | OFontMenu::OFontMenu(QWidget *parent, const char *name, const QList<QWidget> &list ) |
9 | : QPopupMenu( parent, name ) | 15 | : QPopupMenu( parent, name ) |
10 | { | 16 | { |
11 | m_list = list; | 17 | m_list = list; |
@@ -19,13 +25,26 @@ OFontMenu::OFontMenu(QWidget *parent, const char *name, const QList<QWidget> &li | |||
19 | 0, 12 ); | 25 | 0, 12 ); |
20 | setCheckable( true ); | 26 | setCheckable( true ); |
21 | m_size=10; | 27 | m_size=10; |
22 | } | 28 | } |
29 | |||
30 | /** | ||
31 | * This method saves the font size | ||
32 | * into a Config object | ||
33 | * OFontMenu will be used as group and size as key | ||
34 | * @param cfg The Config object to be used | ||
35 | */ | ||
23 | void OFontMenu::save(Config *cfg ) | 36 | void OFontMenu::save(Config *cfg ) |
24 | { | 37 | { |
25 | cfg->setGroup("OFontMenu" ); | 38 | cfg->setGroup("OFontMenu" ); |
26 | cfg->writeEntry("size", m_size ); | 39 | cfg->writeEntry("size", m_size ); |
27 | } | 40 | } |
41 | |||
42 | /** | ||
43 | * This method restores the font size from a Config object | ||
44 | * it'll apply the sizes to the widgets and will also set the | ||
45 | * menu appropriate | ||
46 | */ | ||
28 | void OFontMenu::restore(Config *cfg ) | 47 | void OFontMenu::restore(Config *cfg ) |
29 | { | 48 | { |
30 | cfg->setGroup("OFontMeny" ); | 49 | cfg->setGroup("OFontMeny" ); |
31 | m_size = cfg->readNumEntry("size" ); | 50 | m_size = cfg->readNumEntry("size" ); |
@@ -46,24 +65,49 @@ void OFontMenu::restore(Config *cfg ) | |||
46 | break; | 65 | break; |
47 | } | 66 | } |
48 | setFontSize( m_size ); | 67 | setFontSize( m_size ); |
49 | } | 68 | } |
69 | |||
70 | /** | ||
71 | * set the list of widgets | ||
72 | * @param list the widget list | ||
73 | */ | ||
50 | void OFontMenu::setWidgets(const QList<QWidget> &list ) | 74 | void OFontMenu::setWidgets(const QList<QWidget> &list ) |
51 | { | 75 | { |
52 | m_list = list; | 76 | m_list = list; |
53 | } | 77 | } |
78 | |||
79 | /** | ||
80 | * add a widget to the list | ||
81 | * @param wid The widget to be added | ||
82 | */ | ||
54 | void OFontMenu::addWidget( QWidget *wid ) | 83 | void OFontMenu::addWidget( QWidget *wid ) |
55 | { | 84 | { |
56 | m_list.append(wid ); | 85 | m_list.append(wid ); |
57 | } | 86 | } |
87 | |||
88 | /** | ||
89 | * removes the widget from the list of controlled objects | ||
90 | * @param wid the to be removed widget | ||
91 | */ | ||
58 | void OFontMenu::removeWidget( QWidget *wid ) | 92 | void OFontMenu::removeWidget( QWidget *wid ) |
59 | { | 93 | { |
60 | m_list.remove( wid ); | 94 | m_list.remove( wid ); |
61 | } | 95 | } |
96 | |||
97 | /** | ||
98 | * The list of controlled widgets | ||
99 | */ | ||
62 | const QList<QWidget> &OFontMenu::widgets()const | 100 | const QList<QWidget> &OFontMenu::widgets()const |
63 | { | 101 | { |
64 | return m_list; | 102 | return m_list; |
65 | } | 103 | } |
104 | |||
105 | /** | ||
106 | * Forces a size on a widget | ||
107 | * @param wid The widget | ||
108 | * @param size The font size forced onto the widget | ||
109 | */ | ||
66 | void OFontMenu::forceSize(QWidget *wid, int size ) | 110 | void OFontMenu::forceSize(QWidget *wid, int size ) |
67 | { | 111 | { |
68 | WidSize *widz = new WidSize; | 112 | WidSize *widz = new WidSize; |
69 | widz->wid = wid; | 113 | widz->wid = wid; |
diff --git a/libopie/ofontmenu.h b/libopie/ofontmenu.h index 5fd515f..6e143ca 100644 --- a/libopie/ofontmenu.h +++ b/libopie/ofontmenu.h | |||
@@ -36,19 +36,43 @@ | |||
36 | 36 | ||
37 | #include <qpopupmenu.h> | 37 | #include <qpopupmenu.h> |
38 | #include <qlist.h> | 38 | #include <qlist.h> |
39 | 39 | ||
40 | 40 | /* | |
41 | * @internal | ||
42 | */ | ||
41 | namespace { | 43 | namespace { |
42 | struct WidSize { | 44 | struct WidSize { |
43 | QWidget *wid; | 45 | QWidget *wid; |
44 | int size; | 46 | int size; |
45 | }; | 47 | }; |
46 | 48 | ||
47 | }; | 49 | }; |
48 | 50 | ||
49 | // if i would be on kde this would be a KActionMenu... | 51 | // forward declarations |
50 | class Config; | 52 | class Config; |
53 | |||
54 | /** | ||
55 | * This class is a specialised QPopupMenu. It'll display three different | ||
56 | * font sizes. Small, Normal and large by adding widgets to the Menu | ||
57 | * you can control the font size of these widgets | ||
58 | * by using the save and restore method you can also apply font sizes | ||
59 | * over two different runtimes | ||
60 | * | ||
61 | * <pre> | ||
62 | * QTable* tbl = new QTable(); | ||
63 | * QList<QWidget> wid; | ||
64 | * wid.append( tbl ); | ||
65 | * OFontMenu* menu = new OFontMenu(this, "Popup Menu", wid ); | ||
66 | * Config cfg("mycfg"); | ||
67 | * menu->restore( cfg ); | ||
68 | * </pre> | ||
69 | * | ||
70 | * @author Holger Freyther ( zecke@handhelds.org ) | ||
71 | * @version 0.1 | ||
72 | * @short PopupMenu which can control the size of Widgets | ||
73 | * @see QPopupMenu | ||
74 | */ | ||
51 | class OFontMenu : public QPopupMenu { | 75 | class OFontMenu : public QPopupMenu { |
52 | Q_OBJECT | 76 | Q_OBJECT |
53 | public: | 77 | public: |
54 | OFontMenu(QWidget *parent, const char* name, const QList<QWidget> &list ); | 78 | OFontMenu(QWidget *parent, const char* name, const QList<QWidget> &list ); |
@@ -60,15 +84,21 @@ class OFontMenu : public QPopupMenu { | |||
60 | void removeWidget(QWidget *wid ); | 84 | void removeWidget(QWidget *wid ); |
61 | const QList<QWidget> &widgets()const; | 85 | const QList<QWidget> &widgets()const; |
62 | 86 | ||
63 | signals: | 87 | signals: |
88 | /** | ||
89 | * this signal gets emitted when the font size gets changed | ||
90 | * @param size The new size of font | ||
91 | */ | ||
64 | void fontChanged(int size ); | 92 | void fontChanged(int size ); |
93 | |||
65 | private: | 94 | private: |
66 | QList<QWidget> m_list; | 95 | QList<QWidget> m_list; |
67 | QList<WidSize> m_wids; | 96 | QList<WidSize> m_wids; |
68 | int m_size; | 97 | int m_size; |
69 | class OFontMenuPrivate; | 98 | class OFontMenuPrivate; |
70 | OFontMenuPrivate *d; | 99 | OFontMenuPrivate *d; |
100 | |||
71 | private slots: | 101 | private slots: |
72 | virtual void slotSmall(); | 102 | virtual void slotSmall(); |
73 | virtual void slotMedium(); | 103 | virtual void slotMedium(); |
74 | virtual void slotLarge(); | 104 | virtual void slotLarge(); |
diff --git a/libopie/ofontselector.cpp b/libopie/ofontselector.cpp index b905474..c8471cc 100644 --- a/libopie/ofontselector.cpp +++ b/libopie/ofontselector.cpp | |||
@@ -43,13 +43,14 @@ public: | |||
43 | QComboBox * m_font_style_list; | 43 | QComboBox * m_font_style_list; |
44 | QComboBox * m_font_size_list; | 44 | QComboBox * m_font_size_list; |
45 | QMultiLineEdit *m_preview; | 45 | QMultiLineEdit *m_preview; |
46 | 46 | ||
47 | bool m_pointbug; | 47 | bool m_pointbug : 1; |
48 | 48 | ||
49 | FontDatabase m_fdb; | 49 | FontDatabase m_fdb; |
50 | }; | 50 | }; |
51 | 51 | ||
52 | namespace { | ||
52 | 53 | ||
53 | class FontListItem : public QListBoxText { | 54 | class FontListItem : public QListBoxText { |
54 | public: | 55 | public: |
55 | FontListItem ( const QString &t, const QStringList &styles, const QValueList<int> &sizes ) : QListBoxText ( ) | 56 | FontListItem ( const QString &t, const QStringList &styles, const QValueList<int> &sizes ) : QListBoxText ( ) |
@@ -93,17 +94,24 @@ static int findItemCB ( QComboBox *box, const QString &str ) | |||
93 | } | 94 | } |
94 | return -1; | 95 | return -1; |
95 | } | 96 | } |
96 | 97 | ||
97 | 98 | } | |
99 | /* static same as anon. namespace */ | ||
98 | static int qt_version ( ) | 100 | static int qt_version ( ) |
99 | { | 101 | { |
100 | const char *qver = qVersion ( ); | 102 | const char *qver = qVersion ( ); |
101 | 103 | ||
102 | return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); | 104 | return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); |
103 | } | 105 | } |
104 | 106 | ||
105 | 107 | /** | |
108 | * Constructs the Selector object | ||
109 | * @param withpreview If a font preview should be given | ||
110 | * @param parent The parent of the Font Selector | ||
111 | * @param name The name of the object | ||
112 | * @param fl WidgetFlags | ||
113 | */ | ||
106 | OFontSelector::OFontSelector ( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) | 114 | OFontSelector::OFontSelector ( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) |
107 | { | 115 | { |
108 | d = new OFontSelectorPrivate ( ); | 116 | d = new OFontSelectorPrivate ( ); |
109 | 117 | ||
@@ -151,14 +159,27 @@ OFontSelector::~OFontSelector ( ) | |||
151 | { | 159 | { |
152 | delete d; | 160 | delete d; |
153 | } | 161 | } |
154 | 162 | ||
163 | /** | ||
164 | * This methods tries to set the font | ||
165 | * @param f The wishes font | ||
166 | * @return success or failure | ||
167 | */ | ||
155 | bool OFontSelector::setSelectedFont ( const QFont &f ) | 168 | bool OFontSelector::setSelectedFont ( const QFont &f ) |
156 | { | 169 | { |
157 | return setSelectedFont ( f. family ( ), d-> m_fdb. styleString ( f ), f. pointSize ( ), QFont::encodingName ( f. charSet ( ))); | 170 | return setSelectedFont ( f. family ( ), d-> m_fdb. styleString ( f ), f. pointSize ( ), QFont::encodingName ( f. charSet ( ))); |
158 | } | 171 | } |
159 | 172 | ||
160 | bool OFontSelector::setSelectedFont ( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & /*charset*/ ) | 173 | |
174 | /** | ||
175 | * This is an overloaded method @see setSelectedFont | ||
176 | * @param familyStr The family of the font | ||
177 | * @param styleStr The style of the font | ||
178 | * @param sizeVal The size of font | ||
179 | * @param charset The charset to be used. Will be deprecated by QT3 | ||
180 | */ | ||
181 | bool OFontSelector::setSelectedFont ( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset ) | ||
161 | { | 182 | { |
162 | QString sizeStr = QString::number ( sizeVal ); | 183 | QString sizeStr = QString::number ( sizeVal ); |
163 | 184 | ||
164 | QListBoxItem *family = d-> m_font_family_list-> findItem ( familyStr ); | 185 | QListBoxItem *family = d-> m_font_family_list-> findItem ( familyStr ); |
@@ -187,45 +208,72 @@ bool OFontSelector::setSelectedFont ( const QString &familyStr, const QString &s | |||
187 | 208 | ||
188 | return (( family ) && ( style >= 0 ) && ( size >= 0 )); | 209 | return (( family ) && ( style >= 0 ) && ( size >= 0 )); |
189 | } | 210 | } |
190 | 211 | ||
212 | /** | ||
213 | * This method returns the name, style and size of the currently selected | ||
214 | * font or false if no font is selected | ||
215 | * @param family The font family will be written there | ||
216 | * @param style The style will be written there | ||
217 | * @param size The size will be written there | ||
218 | * @return success or failure | ||
219 | */ | ||
191 | bool OFontSelector::selectedFont ( QString &family, QString &style, int &size ) | 220 | bool OFontSelector::selectedFont ( QString &family, QString &style, int &size ) |
192 | { | 221 | { |
193 | QString dummy; | 222 | QString dummy; |
194 | return selectedFont ( family, style, size, dummy ); | 223 | return selectedFont ( family, style, size, dummy ); |
195 | } | 224 | } |
196 | 225 | ||
197 | 226 | ||
227 | /** | ||
228 | * This method does return the font family or QString::null if there is | ||
229 | * no font item selected | ||
230 | * @return the font family | ||
231 | */ | ||
198 | QString OFontSelector::fontFamily ( ) const | 232 | QString OFontSelector::fontFamily ( ) const |
199 | { | 233 | { |
200 | FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( )); | 234 | FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( )); |
201 | 235 | ||
202 | return fli ? fli-> family ( ) : QString::null; | 236 | return fli ? fli-> family ( ) : QString::null; |
203 | } | 237 | } |
204 | 238 | ||
239 | /** | ||
240 | * This method will return the style of the font or QString::null | ||
241 | * @return the style of the font | ||
242 | */ | ||
205 | QString OFontSelector::fontStyle ( ) const | 243 | QString OFontSelector::fontStyle ( ) const |
206 | { | 244 | { |
207 | FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( )); | 245 | FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( )); |
208 | int fst = d-> m_font_style_list-> currentItem ( ); | 246 | int fst = d-> m_font_style_list-> currentItem ( ); |
209 | 247 | ||
210 | return ( fli && fst >= 0 ) ? fli-> styles ( ) [fst] : QString::null; | 248 | return ( fli && fst >= 0 ) ? fli-> styles ( ) [fst] : QString::null; |
211 | } | 249 | } |
212 | 250 | ||
251 | /** | ||
252 | * This method will return the font size or 10 if no font size is available | ||
253 | */ | ||
213 | int OFontSelector::fontSize ( ) const | 254 | int OFontSelector::fontSize ( ) const |
214 | { | 255 | { |
215 | FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( )); | 256 | FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( )); |
216 | int fsi = d-> m_font_size_list-> currentItem ( ); | 257 | int fsi = d-> m_font_size_list-> currentItem ( ); |
217 | 258 | ||
218 | return ( fli && fsi >= 0 ) ? fli-> sizes ( ) [fsi] : 10; | 259 | return ( fli && fsi >= 0 ) ? fli-> sizes ( ) [fsi] : 10; |
219 | } | 260 | } |
220 | 261 | ||
262 | /** | ||
263 | * returns the charset of the font or QString::null | ||
264 | */ | ||
221 | QString OFontSelector::fontCharSet ( ) const | 265 | QString OFontSelector::fontCharSet ( ) const |
222 | { | 266 | { |
223 | FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( )); | 267 | FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( )); |
224 | 268 | ||
225 | return fli ? d-> m_fdb. charSets ( fli-> family ( )) [0] : QString::null; | 269 | return fli ? d-> m_fdb. charSets ( fli-> family ( )) [0] : QString::null; |
226 | } | 270 | } |
227 | 271 | ||
272 | /** | ||
273 | * Overloaded member function see above | ||
274 | * @see selectedFont | ||
275 | */ | ||
228 | bool OFontSelector::selectedFont ( QString &family, QString &style, int &size, QString &charset ) | 276 | bool OFontSelector::selectedFont ( QString &family, QString &style, int &size, QString &charset ) |
229 | { | 277 | { |
230 | int ffa = d-> m_font_family_list-> currentItem ( ); | 278 | int ffa = d-> m_font_family_list-> currentItem ( ); |
231 | int fst = d-> m_font_style_list-> currentItem ( ); | 279 | int fst = d-> m_font_style_list-> currentItem ( ); |
@@ -326,9 +374,11 @@ void OFontSelector::changeFont ( ) | |||
326 | 374 | ||
327 | emit fontSelected ( f ); | 375 | emit fontSelected ( f ); |
328 | } | 376 | } |
329 | 377 | ||
330 | 378 | /** | |
379 | * Return the selected font | ||
380 | */ | ||
331 | QFont OFontSelector::selectedFont ( ) | 381 | QFont OFontSelector::selectedFont ( ) |
332 | { | 382 | { |
333 | int ffa = d-> m_font_family_list-> currentItem ( ); | 383 | int ffa = d-> m_font_family_list-> currentItem ( ); |
334 | int fst = d-> m_font_style_list-> currentItem ( ); | 384 | int fst = d-> m_font_style_list-> currentItem ( ); |
diff --git a/libopie/ofontselector.h b/libopie/ofontselector.h index 10d16f0..95ffd04 100644 --- a/libopie/ofontselector.h +++ b/libopie/ofontselector.h | |||
@@ -25,17 +25,27 @@ | |||
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef __OPIE_FONTSELECTOR_H__ | 29 | #ifndef OPIE_FONTSELECTOR_H__ |
30 | #define __OPIE_FONTSELECTOR_H__ | 30 | #define OPIE_FONTSELECTOR_H__ |
31 | 31 | ||
32 | #include <qwidget.h> | 32 | #include <qwidget.h> |
33 | 33 | ||
34 | class QListBox; | 34 | class QListBox; |
35 | class OFontSelectorPrivate; | 35 | class OFontSelectorPrivate; |
36 | 36 | ||
37 | 37 | /** | |
38 | * This class lets you chose a Font out of a list of Fonts. | ||
39 | * It can show a preview too. This selector will use all available | ||
40 | * fonts | ||
41 | * | ||
42 | * | ||
43 | * @short A widget to select a font | ||
44 | * @see QWidget | ||
45 | * @see QFont | ||
46 | * @author Rober Griebl | ||
47 | */ | ||
38 | class OFontSelector : public QWidget | 48 | class OFontSelector : public QWidget |
39 | { | 49 | { |
40 | Q_OBJECT | 50 | Q_OBJECT |
41 | 51 | ||
@@ -56,8 +66,11 @@ public: | |||
56 | int fontSize ( ) const; | 66 | int fontSize ( ) const; |
57 | QString fontCharSet ( ) const; | 67 | QString fontCharSet ( ) const; |
58 | 68 | ||
59 | signals: | 69 | signals: |
70 | /** | ||
71 | * This signal gets emitted when a font got chosen | ||
72 | */ | ||
60 | void fontSelected ( const QFont & ); | 73 | void fontSelected ( const QFont & ); |
61 | 74 | ||
62 | protected slots: | 75 | protected slots: |
63 | virtual void fontFamilyClicked ( int ); | 76 | virtual void fontFamilyClicked ( int ); |
diff --git a/libopie/orecurrancewidget.cpp b/libopie/orecurrancewidget.cpp index db86184..471249d 100644 --- a/libopie/orecurrancewidget.cpp +++ b/libopie/orecurrancewidget.cpp | |||
@@ -25,9 +25,17 @@ const QString dayLabel[] = { QObject::tr("Monday"), | |||
25 | static QString numberPlacing( int x );// return the proper word format for | 25 | static QString numberPlacing( int x );// return the proper word format for |
26 | // x (1st, 2nd, etc) | 26 | // x (1st, 2nd, etc) |
27 | static int week( const QDate &dt ); // what week in the month is dt? | 27 | static int week( const QDate &dt ); // what week in the month is dt? |
28 | 28 | ||
29 | 29 | /** | |
30 | * Constructs the Widget | ||
31 | * @param startOnMonday Does the week start on monday | ||
32 | * @param newStart The start date of the recurrence | ||
33 | * @param parent The parent widget | ||
34 | * @param name the name of object | ||
35 | * @param modal if the dialog should be modal | ||
36 | * @param fl Additional window flags | ||
37 | */ | ||
30 | ORecurranceWidget::ORecurranceWidget( bool startOnMonday, | 38 | ORecurranceWidget::ORecurranceWidget( bool startOnMonday, |
31 | const QDate& newStart, | 39 | const QDate& newStart, |
32 | QWidget* parent, | 40 | QWidget* parent, |
33 | const char* name, | 41 | const char* name, |
@@ -42,8 +50,19 @@ ORecurranceWidget::ORecurranceWidget( bool startOnMonday, | |||
42 | fraType->setButton( currInterval ); | 50 | fraType->setButton( currInterval ); |
43 | chkNoEnd->setChecked( TRUE ); | 51 | chkNoEnd->setChecked( TRUE ); |
44 | setupNone(); | 52 | setupNone(); |
45 | } | 53 | } |
54 | |||
55 | /** | ||
56 | * Different constructor | ||
57 | * @param startOnMonday Does the week start on monday? | ||
58 | * @param rp Already set ORecur object | ||
59 | * @param startDate The start date | ||
60 | * @param parent The parent widget | ||
61 | * @param name The name of the object | ||
62 | * @param modal | ||
63 | * @param fl The flags for window | ||
64 | */ | ||
46 | ORecurranceWidget::ORecurranceWidget( bool startOnMonday, | 65 | ORecurranceWidget::ORecurranceWidget( bool startOnMonday, |
47 | const ORecur& rp, const QDate& startDate, | 66 | const ORecur& rp, const QDate& startDate, |
48 | QWidget* parent, const char* name, | 67 | QWidget* parent, const char* name, |
49 | bool modal, WFlags fl) | 68 | bool modal, WFlags fl) |
@@ -58,15 +77,30 @@ ORecurranceWidget::ORecurranceWidget( bool startOnMonday, | |||
58 | } | 77 | } |
59 | 78 | ||
60 | ORecurranceWidget::~ORecurranceWidget() { | 79 | ORecurranceWidget::~ORecurranceWidget() { |
61 | } | 80 | } |
81 | |||
82 | /** | ||
83 | * set the start date | ||
84 | * @param date the new start date | ||
85 | */ | ||
62 | void ORecurranceWidget::setStartDate( const QDate& date ) { | 86 | void ORecurranceWidget::setStartDate( const QDate& date ) { |
63 | qWarning("ORecurranceWidget::setStartDate"); | 87 | qWarning("ORecurranceWidget::setStartDate"); |
64 | setRecurrence( recurrence(), date ); | 88 | setRecurrence( recurrence(), date ); |
65 | } | 89 | } |
90 | /** | ||
91 | * set the recurrence | ||
92 | * @param rp The ORecur object with the new recurrence rules | ||
93 | */ | ||
66 | void ORecurranceWidget::setRecurrence( const ORecur& rp ) { | 94 | void ORecurranceWidget::setRecurrence( const ORecur& rp ) { |
67 | setRecurrence( rp, start ); | 95 | setRecurrence( rp, start ); |
68 | } | 96 | } |
97 | |||
98 | /** | ||
99 | * overloaded method taking ORecur and a new start date | ||
100 | * @param rp Recurrence rule | ||
101 | * @param date The new start date | ||
102 | */ | ||
69 | void ORecurranceWidget::setRecurrence( const ORecur& rp, const QDate& date ) { | 103 | void ORecurranceWidget::setRecurrence( const ORecur& rp, const QDate& date ) { |
70 | start = date; | 104 | start = date; |
71 | end = rp.endDate(); | 105 | end = rp.endDate(); |
72 | switch ( rp.type() ) { | 106 | switch ( rp.type() ) { |
@@ -122,8 +156,13 @@ void ORecurranceWidget::setRecurrence( const ORecur& rp, const QDate& date ) { | |||
122 | chkNoEnd->setChecked( TRUE ); | 156 | chkNoEnd->setChecked( TRUE ); |
123 | } else | 157 | } else |
124 | cmdEnd->setText( TimeString::shortDate( end ) ); | 158 | cmdEnd->setText( TimeString::shortDate( end ) ); |
125 | } | 159 | } |
160 | |||
161 | /** | ||
162 | * the user selected recurrence rule. | ||
163 | * @return The recurrence rule. | ||
164 | */ | ||
126 | ORecur ORecurranceWidget::recurrence()const { | 165 | ORecur ORecurranceWidget::recurrence()const { |
127 | QListIterator<QToolButton> it( listRTypeButtons ); | 166 | QListIterator<QToolButton> it( listRTypeButtons ); |
128 | QListIterator<QToolButton> itExtra( listExtra ); | 167 | QListIterator<QToolButton> itExtra( listExtra ); |
129 | ORecur rpTmp; | 168 | ORecur rpTmp; |
@@ -179,8 +218,13 @@ ORecur ORecurranceWidget::recurrence()const { | |||
179 | // timestamp it... | 218 | // timestamp it... |
180 | // rpTmp.setCreateTime( ); current DateTime is already set -zecke | 219 | // rpTmp.setCreateTime( ); current DateTime is already set -zecke |
181 | return rpTmp; | 220 | return rpTmp; |
182 | } | 221 | } |
222 | |||
223 | /** | ||
224 | * Return the end date of the recurrence. This is only | ||
225 | * valid if the recurrence rule does contain an enddate | ||
226 | */ | ||
183 | QDate ORecurranceWidget::endDate()const { | 227 | QDate ORecurranceWidget::endDate()const { |
184 | return end; | 228 | return end; |
185 | } | 229 | } |
186 | void ORecurranceWidget::slotSetRType(int rtype) { | 230 | void ORecurranceWidget::slotSetRType(int rtype) { |
diff --git a/libopie/orecurrancewidget.h b/libopie/orecurrancewidget.h index 4a8dd08..af87ce9 100644 --- a/libopie/orecurrancewidget.h +++ b/libopie/orecurrancewidget.h | |||
@@ -16,8 +16,20 @@ | |||
16 | #include "orecurrancebase.h" | 16 | #include "orecurrancebase.h" |
17 | #include <opie/orecur.h> | 17 | #include <opie/orecur.h> |
18 | 18 | ||
19 | // FIXME spelling!!!! -zecke | 19 | // FIXME spelling!!!! -zecke |
20 | // FIXME spelling filenames | ||
21 | |||
22 | /** | ||
23 | * A widget to let the user select rules for recurrences. | ||
24 | * This widget can take care of weekly, monthly, daily and yearly recurrence | ||
25 | * It is used inside todolist and datebook. | ||
26 | * | ||
27 | * | ||
28 | * @short Widget of selecting Recurrance | ||
29 | * @author Trolltech, Holger Freyther | ||
30 | * @version 0.9 | ||
31 | */ | ||
20 | class ORecurranceWidget : public ORecurranceBase { | 32 | class ORecurranceWidget : public ORecurranceBase { |
21 | Q_OBJECT | 33 | Q_OBJECT |
22 | public: | 34 | public: |
23 | ORecurranceWidget( bool startOnMonday, | 35 | ORecurranceWidget( bool startOnMonday, |
diff --git a/libopie/otabbar.h b/libopie/otabbar.h index 16797a3..c413611 100644 --- a/libopie/otabbar.h +++ b/libopie/otabbar.h | |||
@@ -56,8 +56,9 @@ public: | |||
56 | * @param name Name of control. | 56 | * @param name Name of control. |
57 | * | 57 | * |
58 | * Constructs a new OTabBar control with parent and name. | 58 | * Constructs a new OTabBar control with parent and name. |
59 | */ | 59 | */ |
60 | // FIXME Allow WFlags? -zecke | ||
60 | OTabBar( QWidget * = 0, const char * = 0 ); | 61 | OTabBar( QWidget * = 0, const char * = 0 ); |
61 | 62 | ||
62 | protected: | 63 | protected: |
63 | /** | 64 | /** |
diff --git a/libopie/otabwidget.h b/libopie/otabwidget.h index 0aa9bb8..23fe774 100644 --- a/libopie/otabwidget.h +++ b/libopie/otabwidget.h | |||
@@ -98,8 +98,9 @@ public: | |||
98 | * | 98 | * |
99 | * Constructs a new OTabWidget control with parent and name. The style and position parameters | 99 | * Constructs a new OTabWidget control with parent and name. The style and position parameters |
100 | * determine how the widget selection control will be displayed. | 100 | * determine how the widget selection control will be displayed. |
101 | */ | 101 | */ |
102 | // FIXME WFlags? -zecke | ||
102 | OTabWidget( QWidget * = 0, const char * = 0, TabStyle = Global, TabPosition = Top ); | 103 | OTabWidget( QWidget * = 0, const char * = 0, TabStyle = Global, TabPosition = Top ); |
103 | 104 | ||
104 | /** | 105 | /** |
105 | * @fn ~OTabWidget() | 106 | * @fn ~OTabWidget() |
@@ -196,8 +197,9 @@ public: | |||
196 | /** | 197 | /** |
197 | * @fn getCurrentTab( ) | 198 | * @fn getCurrentTab( ) |
198 | * @brief returns current tab id. | 199 | * @brief returns current tab id. |
199 | */ | 200 | */ |
201 | //FIXME TT coding style currentTab() -zecke | ||
200 | int getCurrentTab(); | 202 | int getCurrentTab(); |
201 | 203 | ||
202 | 204 | ||
203 | protected: | 205 | protected: |
diff --git a/libopie/oticker.h b/libopie/oticker.h index 5df08da..30b7517 100644 --- a/libopie/oticker.h +++ b/libopie/oticker.h | |||
@@ -39,15 +39,15 @@ | |||
39 | #include <qslider.h> | 39 | #include <qslider.h> |
40 | #include <qlabel.h> | 40 | #include <qlabel.h> |
41 | #include <qframe.h> | 41 | #include <qframe.h> |
42 | #include <qcolor.h> | 42 | #include <qcolor.h> |
43 | /*! | 43 | |
44 | /** | ||
44 | * @class OTicker | 45 | * @class OTicker |
45 | * @brief The OTicker class provides a QLabel widget that scroll its contents | 46 | * @brief The OTicker class provides a QLabel widget that scroll its contents |
46 | * | 47 | * |
47 | */ | 48 | */ |
48 | class OTicker : public QLabel { | 49 | class OTicker : public QLabel { |
49 | //class OTicker : public QFrame { | ||
50 | Q_OBJECT | 50 | Q_OBJECT |
51 | 51 | ||
52 | public: | 52 | public: |
53 | 53 | ||
diff --git a/libopie/otimepicker.cpp b/libopie/otimepicker.cpp index 8e8a4e7..115d39b 100644 --- a/libopie/otimepicker.cpp +++ b/libopie/otimepicker.cpp | |||
@@ -6,12 +6,20 @@ | |||
6 | #include <qstring.h> | 6 | #include <qstring.h> |
7 | #include <stdio.h> | 7 | #include <stdio.h> |
8 | #include <qlineedit.h> | 8 | #include <qlineedit.h> |
9 | 9 | ||
10 | |||
11 | /** | ||
12 | * Constructs the widget | ||
13 | * @param parent The parent of the OTimePicker | ||
14 | * @param name The name of the object | ||
15 | * @param fl Window Flags | ||
16 | */ | ||
10 | OTimePicker::OTimePicker(QWidget* parent, const char* name, | 17 | OTimePicker::OTimePicker(QWidget* parent, const char* name, |
11 | WFlags fl) : | 18 | WFlags fl) : |
12 | QWidget(parent,name,fl) | 19 | QWidget(parent,name,fl) |
13 | { | 20 | { |
21 | |||
14 | QVBoxLayout *vbox=new QVBoxLayout(this); | 22 | QVBoxLayout *vbox=new QVBoxLayout(this); |
15 | 23 | ||
16 | OClickableLabel *r; | 24 | OClickableLabel *r; |
17 | QString s; | 25 | QString s; |
@@ -57,8 +65,16 @@ OTimePicker::OTimePicker(QWidget* parent, const char* name, | |||
57 | this, SLOT(slotMinute(bool))); | 65 | this, SLOT(slotMinute(bool))); |
58 | } | 66 | } |
59 | } | 67 | } |
60 | 68 | ||
69 | /** | ||
70 | * This method return the current time | ||
71 | * @return the time | ||
72 | */ | ||
73 | QTime OTimePicker::time()const { | ||
74 | return tm; | ||
75 | } | ||
76 | |||
61 | void OTimePicker::slotHour(bool b) { | 77 | void OTimePicker::slotHour(bool b) { |
62 | 78 | ||
63 | OClickableLabel *r = (OClickableLabel *) sender(); | 79 | OClickableLabel *r = (OClickableLabel *) sender(); |
64 | 80 | ||
@@ -91,8 +107,34 @@ void OTimePicker::slotMinute(bool b) { | |||
91 | } | 107 | } |
92 | 108 | ||
93 | } | 109 | } |
94 | 110 | ||
111 | /** | ||
112 | * Method to set the time. No signal gets emitted during this method call | ||
113 | * Minutes must be within 5 minutes step starting at 0 ( 0,5,10,15,20... ) | ||
114 | * @param t The time to be set | ||
115 | */ | ||
116 | void OTimePicker::setTime( const QTime& t) { | ||
117 | setTime( t.hour(), t.minute() ); | ||
118 | } | ||
119 | |||
120 | /** | ||
121 | * Method to set the time. No signal gets emitted during this method call | ||
122 | * @param h The hour | ||
123 | * @param m The minute. Minutes need to set by 5 minute steps | ||
124 | */ | ||
125 | void OTimePicker::setTime( int h, int m ) { | ||
126 | setHour(h); | ||
127 | setMinute(m); | ||
128 | } | ||
129 | |||
130 | /* | ||
131 | * FIXME round minutes to the 5 minute arrangement -zecke | ||
132 | */ | ||
133 | /** | ||
134 | * Method to set the minutes | ||
135 | * @param m minutes | ||
136 | */ | ||
95 | void OTimePicker::setMinute(int m) { | 137 | void OTimePicker::setMinute(int m) { |
96 | 138 | ||
97 | QString minute; | 139 | QString minute; |
98 | minute.sprintf("%.2d",m); | 140 | minute.sprintf("%.2d",m); |
@@ -105,8 +147,11 @@ void OTimePicker::setMinute(int m) { | |||
105 | 147 | ||
106 | tm.setHMS(tm.hour(),m,0); | 148 | tm.setHMS(tm.hour(),m,0); |
107 | } | 149 | } |
108 | 150 | ||
151 | /** | ||
152 | * Method to set the hour | ||
153 | */ | ||
109 | void OTimePicker::setHour(int h) { | 154 | void OTimePicker::setHour(int h) { |
110 | 155 | ||
111 | QString hour; | 156 | QString hour; |
112 | hour.sprintf("%.2d",h); | 157 | hour.sprintf("%.2d",h); |
@@ -119,8 +164,15 @@ void OTimePicker::setHour(int h) { | |||
119 | tm.setHMS(h,tm.minute(),0); | 164 | tm.setHMS(h,tm.minute(),0); |
120 | } | 165 | } |
121 | 166 | ||
122 | 167 | ||
168 | /** | ||
169 | * This is a modal Dialog. | ||
170 | * | ||
171 | * @param parent The parent widget | ||
172 | * @param name The name of the object | ||
173 | * @param fl Possible window flags | ||
174 | */ | ||
123 | OTimePickerDialog::OTimePickerDialog ( QWidget* parent, const char* name, WFlags fl ) | 175 | OTimePickerDialog::OTimePickerDialog ( QWidget* parent, const char* name, WFlags fl ) |
124 | : OTimePickerDialogBase (parent , name, true , fl) | 176 | : OTimePickerDialogBase (parent , name, true , fl) |
125 | { | 177 | { |
126 | 178 | ||
@@ -132,12 +184,20 @@ OTimePickerDialog::OTimePickerDialog ( QWidget* parent, const char* name, WFlags | |||
132 | this, SLOT ( setHour ( const QString& ) ) ); | 184 | this, SLOT ( setHour ( const QString& ) ) ); |
133 | 185 | ||
134 | } | 186 | } |
135 | 187 | ||
136 | QTime& OTimePickerDialog::time() | 188 | /** |
189 | * @return the time | ||
190 | */ | ||
191 | QTime OTimePickerDialog::time()const | ||
137 | { | 192 | { |
138 | return m_time; | 193 | return m_time; |
139 | } | 194 | } |
195 | |||
196 | /** | ||
197 | * Set the time to time | ||
198 | * @param time The time to be set | ||
199 | */ | ||
140 | void OTimePickerDialog::setTime( const QTime& time ) | 200 | void OTimePickerDialog::setTime( const QTime& time ) |
141 | { | 201 | { |
142 | m_time = time; | 202 | m_time = time; |
143 | 203 | ||
@@ -156,8 +216,13 @@ void OTimePickerDialog::setTime( const QTime& time ) | |||
156 | minuteField->setText( QString::number( time.minute() ) ); | 216 | minuteField->setText( QString::number( time.minute() ) ); |
157 | 217 | ||
158 | } | 218 | } |
159 | 219 | ||
220 | /** | ||
221 | * This method takes the current minute and tries to set hour | ||
222 | * to hour. This succeeds if the resulting date is valid | ||
223 | * @param hour The hour as a string | ||
224 | */ | ||
160 | void OTimePickerDialog::setHour ( const QString& hour ) | 225 | void OTimePickerDialog::setHour ( const QString& hour ) |
161 | { | 226 | { |
162 | if ( QTime::isValid ( hour.toInt(), m_time.minute() , 00 ) ){ | 227 | if ( QTime::isValid ( hour.toInt(), m_time.minute() , 00 ) ){ |
163 | m_time.setHMS ( hour.toInt(), m_time.minute() , 00 ); | 228 | m_time.setHMS ( hour.toInt(), m_time.minute() , 00 ); |
@@ -165,8 +230,13 @@ void OTimePickerDialog::setHour ( const QString& hour ) | |||
165 | } | 230 | } |
166 | 231 | ||
167 | } | 232 | } |
168 | 233 | ||
234 | /** | ||
235 | * Method to set a new minute. It tries to convert the string to int and | ||
236 | * if the resulting date is valid a new date is set. | ||
237 | * @see setHour | ||
238 | */ | ||
169 | void OTimePickerDialog::setMinute ( const QString& minute ) | 239 | void OTimePickerDialog::setMinute ( const QString& minute ) |
170 | { | 240 | { |
171 | if ( QTime::isValid ( m_time.hour(), minute.toInt(), 00 ) ){ | 241 | if ( QTime::isValid ( m_time.hour(), minute.toInt(), 00 ) ){ |
172 | m_time.setHMS ( m_time.hour(), minute.toInt(), 00 ); | 242 | m_time.setHMS ( m_time.hour(), minute.toInt(), 00 ); |
diff --git a/libopie/otimepicker.h b/libopie/otimepicker.h index 825e2d6..495c806 100644 --- a/libopie/otimepicker.h +++ b/libopie/otimepicker.h | |||
@@ -8,38 +8,68 @@ | |||
8 | 8 | ||
9 | #include <opie/oclickablelabel.h> | 9 | #include <opie/oclickablelabel.h> |
10 | #include "otimepickerbase.h" | 10 | #include "otimepickerbase.h" |
11 | 11 | ||
12 | /** | ||
13 | * A class to pick time. It uses clickable labels | ||
14 | * internally to allow a quick selection of a time. | ||
15 | * A time can be selected by two clicks of a user | ||
16 | * | ||
17 | * @short A widget to quickly pick a QTime | ||
18 | * @version 1.0 | ||
19 | * @see QWidget | ||
20 | * @see QTime | ||
21 | * @author Hakan Ardo, Stefan Eilers | ||
22 | */ | ||
12 | class OTimePicker: public QWidget { | 23 | class OTimePicker: public QWidget { |
13 | Q_OBJECT | 24 | Q_OBJECT |
14 | 25 | ||
15 | public: | 26 | public: |
16 | OTimePicker(QWidget* parent = 0, const char* name = 0, | 27 | OTimePicker(QWidget* parent = 0, const char* name = 0, |
17 | WFlags fl = 0); | 28 | WFlags fl = 0); |
29 | |||
30 | public slots: | ||
18 | void setHour(int h); | 31 | void setHour(int h); |
19 | void setMinute(int m); | 32 | void setMinute(int m); |
33 | void setTime( const QTime& ); | ||
34 | void setTime( int h, int m ); | ||
35 | |||
36 | public: | ||
37 | QTime time()const; | ||
20 | 38 | ||
21 | private: | 39 | private: |
22 | QValueList<OClickableLabel *> hourLst; | 40 | QValueList<OClickableLabel *> hourLst; |
23 | QValueList<OClickableLabel *> minuteLst; | 41 | QValueList<OClickableLabel *> minuteLst; |
24 | QTime tm; | 42 | QTime tm; |
43 | struct Private; | ||
44 | Private *d; | ||
25 | 45 | ||
26 | private slots: | 46 | private slots: |
27 | void slotHour(bool b); | 47 | void slotHour(bool b); |
28 | void slotMinute(bool b); | 48 | void slotMinute(bool b); |
29 | 49 | ||
30 | signals: | 50 | signals: |
51 | /** | ||
52 | * gets emitted when the time got changed by the user | ||
53 | */ | ||
31 | void timeChanged(const QTime &); | 54 | void timeChanged(const QTime &); |
32 | }; | 55 | }; |
33 | 56 | ||
57 | /** | ||
58 | * | ||
59 | * @short | ||
60 | * @version 1.0 | ||
61 | * @author Stefan Eilers | ||
62 | */ | ||
63 | |||
34 | class OTimePickerDialog: public OTimePickerDialogBase { | 64 | class OTimePickerDialog: public OTimePickerDialogBase { |
35 | Q_OBJECT | 65 | Q_OBJECT |
36 | 66 | ||
37 | public: | 67 | public: |
38 | OTimePickerDialog ( QWidget* parent = 0, const char* name = NULL, WFlags fl = 0 ); | 68 | OTimePickerDialog ( QWidget* parent = 0, const char* name = NULL, WFlags fl = 0 ); |
39 | ~OTimePickerDialog() { }; | 69 | ~OTimePickerDialog() { }; |
40 | 70 | ||
41 | QTime& time(); | 71 | QTime time()const; |
42 | 72 | ||
43 | public slots: | 73 | public slots: |
44 | void setTime( const QTime& time ); | 74 | void setTime( const QTime& time ); |
45 | void setHour( const QString& hour ); | 75 | void setHour( const QString& hour ); |
diff --git a/libopie/owait.cpp b/libopie/owait.cpp index c90bb72..0fdf08d 100644 --- a/libopie/owait.cpp +++ b/libopie/owait.cpp | |||
@@ -28,10 +28,20 @@ | |||
28 | #include <qpe/resource.h> | 28 | #include <qpe/resource.h> |
29 | 29 | ||
30 | static int frame = 0; | 30 | static int frame = 0; |
31 | 31 | ||
32 | /** | ||
33 | * This will construct a modal dialog. | ||
34 | * | ||
35 | * The default timer length is 10. | ||
36 | * | ||
37 | * @param parent The parent of the widget | ||
38 | * @param msg The name of the object | ||
39 | * @param dispIcon Display Icon? | ||
40 | */ | ||
32 | OWait::OWait(QWidget *parent, const char* msg, bool dispIcon ) | 41 | OWait::OWait(QWidget *parent, const char* msg, bool dispIcon ) |
33 | :QDialog(parent, QObject::tr("Wait"), TRUE,WStyle_Customize) { | 42 | :QDialog(parent, msg, TRUE,WStyle_Customize) { |
43 | |||
34 | 44 | ||
35 | QHBoxLayout *hbox = new QHBoxLayout( this ); | 45 | QHBoxLayout *hbox = new QHBoxLayout( this ); |
36 | 46 | ||
37 | m_lb = new QLabel( this ); | 47 | m_lb = new QLabel( this ); |
diff --git a/libopie/owait.h b/libopie/owait.h index d22e141..6217e31 100644 --- a/libopie/owait.h +++ b/libopie/owait.h | |||
@@ -28,15 +28,19 @@ | |||
28 | #include <qtimer.h> | 28 | #include <qtimer.h> |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * This class displays a animated waiting icon in the middle of the screen. | 31 | * This class displays a animated waiting icon in the middle of the screen. |
32 | * | ||
33 | * @short modal hour glass dialog | ||
34 | * @see QDialog | ||
35 | * @author Maximilian Reiß | ||
32 | */ | 36 | */ |
33 | class OWait : public QDialog { | 37 | class OWait : public QDialog { |
34 | 38 | ||
35 | Q_OBJECT | 39 | Q_OBJECT |
36 | 40 | ||
37 | public: | 41 | public: |
38 | OWait(QWidget *parent=0,const char* msg=0,bool dispIcon=TRUE); | 42 | OWait(QWidget *parent=0,const char* name=0, bool dispIcon=TRUE); |
39 | ~OWait(); | 43 | ~OWait(); |
40 | 44 | ||
41 | /** | 45 | /** |
42 | * reimplemented for control reasons | 46 | * reimplemented for control reasons |
@@ -44,8 +48,9 @@ public: | |||
44 | void show(); | 48 | void show(); |
45 | 49 | ||
46 | /** | 50 | /** |
47 | * Set the time before the icon will be automaticly hidden | 51 | * Set the time before the icon will be automaticly hidden |
52 | * The timer will be started once the widget will be shown. | ||
48 | * @param length - time in seconds | 53 | * @param length - time in seconds |
49 | */ | 54 | */ |
50 | void setTimerLength( int length ); | 55 | void setTimerLength( int length ); |
51 | 56 | ||
diff --git a/libopie/todayconfigwidget.h b/libopie/todayconfigwidget.h index 48cf379..6b49efc 100644 --- a/libopie/todayconfigwidget.h +++ b/libopie/todayconfigwidget.h | |||
@@ -2,13 +2,31 @@ | |||
2 | #ifndef CONFIG_WIDGET_H | 2 | #ifndef CONFIG_WIDGET_H |
3 | #define CONFIG_WIDGET_H | 3 | #define CONFIG_WIDGET_H |
4 | 4 | ||
5 | 5 | ||
6 | /** | ||
7 | * A base class for all Today Config Widgets. | ||
8 | * This will let a Today plugin to add the possibility of configuration. | ||
9 | * Plugins need to inherit from this class and need to implement | ||
10 | * the pure virtual method to control configuration. | ||
11 | * The Plugin should read its configuration during creation of the Widget | ||
12 | * | ||
13 | * | ||
14 | * @author Maximilian Reiß | ||
15 | * @short base class of all today config widgets | ||
16 | */ | ||
6 | class TodayConfigWidget : public QWidget { | 17 | class TodayConfigWidget : public QWidget { |
7 | 18 | ||
8 | 19 | ||
9 | public: | 20 | public: |
10 | 21 | ||
22 | /** | ||
23 | * This will construct the widget. The widget gets deleted once the parent | ||
24 | * gets deleted as in any Qt application | ||
25 | * | ||
26 | * @param parent The parent of the widget | ||
27 | * @paran name The name of the object | ||
28 | */ | ||
11 | TodayConfigWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) {} ; | 29 | TodayConfigWidget( QWidget *parent, const char *name ) : QWidget( parent, name ) {} ; |
12 | virtual ~TodayConfigWidget() {}; | 30 | virtual ~TodayConfigWidget() {}; |
13 | 31 | ||
14 | /** | 32 | /** |
diff --git a/libopie/todayplugininterface.h b/libopie/todayplugininterface.h index 6ee2a06..29a12bc 100644 --- a/libopie/todayplugininterface.h +++ b/libopie/todayplugininterface.h | |||
@@ -13,9 +13,14 @@ class QWidget; | |||
13 | #endif | 13 | #endif |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * | 16 | * |
17 | * A TodayPluginObject is the base for all Today Plugins. | ||
18 | * A plugin author needs to inherit this class and implement | ||
19 | * the pure virtual methods | ||
17 | * | 20 | * |
21 | * @short base class for today plugins | ||
22 | * @author Maximilian Reiss | ||
18 | * | 23 | * |
19 | */ | 24 | */ |
20 | class TodayPluginObject { | 25 | class TodayPluginObject { |
21 | 26 | ||
@@ -24,23 +29,30 @@ public: | |||
24 | virtual ~TodayPluginObject() {}; | 29 | virtual ~TodayPluginObject() {}; |
25 | 30 | ||
26 | /** | 31 | /** |
27 | * The name if the plugin | 32 | * The name if the plugin |
33 | * @return The plugin should return its name here | ||
28 | */ | 34 | */ |
29 | virtual QString pluginName() const = 0; | 35 | virtual QString pluginName() const = 0; |
30 | 36 | ||
31 | /** | 37 | /** |
32 | * Version numbering | 38 | * Version numbering |
39 | * @return The plugin should return the version number | ||
33 | */ | 40 | */ |
34 | virtual double versionNumber() const = 0; | 41 | virtual double versionNumber() const = 0; |
35 | 42 | ||
36 | 43 | ||
44 | /** | ||
45 | * @return the pixmap name widget?! -- FIXME | ||
46 | */ | ||
37 | virtual QString pixmapNameWidget() const = 0; | 47 | virtual QString pixmapNameWidget() const = 0; |
38 | 48 | ||
39 | /** widget for the today view | 49 | /** |
50 | * widget for the today view | ||
40 | * It _needs_ a parent here. | 51 | * It _needs_ a parent here. |
52 | * Plugin authors need to take parent as parent! | ||
41 | */ | 53 | */ |
42 | virtual QWidget* widget( QWidget * ) = 0; | 54 | virtual QWidget* widget( QWidget *parent ) = 0; |
43 | 55 | ||
44 | /** | 56 | /** |
45 | * Pixmap used in the config widget | 57 | * Pixmap used in the config widget |
46 | */ | 58 | */ |
@@ -48,13 +60,16 @@ public: | |||
48 | 60 | ||
49 | /** | 61 | /** |
50 | * Config plugin widget - optional | 62 | * Config plugin widget - optional |
51 | * If the plugin has a config widget, it _needs_ a parent here. | 63 | * If the plugin has a config widget, it _needs_ a parent here. |
64 | * may return 0 if no config widget is needed | ||
52 | */ | 65 | */ |
53 | virtual TodayConfigWidget* configWidget( QWidget * ) = 0; | 66 | virtual TodayConfigWidget* configWidget( QWidget * ) = 0; |
54 | 67 | ||
55 | /** | 68 | /** |
56 | * The application that should be assigned to the button (pixmap) | 69 | * The application that should be assigned to the button (pixmap) |
70 | * Today will show the plugin icon. On click it tries to execute the | ||
71 | * plugin related application. | ||
57 | */ | 72 | */ |
58 | virtual QString appName() const = 0; | 73 | virtual QString appName() const = 0; |
59 | 74 | ||
60 | 75 | ||
@@ -80,9 +95,11 @@ public: | |||
80 | // virtual int maxHeight() const = 0; | 95 | // virtual int maxHeight() const = 0; |
81 | 96 | ||
82 | }; | 97 | }; |
83 | 98 | ||
84 | 99 | /** | |
100 | * This is part of the QCOM works. See example plugins how to do it right | ||
101 | */ | ||
85 | struct TodayPluginInterface : public QUnknownInterface { | 102 | struct TodayPluginInterface : public QUnknownInterface { |
86 | virtual TodayPluginObject *guiPart() = 0; | 103 | virtual TodayPluginObject *guiPart() = 0; |
87 | }; | 104 | }; |
88 | 105 | ||