From: John Levon Date: Sun, 17 Nov 2002 12:35:06 +0000 (+0000) Subject: Implement prefs browse buttons. I also tried to use Qt 3 to set the fonts. X-Git-Tag: 1.6.10~17947 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=9d23bc01cc4ab9a5fc661a2668835780053bd779;p=features.git Implement prefs browse buttons. I also tried to use Qt 3 to set the fonts. 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 --- diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 2ba6fd50ea..b6f6dc3949 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,9 @@ +2002-11-17 John Levon + + * QPrefsDialog.h: + * QPrefsDialog.C: implement browse slots. Also + try to do something with fonts for Qt 3 (untested) + 2002-11-17 John Levon * QGraphics.C: some fixes from Herbert & me diff --git a/src/frontends/qt2/QPrefsDialog.C b/src/frontends/qt2/QPrefsDialog.C index a93387dbd1..7f69b600fe 100644 --- a/src/frontends/qt2/QPrefsDialog.C +++ b/src/frontends/qt2/QPrefsDialog.C @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #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 +} diff --git a/src/frontends/qt2/QPrefsDialog.h b/src/frontends/qt2/QPrefsDialog.h index 6ce052886c..9596ca76e8 100644 --- a/src/frontends/qt2/QPrefsDialog.h +++ b/src/frontends/qt2/QPrefsDialog.h @@ -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); diff --git a/src/frontends/qt2/ui/QPrefPathsModule.ui b/src/frontends/qt2/ui/QPrefPathsModule.ui index bb6c11eaa4..1a2af78967 100644 --- a/src/frontends/qt2/ui/QPrefPathsModule.ui +++ b/src/frontends/qt2/ui/QPrefPathsModule.ui @@ -156,7 +156,7 @@ QPushButton name - backupDirPB + lyxserverDirPB text @@ -215,7 +215,7 @@ QPushButton name - lyxserverDirPB + backupDirPB text @@ -271,9 +271,9 @@ templateDirED templateDirPB backupDirED - lyxserverDirPB - lyxserverDirED backupDirPB + lyxserverDirED + lyxserverDirPB tempDirCB tempDirED tempDirPB