summaryrefslogtreecommitdiff
path: root/libopie2/opieui/ofontselector.cpp
Unidiff
Diffstat (limited to 'libopie2/opieui/ofontselector.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/ofontselector.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/libopie2/opieui/ofontselector.cpp b/libopie2/opieui/ofontselector.cpp
index 49ddeb6..f93781f 100644
--- a/libopie2/opieui/ofontselector.cpp
+++ b/libopie2/opieui/ofontselector.cpp
@@ -87,111 +87,111 @@ public:
87 87
88 const QValueList<int> &sizes() const 88 const QValueList<int> &sizes() const
89 { 89 {
90 return m_sizes; 90 return m_sizes;
91 } 91 }
92 92
93private: 93private:
94 QStringList m_styles; 94 QStringList m_styles;
95 QValueList<int> m_sizes; 95 QValueList<int> m_sizes;
96 QString m_name; 96 QString m_name;
97}; 97};
98 98
99 99
100static int findItemCB( QComboBox *box, const QString &str ) 100static int findItemCB( QComboBox *box, const QString &str )
101{ 101{
102 for ( int i = 0; i < box->count(); i++ ) 102 for ( int i = 0; i < box->count(); i++ )
103 { 103 {
104 if ( box->text ( i ) == str ) 104 if ( box->text ( i ) == str )
105 return i; 105 return i;
106 } 106 }
107 return -1; 107 return -1;
108} 108}
109 109
110} 110}
111/* static same as anon. namespace */ 111/* static same as anon. namespace */
112static int qt_version() 112static 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 */
126OFontSelector::OFontSelector( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) 126OFontSelector::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 );
135 connect( d->m_font_family_list, SIGNAL( highlighted( int ) ), this, SLOT( fontFamilyClicked( int ) ) ); 135 connect( d->m_font_family_list, SIGNAL( highlighted(int) ), this, SLOT( fontFamilyClicked(int) ) );
136 136
137 QLabel *label = new QLabel( tr( "Style" ), this ); 137 QLabel *label = new QLabel( tr( "Style" ), this );
138 gridLayout->addWidget( label, 0, 1 ); 138 gridLayout->addWidget( label, 0, 1 );
139 139
140 d->m_font_style_list = new QComboBox( this, "StyleListBox" ); 140 d->m_font_style_list = new QComboBox( this, "StyleListBox" );
141 connect( d->m_font_style_list, SIGNAL( activated( int ) ), this, SLOT( fontStyleClicked( int ) ) ); 141 connect( d->m_font_style_list, SIGNAL( activated(int) ), this, SLOT( fontStyleClicked(int) ) );
142 gridLayout->addWidget( d->m_font_style_list, 1, 1 ); 142 gridLayout->addWidget( d->m_font_style_list, 1, 1 );
143 143
144 label = new QLabel( tr( "Size" ), this ); 144 label = new QLabel( tr( "Size" ), this );
145 gridLayout->addWidget( label, 2, 1 ); 145 gridLayout->addWidget( label, 2, 1 );
146 146
147 d->m_font_size_list = new QComboBox( this, "SizeListBox" ); 147 d->m_font_size_list = new QComboBox( this, "SizeListBox" );
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
171OFontSelector::~OFontSelector() 171OFontSelector::~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 */
181bool OFontSelector::setSelectedFont ( const QFont &f ) 181bool 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 */
194bool OFontSelector::setSelectedFont( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset ) 194bool OFontSelector::setSelectedFont( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset )
195{ 195{
196 QString sizeStr = QString::number ( sizeVal ); 196 QString sizeStr = QString::number ( sizeVal );
197 197