]> git.lyx.org Git - features.git/commitdiff
partial fonts fix. Like Juergen said we really need our own dialog.
authorJohn Levon <levon@movementarian.org>
Sun, 17 Nov 2002 16:43:36 +0000 (16:43 +0000)
committerJohn Levon <levon@movementarian.org>
Sun, 17 Nov 2002 16:43:36 +0000 (16:43 +0000)
Not that there's any point until qfont_loader reads  lyxrc...

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5663 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt2/ChangeLog
src/frontends/qt2/QPrefsDialog.C

index b6f6dc3949c6d5d126ad0dd1f2350fbc1091eed2..0c70432c5fd92cfcc28a341e32f7295ec0659d01 100644 (file)
@@ -1,3 +1,7 @@
+2002-11-17  John Levon  <levon@movementarian.org>
+
+       * QPrefsDialog.C: partial fonts fix
 2002-11-17  John Levon  <levon@movementarian.org>
 
        * QPrefsDialog.h:
index 7f69b600feea2c93a837e9c4786e0b3afcf95441..1f243c76c56c3b1ee8d49b1e494a148897f3910f 100644 (file)
@@ -567,53 +567,61 @@ void QPrefsDialog::select_lyxpipe()
                pathsModule->lyxserverDirED->setText(file.c_str());
 }
 
+namespace {
+QFont fontFromString(QString const & s) { 
+       QFont f;
+#if QT_VERSION >= 300
+       f.fromString(s);
+       return f;
+#else
+       f.setRawName(s);
+       return f;
+#endif
+}
 
+QString const fontToString(QFont const & f) {
+#if QT_VERSION >= 300
+       return f.toString();
+#else
+       return f.rawName(); 
+#endif
+}
+
+}
+
 void QPrefsDialog::change_roman()
 {
-#if QT_VERSION >= 300
-       QFont f;
-       f.fromString(screenfontsModule->screenRomanED->text());
+       QFont f(fontFromString(screenfontsModule->screenRomanED->text()));
  
        // Qt designers hadn't heard of references
        bool ok; 
-       QFontDialog::getFont(&ok, f);
+       f = QFontDialog::getFont(&ok, f);
        if (ok)
-               screenfontsModule->screenRomanED->setText(f.toString());
-#else
-       // ??
-#endif
+               screenfontsModule->screenRomanED->setText(fontToString(f));
 }
 
-
 void QPrefsDialog::change_sans()
 {
-#if QT_VERSION >= 300
-       QFont f;
-       f.fromString(screenfontsModule->screenSansED->text());
+       QFont f(fontFromString(screenfontsModule->screenSansED->text()));
  
        // Qt designers hadn't heard of references
        bool ok; 
-       QFontDialog::getFont(&ok, f);
+       f = QFontDialog::getFont(&ok, f);
        if (ok)
-               screenfontsModule->screenSansED->setText(f.toString());
-#else
-       // ?? rawName is no good
-#endif
+               screenfontsModule->screenSansED->setText(fontToString(f));
 }
 
-
 void QPrefsDialog::change_typewriter()
 {
-#if QT_VERSION >= 300
-       QFont f;
-       f.fromString(screenfontsModule->screenTypewriterED->text());
+       QFont f(fontFromString(screenfontsModule->screenTypewriterED->text()));
  
        // Qt designers hadn't heard of references
        bool ok; 
-       QFontDialog::getFont(&ok, f);
+       f = QFontDialog::getFont(&ok, f);
        if (ok)
-               screenfontsModule->screenTypewriterED->setText(f.toString());
-#else
-       // ?? rawName is no good
-#endif
+               screenfontsModule->screenTypewriterED->setText(fontToString(f));
 }