1
/****************************************************************************
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
5
** This file is part of the qtconfig application of the Qt Toolkit.
7
** This file may be distributed under the terms of the Q Public License
8
** as defined by Trolltech AS of Norway and appearing in the file
9
** LICENSE.QPL included in the packaging of this file.
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 as published by the Free Software
13
** Foundation and appearing in the file LICENSE.GPL included in the
14
** packaging of this file.
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
17
** information about Qt Commercial License Agreements.
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
21
** Contact info@trolltech.com if any conditions of this licensing are
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27
****************************************************************************/
29
#include "mainwindow.h"
30
#include "colorbutton.h"
31
#include "previewframe.h"
32
#include "paletteeditoradvanced.h"
35
#include <qapplication.h>
36
#include <qcombobox.h>
37
#include <qstylefactory.h>
38
#include <qfontdatabase.h>
39
#include <qlineedit.h>
41
#include <qcheckbox.h>
42
#include <qfiledialog.h>
44
#include <qstatusbar.h>
45
#include <qsettings.h>
46
#include <qmessagebox.h>
49
#include <q3valuelist.h>
55
// from qapplication.cpp and qapplication_x11.cpp - These are NOT for
56
// external use ignore them
57
// extern bool Q_CORE_EXPORT qt_resolve_symlinks;
60
static const char *appearance_text =
61
"<p><b><font size+=2>Appearance</font></b></p>"
63
"<p>Use this tab to customize the appearance of your Qt applications.</p>"
64
"<p>You can select the default GUI Style from the drop down list and "
65
"customize the colors.</p>"
66
"<p>Any GUI Style plugins in your plugin path will automatically be added "
67
"to the list of built-in Qt styles. (See the Library Paths tab for "
68
"information on adding new plugin paths.)</p>"
69
"<p>When you choose 3-D Effects and Background colors, the Qt Configuration "
70
"program will automatically generate a palette for you. To customize "
71
"colors further, press the Tune Palette button to open the advanced "
73
"<p>The Preview Window shows what the selected Style and colors look "
76
static const char *font_text =
77
"<p><b><font size+=2>Fonts</font></b></p>"
79
"<p>Use this tab to select the default font for your Qt applications. "
80
"The selected font is shown (initially as 'Sample Text') in the line "
81
"edit below the Family, "
82
"Style and Point Size drop down lists.</p>"
83
"<p>Qt has a powerful font substitution feature that allows you to "
84
"specify a list of substitute fonts. Substitute fonts are used "
85
"when a font cannot be loaded, or if the specified font doesn't have "
86
"a particular character."
87
"<p>For example, if you select the font Lucida, which doesn't have Korean "
88
"characters, but need to show some Korean text using the Mincho font family "
89
"you can do so by adding Mincho to the list. Once Mincho is added, any "
90
"Korean characters that are not found in the Lucida font will be taken "
91
"from the Mincho font. Because the font substitutions are "
92
"lists, you can also select multiple families, such as Song Ti (for "
93
"use with Chinese text).";
95
static const char *interface_text =
96
"<p><b><font size+=2>Interface</font></b></p>"
98
"<p>Use this tab to customize the feel of your Qt applications.</p>"
99
"<p>If the Resolve Symlinks checkbox is checked Qt will follow symlinks "
100
"when handling URLs. For example, in the file dialog, if this setting is turned "
101
"on and /usr/tmp is a symlink to /var/tmp, entering the /usr/tmp directory "
102
"will cause the file dialog to change to /var/tmp. With this setting turned "
103
"off, symlinks are not resolved or followed.</p>"
104
"<p>The Global Strut setting is useful for people who require a "
105
"minimum size for all widgets (e.g. when using a touch panel or for users "
106
"who are visually impaired). Leaving the Global Strut width and height "
107
"at 0 will disable the Global Strut feature</p>"
108
"<p>XIM (Extended Input Methods) are used for entering characters in "
109
"languages that have large character sets, for example, Chinese and "
111
// ### What does the 'Enhanced support for languages written R2L do?
113
static const char *printer_text =
114
"<p><b><font size+=2>Printer</font></b></p>"
116
"<p>Use this tab to configure the way Qt generates output for the printer."
117
"You can specify if Qt should try to embed fonts into its generated output."
118
"If you enable font embedding, the resulting postscript will be more "
119
"portable and will more accurately reflect the "
120
"visual output on the screen; however the resulting postscript file "
121
"size will be bigger."
122
"<p>When using font embedding you can select additional directories where "
123
"Qt should search for embeddable font files. By default, the X "
124
"server font path is used.";
126
static const char *about_text =
127
"<p><b><font size=+2>Qt Configuration</font></b></p>"
128
"<p>A graphical configuration tool for programs using Qt</p>"
130
"<p>Copyright (C) 2001-2005 Trolltech AS. All rights reserved.</p>"
132
"<p>This program is licensed to you under the terms of the GNU General "
133
"Public License Version 2 as published by the Free Software Foundation. This "
134
"gives you legal permission to copy, distribute and/or modify this software "
135
"under certain conditions. For details, see the file 'LICENSE.GPL' that came with "
136
"this software distribution. If you did not get the file, send email to "
137
"info@trolltech.com.</p>\n\n<p>The program is provided AS IS with NO WARRANTY "
138
"OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS "
139
"FOR A PARTICULAR PURPOSE.</p>";
142
static QColorGroup::ColorRole centralFromItem( int item )
145
case 0: return QColorGroup::Background;
146
case 1: return QColorGroup::Foreground;
147
case 2: return QColorGroup::Button;
148
case 3: return QColorGroup::Base;
149
case 4: return QColorGroup::Text;
150
case 5: return QColorGroup::BrightText;
151
case 6: return QColorGroup::ButtonText;
152
case 7: return QColorGroup::Highlight;
153
case 8: return QColorGroup::HighlightedText;
154
default: return QColorGroup::NColorRoles;
159
static QColorGroup::ColorRole effectFromItem( int item )
162
case 0: return QColorGroup::Light;
163
case 1: return QColorGroup::Midlight;
164
case 2: return QColorGroup::Mid;
165
case 3: return QColorGroup::Dark;
166
case 4: return QColorGroup::Shadow;
167
default: return QColorGroup::NColorRoles;
172
static void setStyleHelper(QWidget *w, QStyle *s)
176
const QObjectList children = w->children();
177
for (int i = 0; i < children.size(); ++i) {
178
QObject *child = children.at(i);
179
if (child->isWidgetType())
180
setStyleHelper((QWidget *) child, s);
185
MainWindow::MainWindow()
186
: MainWindowBase(0, "main window"),
187
editPalette(palette()), previewPalette(palette()), previewstyle(0)
191
QStringList gstyles = QStyleFactory::keys();
193
gstylecombo->insertStringList(gstyles);
195
QSettings settings("Trolltech");
196
settings.beginGroup("Qt");
198
QString currentstyle = settings.value("style").toString();
199
if (currentstyle.isNull())
200
currentstyle = QApplication::style()->className();
203
QStringList::Iterator git = gstyles.begin();
204
while (git != gstyles.end()) {
205
if (*git == currentstyle)
211
if (s < gstylecombo->count()) {
212
gstylecombo->setCurrentItem(s);
214
// no predefined style, try to find the closest match
215
// class names usually contain the name of the style, so we
216
// iterate over the items in the combobox, and use the one whose
217
// name is contained in the classname of the style
219
git = gstyles.begin();
220
while (git != gstyles.end()) {
221
if (currentstyle.contains(*git))
227
if (s < gstylecombo->count()) {
228
gstylecombo->setCurrentItem(s);
231
gstylecombo->insertItem("Unknown");
232
gstylecombo->setCurrentItem(gstylecombo->count() - 1);
237
buttonMainColor->setColor(palette().color(QPalette::Active,
238
QColorGroup::Button));
239
buttonMainColor2->setColor(palette().color(QPalette::Active,
240
QColorGroup::Background));
241
connect(buttonMainColor, SIGNAL(colorChanged(QColor)),
242
this, SLOT(buildPalette()));
243
connect(buttonMainColor2, SIGNAL(colorChanged(QColor)),
244
this, SLOT(buildPalette()));
247
QStringList families = db.families();
248
familycombo->insertStringList(families);
250
QStringList fs = families;
251
QStringList fs2 = QFont::substitutions();
252
QStringList::Iterator fsit = fs2.begin();
253
while (fsit != fs2.end()) {
254
if (! fs.contains(*fsit))
259
familysubcombo->insertStringList(fs);
261
choosesubcombo->insertStringList(families);
262
Q3ValueList<int> sizes = db.standardSizes();
263
Q3ValueList<int>::Iterator it = sizes.begin();
264
while (it != sizes.end())
265
psizecombo->insertItem(QString::number(*it++));
267
dcispin->setValue(QApplication::doubleClickInterval());
268
cfispin->setValue(QApplication::cursorFlashTime());
269
wslspin->setValue(QApplication::wheelScrollLines());
271
// resolvelinks->setChecked(qt_resolve_symlinks);
273
effectcheckbox->setChecked(QApplication::isEffectEnabled(Qt::UI_General));
274
effectbase->setEnabled(effectcheckbox->isChecked());
276
if (QApplication::isEffectEnabled(Qt::UI_FadeMenu))
277
menueffect->setCurrentItem(2);
278
else if (QApplication::isEffectEnabled(Qt::UI_AnimateMenu))
279
menueffect->setCurrentItem(1);
281
if (QApplication::isEffectEnabled(Qt::UI_AnimateCombo))
282
comboeffect->setCurrentItem(1);
284
if (QApplication::isEffectEnabled(Qt::UI_FadeTooltip))
285
tooltipeffect->setCurrentItem(2);
286
else if (QApplication::isEffectEnabled(Qt::UI_AnimateTooltip))
287
tooltipeffect->setCurrentItem(1);
289
if ( QApplication::isEffectEnabled( Qt::UI_AnimateToolBox ) )
290
toolboxeffect->setCurrentItem( 1 );
292
QSize globalStrut = QApplication::globalStrut();
293
strutwidth->setValue(globalStrut.width());
294
strutheight->setValue(globalStrut.height());
296
// find the default family
297
QStringList::Iterator sit = families.begin();
298
int i = 0, possible = -1;
299
while (sit != families.end()) {
300
if (*sit == QApplication::font().family())
302
if ((*sit).contains(QApplication::font().family()))
308
if (sit == families.end())
310
if (i == -1) // no clue about the current font
313
familycombo->setCurrentItem(i);
315
QStringList styles = db.styles(familycombo->currentText());
316
stylecombo->insertStringList(styles);
318
QString stylestring = db.styleString(QApplication::font());
319
sit = styles.begin();
322
while (sit != styles.end()) {
323
if (*sit == stylestring)
325
if ((*sit).contains(stylestring))
331
if (sit == styles.end())
333
if (i == -1) // no clue about the current font
335
stylecombo->setCurrentItem(i);
338
while (i < psizecombo->count()) {
339
if (psizecombo->text(i) == QString::number(QApplication::font().pointSize())) {
340
psizecombo->setCurrentItem(i);
347
QStringList subs = QFont::substitutes(familysubcombo->currentText());
349
sublistbox->insertStringList(subs);
351
rtlExtensions->setChecked(settings.value("useRtlExtensions", false).toBool());
354
inputStyle->setCurrentText(settings.value("XIMInputStyle", trUtf8("On The Spot")).toString());
357
inputStyleLabel->hide();
360
fontembeddingcheckbox->setChecked(settings.value("embedFonts", true).toBool());
361
fontpaths = settings.value("fontPath").toStringList();
362
fontpathlistbox->insertStringList(fontpaths);
364
settings.endGroup(); // Qt
370
MainWindow::~MainWindow()
375
void MainWindow::fileSave()
378
statusBar()->showMessage("No changes to be saved.", 2000);
382
statusBar()->showMessage("Saving changes...");
385
QSettings settings("Trolltech");
386
settings.beginGroup("Qt");
388
QFont font = db.font(familycombo->currentText(),
389
stylecombo->currentText(),
390
psizecombo->currentText().toInt());
392
QStringList actcg, inactcg, discg;
394
for (i = 0; i < QColorGroup::NColorRoles; i++)
395
actcg << editPalette.color(QPalette::Active,
396
(QColorGroup::ColorRole) i).name();
397
for (i = 0; i < QColorGroup::NColorRoles; i++)
398
inactcg << editPalette.color(QPalette::Inactive,
399
(QColorGroup::ColorRole) i).name();
400
for (i = 0; i < QColorGroup::NColorRoles; i++)
401
discg << editPalette.color(QPalette::Disabled,
402
(QColorGroup::ColorRole) i).name();
404
settings.setValue("font", font.toString());
405
settings.setValue("Palette/active", actcg);
406
settings.setValue("Palette/inactive", inactcg);
407
settings.setValue("Palette/disabled", discg);
409
settings.setValue("fontPath", fontpaths);
410
settings.setValue("embedFonts", fontembeddingcheckbox->isChecked());
411
settings.setValue("style", gstylecombo->currentText());
412
settings.setValue("doubleClickInterval", dcispin->value());
413
settings.setValue("cursorFlashTime", cfispin->value() == 9 ? 0 : cfispin->value() );
414
settings.setValue("wheelScrollLines", wslspin->value());
415
settings.setValue("resolveSymlinks", resolvelinks->isChecked());
417
QSize strut(strutwidth->value(), strutheight->value());
418
settings.setValue("globalStrut/width", strut.width());
419
settings.setValue("globalStrut/height", strut.height());
421
settings.setValue("useRtlExtensions", rtlExtensions->isChecked());
424
QString style = inputStyle->currentText();
425
QString str = "On The Spot";
426
if ( style == trUtf8( "Over The Spot" ) )
427
str = "Over The Spot";
428
else if ( style == trUtf8( "Off The Spot" ) )
429
str = "Off The Spot";
430
else if ( style == trUtf8( "Root" ) )
432
settings.setValue( "XIMInputStyle", str );
436
if (effectcheckbox->isChecked()) {
437
effects << "general";
439
switch (menueffect->currentItem()) {
440
case 1: effects << "animatemenu"; break;
441
case 2: effects << "fademenu"; break;
444
switch (comboeffect->currentItem()) {
445
case 1: effects << "animatecombo"; break;
448
switch (tooltipeffect->currentItem()) {
449
case 1: effects << "animatetooltip"; break;
450
case 2: effects << "fadetooltip"; break;
453
switch ( toolboxeffect->currentItem() ) {
454
case 1: effects << "animatetoolbox"; break;
458
settings.setValue("GUIEffects", effects);
460
QStringList familysubs = QFont::substitutions();
461
QStringList::Iterator fit = familysubs.begin();
462
settings.beginGroup("Font Substitutions");
463
while (fit != familysubs.end()) {
464
QStringList subs = QFont::substitutes(*fit);
465
settings.setValue(*fit, subs);
468
settings.endGroup(); // Font Substitutions
469
settings.endGroup(); // Qt
472
#if defined(Q_WS_X11)
473
// ###### use _QT_SETTINGS_TIMESTAMP_
474
// QApplication::x11_apply_settings();
478
statusBar()->showMessage("Saved changes.");
482
void MainWindow::fileExit()
484
qApp->closeAllWindows();
488
void MainWindow::setModified(bool m)
494
fileSaveAction->setEnabled(m);
498
void MainWindow::buildPalette()
502
QColor btn = buttonMainColor->color();
503
QColor back = buttonMainColor2->color();
504
QPalette automake( btn, back );
506
for (i = 0; i<9; i++)
507
cg.setColor( centralFromItem(i), automake.active().color( centralFromItem(i) ) );
509
editPalette.setActive( cg );
512
cg = editPalette.inactive();
514
QPalette temp( editPalette.active().color( QColorGroup::Button ),
515
editPalette.active().color( QColorGroup::Background ) );
517
for (i = 0; i<9; i++)
518
cg.setColor( centralFromItem(i), temp.inactive().color( centralFromItem(i) ) );
520
editPalette.setInactive( cg );
521
buildInactiveEffect();
523
cg = editPalette.disabled();
525
for (i = 0; i<9; i++)
526
cg.setColor( centralFromItem(i), temp.disabled().color( centralFromItem(i) ) );
528
editPalette.setDisabled( cg );
529
buildDisabledEffect();
531
updateColorButtons();
537
void MainWindow::buildActiveEffect()
539
QColorGroup cg = editPalette.active();
540
QColor btn = cg.color( QColorGroup::Button );
542
QPalette temp( btn, btn );
544
for (int i = 0; i<5; i++)
545
cg.setColor( effectFromItem(i), temp.active().color( effectFromItem(i) ) );
547
editPalette.setActive( cg );
548
setPreviewPalette( editPalette );
550
updateColorButtons();
554
void MainWindow::buildInactive()
556
editPalette.setInactive( editPalette.active() );
557
buildInactiveEffect();
561
void MainWindow::buildInactiveEffect()
563
QColorGroup cg = editPalette.inactive();
565
QColor light, midlight, mid, dark, shadow;
566
QColor btn = cg.color( QColorGroup::Button );
568
light = btn.light(150);
569
midlight = btn.light(115);
574
cg.setColor( QColorGroup::Light, light );
575
cg.setColor( QColorGroup::Midlight, midlight );
576
cg.setColor( QColorGroup::Mid, mid );
577
cg.setColor( QColorGroup::Dark, dark );
578
cg.setColor( QColorGroup::Shadow, shadow );
580
editPalette.setInactive( cg );
581
setPreviewPalette( editPalette );
582
updateColorButtons();
586
void MainWindow::buildDisabled()
588
QColorGroup cg = editPalette.active();
589
cg.setColor( QColorGroup::ButtonText, Qt::darkGray );
590
cg.setColor( QColorGroup::Foreground, Qt::darkGray );
591
cg.setColor( QColorGroup::Text, Qt::darkGray );
592
cg.setColor( QColorGroup::HighlightedText, Qt::darkGray );
593
editPalette.setDisabled( cg );
595
buildDisabledEffect();
599
void MainWindow::buildDisabledEffect()
601
QColorGroup cg = editPalette.disabled();
603
QColor light, midlight, mid, dark, shadow;
604
QColor btn = cg.color( QColorGroup::Button );
606
light = btn.light(150);
607
midlight = btn.light(115);
612
cg.setColor( QColorGroup::Light, light );
613
cg.setColor( QColorGroup::Midlight, midlight );
614
cg.setColor( QColorGroup::Mid, mid );
615
cg.setColor( QColorGroup::Dark, dark );
616
cg.setColor( QColorGroup::Shadow, shadow );
618
editPalette.setDisabled( cg );
619
setPreviewPalette( editPalette );
620
updateColorButtons();
624
void MainWindow::setPreviewPalette( const QPalette& pal )
628
switch (paletteCombo->currentItem()) {
640
previewPalette.setActive( cg );
641
previewPalette.setInactive( cg );
642
previewPalette.setDisabled( cg );
644
previewFrame->setPreviewPalette(previewPalette);
648
void MainWindow::updateColorButtons()
650
buttonMainColor->setColor( editPalette.active().color( QColorGroup::Button ));
651
buttonMainColor2->setColor( editPalette.active().color( QColorGroup::Background ));
655
void MainWindow::tunePalette()
658
QPalette pal = PaletteEditorAdvanced::getPalette(&ok, editPalette,
659
backgroundMode(), this);
664
setPreviewPalette(editPalette);
669
void MainWindow::paletteSelected(int)
671
setPreviewPalette(editPalette);
675
void MainWindow::styleSelected(const QString &stylename)
677
QStyle *style = QStyleFactory::create(stylename);
681
setStyleHelper(previewFrame, style);
683
previewstyle = style;
689
void MainWindow::familySelected(const QString &family)
692
QStringList styles = db.styles(family);
694
stylecombo->insertStringList(styles);
695
familysubcombo->insertItem(family);
700
void MainWindow::buildFont()
703
QFont font = db.font(familycombo->currentText(),
704
stylecombo->currentText(),
705
psizecombo->currentText().toInt());
706
samplelineedit->setFont(font);
711
void MainWindow::substituteSelected(const QString &family)
713
QStringList subs = QFont::substitutes(family);
715
sublistbox->insertStringList(subs);
719
void MainWindow::removeSubstitute()
721
if (sublistbox->currentItem() < 0 ||
722
uint(sublistbox->currentItem()) > sublistbox->count())
725
int item = sublistbox->currentItem();
726
QStringList subs = QFont::substitutes(familysubcombo->currentText());
727
subs.remove(subs.at(sublistbox->currentItem()));
729
sublistbox->insertStringList(subs);
730
if (uint(item) > sublistbox->count())
731
item = int(sublistbox->count()) - 1;
732
sublistbox->setCurrentItem(item);
733
QFont::removeSubstitution(familysubcombo->currentText());
734
QFont::insertSubstitutions(familysubcombo->currentText(), subs);
739
void MainWindow::addSubstitute()
741
if (sublistbox->currentItem() < 0 ||
742
uint(sublistbox->currentItem()) > sublistbox->count()) {
743
QStringList subs = QFont::substitutes(familysubcombo->currentText());
744
subs.append(choosesubcombo->currentText());
746
sublistbox->insertStringList(subs);
747
QFont::removeSubstitution(familysubcombo->currentText());
748
QFont::insertSubstitutions(familysubcombo->currentText(), subs);
754
int item = sublistbox->currentItem();
755
QStringList subs = QFont::substitutes(familysubcombo->currentText());
756
subs.insert(sublistbox->currentItem()+1, choosesubcombo->currentText());
758
sublistbox->insertStringList(subs);
759
sublistbox->setCurrentItem(item);
760
QFont::removeSubstitution(familysubcombo->currentText());
761
QFont::insertSubstitutions(familysubcombo->currentText(), subs);
766
void MainWindow::downSubstitute()
768
if (sublistbox->currentItem() < 0 ||
769
uint(sublistbox->currentItem()) >= sublistbox->count())
772
int item = sublistbox->currentItem();
773
QStringList subs = QFont::substitutes(familysubcombo->currentText());
774
QString fam = subs.at(item);
776
subs.insert(item+1, fam);
778
sublistbox->insertStringList(subs);
779
sublistbox->setCurrentItem(item + 1);
780
QFont::removeSubstitution(familysubcombo->currentText());
781
QFont::insertSubstitutions(familysubcombo->currentText(), subs);
786
void MainWindow::upSubstitute()
788
if (sublistbox->currentItem() < 1)
791
int item = sublistbox->currentItem();
792
QStringList subs = QFont::substitutes(familysubcombo->currentText());
793
QString fam = subs.at(item);
795
subs.insert(item-1, fam);
797
sublistbox->insertStringList(subs);
798
sublistbox->setCurrentItem(item - 1);
799
QFont::removeSubstitution(familysubcombo->currentText());
800
QFont::insertSubstitutions(familysubcombo->currentText(), subs);
805
void MainWindow::removeFontpath()
807
if (fontpathlistbox->currentItem() < 0 ||
808
uint(fontpathlistbox->currentItem()) > fontpathlistbox->count())
811
int item = fontpathlistbox->currentItem();
812
fontpaths.remove(fontpaths.at(fontpathlistbox->currentItem()));
813
fontpathlistbox->clear();
814
fontpathlistbox->insertStringList(fontpaths);
815
if (uint(item) > fontpathlistbox->count())
816
item = int(fontpathlistbox->count()) - 1;
817
fontpathlistbox->setCurrentItem(item);
822
void MainWindow::addFontpath()
824
if (fontpathlineedit->text().isEmpty())
827
if (fontpathlistbox->currentItem() < 0 ||
828
uint(fontpathlistbox->currentItem()) > fontpathlistbox->count()) {
829
fontpaths.append(fontpathlineedit->text());
830
fontpathlistbox->clear();
831
fontpathlistbox->insertStringList(fontpaths);
837
int item = fontpathlistbox->currentItem();
838
fontpaths.insert(fontpathlistbox->currentItem()+1,
839
fontpathlineedit->text());
840
fontpathlistbox->clear();
841
fontpathlistbox->insertStringList(fontpaths);
842
fontpathlistbox->setCurrentItem(item);
847
void MainWindow::downFontpath()
849
if (fontpathlistbox->currentItem() < 0 ||
850
uint(fontpathlistbox->currentItem()) >= fontpathlistbox->count() - 1)
853
int item = fontpathlistbox->currentItem();
854
QString fam = fontpaths.at(item);
855
fontpaths.removeAt(item);
856
fontpaths.insert(item+1, fam);
857
fontpathlistbox->clear();
858
fontpathlistbox->insertStringList(fontpaths);
859
fontpathlistbox->setCurrentItem(item + 1);
864
void MainWindow::upFontpath()
866
if (fontpathlistbox->currentItem() < 1)
869
int item = fontpathlistbox->currentItem();
870
QString fam = fontpaths.at(item);
871
fontpaths.removeAt(item);
872
fontpaths.insert(item-1, fam);
873
fontpathlistbox->clear();
874
fontpathlistbox->insertStringList(fontpaths);
875
fontpathlistbox->setCurrentItem(item - 1);
880
void MainWindow::browseFontpath()
882
QString dirname = QFileDialog::getExistingDirectory(QString(), this, 0,
883
tr("Select a Directory"));
884
if (dirname.isNull())
887
fontpathlineedit->setText(dirname);
891
void MainWindow::somethingModified()
897
void MainWindow::helpAbout()
899
QMessageBox::about(this, tr("Qt Configuration"),
904
void MainWindow::helpAboutQt()
906
QMessageBox::aboutQt(this, tr("Qt Configuration"));
910
void MainWindow::pageChanged(QWidget *page)
913
helpview->setText(tr(appearance_text));
914
else if (page == tab1)
915
helpview->setText(tr(font_text));
916
else if (page == tab2)
917
helpview->setText(tr(interface_text));
918
else if (page == tab3)
919
helpview->setText(tr(printer_text));
923
void MainWindow::closeEvent(QCloseEvent *e)
926
switch(QMessageBox::warning(this, tr("Save Changes"),
927
tr("Save changes to settings?"),
928
tr("&Yes"), tr("&No"), tr("&Cancel"), 0, 2)) {
930
qApp->processEvents();
933
// fall through intended
934
case 1: // don't save