author | zecke <zecke> | 2004-03-13 19:51:45 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-03-13 19:51:45 (UTC) |
commit | 6d08277737e22b7a1527124623f3571969073ddf (patch) (unidiff) | |
tree | 4129e674e21df767b31299e873dd44e33a308e1b /libopie2/opieui/ofontselector.cpp | |
parent | 8e28911f7199f4450ac5eef09482069f9b9caea2 (diff) | |
download | opie-6d08277737e22b7a1527124623f3571969073ddf.zip opie-6d08277737e22b7a1527124623f3571969073ddf.tar.gz opie-6d08277737e22b7a1527124623f3571969073ddf.tar.bz2 |
Move XML class to internal PIM
Add namespaces!!!
Opie::Core and Opie::Core::Private
Opie::Net and Opie::Net::Private
Opie::Ui and Opie::Ui::Private
Opie::MM and Opie::MM::Private
Opie::DB and Opie::DB::Private
PIM classes are not yet converted because we will do other work
on it as well
Diffstat (limited to 'libopie2/opieui/ofontselector.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opieui/ofontselector.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/libopie2/opieui/ofontselector.cpp b/libopie2/opieui/ofontselector.cpp index f93781f..b19c26e 100644 --- a/libopie2/opieui/ofontselector.cpp +++ b/libopie2/opieui/ofontselector.cpp | |||
@@ -17,118 +17,118 @@ | |||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | /* OPIE */ | 30 | /* OPIE */ |
31 | #include <opie2/ofontselector.h> | 31 | #include <opie2/ofontselector.h> |
32 | #include <qpe/fontdatabase.h> | 32 | #include <qpe/fontdatabase.h> |
33 | 33 | ||
34 | /* QT */ | 34 | /* QT */ |
35 | #include <qlayout.h> | 35 | #include <qlayout.h> |
36 | #include <qlistbox.h> | 36 | #include <qlistbox.h> |
37 | #include <qcombobox.h> | 37 | #include <qcombobox.h> |
38 | #include <qlabel.h> | 38 | #include <qlabel.h> |
39 | #include <qmultilineedit.h> | 39 | #include <qmultilineedit.h> |
40 | 40 | ||
41 | using namespace Opie; | ||
42 | 41 | ||
43 | namespace Opie | 42 | namespace Opie { |
44 | { | 43 | namespace Ui { |
44 | namespace Private { | ||
45 | 45 | ||
46 | class OFontSelectorPrivate | 46 | class OFontSelectorPrivate |
47 | { | 47 | { |
48 | public: | 48 | public: |
49 | QListBox * m_font_family_list; | 49 | QListBox * m_font_family_list; |
50 | QComboBox * m_font_style_list; | 50 | QComboBox * m_font_style_list; |
51 | QComboBox * m_font_size_list; | 51 | QComboBox * m_font_size_list; |
52 | QMultiLineEdit *m_preview; | 52 | QMultiLineEdit *m_preview; |
53 | 53 | ||
54 | bool m_pointbug : 1; | 54 | bool m_pointbug : 1; |
55 | 55 | ||
56 | FontDatabase m_fdb; | 56 | FontDatabase m_fdb; |
57 | }; | 57 | }; |
58 | 58 | ||
59 | }; | ||
60 | |||
61 | namespace | ||
62 | { | ||
63 | |||
64 | class FontListItem : public QListBoxText | 59 | class FontListItem : public QListBoxText |
65 | { | 60 | { |
66 | public: | 61 | public: |
67 | FontListItem ( const QString &t, const QStringList &styles, const QValueList<int> &sizes ) : QListBoxText() | 62 | FontListItem ( const QString &t, const QStringList &styles, const QValueList<int> &sizes ) : QListBoxText() |
68 | { | 63 | { |
69 | m_name = t; | 64 | m_name = t; |
70 | m_styles = styles; | 65 | m_styles = styles; |
71 | m_sizes = sizes; | 66 | m_sizes = sizes; |
72 | 67 | ||
73 | QString str = t; | 68 | QString str = t; |
74 | str [0] = str [0]. upper(); | 69 | str [0] = str [0]. upper(); |
75 | setText ( str ); | 70 | setText ( str ); |
76 | } | 71 | } |
77 | 72 | ||
78 | QString family() const | 73 | QString family() const |
79 | { | 74 | { |
80 | return m_name; | 75 | return m_name; |
81 | } | 76 | } |
82 | 77 | ||
83 | const QStringList &styles() const | 78 | const QStringList &styles() const |
84 | { | 79 | { |
85 | return m_styles; | 80 | return m_styles; |
86 | } | 81 | } |
87 | 82 | ||
88 | const QValueList<int> &sizes() const | 83 | const QValueList<int> &sizes() const |
89 | { | 84 | { |
90 | return m_sizes; | 85 | return m_sizes; |
91 | } | 86 | } |
92 | 87 | ||
93 | private: | 88 | private: |
94 | QStringList m_styles; | 89 | QStringList m_styles; |
95 | QValueList<int> m_sizes; | 90 | QValueList<int> m_sizes; |
96 | QString m_name; | 91 | QString m_name; |
97 | }; | 92 | }; |
93 | } | ||
94 | } | ||
95 | } | ||
96 | |||
98 | 97 | ||
98 | using namespace Opie::Ui; | ||
99 | using namespace Opie::Ui::Private; | ||
99 | 100 | ||
100 | static int findItemCB( QComboBox *box, const QString &str ) | 101 | static int findItemCB( QComboBox *box, const QString &str ) |
101 | { | 102 | { |
102 | for ( int i = 0; i < box->count(); i++ ) | 103 | for ( int i = 0; i < box->count(); i++ ) |
103 | { | 104 | { |
104 | if ( box->text ( i ) == str ) | 105 | if ( box->text ( i ) == str ) |
105 | return i; | 106 | return i; |
106 | } | 107 | } |
107 | return -1; | 108 | return -1; |
108 | } | 109 | } |
109 | 110 | ||
110 | } | ||
111 | /* static same as anon. namespace */ | 111 | /* static same as anon. namespace */ |
112 | static int qt_version() | 112 | static int qt_version() |
113 | { | 113 | { |
114 | const char *qver = qVersion(); | 114 | const char *qver = qVersion(); |
115 | 115 | ||
116 | return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); | 116 | return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); |
117 | } | 117 | } |
118 | 118 | ||
119 | /** | 119 | /** |
120 | * Constructs the Selector object | 120 | * Constructs the Selector object |
121 | * @param withpreview If a font preview should be given | 121 | * @param withpreview If a font preview should be given |
122 | * @param parent The parent of the Font Selector | 122 | * @param parent The parent of the Font Selector |
123 | * @param name The name of the object | 123 | * @param name The name of the object |
124 | * @param fl WidgetFlags | 124 | * @param fl WidgetFlags |
125 | */ | 125 | */ |
126 | OFontSelector::OFontSelector( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) | 126 | OFontSelector::OFontSelector( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) |
127 | { | 127 | { |
128 | d = new OFontSelectorPrivate(); | 128 | d = new OFontSelectorPrivate(); |
129 | 129 | ||
130 | QGridLayout *gridLayout = new QGridLayout( this, 0, 0, 4, 4 ); | 130 | QGridLayout *gridLayout = new QGridLayout( this, 0, 0, 4, 4 ); |
131 | gridLayout->setRowStretch( 4, 10 ); | 131 | gridLayout->setRowStretch( 4, 10 ); |
132 | 132 | ||
133 | d->m_font_family_list = new QListBox( this, "FontListBox" ); | 133 | d->m_font_family_list = new QListBox( this, "FontListBox" ); |
134 | gridLayout->addMultiCellWidget( d->m_font_family_list, 0, 4, 0, 0 ); | 134 | gridLayout->addMultiCellWidget( d->m_font_family_list, 0, 4, 0, 0 ); |
@@ -405,24 +405,25 @@ QFont OFontSelector::selectedFont() | |||
405 | { | 405 | { |
406 | return d->m_fdb. font ( fli->family(), \ | 406 | return d->m_fdb. font ( fli->family(), \ |
407 | fst >= 0 ? fli->styles() [fst] : QString::null, \ | 407 | fst >= 0 ? fli->styles() [fst] : QString::null, \ |
408 | fsi >= 0 ? fli->sizes() [fsi] : 10, \ | 408 | fsi >= 0 ? fli->sizes() [fsi] : 10, \ |
409 | d->m_fdb. charSets ( fli->family()) [0] ); | 409 | d->m_fdb. charSets ( fli->family()) [0] ); |
410 | } | 410 | } |
411 | else | 411 | else |
412 | return QFont(); | 412 | return QFont(); |
413 | } | 413 | } |
414 | 414 | ||
415 | void OFontSelector::resizeEvent ( QResizeEvent *re ) | 415 | void OFontSelector::resizeEvent ( QResizeEvent *re ) |
416 | { | 416 | { |
417 | if ( d->m_preview ) | 417 | if ( d->m_preview ) |
418 | { | 418 | { |
419 | d->m_preview->setMinimumHeight ( 1 ); | 419 | d->m_preview->setMinimumHeight ( 1 ); |
420 | d->m_preview->setMaximumHeight ( 32767 ); | 420 | d->m_preview->setMaximumHeight ( 32767 ); |
421 | } | 421 | } |
422 | 422 | ||
423 | QWidget::resizeEvent ( re ); | 423 | QWidget::resizeEvent ( re ); |
424 | 424 | ||
425 | if ( d->m_preview ) | 425 | if ( d->m_preview ) |
426 | d->m_preview->setFixedHeight ( d->m_preview->height()); | 426 | d->m_preview->setFixedHeight ( d->m_preview->height()); |
427 | 427 | ||
428 | } | 428 | } |
429 | |||