-rw-r--r-- | microkde/ofontselector.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/microkde/ofontselector.cpp b/microkde/ofontselector.cpp index c8471cc..05095f3 100644 --- a/microkde/ofontselector.cpp +++ b/microkde/ofontselector.cpp | |||
@@ -92,97 +92,98 @@ static int findItemCB ( QComboBox *box, const QString &str ) | |||
92 | if ( box-> text ( i ) == str ) | 92 | if ( box-> text ( i ) == str ) |
93 | return i; | 93 | return i; |
94 | } | 94 | } |
95 | return -1; | 95 | return -1; |
96 | } | 96 | } |
97 | 97 | ||
98 | } | 98 | } |
99 | /* static same as anon. namespace */ | 99 | /* static same as anon. namespace */ |
100 | static int qt_version ( ) | 100 | static int qt_version ( ) |
101 | { | 101 | { |
102 | const char *qver = qVersion ( ); | 102 | const char *qver = qVersion ( ); |
103 | 103 | ||
104 | 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' ); |
105 | } | 105 | } |
106 | 106 | ||
107 | /** | 107 | /** |
108 | * Constructs the Selector object | 108 | * Constructs the Selector object |
109 | * @param withpreview If a font preview should be given | 109 | * @param withpreview If a font preview should be given |
110 | * @param parent The parent of the Font Selector | 110 | * @param parent The parent of the Font Selector |
111 | * @param name The name of the object | 111 | * @param name The name of the object |
112 | * @param fl WidgetFlags | 112 | * @param fl WidgetFlags |
113 | */ | 113 | */ |
114 | 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 ) |
115 | { | 115 | { |
116 | d = new OFontSelectorPrivate ( ); | 116 | d = new OFontSelectorPrivate ( ); |
117 | 117 | ||
118 | QGridLayout *gridLayout = new QGridLayout ( this, 0, 0, 4, 4 ); | 118 | QGridLayout *gridLayout = new QGridLayout ( this, 0, 0, 4, 4 ); |
119 | gridLayout->setRowStretch ( 4, 10 ); | 119 | gridLayout->setRowStretch ( 4, 10 ); |
120 | 120 | ||
121 | d-> m_font_family_list = new QListBox( this, "FontListBox" ); | 121 | d-> m_font_family_list = new QListBox( this, "FontListBox" ); |
122 | gridLayout->addMultiCellWidget( d-> m_font_family_list, 0, 4, 0, 0 ); | 122 | gridLayout->addMultiCellWidget( d-> m_font_family_list, 0, 4, 0, 0 ); |
123 | connect( d-> m_font_family_list, SIGNAL( highlighted( int ) ), this, SLOT( fontFamilyClicked( int ) ) ); | 123 | connect( d-> m_font_family_list, SIGNAL( highlighted( int ) ), this, SLOT( fontFamilyClicked( int ) ) ); |
124 | 124 | ||
125 | QLabel *label = new QLabel( tr( "Style" ), this ); | 125 | QLabel *label = new QLabel( tr( "Style" ), this ); |
126 | gridLayout->addWidget( label, 0, 1 ); | 126 | gridLayout->addWidget( label, 0, 1 ); |
127 | 127 | ||
128 | d-> m_font_style_list = new QComboBox( this, "StyleListBox" ); | 128 | d-> m_font_style_list = new QComboBox( this, "StyleListBox" ); |
129 | connect( d-> m_font_style_list, SIGNAL( activated( int ) ), this, SLOT( fontStyleClicked( int ) ) ); | 129 | connect( d-> m_font_style_list, SIGNAL( activated( int ) ), this, SLOT( fontStyleClicked( int ) ) ); |
130 | gridLayout->addWidget( d-> m_font_style_list, 1, 1 ); | 130 | gridLayout->addWidget( d-> m_font_style_list, 1, 1 ); |
131 | 131 | ||
132 | label = new QLabel( tr( "Size" ), this ); | 132 | label = new QLabel( tr( "Size" ), this ); |
133 | gridLayout->addWidget( label, 2, 1 ); | 133 | gridLayout->addWidget( label, 2, 1 ); |
134 | 134 | ||
135 | d-> m_font_size_list = new QComboBox( this, "SizeListBox" ); | 135 | d-> m_font_size_list = new QComboBox( this, "SizeListBox" ); |
136 | connect( d-> m_font_size_list, SIGNAL( activated( int ) ), | 136 | connect( d-> m_font_size_list, SIGNAL( activated( int ) ), |
137 | this, SLOT( fontSizeClicked( int ) ) ); | 137 | this, SLOT( fontSizeClicked( int ) ) ); |
138 | gridLayout->addWidget( d-> m_font_size_list, 3, 1 ); | 138 | gridLayout->addWidget( d-> m_font_size_list, 3, 1 ); |
139 | 139 | ||
140 | d-> m_pointbug = ( qt_version ( ) <= 233 ); | 140 | //d-> m_pointbug = ( qt_version ( ) <= 233 ); |
141 | d->m_pointbug = ( qt_version() == 232 || qt_version() == 233 ); // SharpROM uses 2.3.2 | ||
141 | 142 | ||
142 | if ( withpreview ) { | 143 | if ( withpreview ) { |
143 | d-> m_preview = new QMultiLineEdit ( this, "Preview" ); | 144 | d-> m_preview = new QMultiLineEdit ( this, "Preview" ); |
144 | d-> m_preview-> setAlignment ( AlignCenter ); | 145 | d-> m_preview-> setAlignment ( AlignCenter ); |
145 | d-> m_preview-> setWordWrap ( QMultiLineEdit::WidgetWidth ); | 146 | d-> m_preview-> setWordWrap ( QMultiLineEdit::WidgetWidth ); |
146 | d-> m_preview-> setMargin ( 3 ); | 147 | d-> m_preview-> setMargin ( 3 ); |
147 | d-> m_preview-> setText ( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" )); | 148 | d-> m_preview-> setText ( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" )); |
148 | gridLayout-> addRowSpacing ( 5, 4 ); | 149 | gridLayout-> addRowSpacing ( 5, 4 ); |
149 | gridLayout-> addMultiCellWidget ( d-> m_preview, 6, 6, 0, 1 ); | 150 | gridLayout-> addMultiCellWidget ( d-> m_preview, 6, 6, 0, 1 ); |
150 | gridLayout-> setRowStretch ( 6, 5 ); | 151 | gridLayout-> setRowStretch ( 6, 5 ); |
151 | } | 152 | } |
152 | else | 153 | else |
153 | d-> m_preview = 0; | 154 | d-> m_preview = 0; |
154 | 155 | ||
155 | loadFonts ( d-> m_font_family_list ); | 156 | loadFonts ( d-> m_font_family_list ); |
156 | } | 157 | } |
157 | 158 | ||
158 | OFontSelector::~OFontSelector ( ) | 159 | OFontSelector::~OFontSelector ( ) |
159 | { | 160 | { |
160 | delete d; | 161 | delete d; |
161 | } | 162 | } |
162 | 163 | ||
163 | /** | 164 | /** |
164 | * This methods tries to set the font | 165 | * This methods tries to set the font |
165 | * @param f The wishes font | 166 | * @param f The wishes font |
166 | * @return success or failure | 167 | * @return success or failure |
167 | */ | 168 | */ |
168 | bool OFontSelector::setSelectedFont ( const QFont &f ) | 169 | bool OFontSelector::setSelectedFont ( const QFont &f ) |
169 | { | 170 | { |
170 | return setSelectedFont ( f. family ( ), d-> m_fdb. styleString ( f ), f. pointSize ( ), QFont::encodingName ( f. charSet ( ))); | 171 | return setSelectedFont ( f. family ( ), d-> m_fdb. styleString ( f ), f. pointSize ( ), QFont::encodingName ( f. charSet ( ))); |
171 | } | 172 | } |
172 | 173 | ||
173 | 174 | ||
174 | /** | 175 | /** |
175 | * This is an overloaded method @see setSelectedFont | 176 | * This is an overloaded method @see setSelectedFont |
176 | * @param familyStr The family of the font | 177 | * @param familyStr The family of the font |
177 | * @param styleStr The style of the font | 178 | * @param styleStr The style of the font |
178 | * @param sizeVal The size of font | 179 | * @param sizeVal The size of font |
179 | * @param charset The charset to be used. Will be deprecated by QT3 | 180 | * @param charset The charset to be used. Will be deprecated by QT3 |
180 | */ | 181 | */ |
181 | bool OFontSelector::setSelectedFont ( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset ) | 182 | bool OFontSelector::setSelectedFont ( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset ) |
182 | { | 183 | { |
183 | QString sizeStr = QString::number ( sizeVal ); | 184 | QString sizeStr = QString::number ( sizeVal ); |
184 | 185 | ||
185 | QListBoxItem *family = d-> m_font_family_list-> findItem ( familyStr ); | 186 | QListBoxItem *family = d-> m_font_family_list-> findItem ( familyStr ); |
186 | if ( !family ) | 187 | if ( !family ) |
187 | family = d-> m_font_family_list-> findItem ( "Helvetica" ); | 188 | family = d-> m_font_family_list-> findItem ( "Helvetica" ); |
188 | if ( !family ) | 189 | if ( !family ) |