]> git.lyx.org Git - features.git/commitdiff
Implement prefs browse buttons. I also tried to use Qt 3 to set the fonts.
authorJohn Levon <levon@movementarian.org>
Sun, 17 Nov 2002 12:35:06 +0000 (12:35 +0000)
committerJohn Levon <levon@movementarian.org>
Sun, 17 Nov 2002 12:35:06 +0000 (12:35 +0000)
Qt 2 can't even do it (what a bag of shit !!) - f.rawName() on the returned font
always returns "6x13", which is worse than useless, as even Qt can't under
stand that as an XLFD.

Can Qt 3ers test ?

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

src/frontends/qt2/ChangeLog
src/frontends/qt2/QPrefsDialog.C
src/frontends/qt2/QPrefsDialog.h
src/frontends/qt2/ui/QPrefPathsModule.ui

index 2ba6fd50ea86ca4ddd0f7a05c8f334c95f4cdcc0..b6f6dc3949c6d5d126ad0dd1f2350fbc1091eed2 100644 (file)
@@ -1,3 +1,9 @@
+2002-11-17  John Levon  <levon@movementarian.org>
+
+       * QPrefsDialog.h:
+       * QPrefsDialog.C: implement browse slots. Also
+         try to do something with fonts for Qt 3 (untested)
 2002-11-17  John Levon  <levon@movementarian.org>
 
        * QGraphics.C: some fixes from Herbert & me
index a93387dbd1c0c2ec2b8c547552945fe922bbc310..7f69b600feea2c93a837e9c4786e0b3afcf95441 100644 (file)
@@ -47,6 +47,7 @@
 #include <qlineedit.h>
 #include <qcheckbox.h>
 #include <qcombobox.h>
+#include <qfontdialog.h>
 #include <qcolordialog.h>
 #include <qcolor.h>
 #include "qcoloritem.h"
@@ -178,6 +179,24 @@ QPrefsDialog::QPrefsDialog(QPrefs * form)
                colorsModule->lyxObjectsLB->insertItem(ci);
        }
 
+       connect(uiModule->uiFilePB, SIGNAL(clicked()), this, SLOT(select_ui()));
+       connect(uiModule->bindFilePB, SIGNAL(clicked()), this, SLOT(select_bind()));
+       connect(keyboardModule->firstKeymapPB, SIGNAL(clicked()), this, SLOT(select_keymap1()));
+       connect(keyboardModule->secondKeymapPB, SIGNAL(clicked()), this, SLOT(select_keymap2()));
+       connect(spellcheckerModule->persDictionaryPB, SIGNAL(clicked()), this, SLOT(select_dict()));
+
+       connect(pathsModule->templateDirPB, SIGNAL(clicked()), this, SLOT(select_templatedir()));
+       connect(pathsModule->tempDirPB, SIGNAL(clicked()), this, SLOT(select_tempdir()));
+       connect(pathsModule->backupDirPB, SIGNAL(clicked()), this, SLOT(select_backupdir()));
+       connect(pathsModule->workingDirPB, SIGNAL(clicked()), this, SLOT(select_workingdir()));
+       connect(pathsModule->lyxserverDirPB, SIGNAL(clicked()), this, SLOT(select_lyxpipe()));
+       connect(screenfontsModule->screenRomanPB, SIGNAL(clicked()), this, SLOT(change_roman()));
+       connect(screenfontsModule->screenSansPB, SIGNAL(clicked()), this, SLOT(change_sans()));
+       connect(screenfontsModule->screenTypewriterPB, SIGNAL(clicked()), this, SLOT(change_typewriter()));
        connect(colorsModule->colorChangePB, SIGNAL(clicked()), this, SLOT(change_color()));
        connect(colorsModule->lyxObjectsLB, SIGNAL(selected(int)), this, SLOT(change_color()));
  
@@ -467,3 +486,134 @@ void QPrefsDialog::change_color()
                change_adaptor();
        }
 }
+
+
+void QPrefsDialog::select_ui()
+{
+       string file(form_->controller().browseUI(uiModule->uiFileED->text().latin1()));
+       if (!file.empty())
+               uiModule->uiFileED->setText(file.c_str());
+}
+
+
+void QPrefsDialog::select_bind()
+{
+       string file(form_->controller().browsebind(uiModule->bindFileED->text().latin1()));
+       if (!file.empty())
+               uiModule->bindFileED->setText(file.c_str());
+}
+
+void QPrefsDialog::select_keymap1()
+{
+       string file(form_->controller().browsekbmap(keyboardModule->firstKeymapED->text().latin1()));
+       if (!file.empty())
+               keyboardModule->firstKeymapED->setText(file.c_str());
+}
+
+void QPrefsDialog::select_keymap2()
+{
+       string file(form_->controller().browsekbmap(keyboardModule->secondKeymapED->text().latin1()));
+       if (!file.empty())
+               keyboardModule->secondKeymapED->setText(file.c_str());
+}
+
+
+void QPrefsDialog::select_dict()
+{
+       string file(form_->controller().browsedict(spellcheckerModule->persDictionaryED->text().latin1()));
+       if (!file.empty())
+               spellcheckerModule->persDictionaryED->setText(file.c_str());
+}
+
+void QPrefsDialog::select_templatedir()
+{
+       string file(form_->controller().browse(pathsModule->templateDirED->text().latin1(), _("Select a document templates directory")));
+       if (!file.empty())
+               pathsModule->templateDirED->setText(file.c_str());
+}
+
+void QPrefsDialog::select_tempdir()
+{
+       string file(form_->controller().browse(pathsModule->tempDirED->text().latin1(), _("Select a temporary directory")));
+       if (!file.empty())
+               pathsModule->tempDirED->setText(file.c_str());
+}
+
+void QPrefsDialog::select_backupdir()
+{
+       string file(form_->controller().browse(pathsModule->backupDirED->text().latin1(), _("Select a backups directory")));
+       if (!file.empty())
+               pathsModule->backupDirED->setText(file.c_str());
+}
+
+void QPrefsDialog::select_workingdir()
+{
+       string file(form_->controller().browse(pathsModule->workingDirED->text().latin1(), _("Selection a documents directory")));
+       if (!file.empty())
+               pathsModule->workingDirED->setText(file.c_str());
+}
+
+void QPrefsDialog::select_lyxpipe()
+{
+       string file(form_->controller().browse(pathsModule->lyxserverDirED->text().latin1(), _("Give a filename for the LyX server pipe")));
+       if (!file.empty())
+               pathsModule->lyxserverDirED->setText(file.c_str());
+}
+
+
+void QPrefsDialog::change_roman()
+{
+#if QT_VERSION >= 300
+       QFont f;
+       f.fromString(screenfontsModule->screenRomanED->text());
+       // Qt designers hadn't heard of references
+       bool ok; 
+       QFontDialog::getFont(&ok, f);
+       if (ok)
+               screenfontsModule->screenRomanED->setText(f.toString());
+#else
+       // ??
+#endif
+}
+
+
+void QPrefsDialog::change_sans()
+{
+#if QT_VERSION >= 300
+       QFont f;
+       f.fromString(screenfontsModule->screenSansED->text());
+       // Qt designers hadn't heard of references
+       bool ok; 
+       QFontDialog::getFont(&ok, f);
+       if (ok)
+               screenfontsModule->screenSansED->setText(f.toString());
+#else
+       // ?? rawName is no good
+#endif
+}
+
+
+void QPrefsDialog::change_typewriter()
+{
+#if QT_VERSION >= 300
+       QFont f;
+       f.fromString(screenfontsModule->screenTypewriterED->text());
+       // Qt designers hadn't heard of references
+       bool ok; 
+       QFontDialog::getFont(&ok, f);
+       if (ok)
+               screenfontsModule->screenTypewriterED->setText(f.toString());
+#else
+       // ?? rawName is no good
+#endif
+}
index 6ce052886cef147fd687645d0ebaea48f13ae027..9596ca76e8a396a9778ec6cd916edf206a297fb3 100644 (file)
@@ -70,6 +70,21 @@ public slots:
  
        void change_color();
  
+       void change_roman();
+       void change_sans();
+       void change_typewriter();
+
+       void select_ui();
+       void select_bind();
+       void select_keymap1();
+       void select_keymap2();
+       void select_dict();
+       void select_templatedir();
+       void select_tempdir();
+       void select_backupdir();
+       void select_workingdir();
+       void select_lyxpipe();
+
 protected:
        void closeEvent(QCloseEvent * e);
  
index bb6c11eaa4860fcbc425a373126b44eea06f42b0..1a2af789674550234e9323f91cfe916aafd5db26 100644 (file)
                     <class>QPushButton</class>
                     <property stdset="1">
                         <name>name</name>
-                        <cstring>backupDirPB</cstring>
+                        <cstring>lyxserverDirPB</cstring>
                     </property>
                     <property stdset="1">
                         <name>text</name>
                     <class>QPushButton</class>
                     <property stdset="1">
                         <name>name</name>
-                        <cstring>lyxserverDirPB</cstring>
+                        <cstring>backupDirPB</cstring>
                     </property>
                     <property stdset="1">
                         <name>text</name>
     <tabstop>templateDirED</tabstop>
     <tabstop>templateDirPB</tabstop>
     <tabstop>backupDirED</tabstop>
-    <tabstop>lyxserverDirPB</tabstop>
-    <tabstop>lyxserverDirED</tabstop>
     <tabstop>backupDirPB</tabstop>
+    <tabstop>lyxserverDirED</tabstop>
+    <tabstop>lyxserverDirPB</tabstop>
     <tabstop>tempDirCB</tabstop>
     <tabstop>tempDirED</tabstop>
     <tabstop>tempDirPB</tabstop>