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
This commit is contained in:
John Levon 2002-11-17 12:35:06 +00:00
parent a64be15d94
commit 9d23bc01cc
4 changed files with 175 additions and 4 deletions

View 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

View 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
}

View 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);

View File

@ -156,7 +156,7 @@
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>backupDirPB</cstring>
<cstring>lyxserverDirPB</cstring>
</property>
<property stdset="1">
<name>text</name>
@ -215,7 +215,7 @@
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>lyxserverDirPB</cstring>
<cstring>backupDirPB</cstring>
</property>
<property stdset="1">
<name>text</name>
@ -271,9 +271,9 @@
<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>