summaryrefslogtreecommitdiff
path: root/libopie2
Unidiff
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/ofontselector.cpp2
-rw-r--r--libopie2/opieui/opieui.pro2
2 files changed, 2 insertions, 2 deletions
diff --git a/libopie2/opieui/ofontselector.cpp b/libopie2/opieui/ofontselector.cpp
index 6c24f14..8b679c8 100644
--- a/libopie2/opieui/ofontselector.cpp
+++ b/libopie2/opieui/ofontselector.cpp
@@ -27,257 +27,257 @@
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 41
42/* TRANSLATOR Opie::Ui::OFontSelector */ 42/* TRANSLATOR Opie::Ui::OFontSelector */
43 43
44 44
45namespace Opie { 45namespace Opie {
46namespace Ui { 46namespace Ui {
47namespace Internal { 47namespace Internal {
48 48
49class OFontSelectorPrivate 49class OFontSelectorPrivate
50{ 50{
51public: 51public:
52 QListBox * m_font_family_list; 52 QListBox * m_font_family_list;
53 QComboBox * m_font_style_list; 53 QComboBox * m_font_style_list;
54 QComboBox * m_font_size_list; 54 QComboBox * m_font_size_list;
55 QMultiLineEdit *m_preview; 55 QMultiLineEdit *m_preview;
56 56
57 bool m_pointbug : 1; 57 bool m_pointbug : 1;
58 58
59 FontDatabase m_fdb; 59 FontDatabase m_fdb;
60}; 60};
61 61
62class FontListItem : public QListBoxText 62class FontListItem : public QListBoxText
63{ 63{
64public: 64public:
65 FontListItem ( const QString &t, const QStringList &styles, const QValueList<int> &sizes ) : QListBoxText() 65 FontListItem ( const QString &t, const QStringList &styles, const QValueList<int> &sizes ) : QListBoxText()
66 { 66 {
67 m_name = t; 67 m_name = t;
68 m_styles = styles; 68 m_styles = styles;
69 m_sizes = sizes; 69 m_sizes = sizes;
70 70
71 QString str = t; 71 QString str = t;
72 str [0] = str [0]. upper(); 72 str [0] = str [0]. upper();
73 setText ( str ); 73 setText ( str );
74 } 74 }
75 75
76 QString family() const 76 QString family() const
77 { 77 {
78 return m_name; 78 return m_name;
79 } 79 }
80 80
81 const QStringList &styles() const 81 const QStringList &styles() const
82 { 82 {
83 return m_styles; 83 return m_styles;
84 } 84 }
85 85
86 const QValueList<int> &sizes() const 86 const QValueList<int> &sizes() const
87 { 87 {
88 return m_sizes; 88 return m_sizes;
89 } 89 }
90 90
91private: 91private:
92 QStringList m_styles; 92 QStringList m_styles;
93 QValueList<int> m_sizes; 93 QValueList<int> m_sizes;
94 QString m_name; 94 QString m_name;
95}; 95};
96} 96}
97} 97}
98} 98}
99 99
100 100
101using namespace Opie::Ui; 101using namespace Opie::Ui;
102using namespace Opie::Ui::Internal; 102using namespace Opie::Ui::Internal;
103 103
104static int findItemCB( QComboBox *box, const QString &str ) 104static int findItemCB( QComboBox *box, const QString &str )
105{ 105{
106 for ( int i = 0; i < box->count(); i++ ) 106 for ( int i = 0; i < box->count(); i++ )
107 { 107 {
108 if ( box->text ( i ) == str ) 108 if ( box->text ( i ) == str )
109 return i; 109 return i;
110 } 110 }
111 return -1; 111 return -1;
112} 112}
113 113
114/* static same as anon. namespace */ 114/* static same as anon. namespace */
115static int qt_version() 115static int qt_version()
116{ 116{
117 const char *qver = qVersion(); 117 const char *qver = qVersion();
118 118
119 return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); 119 return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' );
120} 120}
121 121
122/** 122/**
123 * Constructs the Selector object 123 * Constructs the Selector object
124 * @param withpreview If a font preview should be given 124 * @param withpreview If a font preview should be given
125 * @param parent The parent of the Font Selector 125 * @param parent The parent of the Font Selector
126 * @param name The name of the object 126 * @param name The name of the object
127 * @param fl WidgetFlags 127 * @param fl WidgetFlags
128 */ 128 */
129OFontSelector::OFontSelector( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) 129OFontSelector::OFontSelector( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl )
130{ 130{
131 d = new OFontSelectorPrivate(); 131 d = new OFontSelectorPrivate();
132 132
133 QGridLayout *gridLayout = new QGridLayout( this, 0, 0, 4, 4 ); 133 QGridLayout *gridLayout = new QGridLayout( this, 0, 0, 4, 4 );
134 gridLayout->setRowStretch( 4, 10 ); 134 gridLayout->setRowStretch( 4, 10 );
135 135
136 d->m_font_family_list = new QListBox( this, "FontListBox" ); 136 d->m_font_family_list = new QListBox( this, "FontListBox" );
137 gridLayout->addMultiCellWidget( d->m_font_family_list, 0, 4, 0, 0 ); 137 gridLayout->addMultiCellWidget( d->m_font_family_list, 0, 4, 0, 0 );
138 connect( d->m_font_family_list, SIGNAL( highlighted(int) ), this, SLOT( fontFamilyClicked(int) ) ); 138 connect( d->m_font_family_list, SIGNAL( highlighted(int) ), this, SLOT( fontFamilyClicked(int) ) );
139 139
140 QLabel *label = new QLabel( tr( "Style" ), this ); 140 QLabel *label = new QLabel( tr( "Style" ), this );
141 gridLayout->addWidget( label, 0, 1 ); 141 gridLayout->addWidget( label, 0, 1 );
142 142
143 d->m_font_style_list = new QComboBox( this, "StyleListBox" ); 143 d->m_font_style_list = new QComboBox( this, "StyleListBox" );
144 connect( d->m_font_style_list, SIGNAL( activated(int) ), this, SLOT( fontStyleClicked(int) ) ); 144 connect( d->m_font_style_list, SIGNAL( activated(int) ), this, SLOT( fontStyleClicked(int) ) );
145 gridLayout->addWidget( d->m_font_style_list, 1, 1 ); 145 gridLayout->addWidget( d->m_font_style_list, 1, 1 );
146 146
147 label = new QLabel( tr( "Size" ), this ); 147 label = new QLabel( tr( "Size" ), this );
148 gridLayout->addWidget( label, 2, 1 ); 148 gridLayout->addWidget( label, 2, 1 );
149 149
150 d->m_font_size_list = new QComboBox( this, "SizeListBox" ); 150 d->m_font_size_list = new QComboBox( this, "SizeListBox" );
151 connect( d->m_font_size_list, SIGNAL( activated(int) ), 151 connect( d->m_font_size_list, SIGNAL( activated(int) ),
152 this, SLOT( fontSizeClicked(int) ) ); 152 this, SLOT( fontSizeClicked(int) ) );
153 gridLayout->addWidget( d->m_font_size_list, 3, 1 ); 153 gridLayout->addWidget( d->m_font_size_list, 3, 1 );
154 154
155 d->m_pointbug = ( qt_version() <= 233 ); 155 d->m_pointbug = ( qt_version() == 232 || qt_version() == 233 ); // SharpROM uses 2.3.2
156 156
157 if ( withpreview ) 157 if ( withpreview )
158 { 158 {
159 d->m_preview = new QMultiLineEdit ( this, "Preview" ); 159 d->m_preview = new QMultiLineEdit ( this, "Preview" );
160 d->m_preview->setAlignment ( AlignCenter ); 160 d->m_preview->setAlignment ( AlignCenter );
161 d->m_preview->setWordWrap ( QMultiLineEdit::WidgetWidth ); 161 d->m_preview->setWordWrap ( QMultiLineEdit::WidgetWidth );
162 d->m_preview->setMargin ( 3 ); 162 d->m_preview->setMargin ( 3 );
163 d->m_preview->setText ( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" )); 163 d->m_preview->setText ( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" ));
164 gridLayout->addRowSpacing ( 5, 4 ); 164 gridLayout->addRowSpacing ( 5, 4 );
165 gridLayout->addMultiCellWidget ( d->m_preview, 6, 6, 0, 1 ); 165 gridLayout->addMultiCellWidget ( d->m_preview, 6, 6, 0, 1 );
166 gridLayout->setRowStretch ( 6, 5 ); 166 gridLayout->setRowStretch ( 6, 5 );
167 } 167 }
168 else 168 else
169 d->m_preview = 0; 169 d->m_preview = 0;
170 170
171 loadFonts ( d->m_font_family_list ); 171 loadFonts ( d->m_font_family_list );
172} 172}
173 173
174OFontSelector::~OFontSelector() 174OFontSelector::~OFontSelector()
175{ 175{
176 delete d; 176 delete d;
177} 177}
178 178
179/** 179/**
180 * This methods tries to set the font 180 * This methods tries to set the font
181 * @param f The wishes font 181 * @param f The wishes font
182 * @return success or failure 182 * @return success or failure
183 */ 183 */
184bool OFontSelector::setSelectedFont ( const QFont &f ) 184bool OFontSelector::setSelectedFont ( const QFont &f )
185{ 185{
186 return setSelectedFont ( f. family(), d->m_fdb. styleString ( f ), f. pointSize(), QFont::encodingName ( f. charSet())); 186 return setSelectedFont ( f. family(), d->m_fdb. styleString ( f ), f. pointSize(), QFont::encodingName ( f. charSet()));
187} 187}
188 188
189 189
190/** 190/**
191 * This is an overloaded method @see setSelectedFont 191 * This is an overloaded method @see setSelectedFont
192 * @param familyStr The family of the font 192 * @param familyStr The family of the font
193 * @param styleStr The style of the font 193 * @param styleStr The style of the font
194 * @param sizeVal The size of font 194 * @param sizeVal The size of font
195 * @param charset The charset to be used. Will be deprecated by QT3 195 * @param charset The charset to be used. Will be deprecated by QT3
196 */ 196 */
197bool OFontSelector::setSelectedFont( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset ) 197bool OFontSelector::setSelectedFont( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset )
198{ 198{
199 Q_CONST_UNUSED( charset ) 199 Q_CONST_UNUSED( charset )
200 QString sizeStr = QString::number ( sizeVal ); 200 QString sizeStr = QString::number ( sizeVal );
201 201
202 QListBoxItem *family = d->m_font_family_list->findItem ( familyStr ); 202 QListBoxItem *family = d->m_font_family_list->findItem ( familyStr );
203 if ( !family ) 203 if ( !family )
204 family = d->m_font_family_list->findItem ( "Helvetica" ); 204 family = d->m_font_family_list->findItem ( "Helvetica" );
205 if ( !family ) 205 if ( !family )
206 family = d->m_font_family_list->firstItem(); 206 family = d->m_font_family_list->firstItem();
207 d->m_font_family_list->setCurrentItem ( family ); 207 d->m_font_family_list->setCurrentItem ( family );
208 fontFamilyClicked ( d->m_font_family_list->index ( family )); 208 fontFamilyClicked ( d->m_font_family_list->index ( family ));
209 209
210 int style = findItemCB ( d->m_font_style_list, styleStr ); 210 int style = findItemCB ( d->m_font_style_list, styleStr );
211 if ( style < 0 ) 211 if ( style < 0 )
212 style = findItemCB ( d->m_font_style_list, "Regular" ); 212 style = findItemCB ( d->m_font_style_list, "Regular" );
213 if ( style < 0 && d->m_font_style_list->count() > 0 ) 213 if ( style < 0 && d->m_font_style_list->count() > 0 )
214 style = 0; 214 style = 0;
215 d->m_font_style_list->setCurrentItem ( style ); 215 d->m_font_style_list->setCurrentItem ( style );
216 fontStyleClicked ( style ); 216 fontStyleClicked ( style );
217 217
218 int size = findItemCB ( d->m_font_size_list, sizeStr ); 218 int size = findItemCB ( d->m_font_size_list, sizeStr );
219 if ( size < 0 ) 219 if ( size < 0 )
220 size = findItemCB ( d->m_font_size_list, "10" ); 220 size = findItemCB ( d->m_font_size_list, "10" );
221 if ( size < 0 && d->m_font_size_list->count() > 0 ) 221 if ( size < 0 && d->m_font_size_list->count() > 0 )
222 size = 0; 222 size = 0;
223 d->m_font_size_list->setCurrentItem ( size ); 223 d->m_font_size_list->setCurrentItem ( size );
224 fontSizeClicked ( size ); 224 fontSizeClicked ( size );
225 225
226 return (( family ) && ( style >= 0 ) && ( size >= 0 )); 226 return (( family ) && ( style >= 0 ) && ( size >= 0 ));
227} 227}
228 228
229/** 229/**
230 * This method returns the name, style and size of the currently selected 230 * This method returns the name, style and size of the currently selected
231 * font or false if no font is selected 231 * font or false if no font is selected
232 * @param family The font family will be written there 232 * @param family The font family will be written there
233 * @param style The style will be written there 233 * @param style The style will be written there
234 * @param size The size will be written there 234 * @param size The size will be written there
235 * @return success or failure 235 * @return success or failure
236 */ 236 */
237bool OFontSelector::selectedFont ( QString &family, QString &style, int &size ) 237bool OFontSelector::selectedFont ( QString &family, QString &style, int &size )
238{ 238{
239 QString dummy; 239 QString dummy;
240 return selectedFont ( family, style, size, dummy ); 240 return selectedFont ( family, style, size, dummy );
241} 241}
242 242
243 243
244/** 244/**
245 * This method does return the font family or QString::null if there is 245 * This method does return the font family or QString::null if there is
246 * no font item selected 246 * no font item selected
247 * @return the font family 247 * @return the font family
248 */ 248 */
249QString OFontSelector::fontFamily() const 249QString OFontSelector::fontFamily() const
250{ 250{
251 FontListItem *fli = (FontListItem *) d->m_font_family_list->item ( d->m_font_family_list->currentItem()); 251 FontListItem *fli = (FontListItem *) d->m_font_family_list->item ( d->m_font_family_list->currentItem());
252 252
253 return fli ? fli->family() : QString::null; 253 return fli ? fli->family() : QString::null;
254} 254}
255 255
256/** 256/**
257 * This method will return the style of the font or QString::null 257 * This method will return the style of the font or QString::null
258 * @return the style of the font 258 * @return the style of the font
259 */ 259 */
260QString OFontSelector::fontStyle() const 260QString OFontSelector::fontStyle() const
261{ 261{
262 FontListItem *fli = (FontListItem *) d->m_font_family_list->item ( d->m_font_family_list->currentItem()); 262 FontListItem *fli = (FontListItem *) d->m_font_family_list->item ( d->m_font_family_list->currentItem());
263 int fst = d->m_font_style_list->currentItem(); 263 int fst = d->m_font_style_list->currentItem();
264 264
265 return ( fli && fst >= 0 ) ? fli->styles() [fst] : QString::null; 265 return ( fli && fst >= 0 ) ? fli->styles() [fst] : QString::null;
266} 266}
267 267
268/** 268/**
269 * This method will return the font size or 10 if no font size is available 269 * This method will return the font size or 10 if no font size is available
270 */ 270 */
271int OFontSelector::fontSize() const 271int OFontSelector::fontSize() const
272{ 272{
273 FontListItem *fli = (FontListItem *) d->m_font_family_list->item ( d->m_font_family_list->currentItem()); 273 FontListItem *fli = (FontListItem *) d->m_font_family_list->item ( d->m_font_family_list->currentItem());
274 int fsi = d->m_font_size_list->currentItem(); 274 int fsi = d->m_font_size_list->currentItem();
275 275
276 return ( fli && fsi >= 0 ) ? fli->sizes() [fsi] : 10; 276 return ( fli && fsi >= 0 ) ? fli->sizes() [fsi] : 10;
277} 277}
278 278
279/** 279/**
280 * returns the charset of the font or QString::null 280 * returns the charset of the font or QString::null
281 */ 281 */
282QString OFontSelector::fontCharSet() const 282QString OFontSelector::fontCharSet() const
283{ 283{
diff --git a/libopie2/opieui/opieui.pro b/libopie2/opieui/opieui.pro
index ffa8b83..5525ea2 100644
--- a/libopie2/opieui/opieui.pro
+++ b/libopie2/opieui/opieui.pro
@@ -1,65 +1,65 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on 2CONFIG += qt warn_on
3DESTDIR = $(OPIEDIR)/lib 3DESTDIR = $(OPIEDIR)/lib
4HEADERS = oclickablelabel.h \ 4HEADERS = oclickablelabel.h \
5 odialog.h \ 5 odialog.h \
6 ofontselector.h \ 6 ofontselector.h \
7 oimageeffect.h \ 7 oimageeffect.h \
8 okeyconfigwidget.h \ 8 okeyconfigwidget.h \
9 oledbox.h \ 9 oledbox.h \
10 olistview.h \ 10 olistview.h \
11 opixmapeffect.h \ 11 opixmapeffect.h \
12 opopupmenu.h \ 12 opopupmenu.h \
13 opixmapprovider.h \ 13 opixmapprovider.h \
14 oselector.h \ 14 oselector.h \
15 oseparator.h \ 15 oseparator.h \
16 otabinfo.h \ 16 otabinfo.h \
17 otabbar.h \ 17 otabbar.h \
18 otabwidget.h \ 18 otabwidget.h \
19 otaskbarapplet.h \ 19 otaskbarapplet.h \
20 otimepicker.h \ 20 otimepicker.h \
21 oversatileview.h \ 21 oversatileview.h \
22 oversatileviewitem.h \ 22 oversatileviewitem.h \
23 owait.h 23 owait.h
24 24
25SOURCES = oclickablelabel.cpp \ 25SOURCES = oclickablelabel.cpp \
26 odialog.cpp \ 26 odialog.cpp \
27 ofontselector.cpp \ 27 ofontselector.cpp \
28 oimageeffect.cpp \ 28 oimageeffect.cpp \
29 okeyconfigwidget.cpp \ 29 okeyconfigwidget.cpp \
30 oledbox.cpp \ 30 oledbox.cpp \
31 olistview.cpp \ 31 olistview.cpp \
32 opixmapeffect.cpp \ 32 opixmapeffect.cpp \
33 opopupmenu.cpp \ 33 opopupmenu.cpp \
34 opixmapprovider.cpp \ 34 opixmapprovider.cpp \
35 oselector.cpp \ 35 oselector.cpp \
36 oseparator.cpp \ 36 oseparator.cpp \
37 otabbar.cpp \ 37 otabbar.cpp \
38 otabwidget.cpp \ 38 otabwidget.cpp \
39 otaskbarapplet.cpp \ 39 otaskbarapplet.cpp \
40 otimepicker.cpp \ 40 otimepicker.cpp \
41 oversatileview.cpp \ 41 oversatileview.cpp \
42 oversatileviewitem.cpp \ 42 oversatileviewitem.cpp \
43 owait.cpp 43 owait.cpp
44 44
45include( big-screen/big-screen.pro ) 45include( big-screen/big-screen.pro )
46include( fileselector/fileselector.pro ) 46include( fileselector/fileselector.pro )
47 47
48INTERFACES = otimepickerbase.ui 48INTERFACES = otimepickerbase.ui
49 49
50TARGET = opieui2 50TARGET = opieui2
51VERSION = 1.9.0 51VERSION = 1.9.1
52 52
53INCLUDEPATH += $(OPIEDIR)/include 53INCLUDEPATH += $(OPIEDIR)/include
54DEPENDPATH += $(OPIEDIR)/include 54DEPENDPATH += $(OPIEDIR)/include
55 55
56LIBS += -lopiecore2 56LIBS += -lopiecore2
57 57
58!contains( platform, x11 ) { 58!contains( platform, x11 ) {
59 include( $(OPIEDIR)/include.pro ) 59 include( $(OPIEDIR)/include.pro )
60} 60}
61 61
62contains( platform, x11 ) { 62contains( platform, x11 ) {
63 LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib 63 LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib
64} 64}
65 65