summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-06-26 12:36:16 (UTC)
committer llornkcor <llornkcor>2002-06-26 12:36:16 (UTC)
commit4b0e72bed1ead4e3c7af2209a11f34aa9209653c (patch) (unidiff)
tree2226ec05b90e27487504f38cb385b4b22816fb33
parentb72d90431bf1bf3235213612daad275836bcbb9f (diff)
downloadopie-4b0e72bed1ead4e3c7af2209a11f34aa9209653c.zip
opie-4b0e72bed1ead4e3c7af2209a11f34aa9209653c.tar.gz
opie-4b0e72bed1ead4e3c7af2209a11f34aa9209653c.tar.bz2
fixed font dialog not showing maximized
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/textedit/fontDialog.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/core/apps/textedit/fontDialog.cpp b/core/apps/textedit/fontDialog.cpp
index 681e8a6..5cdf538 100644
--- a/core/apps/textedit/fontDialog.cpp
+++ b/core/apps/textedit/fontDialog.cpp
@@ -1,236 +1,237 @@
1/**************************************************************************** 1/****************************************************************************
2** Created: Sun Jan 27 11:03:24 2002 fileDialog.cpp 2** Created: Sun Jan 27 11:03:24 2002 fileDialog.cpp
3copyright 2002 by L.J. Potter ljp@llornkcor.com 3copyright 2002 by L.J. Potter ljp@llornkcor.com
4 4
5** This file may be distributed and/or modified under the terms of the 5** This file may be distributed and/or modified under the terms of the
6** GNU General Public License version 2 as published by the Free Software 6** GNU General Public License version 2 as published by the Free Software
7** Foundation and appearing in the file LICENSE.GPL included in the 7** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file. 8** packaging of this file.
9** 9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12** 12**
13****************************************************************************/ 13****************************************************************************/
14#include "fontDialog.h" 14#include "fontDialog.h"
15 15
16#include <qpe/fontdatabase.h> 16#include <qpe/fontdatabase.h>
17#include <qpe/config.h> 17#include <qpe/config.h>
18 18
19#include <qstringlist.h> 19#include <qstringlist.h>
20#include <qfontinfo.h> 20#include <qfontinfo.h>
21#include <qvaluelist.h> 21#include <qvaluelist.h>
22#include <qpe/qpeapplication.h> 22#include <qpe/qpeapplication.h>
23 23
24#include <qgroupbox.h> 24#include <qgroupbox.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qlistbox.h> 26#include <qlistbox.h>
27#include <qmultilineedit.h> 27#include <qmultilineedit.h>
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qvariant.h> 30#include <qvariant.h>
31#include <qtooltip.h> 31#include <qtooltip.h>
32#include <qwhatsthis.h> 32#include <qwhatsthis.h>
33 33
34FontDialog::FontDialog( QWidget * parent, const char* name , bool modal, WFlags fl ) 34FontDialog::FontDialog( QWidget * parent, const char* name , bool modal, WFlags fl )
35 :QDialog /*QWidget*/( parent, name , modal, fl ) 35 :QDialog /*QWidget*/( parent, name , modal, fl )
36{ 36{
37 if ( !name ) 37 if ( !name )
38 setName( tr("FontDialog") ); 38 setName( tr("FontDialog") );
39 setCaption( tr( "Font Dialog" ) ); 39 setCaption( tr( "Font Dialog" ) );
40 FontTextLabel4 = new QLabel( this, "TextLabel4" ); 40 FontTextLabel4 = new QLabel( this, "TextLabel4" );
41 FontTextLabel4->setGeometry( QRect( 145, 100, 30, 19 /*192, 0, 43, 19*/ ) ); 41 FontTextLabel4->setGeometry( QRect( 145, 100, 30, 19 /*192, 0, 43, 19*/ ) );
42 FontTextLabel4->setText( tr( "Size" ) ); 42 FontTextLabel4->setText( tr( "Size" ) );
43 43
44 FamilyGroup = new QGroupBox( this, "FamilyGroup" ); 44 FamilyGroup = new QGroupBox( this, "FamilyGroup" );
45 FamilyGroup->setGeometry( QRect( 5, 5, 115, 135 /*0, 6, 185, 131 */) ); 45 FamilyGroup->setGeometry( QRect( 5, 5, 115, 135 /*0, 6, 185, 131 */) );
46 FamilyGroup->setTitle( tr( "Font" ) ); 46 FamilyGroup->setTitle( tr( "Font" ) );
47 47
48 familyListBox = new QListBox( FamilyGroup, "familyListBox" ); 48 familyListBox = new QListBox( FamilyGroup, "familyListBox" );
49 familyListBox->setGeometry( QRect( 5, 20, 100, 105 /* 6, 18, 170, 105 */) ); 49 familyListBox->setGeometry( QRect( 5, 20, 100, 105 /* 6, 18, 170, 105 */) );
50 50
51 GroupBox2 = new QGroupBox( this, "GroupBox2" ); 51 GroupBox2 = new QGroupBox( this, "GroupBox2" );
52 GroupBox2->setGeometry( QRect( 120, 5, 100, 90/* 0, 138, 170, 90*/ ) ); 52 GroupBox2->setGeometry( QRect( 120, 5, 100, 90/* 0, 138, 170, 90*/ ) );
53 GroupBox2->setTitle( tr( "Font Style" ) ); 53 GroupBox2->setTitle( tr( "Font Style" ) );
54 54
55 styleListBox = new QListBox( GroupBox2, "styleListBox" ); 55 styleListBox = new QListBox( GroupBox2, "styleListBox" );
56 styleListBox->setGeometry( QRect( 5, 20, 90, 60 /*10, 20, 150, 61*/ ) ); 56 styleListBox->setGeometry( QRect( 5, 20, 90, 60 /*10, 20, 150, 61*/ ) );
57 57
58 sizeListBox = new QListBox( this, "sizeListBox" ); 58 sizeListBox = new QListBox( this, "sizeListBox" );
59 sizeListBox->setGeometry( QRect( 180, 100, 40, 60 /* 192, 24, 40, 108 */) ); 59 sizeListBox->setGeometry( QRect( 180, 100, 40, 60 /* 192, 24, 40, 108 */) );
60 60
61 MultiLineEdit1 = new QMultiLineEdit( this, "MultiLineEdit1" ); 61 MultiLineEdit1 = new QMultiLineEdit( this, "MultiLineEdit1" );
62 MultiLineEdit1->setGeometry( QRect( 5, 165, 215, 45 /* 6, 234, 222, 55*/ ) ); 62 MultiLineEdit1->setGeometry( QRect( 5, 165, 215, 45 /* 6, 234, 222, 55*/ ) );
63 MultiLineEdit1->setText( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" ) ); 63 MultiLineEdit1->setText( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" ) );
64 MultiLineEdit1->setWordWrap(QMultiLineEdit::WidgetWidth); 64 MultiLineEdit1->setWordWrap(QMultiLineEdit::WidgetWidth);
65 65
66 connect( familyListBox,SIGNAL( highlighted( const QString &)),SLOT( familyListBoxSlot(const QString &) )); 66 connect( familyListBox,SIGNAL( highlighted( const QString &)),SLOT( familyListBoxSlot(const QString &) ));
67 connect( styleListBox,SIGNAL( highlighted( const QString &)),SLOT( styleListBoxSlot(const QString &) )); 67 connect( styleListBox,SIGNAL( highlighted( const QString &)),SLOT( styleListBoxSlot(const QString &) ));
68 connect( sizeListBox,SIGNAL( highlighted( const QString &)),SLOT( sizeListBoxSlot(const QString &) )); 68 connect( sizeListBox,SIGNAL( highlighted( const QString &)),SLOT( sizeListBoxSlot(const QString &) ));
69 69
70 populateLists(); 70 populateLists();
71// MultiLineEdit1 71// MultiLineEdit1
72// connect(); 72// connect();
73 73// move(5,15);
74 showMaximized();
74} 75}
75 76
76FontDialog::~FontDialog() 77FontDialog::~FontDialog()
77{ 78{
78} 79}
79 80
80void FontDialog::familyListBoxSlot(const QString & text) 81void FontDialog::familyListBoxSlot(const QString & text)
81{ 82{
82 int styleInt=styleListBox->currentItem(); 83 int styleInt=styleListBox->currentItem();
83 int sizeInt=sizeListBox->currentItem(); 84 int sizeInt=sizeListBox->currentItem();
84 85
85 styleListBox->clear(); 86 styleListBox->clear();
86 sizeListBox->clear(); 87 sizeListBox->clear();
87 family= text; 88 family= text;
88// qDebug(family); 89// qDebug(family);
89 QStringList styles = fdb.styles( family ); // string list of styles of our current font family 90 QStringList styles = fdb.styles( family ); // string list of styles of our current font family
90 styleListBox->insertStringList( styles); 91 styleListBox->insertStringList( styles);
91 QString dstyle;// = "\t" + style + " ("; 92 QString dstyle;// = "\t" + style + " (";
92 QValueList<int> smoothies = fdb.smoothSizes( family, styleListBox->text(0) ); 93 QValueList<int> smoothies = fdb.smoothSizes( family, styleListBox->text(0) );
93 for ( QValueList<int>::Iterator points = smoothies.begin(); points != smoothies.end(); ++points ) { 94 for ( QValueList<int>::Iterator points = smoothies.begin(); points != smoothies.end(); ++points ) {
94 dstyle = QString::number( *points ); 95 dstyle = QString::number( *points );
95 sizeListBox ->insertItem( dstyle.left( dstyle.length() - 1 )); 96 sizeListBox ->insertItem( dstyle.left( dstyle.length() - 1 ));
96 } 97 }
97 if(styleInt == -1 || styleInt > styleListBox->count() ) 98 if(styleInt == -1 || styleInt > styleListBox->count() )
98 styleListBox->setCurrentItem(0); 99 styleListBox->setCurrentItem(0);
99 else 100 else
100 styleListBox->setCurrentItem(styleInt); 101 styleListBox->setCurrentItem(styleInt);
101 102
102 if(sizeInt == -1 || sizeInt > sizeListBox->count()) 103 if(sizeInt == -1 || sizeInt > sizeListBox->count())
103 sizeListBox->setCurrentItem(0); 104 sizeListBox->setCurrentItem(0);
104 else 105 else
105 sizeListBox->setCurrentItem(sizeInt); 106 sizeListBox->setCurrentItem(sizeInt);
106 107
107 changeText(); 108 changeText();
108} 109}
109 110
110void FontDialog::styleListBoxSlot(const QString &text) 111void FontDialog::styleListBoxSlot(const QString &text)
111{ 112{
112 changeText(); 113 changeText();
113} 114}
114 115
115void FontDialog::sizeListBoxSlot(const QString & text) 116void FontDialog::sizeListBoxSlot(const QString & text)
116{ 117{
117 changeText(); 118 changeText();
118} 119}
119 120
120void FontDialog::populateLists() 121void FontDialog::populateLists()
121{ 122{
122// QFont defaultFont=MultiLineEdit1->font(); 123// QFont defaultFont=MultiLineEdit1->font();
123// QFont defaultFont=Lview->font(); 124// QFont defaultFont=Lview->font();
124// QFontInfo fontInfo(defaultFont); 125// QFontInfo fontInfo(defaultFont);
125 Config config("TextEdit"); 126 Config config("TextEdit");
126 config.setGroup("Font"); 127 config.setGroup("Font");
127 QString familyStr = config.readEntry("Family", "fixed"); 128 QString familyStr = config.readEntry("Family", "fixed");
128 QString styleStr = config.readEntry("Style", "Regular"); 129 QString styleStr = config.readEntry("Style", "Regular");
129 QString sizeStr = config.readEntry("Size", "10"); 130 QString sizeStr = config.readEntry("Size", "10");
130 QString charSetStr = config.readEntry("CharSet", "iso10646-1" ); 131 QString charSetStr = config.readEntry("CharSet", "iso10646-1" );
131 bool ok; 132 bool ok;
132 int i_size=sizeStr.toInt(&ok,10); 133 int i_size=sizeStr.toInt(&ok,10);
133 selectedFont = fdb.font(familyStr,styleStr,i_size,charSetStr); 134 selectedFont = fdb.font(familyStr,styleStr,i_size,charSetStr);
134// defaultFont.setItalic(TRUE); 135// defaultFont.setItalic(TRUE);
135 families = fdb.families(); 136 families = fdb.families();
136 for ( QStringList::Iterator f = families.begin(); f != families.end();++f ) { 137 for ( QStringList::Iterator f = families.begin(); f != families.end();++f ) {
137 QString family = *f; 138 QString family = *f;
138// if(family == defaultFont.family()) 139// if(family == defaultFont.family())
139// qDebug(family); 140// qDebug(family);
140 familyListBox->insertItem( family); 141 familyListBox->insertItem( family);
141 142
142 if( familyListBox->text(0) == family) { 143 if( familyListBox->text(0) == family) {
143 QStringList styles = fdb.styles( family ); // string list of styles of our current font family 144 QStringList styles = fdb.styles( family ); // string list of styles of our current font family
144 styleListBox->insertStringList( styles); 145 styleListBox->insertStringList( styles);
145 for ( QStringList::Iterator s = styles.begin(); s != styles.end();++s ) { // for each font style 146 for ( QStringList::Iterator s = styles.begin(); s != styles.end();++s ) { // for each font style
146 style = *s; 147 style = *s;
147 QString dstyle;// = "\t" + style + " ("; 148 QString dstyle;// = "\t" + style + " (";
148 if(styleListBox->text(0) == style) { 149 if(styleListBox->text(0) == style) {
149 QValueList<int> smoothies = fdb.smoothSizes( family, style ); 150 QValueList<int> smoothies = fdb.smoothSizes( family, style );
150 for ( QValueList<int>::Iterator points = smoothies.begin(); points != smoothies.end(); ++points ) { 151 for ( QValueList<int>::Iterator points = smoothies.begin(); points != smoothies.end(); ++points ) {
151 dstyle = QString::number( *points ) + " "; 152 dstyle = QString::number( *points ) + " ";
152 153
153 sizeListBox ->insertItem( dstyle.left( dstyle.length() - 1 )); 154 sizeListBox ->insertItem( dstyle.left( dstyle.length() - 1 ));
154 } 155 }
155 dstyle = dstyle.left( dstyle.length() - 1 ) + ")"; 156 dstyle = dstyle.left( dstyle.length() - 1 ) + ")";
156 } 157 }
157 } // styles 158 } // styles
158 } 159 }
159 } 160 }
160 for(int i=0;i < familyListBox->count();i++) { 161 for(int i=0;i < familyListBox->count();i++) {
161 if( familyListBox->text(i) == familyStr) 162 if( familyListBox->text(i) == familyStr)
162 familyListBox->setSelected( i, TRUE); 163 familyListBox->setSelected( i, TRUE);
163 } 164 }
164 165
165 for(int i=0;i < styleListBox->count();i++) { 166 for(int i=0;i < styleListBox->count();i++) {
166 if( styleListBox->text(i) == styleStr) 167 if( styleListBox->text(i) == styleStr)
167 styleListBox->setSelected( i, TRUE); 168 styleListBox->setSelected( i, TRUE);
168 } 169 }
169 170
170 for(int i=0;i < sizeListBox->count();i++) { 171 for(int i=0;i < sizeListBox->count();i++) {
171 if( sizeListBox->text(i) == sizeStr) 172 if( sizeListBox->text(i) == sizeStr)
172 sizeListBox->setSelected( i, TRUE); 173 sizeListBox->setSelected( i, TRUE);
173 } 174 }
174 changeText(); 175 changeText();
175} 176}
176 177
177void FontDialog::clearListBoxes() { 178void FontDialog::clearListBoxes() {
178 familyListBox->clear(); 179 familyListBox->clear();
179 sizeListBox->clear(); 180 sizeListBox->clear();
180 styleListBox->clear(); 181 styleListBox->clear();
181} 182}
182 183
183void FontDialog::changeText() 184void FontDialog::changeText()
184{ 185{
185 if( familyListBox->currentItem() == -1) 186 if( familyListBox->currentItem() == -1)
186 family= familyListBox->text(0); 187 family= familyListBox->text(0);
187 else { 188 else {
188 family = familyListBox->currentText(); 189 family = familyListBox->currentText();
189 } 190 }
190// qDebug("Font family is "+family); 191// qDebug("Font family is "+family);
191 if( styleListBox->currentItem() == -1) 192 if( styleListBox->currentItem() == -1)
192 style=styleListBox->text(0); 193 style=styleListBox->text(0);
193 else { 194 else {
194 style = styleListBox->currentText(); 195 style = styleListBox->currentText();
195 } 196 }
196// qDebug("font style is "+style); 197// qDebug("font style is "+style);
197 if( sizeListBox->currentItem() == -1 ) 198 if( sizeListBox->currentItem() == -1 )
198 size= sizeListBox->text(0); 199 size= sizeListBox->text(0);
199 else { 200 else {
200 size = sizeListBox->currentText(); 201 size = sizeListBox->currentText();
201 } 202 }
202 203
203// qDebug("Font size is "+size); 204// qDebug("Font size is "+size);
204 bool ok; 205 bool ok;
205 int i_size= size.toInt(&ok,10); 206 int i_size= size.toInt(&ok,10);
206 QStringList charSetList= fdb.charSets(family); 207 QStringList charSetList= fdb.charSets(family);
207// QStringList styles = fdb.styles( family ); // string list of styles of our current font family 208// QStringList styles = fdb.styles( family ); // string list of styles of our current font family
208 QString charSet; 209 QString charSet;
209 for ( QStringList::Iterator s = charSetList.begin(); s != charSetList.end();++s ) { // for each font style 210 for ( QStringList::Iterator s = charSetList.begin(); s != charSetList.end();++s ) { // for each font style
210 charSet = *s; 211 charSet = *s;
211// qDebug(charSet); 212// qDebug(charSet);
212 } 213 }
213 selectedFont = fdb.font(family,style,i_size,charSet); 214 selectedFont = fdb.font(family,style,i_size,charSet);
214 QFontInfo fontInfo( selectedFont); 215 QFontInfo fontInfo( selectedFont);
215// if(fontInfo.italic() ) qDebug("italic"); 216// if(fontInfo.italic() ) qDebug("italic");
216 selectedFont.setWeight(fontInfo.weight() ); 217 selectedFont.setWeight(fontInfo.weight() );
217// qDebug("Style are "+style+" %d ",fontInfo.weight()); 218// qDebug("Style are "+style+" %d ",fontInfo.weight());
218 Config cfg("TextEdit"); 219 Config cfg("TextEdit");
219 cfg.setGroup("Font"); 220 cfg.setGroup("Font");
220 cfg.writeEntry("Family",family); 221 cfg.writeEntry("Family",family);
221 cfg.writeEntry("Style",style); 222 cfg.writeEntry("Style",style);
222 cfg.writeEntry("Size",size); 223 cfg.writeEntry("Size",size);
223 cfg.writeEntry("CharSet",charSet); 224 cfg.writeEntry("CharSet",charSet);
224 225
225 if(style.find("Italic",0,TRUE) != -1) { 226 if(style.find("Italic",0,TRUE) != -1) {
226 selectedFont = fdb.font(family,"Regular",i_size,charSet); 227 selectedFont = fdb.font(family,"Regular",i_size,charSet);
227 selectedFont.setItalic(TRUE); //ya right 228 selectedFont.setItalic(TRUE); //ya right
228 cfg.writeEntry("Italic","TRUE"); 229 cfg.writeEntry("Italic","TRUE");
229// qDebug("Style is "+styleListBox->currentText()); 230// qDebug("Style is "+styleListBox->currentText());
230 } else 231 } else
231 cfg.writeEntry("Italic","FALSE"); 232 cfg.writeEntry("Italic","FALSE");
232 changedFonts=TRUE; 233 changedFonts=TRUE;
233 MultiLineEdit1->setFont( selectedFont); 234 MultiLineEdit1->setFont( selectedFont);
234 MultiLineEdit1->update(); 235 MultiLineEdit1->update();
235} 236}
236 237