summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-gutenbrowser/fontDialog.cpp
authorzecke <zecke>2004-09-10 11:11:23 (UTC)
committer zecke <zecke>2004-09-10 11:11:23 (UTC)
commit532d65f8a45850bfda3c3344a7b165af91e48440 (patch) (unidiff)
treecbda2467001ed9a5be304fa52cabbb797b56ecfe /noncore/apps/opie-gutenbrowser/fontDialog.cpp
parente64d9e9682e0afefc4fbebe7ba9737e0f86e3ed7 (diff)
downloadopie-532d65f8a45850bfda3c3344a7b165af91e48440.zip
opie-532d65f8a45850bfda3c3344a7b165af91e48440.tar.gz
opie-532d65f8a45850bfda3c3344a7b165af91e48440.tar.bz2
Add newlines, remove unused local variables, remove unused parameters,
add newlines at the end of file...
Diffstat (limited to 'noncore/apps/opie-gutenbrowser/fontDialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-gutenbrowser/fontDialog.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/noncore/apps/opie-gutenbrowser/fontDialog.cpp b/noncore/apps/opie-gutenbrowser/fontDialog.cpp
index fa964a6..c6d0fe6 100644
--- a/noncore/apps/opie-gutenbrowser/fontDialog.cpp
+++ b/noncore/apps/opie-gutenbrowser/fontDialog.cpp
@@ -52,20 +52,20 @@ FontDialog::FontDialog( QWidget * parent, const char* name /*, bool modal, WFla
52 styleListBox = new QListBox( this, "styleListBox" ); 52 styleListBox = new QListBox( this, "styleListBox" );
53 vbox->addWidget( styleListBox, 0); 53 vbox->addWidget( styleListBox, 0);
54 54
55 FontTextLabel4 = new QLabel( this, "TextLabel4" ); 55 FontTextLabel4 = new QLabel( this, "TextLabel4" );
56 FontTextLabel4->setText( tr( "Size" ) ); 56 FontTextLabel4->setText( tr( "Size" ) );
57 hbox->addWidget( FontTextLabel4,0); 57 hbox->addWidget( FontTextLabel4,0);
58 58
59 sizeComboBox = new QComboBox( FALSE, this, "SizeCombo"); 59 sizeComboBox = new QComboBox( FALSE, this, "SizeCombo");
60// sizeComboBox->setMaximumWidth(60); 60// sizeComboBox->setMaximumWidth(60);
61 hbox->addWidget( sizeComboBox, 0); 61 hbox->addWidget( sizeComboBox, 0);
62 62
63 vbox->addLayout(hbox,0); 63 vbox->addLayout(hbox,0);
64 layout->addLayout( vbox,0,3); 64 layout->addLayout( vbox,0,3);
65 65
66 MultiLineEdit1 = new QMultiLineEdit( this, "MultiLineEdit1" ); 66 MultiLineEdit1 = new QMultiLineEdit( this, "MultiLineEdit1" );
67 MultiLineEdit1->setText( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" ) ); 67 MultiLineEdit1->setText( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" ) );
68 MultiLineEdit1->setWordWrap( QMultiLineEdit::WidgetWidth); 68 MultiLineEdit1->setWordWrap( QMultiLineEdit::WidgetWidth);
69 69
70 layout->addMultiCellWidget( MultiLineEdit1, 4, 4, 0, 3); 70 layout->addMultiCellWidget( MultiLineEdit1, 4, 4, 0, 3);
71 71
@@ -87,49 +87,49 @@ void FontDialog::familyListBoxSlot(const QString & text)
87 int sizeInt = sizeComboBox->currentText().toInt(); 87 int sizeInt = sizeComboBox->currentText().toInt();
88 88
89 sizeComboBox->clear(); 89 sizeComboBox->clear();
90 styleListBox->clear(); 90 styleListBox->clear();
91// clearListBoxes(); 91// clearListBoxes();
92 family = text; 92 family = text;
93// odebug << family << oendl; 93// odebug << family << oendl;
94 QStringList styles = fdb.styles( family ); // string list of styles of our current font family 94 QStringList styles = fdb.styles( family ); // string list of styles of our current font family
95 styleListBox->insertStringList( styles); 95 styleListBox->insertStringList( styles);
96 QString dstyle;// = "\t" + style + " ("; 96 QString dstyle;// = "\t" + style + " (";
97 97
98#ifdef BUGGY_SHARP_ZAURUS 98#ifdef BUGGY_SHARP_ZAURUS
99 99
100QValueList<int> smoothies = fdb.smoothSizes( family, styleListBox->text(0) ); 100QValueList<int> smoothies = fdb.smoothSizes( family, styleListBox->text(0) );
101 for ( QValueList<int>::Iterator points = smoothies.begin(); points != smoothies.end(); ++points ) { 101 for ( QValueList<int>::Iterator points = smoothies.begin(); points != smoothies.end(); ++points ) {
102 dstyle = QString::number( *points ); 102 dstyle = QString::number( *points );
103 odebug << dstyle << oendl; 103 odebug << dstyle << oendl;
104 sizeComboBox->insertItem( dstyle.left( dstyle.length() - 1 )); 104 sizeComboBox->insertItem( dstyle.left( dstyle.length() - 1 ));
105 } 105 }
106#else 106#else
107 107
108 for (int i=0; i<nfontsizes; i++) { 108 for (int i=0; i<nfontsizes; i++) {
109 sizeComboBox->insertItem( QString::number(fontsize[i])); 109 sizeComboBox->insertItem( QString::number(fontsize[i]));
110 if(fontsize[i] == sizeInt) { 110 if(fontsize[i] == sizeInt) {
111 sizeComboBox->setCurrentItem(i); 111 sizeComboBox->setCurrentItem(i);
112 } 112 }
113 } 113 }
114#endif 114#endif
115 115
116 if(styleInt == -1 || styleInt > styleListBox->count() ) 116 if(styleInt == -1 || styleInt > static_cast<int>(styleListBox->count()) )
117 styleListBox->setCurrentItem(0); 117 styleListBox->setCurrentItem(0);
118 else 118 else
119 styleListBox->setCurrentItem(styleInt); 119 styleListBox->setCurrentItem(styleInt);
120 120
121 changeText(); 121 changeText();
122} 122}
123 123
124void FontDialog::styleListBoxSlot(const QString &text) 124void FontDialog::styleListBoxSlot(const QString &)
125{ 125{
126 changeText(); 126 changeText();
127} 127}
128 128
129void FontDialog::sizeComboBoxSlot(const QString & text) 129void FontDialog::sizeComboBoxSlot(const QString &)
130{ 130{
131 changeText(); 131 changeText();
132} 132}
133 133
134void FontDialog::populateLists() 134void FontDialog::populateLists()
135{ 135{
@@ -148,13 +148,13 @@ void FontDialog::populateLists()
148// defaultFont.setItalic(TRUE); 148// defaultFont.setItalic(TRUE);
149 families = fdb.families(); 149 families = fdb.families();
150 150
151 for ( QStringList::Iterator f = families.begin(); f != families.end();++f ) { 151 for ( QStringList::Iterator f = families.begin(); f != families.end();++f ) {
152 QString family = *f; 152 QString family = *f;
153// if(family == defaultFont.family()) 153// if(family == defaultFont.family())
154// odebug << family << oendl; 154// odebug << family << oendl;
155 familyListBox->insertItem( family); 155 familyListBox->insertItem( family);
156 156
157 if( familyListBox->text(0) == family) { 157 if( familyListBox->text(0) == family) {
158 QStringList styles = fdb.styles( family ); 158 QStringList styles = fdb.styles( family );
159// string list of styles of our current font family 159// string list of styles of our current font family
160 styleListBox->insertStringList( styles); 160 styleListBox->insertStringList( styles);
@@ -171,28 +171,28 @@ void FontDialog::populateLists()
171 } 171 }
172 dstyle = dstyle.left( dstyle.length() - 1 ) + ")"; 172 dstyle = dstyle.left( dstyle.length() - 1 ) + ")";
173 } 173 }
174 } // styles 174 } // styles
175 } 175 }
176 } 176 }
177 for(int i=0;i < familyListBox->count();i++) { 177 for(uint i=0;i < familyListBox->count();i++) {
178 if( familyListBox->text(i) == familyStr) 178 if( familyListBox->text(i) == familyStr)
179 familyListBox->setSelected( i, TRUE); 179 familyListBox->setSelected( i, TRUE);
180 } 180 }
181 181
182 for(int i=0;i < styleListBox->count();i++) { 182 for(uint i=0;i < styleListBox->count();i++) {
183 if( styleListBox->text(i) == styleStr) 183 if( styleListBox->text(i) == styleStr)
184 styleListBox->setSelected( i, TRUE); 184 styleListBox->setSelected( i, TRUE);
185 } 185 }
186 186
187 for (int i=0; i<sizeComboBox->count(); i++) { 187 for (int i=0; i<sizeComboBox->count(); i++) {
188 188
189#ifdef BUGGY_SHARP_ZAURUS 189#ifdef BUGGY_SHARP_ZAURUS
190 if(sizeComboBox->text(i) == sizeStr) 190 if(sizeComboBox->text(i) == sizeStr)
191#else 191#else
192 if(fontsize[i] == i_size) 192 if(fontsize[i] == i_size)
193#endif 193#endif
194 sizeComboBox->setCurrentItem(i); 194 sizeComboBox->setCurrentItem(i);
195 } 195 }
196 changeText(); 196 changeText();
197} 197}
198 198
@@ -206,53 +206,53 @@ void FontDialog::changeText()
206{ 206{
207 if( familyListBox->currentItem() == -1) 207 if( familyListBox->currentItem() == -1)
208 family= familyListBox->text(0); 208 family= familyListBox->text(0);
209 else { 209 else {
210 family = familyListBox->currentText(); 210 family = familyListBox->currentText();
211 } 211 }
212// odebug << "Font family is "+family << oendl; 212// odebug << "Font family is "+family << oendl;
213 if( styleListBox->currentItem() == -1) 213 if( styleListBox->currentItem() == -1)
214 style=styleListBox->text(0); 214 style=styleListBox->text(0);
215 else { 215 else {
216 style = styleListBox->currentText(); 216 style = styleListBox->currentText();
217 } 217 }
218// odebug << "font style is "+style << oendl; 218// odebug << "font style is "+style << oendl;
219 219
220 if( sizeComboBox->currentItem() == -1 ) 220 if( sizeComboBox->currentItem() == -1 )
221 size = sizeComboBox->text(0); 221 size = sizeComboBox->text(0);
222 else { 222 else {
223 size = sizeComboBox->currentText(); 223 size = sizeComboBox->currentText();
224 } 224 }
225 225
226// odebug << "Font size is "+size << oendl; 226// odebug << "Font size is "+size << oendl;
227 bool ok; 227 bool ok;
228 int i_size = size.toInt(&ok,10); 228 int i_size = size.toInt(&ok,10);
229 QStringList charSetList = fdb.charSets(family); 229 QStringList charSetList = fdb.charSets(family);
230// QStringList styles = fdb.styles( family ); // string list of styles of our current font family 230// QStringList styles = fdb.styles( family ); // string list of styles of our current font family
231 QString charSet; 231 QString charSet;
232 for ( QStringList::Iterator s = charSetList.begin(); s != charSetList.end();++s ) { // for each font style 232 for ( QStringList::Iterator s = charSetList.begin(); s != charSetList.end();++s ) { // for each font style
233 charSet = *s; 233 charSet = *s;
234// odebug << charSet << oendl; 234// odebug << charSet << oendl;
235 } 235 }
236 selectedFont = fdb.font(family,style,i_size,charSet); 236 selectedFont = fdb.font(family,style,i_size,charSet);
237 QFontInfo fontInfo( selectedFont); 237 QFontInfo fontInfo( selectedFont);
238// if(fontInfo.italic() ) odebug << "italic" << oendl; 238// if(fontInfo.italic() ) odebug << "italic" << oendl;
239 selectedFont.setWeight(fontInfo.weight() ); 239 selectedFont.setWeight(fontInfo.weight() );
240// odebug << "Style are "+style+" " << fontInfo.weight() << " " << oendl; 240// odebug << "Style are "+style+" " << fontInfo.weight() << " " << oendl;
241 Config cfg("Gutenbrowser"); 241 Config cfg("Gutenbrowser");
242 cfg.setGroup("Font"); 242 cfg.setGroup("Font");
243 cfg.writeEntry("Family",family); 243 cfg.writeEntry("Family",family);
244 cfg.writeEntry("Style",style); 244 cfg.writeEntry("Style",style);
245 cfg.writeEntry("Size",size); 245 cfg.writeEntry("Size",size);
246 cfg.writeEntry("CharSet",charSet); 246 cfg.writeEntry("CharSet",charSet);
247 247
248 if(style.find("Italic",0,TRUE) != -1) { 248 if(style.find("Italic",0,TRUE) != -1) {
249 selectedFont = fdb.font(family,"Regular",i_size,charSet); 249 selectedFont = fdb.font(family,"Regular",i_size,charSet);
250 selectedFont.setItalic(TRUE); //ya right 250 selectedFont.setItalic(TRUE); //ya right
251 cfg.writeEntry("Italic","TRUE"); 251 cfg.writeEntry("Italic","TRUE");
252// odebug << "Style is "+styleListBox->currentText() << oendl; 252// odebug << "Style is "+styleListBox->currentText() << oendl;
253 } else 253 } else
254 cfg.writeEntry("Italic","FALSE"); 254 cfg.writeEntry("Italic","FALSE");
255 255
256 MultiLineEdit1->setFont( selectedFont); 256 MultiLineEdit1->setFont( selectedFont);
257 MultiLineEdit1->update(); 257 MultiLineEdit1->update();
258 changedFonts=TRUE; 258 changedFonts=TRUE;