2002-11-13 02:22:48 +00:00
|
|
|
/**
|
|
|
|
* \file QPrefsDialog.C
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Edwin Leuven
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
2002-12-17 20:37:13 +00:00
|
|
|
#include "qt_helpers.h"
|
2002-11-13 02:22:48 +00:00
|
|
|
|
|
|
|
#include "ControlPrefs.h"
|
|
|
|
#include "QPrefs.h"
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "QPrefsDialog.h"
|
|
|
|
|
2002-11-13 05:36:07 +00:00
|
|
|
#include "ui/QPrefAsciiModule.h"
|
|
|
|
#include "ui/QPrefDateModule.h"
|
|
|
|
#include "ui/QPrefKeyboardModule.h"
|
|
|
|
#include "ui/QPrefLatexModule.h"
|
|
|
|
#include "ui/QPrefScreenFontsModule.h"
|
|
|
|
#include "ui/QPrefColorsModule.h"
|
|
|
|
#include "ui/QPrefDisplayModule.h"
|
|
|
|
#include "ui/QPrefPathsModule.h"
|
|
|
|
#include "ui/QPrefSpellcheckerModule.h"
|
|
|
|
#include "ui/QPrefConvertersModule.h"
|
|
|
|
#include "ui/QPrefFileformatsModule.h"
|
|
|
|
#include "ui/QPrefLanguageModule.h"
|
|
|
|
#include "ui/QPrefPrinterModule.h"
|
|
|
|
#include "ui/QPrefUIModule.h"
|
|
|
|
|
2002-11-13 02:22:48 +00:00
|
|
|
#include "support/lstrings.h"
|
|
|
|
#include "lyxrc.h"
|
2002-11-13 05:36:07 +00:00
|
|
|
#include "debug.h"
|
2002-12-17 20:37:13 +00:00
|
|
|
#include "gettext.h"
|
2002-11-13 02:22:48 +00:00
|
|
|
|
|
|
|
#include <qwidgetstack.h>
|
|
|
|
#include <qpushbutton.h>
|
2002-11-13 05:36:07 +00:00
|
|
|
#include <qlistview.h>
|
2002-11-17 07:11:02 +00:00
|
|
|
#include <qlistbox.h>
|
2002-11-17 05:37:27 +00:00
|
|
|
#include <qspinbox.h>
|
|
|
|
#include <qlineedit.h>
|
|
|
|
#include <qcheckbox.h>
|
|
|
|
#include <qcombobox.h>
|
2002-11-17 17:16:21 +00:00
|
|
|
#include <qfontdatabase.h>
|
|
|
|
#include <qstringlist.h>
|
2002-11-17 09:42:25 +00:00
|
|
|
#include <qcolordialog.h>
|
|
|
|
#include <qcolor.h>
|
|
|
|
#include "qcoloritem.h"
|
2002-11-18 19:52:29 +00:00
|
|
|
#include "qfontexample.h"
|
2002-11-13 02:22:48 +00:00
|
|
|
|
2002-11-13 05:36:07 +00:00
|
|
|
using std::map;
|
|
|
|
using std::endl;
|
2002-11-13 02:22:48 +00:00
|
|
|
|
|
|
|
QPrefsDialog::QPrefsDialog(QPrefs * form)
|
|
|
|
: QPrefsDialogBase(0, 0, false, 0), form_(form)
|
|
|
|
{
|
|
|
|
connect(savePB, SIGNAL(clicked()),
|
|
|
|
form, SLOT(slotOK()));
|
|
|
|
connect(applyPB, SIGNAL(clicked()),
|
|
|
|
form, SLOT(slotApply()));
|
|
|
|
connect(closePB, SIGNAL(clicked()),
|
|
|
|
form, SLOT(slotClose()));
|
|
|
|
connect(restorePB, SIGNAL(clicked()),
|
|
|
|
form, SLOT(slotRestore()));
|
2002-11-13 06:26:39 +00:00
|
|
|
|
2002-11-13 05:36:07 +00:00
|
|
|
prefsLV->setSorting(-1);
|
2002-11-13 06:26:39 +00:00
|
|
|
|
2002-11-13 05:36:07 +00:00
|
|
|
// OK, Qt is REALLY broken. We have to hard
|
|
|
|
// code the menu structure here.
|
|
|
|
|
2002-12-17 20:37:13 +00:00
|
|
|
QListViewItem * lnf(new QListViewItem(prefsLV, qt_("Look and feel")));
|
2002-11-13 06:26:39 +00:00
|
|
|
lnf->setSelectable(false);
|
|
|
|
lnf->setOpen(true);
|
2002-12-17 20:37:13 +00:00
|
|
|
QListViewItem * lan(new QListViewItem(prefsLV, lnf, qt_("Language settings")));
|
2002-11-13 06:26:39 +00:00
|
|
|
lan->setSelectable(false);
|
2002-12-17 20:37:13 +00:00
|
|
|
QListViewItem * out(new QListViewItem(prefsLV, lan, qt_("Outputs")));
|
2002-11-17 03:35:02 +00:00
|
|
|
out->setSelectable(false);
|
2002-11-13 05:36:07 +00:00
|
|
|
|
|
|
|
asciiModule = new QPrefAsciiModule(prefsWS);
|
|
|
|
dateModule = new QPrefDateModule(prefsWS);
|
|
|
|
keyboardModule = new QPrefKeyboardModule(prefsWS);
|
|
|
|
latexModule = new QPrefLatexModule(prefsWS);
|
|
|
|
screenfontsModule = new QPrefScreenFontsModule(prefsWS);
|
|
|
|
colorsModule = new QPrefColorsModule(prefsWS);
|
|
|
|
displayModule = new QPrefDisplayModule(prefsWS);
|
|
|
|
pathsModule = new QPrefPathsModule(prefsWS);
|
|
|
|
spellcheckerModule = new QPrefSpellcheckerModule(prefsWS);
|
|
|
|
convertersModule = new QPrefConvertersModule(prefsWS);
|
|
|
|
fileformatsModule = new QPrefFileformatsModule(prefsWS);
|
|
|
|
languageModule = new QPrefLanguageModule(prefsWS);
|
|
|
|
printerModule = new QPrefPrinterModule(prefsWS);
|
|
|
|
uiModule = new QPrefUIModule(prefsWS);
|
|
|
|
|
|
|
|
prefsWS->addWidget(asciiModule, 0);
|
|
|
|
prefsWS->addWidget(dateModule, 1);
|
|
|
|
prefsWS->addWidget(keyboardModule, 2);
|
|
|
|
prefsWS->addWidget(latexModule, 3);
|
|
|
|
prefsWS->addWidget(screenfontsModule, 4);
|
|
|
|
prefsWS->addWidget(colorsModule, 5);
|
|
|
|
prefsWS->addWidget(displayModule, 6);
|
2002-11-13 06:36:28 +00:00
|
|
|
prefsWS->addWidget(pathsModule, 7);
|
|
|
|
prefsWS->addWidget(spellcheckerModule, 8);
|
|
|
|
prefsWS->addWidget(convertersModule, 9);
|
|
|
|
prefsWS->addWidget(fileformatsModule, 10);
|
|
|
|
prefsWS->addWidget(languageModule, 11);
|
|
|
|
prefsWS->addWidget(printerModule, 12);
|
|
|
|
prefsWS->addWidget(uiModule, 13);
|
2002-11-13 06:26:39 +00:00
|
|
|
|
2002-11-13 05:36:07 +00:00
|
|
|
QListViewItem * i;
|
|
|
|
|
|
|
|
// language settings
|
2002-11-13 06:26:39 +00:00
|
|
|
|
2002-12-17 20:37:13 +00:00
|
|
|
i = new QListViewItem(lan, qt_("Language"));
|
2002-11-13 05:36:07 +00:00
|
|
|
pane_map_[i] = languageModule;
|
2002-12-17 20:37:13 +00:00
|
|
|
i = new QListViewItem(lan, i, qt_("Spellchecker"));
|
2002-11-13 05:36:07 +00:00
|
|
|
pane_map_[i] = spellcheckerModule;
|
2002-11-13 06:26:39 +00:00
|
|
|
|
2002-11-13 05:36:07 +00:00
|
|
|
// UI
|
2002-11-13 06:26:39 +00:00
|
|
|
|
2002-12-17 20:37:13 +00:00
|
|
|
i = new QListViewItem(lnf, qt_("User interface"));
|
2002-11-13 05:36:07 +00:00
|
|
|
pane_map_[i] = uiModule;
|
|
|
|
prefsLV->setCurrentItem(i);
|
2002-11-13 06:26:39 +00:00
|
|
|
|
2002-12-17 20:37:13 +00:00
|
|
|
i = new QListViewItem(lnf, i, qt_("Screen fonts"));
|
2002-11-13 05:36:07 +00:00
|
|
|
pane_map_[i] = screenfontsModule;
|
2002-12-17 20:37:13 +00:00
|
|
|
i = new QListViewItem(lnf, i, qt_("Colors"));
|
2002-11-13 05:36:07 +00:00
|
|
|
pane_map_[i] = colorsModule;
|
2002-12-17 20:37:13 +00:00
|
|
|
i = new QListViewItem(lnf, i, qt_("Graphics"));
|
2002-11-13 05:36:07 +00:00
|
|
|
pane_map_[i] = displayModule;
|
2002-12-17 20:37:13 +00:00
|
|
|
i = new QListViewItem(lnf, i, qt_("Keyboard"));
|
2002-11-17 03:35:02 +00:00
|
|
|
pane_map_[i] = keyboardModule;
|
2002-11-13 06:26:39 +00:00
|
|
|
|
2002-11-17 03:35:02 +00:00
|
|
|
// output
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2003-01-06 14:02:24 +00:00
|
|
|
i = new QListViewItem(out, qt_("ASCII"));
|
2002-11-13 05:36:07 +00:00
|
|
|
pane_map_[i] = asciiModule;
|
2002-12-17 20:37:13 +00:00
|
|
|
i = new QListViewItem(out, i, qt_("Date format"));
|
2002-11-13 05:36:07 +00:00
|
|
|
pane_map_[i] = dateModule;
|
2002-12-17 20:37:13 +00:00
|
|
|
i = new QListViewItem(out, i, qt_("LaTeX"));
|
2002-11-13 05:36:07 +00:00
|
|
|
pane_map_[i] = latexModule;
|
2002-12-17 20:37:13 +00:00
|
|
|
i = new QListViewItem(out, i, qt_("Printer"));
|
2002-11-13 05:36:07 +00:00
|
|
|
pane_map_[i] = printerModule;
|
2002-11-13 06:26:39 +00:00
|
|
|
|
2002-12-17 20:37:13 +00:00
|
|
|
i = new QListViewItem(prefsLV, out, qt_("Paths"));
|
2002-11-17 03:35:02 +00:00
|
|
|
pane_map_[i] = pathsModule;
|
2002-12-17 20:37:13 +00:00
|
|
|
i = new QListViewItem(prefsLV, i, qt_("Converters"));
|
2002-11-17 03:35:02 +00:00
|
|
|
pane_map_[i] = convertersModule;
|
2002-12-17 20:37:13 +00:00
|
|
|
i = new QListViewItem(prefsLV, i, qt_("File formats"));
|
2002-11-17 03:35:02 +00:00
|
|
|
pane_map_[i] = fileformatsModule;
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-13 05:36:07 +00:00
|
|
|
prefsLV->setMinimumSize(prefsLV->sizeHint());
|
2002-11-13 06:26:39 +00:00
|
|
|
|
|
|
|
// Qt sucks
|
|
|
|
resize(minimumSize());
|
2002-11-17 05:37:27 +00:00
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
// FIXME: put in controller
|
2002-11-17 09:42:25 +00:00
|
|
|
for (int i = 0; i < LColor::ignore; ++i) {
|
|
|
|
LColor::color lc = static_cast<LColor::color>(i);
|
|
|
|
if (lc == LColor::none
|
|
|
|
|| lc == LColor::black
|
|
|
|
|| lc == LColor::white
|
|
|
|
|| lc == LColor::red
|
|
|
|
|| lc == LColor::green
|
|
|
|
|| lc == LColor::blue
|
|
|
|
|| lc == LColor::cyan
|
|
|
|
|| lc == LColor::magenta
|
|
|
|
|| lc == LColor::yellow
|
|
|
|
|| lc == LColor::inherit
|
|
|
|
|| lc == LColor::ignore) continue;
|
|
|
|
|
|
|
|
colors_.push_back(lc);
|
|
|
|
string const x11name(lcolor.getX11Name(lc));
|
|
|
|
string const guiname(lcolor.getGUIName(lc));
|
2002-12-17 20:37:13 +00:00
|
|
|
QColorItem * ci(new QColorItem(QColor(toqstr(x11name)),
|
|
|
|
toqstr(guiname)));
|
2002-11-17 09:42:25 +00:00
|
|
|
colorsModule->lyxObjectsLB->insertItem(ci);
|
|
|
|
}
|
|
|
|
|
2002-11-17 17:16:21 +00:00
|
|
|
QFontDatabase fontdb;
|
|
|
|
QStringList families(fontdb.families());
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-18 19:52:29 +00:00
|
|
|
connect(screenfontsModule->screenRomanCO, SIGNAL(activated(const QString&)), this, SLOT(select_roman(const QString&)));
|
|
|
|
connect(screenfontsModule->screenSansCO, SIGNAL(activated(const QString&)), this, SLOT(select_sans(const QString&)));
|
|
|
|
connect(screenfontsModule->screenTypewriterCO, SIGNAL(activated(const QString&)), this, SLOT(select_typewriter(const QString&)));
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-17 17:16:21 +00:00
|
|
|
for (QStringList::Iterator it = families.begin(); it != families.end(); ++it) {
|
2002-12-01 22:59:25 +00:00
|
|
|
screenfontsModule->screenRomanCO->insertItem(*it);
|
|
|
|
screenfontsModule->screenSansCO->insertItem(*it);
|
|
|
|
screenfontsModule->screenTypewriterCO->insertItem(*it);
|
|
|
|
}
|
|
|
|
|
2002-11-17 12:35:06 +00:00
|
|
|
connect(uiModule->uiFilePB, SIGNAL(clicked()), this, SLOT(select_ui()));
|
|
|
|
connect(uiModule->bindFilePB, SIGNAL(clicked()), this, SLOT(select_bind()));
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-17 12:35:06 +00:00
|
|
|
connect(keyboardModule->firstKeymapPB, SIGNAL(clicked()), this, SLOT(select_keymap1()));
|
|
|
|
connect(keyboardModule->secondKeymapPB, SIGNAL(clicked()), this, SLOT(select_keymap2()));
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-17 12:35:06 +00:00
|
|
|
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()));
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-17 09:42:25 +00:00
|
|
|
connect(colorsModule->colorChangePB, SIGNAL(clicked()), this, SLOT(change_color()));
|
|
|
|
connect(colorsModule->lyxObjectsLB, SIGNAL(selected(int)), this, SLOT(change_color()));
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-17 07:11:02 +00:00
|
|
|
connect(fileformatsModule->formatNewPB, SIGNAL(clicked()), this, SLOT(new_format()));
|
|
|
|
connect(fileformatsModule->formatRemovePB, SIGNAL(clicked()), this, SLOT(remove_format()));
|
|
|
|
connect(fileformatsModule->formatModifyPB, SIGNAL(clicked()), this, SLOT(modify_format()));
|
|
|
|
connect(fileformatsModule->formatsLB, SIGNAL(highlighted(int)), this, SLOT(switch_format(int)));
|
2002-11-17 08:02:55 +00:00
|
|
|
|
|
|
|
connect(convertersModule->converterNewPB, SIGNAL(clicked()), this, SLOT(new_converter()));
|
|
|
|
connect(convertersModule->converterRemovePB, SIGNAL(clicked()), this, SLOT(remove_converter()));
|
|
|
|
connect(convertersModule->converterModifyPB, SIGNAL(clicked()), this, SLOT(modify_converter()));
|
|
|
|
connect(convertersModule->convertersLB, SIGNAL(highlighted(int)), this, SLOT(switch_converter(int)));
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-17 05:37:27 +00:00
|
|
|
// Qt really sucks. This is as ugly as it looks, but the alternative
|
|
|
|
// means having to derive every module == bloat
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-17 07:11:02 +00:00
|
|
|
connect(convertersModule->converterNewPB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
|
|
|
connect(convertersModule->converterRemovePB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
|
|
|
connect(convertersModule->converterModifyPB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
|
|
|
connect(fileformatsModule->formatNewPB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
|
|
|
connect(fileformatsModule->formatRemovePB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
|
|
|
connect(fileformatsModule->formatModifyPB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
2002-11-17 05:37:27 +00:00
|
|
|
connect(languageModule->rtlCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
|
|
|
connect(languageModule->markForeignCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
|
|
|
connect(languageModule->autoBeginCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
|
|
|
connect(languageModule->autoEndCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
|
|
|
connect(languageModule->useBabelCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
|
|
|
connect(languageModule->globalCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
|
|
|
connect(languageModule->languagePackageED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(languageModule->startCommandED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(languageModule->endCommandED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(languageModule->defaultLanguageCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
|
|
|
|
connect(uiModule->uiFileED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(uiModule->bindFileED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(uiModule->cursorFollowsCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
|
|
|
connect(uiModule->wheelMouseSB, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
|
|
|
|
connect(uiModule->autoSaveSB, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
|
|
|
|
connect(uiModule->autoSaveCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
|
|
|
connect(uiModule->lastfilesSB, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
|
|
|
|
connect(keyboardModule->keymapCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
|
|
|
connect(keyboardModule->firstKeymapED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(keyboardModule->secondKeymapED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(asciiModule->asciiLinelengthSB, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
|
|
|
|
connect(asciiModule->asciiRoffED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(dateModule->DateED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(latexModule->latexEncodingED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(latexModule->latexChecktexED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(latexModule->latexAutoresetCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
|
|
|
connect(latexModule->latexDviPaperED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(latexModule->latexPaperSizeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
|
|
|
|
connect(displayModule->previewCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
|
|
|
connect(displayModule->displayGraphicsCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
|
|
|
|
connect(pathsModule->workingDirED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(pathsModule->templateDirED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(pathsModule->backupDirED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(pathsModule->tempDirCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
|
|
|
connect(pathsModule->tempDirED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(pathsModule->lyxserverDirED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(spellcheckerModule->spellCommandCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
|
|
|
|
connect(spellcheckerModule->altLanguageED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(spellcheckerModule->escapeCharactersED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(spellcheckerModule->persDictionaryED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(spellcheckerModule->compoundWordCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
|
|
|
connect(spellcheckerModule->inputEncodingCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
|
|
|
connect(printerModule->printerAdaptCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
|
|
|
connect(printerModule->printerCommandED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(printerModule->printerNameED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(printerModule->printerPageRangeED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(printerModule->printerCopiesED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(printerModule->printerReverseED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(printerModule->printerToPrinterED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(printerModule->printerExtensionED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(printerModule->printerSpoolCommandED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(printerModule->printerPaperTypeED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(printerModule->printerEvenED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(printerModule->printerOddED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(printerModule->printerCollatedED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(printerModule->printerLandscapeED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(printerModule->printerToFileED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(printerModule->printerExtraED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(printerModule->printerSpoolPrefixED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(printerModule->printerPaperSizeED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
2002-11-17 17:16:21 +00:00
|
|
|
connect(screenfontsModule->screenRomanCO, SIGNAL(activated(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(screenfontsModule->screenSansCO, SIGNAL(activated(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(screenfontsModule->screenTypewriterCO, SIGNAL(activated(const QString&)), this, SLOT(change_adaptor()));
|
2002-11-17 05:37:27 +00:00
|
|
|
connect(screenfontsModule->screenZoomSB, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
|
|
|
|
connect(screenfontsModule->screenDpiSB, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
|
|
|
|
connect(screenfontsModule->screenTinyED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(screenfontsModule->screenSmallestED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(screenfontsModule->screenSmallerED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(screenfontsModule->screenSmallED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(screenfontsModule->screenNormalED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(screenfontsModule->screenLargeED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(screenfontsModule->screenLargerED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(screenfontsModule->screenLargestED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(screenfontsModule->screenHugeED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(screenfontsModule->screenHugerED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
2002-11-13 02:22:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QPrefsDialog::~QPrefsDialog()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::closeEvent(QCloseEvent * e)
|
|
|
|
{
|
|
|
|
form_->slotWMHide();
|
|
|
|
e->accept();
|
|
|
|
}
|
2002-11-13 05:36:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::switchPane(QListViewItem * i)
|
|
|
|
{
|
|
|
|
prefsWS->raiseWidget(pane_map_[i]);
|
|
|
|
}
|
2002-11-17 05:37:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::change_adaptor()
|
|
|
|
{
|
|
|
|
form_->changed();
|
|
|
|
}
|
2002-11-17 07:11:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::updateConverters()
|
2002-12-01 22:59:25 +00:00
|
|
|
{
|
2002-11-17 07:11:02 +00:00
|
|
|
QPrefConvertersModule * convertmod(convertersModule);
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-17 08:02:55 +00:00
|
|
|
convertmod->converterFromCO->clear();
|
|
|
|
convertmod->converterToCO->clear();
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-17 08:02:55 +00:00
|
|
|
Formats::const_iterator cit = form_->formats_.begin();
|
|
|
|
Formats::const_iterator end = form_->formats_.end();
|
|
|
|
for (; cit != end; ++cit) {
|
2002-12-17 20:37:13 +00:00
|
|
|
convertmod->converterFromCO->insertItem(toqstr(cit->prettyname()));
|
|
|
|
convertmod->converterToCO->insertItem(toqstr(cit->prettyname()));
|
2002-11-17 08:02:55 +00:00
|
|
|
}
|
2002-12-01 22:59:25 +00:00
|
|
|
|
|
|
|
convertmod->convertersLB->clear();
|
2002-11-17 07:11:02 +00:00
|
|
|
|
|
|
|
Converters::const_iterator ccit = form_->converters_.begin();
|
|
|
|
Converters::const_iterator cend = form_->converters_.end();
|
|
|
|
for (; ccit != cend; ++ccit) {
|
|
|
|
string const name(ccit->From->prettyname() + " -> " +
|
2002-12-01 22:59:25 +00:00
|
|
|
ccit->To->prettyname());
|
2002-12-17 20:37:13 +00:00
|
|
|
convertmod->convertersLB->insertItem(toqstr(name));
|
2002-11-17 07:11:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-17 08:02:55 +00:00
|
|
|
void QPrefsDialog::switch_converter(int nr)
|
|
|
|
{
|
|
|
|
Converter const & c(form_->converters_.get(nr));
|
|
|
|
convertersModule->converterFromCO->setCurrentItem(form_->formats_.getNumber(c.from));
|
|
|
|
convertersModule->converterToCO->setCurrentItem(form_->formats_.getNumber(c.to));
|
2002-12-17 20:37:13 +00:00
|
|
|
convertersModule->converterED->setText(toqstr(c.command));
|
|
|
|
convertersModule->converterFlagED->setText(toqstr(c.flags));
|
2002-11-17 08:02:55 +00:00
|
|
|
}
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-17 08:32:09 +00:00
|
|
|
// FIXME: user must
|
2002-11-17 08:02:55 +00:00
|
|
|
// specify unique from/to or it doesn't appear. This is really bad UI
|
|
|
|
void QPrefsDialog::new_converter()
|
2002-12-01 22:59:25 +00:00
|
|
|
{
|
|
|
|
Format const & from(form_->formats_.get(convertersModule->converterFromCO->currentItem()));
|
|
|
|
Format const & to(form_->formats_.get(convertersModule->converterToCO->currentItem()));
|
|
|
|
|
2002-11-17 08:02:55 +00:00
|
|
|
Converter const * old = form_->converters_.getConverter(from.name(), to.name());
|
|
|
|
form_->converters_.add(from.name(), to.name(), "", "");
|
|
|
|
if (!old) {
|
|
|
|
form_->converters_.updateLast(form_->formats_);
|
|
|
|
}
|
|
|
|
updateConverters();
|
2002-12-01 22:59:25 +00:00
|
|
|
convertersModule->convertersLB->setCurrentItem(convertersModule->convertersLB->count() - 1);
|
2002-11-17 08:02:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::modify_converter()
|
|
|
|
{
|
2002-12-01 22:59:25 +00:00
|
|
|
Format const & from(form_->formats_.get(convertersModule->converterFromCO->currentItem()));
|
|
|
|
Format const & to(form_->formats_.get(convertersModule->converterToCO->currentItem()));
|
2002-12-17 20:37:13 +00:00
|
|
|
string flags(fromqstr(convertersModule->converterFlagED->text()));
|
|
|
|
string name(fromqstr(convertersModule->converterED->text()));
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-17 08:02:55 +00:00
|
|
|
Converter const * old = form_->converters_.getConverter(from.name(), to.name());
|
|
|
|
form_->converters_.add(from.name(), to.name(), name, flags);
|
|
|
|
if (!old) {
|
|
|
|
form_->converters_.updateLast(form_->formats_);
|
|
|
|
}
|
|
|
|
updateConverters();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::remove_converter()
|
|
|
|
{
|
2002-12-01 22:59:25 +00:00
|
|
|
Format const & from(form_->formats_.get(convertersModule->converterFromCO->currentItem()));
|
|
|
|
Format const & to(form_->formats_.get(convertersModule->converterToCO->currentItem()));
|
2002-11-17 08:02:55 +00:00
|
|
|
form_->converters_.erase(from.name(), to.name());
|
|
|
|
updateConverters();
|
|
|
|
}
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-17 07:11:02 +00:00
|
|
|
void QPrefsDialog::updateFormats()
|
|
|
|
{
|
|
|
|
QPrefFileformatsModule * formatmod(fileformatsModule);
|
|
|
|
|
|
|
|
formatmod->formatsLB->clear();
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-17 07:11:02 +00:00
|
|
|
Formats::const_iterator cit = form_->formats_.begin();
|
|
|
|
Formats::const_iterator end = form_->formats_.end();
|
|
|
|
for (; cit != end; ++cit) {
|
2002-12-17 20:37:13 +00:00
|
|
|
formatmod->formatsLB->insertItem(toqstr(cit->prettyname()));
|
2002-11-17 07:11:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::switch_format(int nr)
|
|
|
|
{
|
|
|
|
Format const & f(form_->formats_.get(nr));
|
2002-12-17 20:37:13 +00:00
|
|
|
fileformatsModule->formatED->setText(toqstr(f.name()));
|
|
|
|
fileformatsModule->guiNameED->setText(toqstr(f.prettyname()));
|
|
|
|
fileformatsModule->extensionED->setText(toqstr(f.extension()));
|
|
|
|
fileformatsModule->shortcutED->setText(toqstr(f.shortcut()));
|
|
|
|
fileformatsModule->viewerED->setText(toqstr(f.viewer()));
|
2002-11-17 07:11:02 +00:00
|
|
|
fileformatsModule->formatRemovePB->setEnabled(
|
|
|
|
!form_->converters_.formatIsUsed(f.name()));
|
|
|
|
}
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-17 07:11:02 +00:00
|
|
|
void QPrefsDialog::new_format()
|
|
|
|
{
|
|
|
|
form_->formats_.add(_("New"));
|
2002-12-01 22:59:25 +00:00
|
|
|
form_->formats_.sort();
|
2002-11-17 07:11:02 +00:00
|
|
|
updateFormats();
|
|
|
|
fileformatsModule->formatsLB->setCurrentItem(form_->formats_.getNumber(_("New")));
|
|
|
|
updateConverters();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::modify_format()
|
|
|
|
{
|
|
|
|
Format const & oldformat(form_->formats_.get(fileformatsModule->formatsLB->currentItem()));
|
|
|
|
string const oldpretty(oldformat.prettyname());
|
2002-12-17 20:37:13 +00:00
|
|
|
string const name(fromqstr(fileformatsModule->formatED->text()));
|
2002-11-17 07:11:02 +00:00
|
|
|
form_->formats_.erase(oldformat.name());
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-12-17 20:37:13 +00:00
|
|
|
string const prettyname = fromqstr(fileformatsModule->guiNameED->text());
|
|
|
|
string const extension = fromqstr(fileformatsModule->extensionED->text());
|
|
|
|
string const shortcut = fromqstr(fileformatsModule->shortcutED->text());
|
|
|
|
string const viewer = fromqstr(fileformatsModule->viewerED->text());
|
2002-12-01 22:59:25 +00:00
|
|
|
|
|
|
|
form_->formats_.add(name, extension, prettyname, shortcut);
|
2002-11-17 07:11:02 +00:00
|
|
|
form_->formats_.sort();
|
2002-12-01 22:59:25 +00:00
|
|
|
form_->formats_.setViewer(name, viewer);
|
2002-11-17 07:11:02 +00:00
|
|
|
|
|
|
|
fileformatsModule->formatsLB->setUpdatesEnabled(false);
|
2002-12-01 22:59:25 +00:00
|
|
|
updateFormats();
|
2002-11-17 07:11:02 +00:00
|
|
|
fileformatsModule->formatsLB->setUpdatesEnabled(true);
|
|
|
|
fileformatsModule->formatsLB->update();
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-17 07:11:02 +00:00
|
|
|
updateConverters();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::remove_format()
|
|
|
|
{
|
|
|
|
int const nr(fileformatsModule->formatsLB->currentItem());
|
|
|
|
if (nr < 0)
|
|
|
|
return;
|
|
|
|
form_->formats_.erase(form_->formats_.get(nr).name());
|
|
|
|
updateFormats();
|
|
|
|
updateConverters();
|
|
|
|
}
|
2002-11-17 09:42:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::change_color()
|
|
|
|
{
|
|
|
|
QListBox * lb(colorsModule->lyxObjectsLB);
|
|
|
|
if (lb->currentItem() < 0)
|
|
|
|
return;
|
|
|
|
QListBoxItem * ib(lb->item(lb->currentItem()));
|
|
|
|
QColorItem * ci(static_cast<QColorItem*>(ib));
|
|
|
|
QColor c(QColorDialog::getColor(ci->color()));
|
|
|
|
if (c.isValid()) {
|
|
|
|
ci->color(c);
|
|
|
|
lb->update();
|
|
|
|
change_adaptor();
|
|
|
|
}
|
|
|
|
}
|
2002-11-17 12:35:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::select_ui()
|
|
|
|
{
|
2002-12-17 20:37:13 +00:00
|
|
|
string file(form_->controller().browseUI(fromqstr(uiModule->uiFileED->text())));
|
2002-11-17 12:35:06 +00:00
|
|
|
if (!file.empty())
|
2002-12-17 20:37:13 +00:00
|
|
|
uiModule->uiFileED->setText(toqstr(file));
|
2002-11-17 12:35:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::select_bind()
|
|
|
|
{
|
2002-12-17 20:37:13 +00:00
|
|
|
string file(form_->controller().browsebind(fromqstr(uiModule->bindFileED->text())));
|
2002-11-17 12:35:06 +00:00
|
|
|
if (!file.empty())
|
2002-12-17 20:37:13 +00:00
|
|
|
uiModule->bindFileED->setText(toqstr(file));
|
2002-11-17 12:35:06 +00:00
|
|
|
}
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-17 12:35:06 +00:00
|
|
|
void QPrefsDialog::select_keymap1()
|
|
|
|
{
|
2002-12-17 20:37:13 +00:00
|
|
|
string file(form_->controller().browsekbmap(fromqstr(keyboardModule->firstKeymapED->text())));
|
2002-11-17 12:35:06 +00:00
|
|
|
if (!file.empty())
|
2002-12-17 20:37:13 +00:00
|
|
|
keyboardModule->firstKeymapED->setText(toqstr(file));
|
2002-11-17 12:35:06 +00:00
|
|
|
}
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-17 12:35:06 +00:00
|
|
|
void QPrefsDialog::select_keymap2()
|
|
|
|
{
|
2002-12-17 20:37:13 +00:00
|
|
|
string file(form_->controller().browsekbmap(fromqstr(keyboardModule->secondKeymapED->text())));
|
2002-11-17 12:35:06 +00:00
|
|
|
if (!file.empty())
|
2002-12-17 20:37:13 +00:00
|
|
|
keyboardModule->secondKeymapED->setText(toqstr(file));
|
2002-11-17 12:35:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::select_dict()
|
|
|
|
{
|
2002-12-17 20:37:13 +00:00
|
|
|
string file(form_->controller().browsedict(fromqstr(spellcheckerModule->persDictionaryED->text())));
|
2002-11-17 12:35:06 +00:00
|
|
|
if (!file.empty())
|
2002-12-17 20:37:13 +00:00
|
|
|
spellcheckerModule->persDictionaryED->setText(toqstr(file));
|
2002-11-17 12:35:06 +00:00
|
|
|
}
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-12-17 20:37:13 +00:00
|
|
|
// NB: the _() is OK here because it gets passed back and we toqstr() them
|
|
|
|
|
2002-11-17 12:35:06 +00:00
|
|
|
void QPrefsDialog::select_templatedir()
|
|
|
|
{
|
2003-01-14 21:51:34 +00:00
|
|
|
string file(form_->controller().browsedir(fromqstr(pathsModule->templateDirED->text()), _("Select a document templates directory")));
|
2002-11-17 12:35:06 +00:00
|
|
|
if (!file.empty())
|
2002-12-17 20:37:13 +00:00
|
|
|
pathsModule->templateDirED->setText(toqstr(file));
|
2002-11-17 12:35:06 +00:00
|
|
|
}
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-17 12:35:06 +00:00
|
|
|
void QPrefsDialog::select_tempdir()
|
|
|
|
{
|
2003-01-14 21:51:34 +00:00
|
|
|
string file(form_->controller().browsedir(fromqstr(pathsModule->tempDirED->text()), _("Select a temporary directory")));
|
2002-11-17 12:35:06 +00:00
|
|
|
if (!file.empty())
|
2002-12-17 20:37:13 +00:00
|
|
|
pathsModule->tempDirED->setText(toqstr(file));
|
2002-11-17 12:35:06 +00:00
|
|
|
}
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-17 12:35:06 +00:00
|
|
|
void QPrefsDialog::select_backupdir()
|
|
|
|
{
|
2003-01-14 21:51:34 +00:00
|
|
|
string file(form_->controller().browsedir(fromqstr(pathsModule->backupDirED->text()), _("Select a backups directory")));
|
2002-11-17 12:35:06 +00:00
|
|
|
if (!file.empty())
|
2002-12-17 20:37:13 +00:00
|
|
|
pathsModule->backupDirED->setText(toqstr(file));
|
2002-11-17 12:35:06 +00:00
|
|
|
}
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-17 12:35:06 +00:00
|
|
|
void QPrefsDialog::select_workingdir()
|
|
|
|
{
|
2003-01-14 21:51:34 +00:00
|
|
|
string file(form_->controller().browsedir(fromqstr(pathsModule->workingDirED->text()), _("Select a document directory")));
|
2002-11-17 12:35:06 +00:00
|
|
|
if (!file.empty())
|
2002-12-17 20:37:13 +00:00
|
|
|
pathsModule->workingDirED->setText(toqstr(file));
|
2002-11-17 12:35:06 +00:00
|
|
|
}
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-17 12:35:06 +00:00
|
|
|
void QPrefsDialog::select_lyxpipe()
|
|
|
|
{
|
2002-12-17 20:37:13 +00:00
|
|
|
string file(form_->controller().browse(fromqstr(pathsModule->lyxserverDirED->text()), _("Give a filename for the LyX server pipe")));
|
2002-11-17 12:35:06 +00:00
|
|
|
if (!file.empty())
|
2002-12-17 20:37:13 +00:00
|
|
|
pathsModule->lyxserverDirED->setText(toqstr(file));
|
2002-11-17 12:35:06 +00:00
|
|
|
}
|
2002-11-18 19:52:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::select_roman(const QString& name)
|
|
|
|
{
|
|
|
|
screenfontsModule->screenRomanFE->set(QFont(name), name);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::select_sans(const QString& name)
|
|
|
|
{
|
|
|
|
screenfontsModule->screenSansFE->set(QFont(name), name);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::select_typewriter(const QString& name)
|
|
|
|
{
|
|
|
|
screenfontsModule->screenTypewriterFE->set(QFont(name), name);
|
|
|
|
}
|