Diffstat (limited to 'libopie2/opieui/ofontselector.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opieui/ofontselector.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libopie2/opieui/ofontselector.cpp b/libopie2/opieui/ofontselector.cpp index 6763ee6..4870cd9 100644 --- a/libopie2/opieui/ofontselector.cpp +++ b/libopie2/opieui/ofontselector.cpp | |||
@@ -148,96 +148,97 @@ OFontSelector::OFontSelector( bool withpreview, QWidget *parent, const char *nam | |||
148 | connect( d->m_font_size_list, SIGNAL( activated(int) ), | 148 | connect( d->m_font_size_list, SIGNAL( activated(int) ), |
149 | this, SLOT( fontSizeClicked(int) ) ); | 149 | this, SLOT( fontSizeClicked(int) ) ); |
150 | gridLayout->addWidget( d->m_font_size_list, 3, 1 ); | 150 | gridLayout->addWidget( d->m_font_size_list, 3, 1 ); |
151 | 151 | ||
152 | d->m_pointbug = ( qt_version() <= 233 ); | 152 | d->m_pointbug = ( qt_version() <= 233 ); |
153 | 153 | ||
154 | if ( withpreview ) | 154 | if ( withpreview ) |
155 | { | 155 | { |
156 | d->m_preview = new QMultiLineEdit ( this, "Preview" ); | 156 | d->m_preview = new QMultiLineEdit ( this, "Preview" ); |
157 | d->m_preview->setAlignment ( AlignCenter ); | 157 | d->m_preview->setAlignment ( AlignCenter ); |
158 | d->m_preview->setWordWrap ( QMultiLineEdit::WidgetWidth ); | 158 | d->m_preview->setWordWrap ( QMultiLineEdit::WidgetWidth ); |
159 | d->m_preview->setMargin ( 3 ); | 159 | d->m_preview->setMargin ( 3 ); |
160 | d->m_preview->setText ( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" )); | 160 | d->m_preview->setText ( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" )); |
161 | gridLayout->addRowSpacing ( 5, 4 ); | 161 | gridLayout->addRowSpacing ( 5, 4 ); |
162 | gridLayout->addMultiCellWidget ( d->m_preview, 6, 6, 0, 1 ); | 162 | gridLayout->addMultiCellWidget ( d->m_preview, 6, 6, 0, 1 ); |
163 | gridLayout->setRowStretch ( 6, 5 ); | 163 | gridLayout->setRowStretch ( 6, 5 ); |
164 | } | 164 | } |
165 | else | 165 | else |
166 | d->m_preview = 0; | 166 | d->m_preview = 0; |
167 | 167 | ||
168 | loadFonts ( d->m_font_family_list ); | 168 | loadFonts ( d->m_font_family_list ); |
169 | } | 169 | } |
170 | 170 | ||
171 | OFontSelector::~OFontSelector() | 171 | OFontSelector::~OFontSelector() |
172 | { | 172 | { |
173 | delete d; | 173 | delete d; |
174 | } | 174 | } |
175 | 175 | ||
176 | /** | 176 | /** |
177 | * This methods tries to set the font | 177 | * This methods tries to set the font |
178 | * @param f The wishes font | 178 | * @param f The wishes font |
179 | * @return success or failure | 179 | * @return success or failure |
180 | */ | 180 | */ |
181 | bool OFontSelector::setSelectedFont ( const QFont &f ) | 181 | bool OFontSelector::setSelectedFont ( const QFont &f ) |
182 | { | 182 | { |
183 | return setSelectedFont ( f. family(), d->m_fdb. styleString ( f ), f. pointSize(), QFont::encodingName ( f. charSet())); | 183 | return setSelectedFont ( f. family(), d->m_fdb. styleString ( f ), f. pointSize(), QFont::encodingName ( f. charSet())); |
184 | } | 184 | } |
185 | 185 | ||
186 | 186 | ||
187 | /** | 187 | /** |
188 | * This is an overloaded method @see setSelectedFont | 188 | * This is an overloaded method @see setSelectedFont |
189 | * @param familyStr The family of the font | 189 | * @param familyStr The family of the font |
190 | * @param styleStr The style of the font | 190 | * @param styleStr The style of the font |
191 | * @param sizeVal The size of font | 191 | * @param sizeVal The size of font |
192 | * @param charset The charset to be used. Will be deprecated by QT3 | 192 | * @param charset The charset to be used. Will be deprecated by QT3 |
193 | */ | 193 | */ |
194 | bool OFontSelector::setSelectedFont( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset ) | 194 | bool OFontSelector::setSelectedFont( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset ) |
195 | { | 195 | { |
196 | Q_CONST_UNUSED( charset ) | ||
196 | QString sizeStr = QString::number ( sizeVal ); | 197 | QString sizeStr = QString::number ( sizeVal ); |
197 | 198 | ||
198 | QListBoxItem *family = d->m_font_family_list->findItem ( familyStr ); | 199 | QListBoxItem *family = d->m_font_family_list->findItem ( familyStr ); |
199 | if ( !family ) | 200 | if ( !family ) |
200 | family = d->m_font_family_list->findItem ( "Helvetica" ); | 201 | family = d->m_font_family_list->findItem ( "Helvetica" ); |
201 | if ( !family ) | 202 | if ( !family ) |
202 | family = d->m_font_family_list->firstItem(); | 203 | family = d->m_font_family_list->firstItem(); |
203 | d->m_font_family_list->setCurrentItem ( family ); | 204 | d->m_font_family_list->setCurrentItem ( family ); |
204 | fontFamilyClicked ( d->m_font_family_list->index ( family )); | 205 | fontFamilyClicked ( d->m_font_family_list->index ( family )); |
205 | 206 | ||
206 | int style = findItemCB ( d->m_font_style_list, styleStr ); | 207 | int style = findItemCB ( d->m_font_style_list, styleStr ); |
207 | if ( style < 0 ) | 208 | if ( style < 0 ) |
208 | style = findItemCB ( d->m_font_style_list, "Regular" ); | 209 | style = findItemCB ( d->m_font_style_list, "Regular" ); |
209 | if ( style < 0 && d->m_font_style_list->count() > 0 ) | 210 | if ( style < 0 && d->m_font_style_list->count() > 0 ) |
210 | style = 0; | 211 | style = 0; |
211 | d->m_font_style_list->setCurrentItem ( style ); | 212 | d->m_font_style_list->setCurrentItem ( style ); |
212 | fontStyleClicked ( style ); | 213 | fontStyleClicked ( style ); |
213 | 214 | ||
214 | int size = findItemCB ( d->m_font_size_list, sizeStr ); | 215 | int size = findItemCB ( d->m_font_size_list, sizeStr ); |
215 | if ( size < 0 ) | 216 | if ( size < 0 ) |
216 | size = findItemCB ( d->m_font_size_list, "10" ); | 217 | size = findItemCB ( d->m_font_size_list, "10" ); |
217 | if ( size < 0 && d->m_font_size_list->count() > 0 ) | 218 | if ( size < 0 && d->m_font_size_list->count() > 0 ) |
218 | size = 0; | 219 | size = 0; |
219 | d->m_font_size_list->setCurrentItem ( size ); | 220 | d->m_font_size_list->setCurrentItem ( size ); |
220 | fontSizeClicked ( size ); | 221 | fontSizeClicked ( size ); |
221 | 222 | ||
222 | return (( family ) && ( style >= 0 ) && ( size >= 0 )); | 223 | return (( family ) && ( style >= 0 ) && ( size >= 0 )); |
223 | } | 224 | } |
224 | 225 | ||
225 | /** | 226 | /** |
226 | * This method returns the name, style and size of the currently selected | 227 | * This method returns the name, style and size of the currently selected |
227 | * font or false if no font is selected | 228 | * font or false if no font is selected |
228 | * @param family The font family will be written there | 229 | * @param family The font family will be written there |
229 | * @param style The style will be written there | 230 | * @param style The style will be written there |
230 | * @param size The size will be written there | 231 | * @param size The size will be written there |
231 | * @return success or failure | 232 | * @return success or failure |
232 | */ | 233 | */ |
233 | bool OFontSelector::selectedFont ( QString &family, QString &style, int &size ) | 234 | bool OFontSelector::selectedFont ( QString &family, QString &style, int &size ) |
234 | { | 235 | { |
235 | QString dummy; | 236 | QString dummy; |
236 | return selectedFont ( family, style, size, dummy ); | 237 | return selectedFont ( family, style, size, dummy ); |
237 | } | 238 | } |
238 | 239 | ||
239 | 240 | ||
240 | /** | 241 | /** |
241 | * This method does return the font family or QString::null if there is | 242 | * This method does return the font family or QString::null if there is |
242 | * no font item selected | 243 | * no font item selected |
243 | * @return the font family | 244 | * @return the font family |