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
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-11-13 02:22:48 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
2004-10-26 18:39:13 +00:00
|
|
|
#include "debug.h"
|
2002-12-17 20:37:13 +00:00
|
|
|
#include "qt_helpers.h"
|
2002-11-13 02:22:48 +00:00
|
|
|
|
2004-05-20 09:36:28 +00:00
|
|
|
#include "QPrefsDialog.h"
|
2002-11-13 02:22:48 +00:00
|
|
|
#include "QPrefs.h"
|
|
|
|
|
2004-05-20 09:36:28 +00:00
|
|
|
#include "panelstack.h"
|
|
|
|
#include "qcoloritem.h"
|
|
|
|
#include "qfontexample.h"
|
2002-11-13 02:22:48 +00:00
|
|
|
|
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"
|
2005-01-14 15:53:30 +00:00
|
|
|
#if defined(__CYGWIN__) || defined(__CYGWIN32__)
|
|
|
|
#include "ui/QPrefCygwinPathModule.h"
|
|
|
|
#endif
|
2002-11-13 05:36:07 +00:00
|
|
|
#include "ui/QPrefDisplayModule.h"
|
|
|
|
#include "ui/QPrefPathsModule.h"
|
|
|
|
#include "ui/QPrefSpellcheckerModule.h"
|
|
|
|
#include "ui/QPrefConvertersModule.h"
|
2004-10-26 18:39:13 +00:00
|
|
|
#include "ui/QPrefCopiersModule.h"
|
2002-11-13 05:36:07 +00:00
|
|
|
#include "ui/QPrefFileformatsModule.h"
|
|
|
|
#include "ui/QPrefLanguageModule.h"
|
|
|
|
#include "ui/QPrefPrinterModule.h"
|
|
|
|
#include "ui/QPrefUIModule.h"
|
2003-02-09 00:11:51 +00:00
|
|
|
#include "ui/QPrefIdentityModule.h"
|
2002-11-13 05:36:07 +00:00
|
|
|
|
2002-12-17 20:37:13 +00:00
|
|
|
#include "gettext.h"
|
2003-09-15 15:20:22 +00:00
|
|
|
#include "LColor.h"
|
2002-11-13 02:22:48 +00:00
|
|
|
|
2004-05-20 09:36:28 +00:00
|
|
|
#include "controllers/ControlPrefs.h"
|
|
|
|
|
2002-11-17 05:37:27 +00:00
|
|
|
#include <qcheckbox.h>
|
2004-05-20 09:36:28 +00:00
|
|
|
#include <qcolordialog.h>
|
2002-11-17 05:37:27 +00:00
|
|
|
#include <qcombobox.h>
|
2002-11-17 17:16:21 +00:00
|
|
|
#include <qfontdatabase.h>
|
2004-05-20 09:36:28 +00:00
|
|
|
#include <qlineedit.h>
|
|
|
|
#include <qpushbutton.h>
|
|
|
|
#include <qspinbox.h>
|
2004-11-08 08:33:54 +00:00
|
|
|
#include <qstring.h>
|
2004-12-03 11:02:06 +00:00
|
|
|
#include <qvalidator.h>
|
2002-11-13 02:22:48 +00:00
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
using std::string;
|
|
|
|
|
2004-05-19 15:11:37 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
2002-11-13 02:22:48 +00:00
|
|
|
|
|
|
|
QPrefsDialog::QPrefsDialog(QPrefs * form)
|
2004-06-02 20:13:18 +00:00
|
|
|
: QPrefsDialogBase(0, 0, false, 0), form_(form)
|
2002-11-13 02:22:48 +00:00
|
|
|
{
|
|
|
|
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
|
|
|
|
2003-03-28 01:21:42 +00:00
|
|
|
asciiModule = new QPrefAsciiModule(this);
|
|
|
|
dateModule = new QPrefDateModule(this);
|
|
|
|
keyboardModule = new QPrefKeyboardModule(this);
|
|
|
|
latexModule = new QPrefLatexModule(this);
|
|
|
|
screenfontsModule = new QPrefScreenFontsModule(this);
|
|
|
|
colorsModule = new QPrefColorsModule(this);
|
2005-01-14 15:53:30 +00:00
|
|
|
#if defined(__CYGWIN__) || defined(__CYGWIN32__)
|
|
|
|
cygwinpathModule = new QPrefCygwinPathModule(this);
|
|
|
|
#endif
|
2003-03-28 01:21:42 +00:00
|
|
|
displayModule = new QPrefDisplayModule(this);
|
|
|
|
pathsModule = new QPrefPathsModule(this);
|
|
|
|
spellcheckerModule = new QPrefSpellcheckerModule(this);
|
|
|
|
convertersModule = new QPrefConvertersModule(this);
|
2004-10-26 18:39:13 +00:00
|
|
|
copiersModule = new QPrefCopiersModule(this);
|
2003-03-28 01:21:42 +00:00
|
|
|
fileformatsModule = new QPrefFileformatsModule(this);
|
|
|
|
languageModule = new QPrefLanguageModule(this);
|
|
|
|
printerModule = new QPrefPrinterModule(this);
|
|
|
|
uiModule = new QPrefUIModule(this);
|
|
|
|
identityModule = new QPrefIdentityModule(this);
|
|
|
|
|
|
|
|
string const laf = _("Look and feel");
|
|
|
|
prefsPS->addCategory(laf);
|
|
|
|
prefsPS->addPanel(uiModule, _("User interface"), laf);
|
|
|
|
prefsPS->addPanel(screenfontsModule, _("Screen fonts"), laf);
|
|
|
|
prefsPS->addPanel(colorsModule, _("Colors"), laf);
|
|
|
|
prefsPS->addPanel(displayModule, _("Graphics"), laf);
|
|
|
|
prefsPS->addPanel(keyboardModule, _("Keyboard"), laf);
|
|
|
|
|
|
|
|
string const ls = _("Language settings");
|
|
|
|
prefsPS->addCategory(ls);
|
|
|
|
prefsPS->addPanel(languageModule, _("Language"), ls);
|
|
|
|
prefsPS->addPanel(spellcheckerModule, _("Spell-checker"), ls);
|
|
|
|
|
|
|
|
string const op = _("Outputs");
|
|
|
|
prefsPS->addCategory(op);
|
|
|
|
prefsPS->addPanel(asciiModule, _("ASCII"), op);
|
|
|
|
prefsPS->addPanel(dateModule, _("Date format"), op);
|
|
|
|
prefsPS->addPanel(latexModule, _("LaTeX"), op);
|
2005-01-14 15:53:30 +00:00
|
|
|
#if defined(__CYGWIN__) || defined(__CYGWIN32__)
|
|
|
|
prefsPS->addPanel(cygwinpathModule, _("Paths"), op);
|
|
|
|
#endif
|
2003-03-28 01:21:42 +00:00
|
|
|
prefsPS->addPanel(printerModule, _("Printer"), op);
|
|
|
|
|
|
|
|
prefsPS->addPanel(identityModule, _("Identity"));
|
|
|
|
prefsPS->addPanel(pathsModule, _("Paths"));
|
|
|
|
prefsPS->addPanel(fileformatsModule, _("File formats"));
|
|
|
|
prefsPS->addPanel(convertersModule, _("Converters"));
|
2004-10-26 18:39:13 +00:00
|
|
|
prefsPS->addPanel(copiersModule, _("Copiers"));
|
2003-03-28 01:21:42 +00:00
|
|
|
|
|
|
|
prefsPS->setCurrentPanel(_("User interface"));
|
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)));
|
2005-04-15 08:56:46 +00:00
|
|
|
connect(fileformatsModule->formatED, SIGNAL(textChanged(const QString&)), this, SLOT(fileformat_changed()));
|
|
|
|
connect(fileformatsModule->guiNameED, SIGNAL(textChanged(const QString&)), this, SLOT(fileformat_changed()));
|
|
|
|
connect(fileformatsModule->shortcutED, SIGNAL(textChanged(const QString&)), this, SLOT(fileformat_changed()));
|
|
|
|
connect(fileformatsModule->extensionED, SIGNAL(textChanged(const QString&)), this, SLOT(fileformat_changed()));
|
|
|
|
connect(fileformatsModule->viewerED, SIGNAL(textChanged(const QString&)), this, SLOT(fileformat_changed()));
|
|
|
|
connect(fileformatsModule->editorED, SIGNAL(textChanged(const QString&)), this, SLOT(fileformat_changed()));
|
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)));
|
2004-11-08 08:33:54 +00:00
|
|
|
connect(convertersModule->converterFromCO, SIGNAL(activated(const QString&)), this, SLOT(converter_changed()));
|
|
|
|
connect(convertersModule->converterToCO, SIGNAL(activated(const QString&)), this, SLOT(converter_changed()));
|
|
|
|
connect(convertersModule->converterED, SIGNAL(textChanged(const QString&)), this, SLOT(converter_changed()));
|
|
|
|
connect(convertersModule->converterFlagED, SIGNAL(textChanged(const QString&)), this, SLOT(converter_changed()));
|
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()));
|
2004-10-26 18:39:13 +00:00
|
|
|
|
|
|
|
connect(copiersModule->copierNewPB, SIGNAL(clicked()), this, SLOT(new_copier()));
|
|
|
|
connect(copiersModule->copierRemovePB, SIGNAL(clicked()), this, SLOT(remove_copier()));
|
|
|
|
connect(copiersModule->copierModifyPB, SIGNAL(clicked()), this, SLOT(modify_copier()));
|
|
|
|
connect(copiersModule->AllCopiersLB, SIGNAL(highlighted(int)), this, SLOT(switch_copierLB(int)));
|
|
|
|
connect(copiersModule->copierFormatCO, SIGNAL(activated(int)), this, SLOT(switch_copierCO(int)));
|
|
|
|
connect(copiersModule->copierNewPB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
|
|
|
connect(copiersModule->copierRemovePB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
|
|
|
connect(copiersModule->copierModifyPB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
2005-04-15 08:56:46 +00:00
|
|
|
connect(copiersModule->copierFormatCO, SIGNAL(activated(const QString&)), this, SLOT(copiers_changed()));
|
|
|
|
connect(copiersModule->copierED, SIGNAL(textChanged(const QString&)), this, SLOT(copiers_changed()));
|
2004-10-26 18:39:13 +00:00
|
|
|
|
2002-11-17 07:11:02 +00:00
|
|
|
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()));
|
2005-01-14 15:53:30 +00:00
|
|
|
#if defined(__CYGWIN__) || defined(__CYGWIN32__)
|
|
|
|
connect(cygwinpathModule->pathCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
|
|
|
|
#endif
|
2002-11-17 05:37:27 +00:00
|
|
|
connect(latexModule->latexEncodingED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(latexModule->latexChecktexED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
2004-03-29 12:11:53 +00:00
|
|
|
connect(latexModule->latexBibtexED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
2004-10-05 08:34:41 +00:00
|
|
|
connect(latexModule->latexIndexED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
2002-11-17 05:37:27 +00:00
|
|
|
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()));
|
2004-04-19 13:31:17 +00:00
|
|
|
connect(displayModule->instantPreviewCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
|
2002-11-17 05:37:27 +00:00
|
|
|
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->tempDirED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(pathsModule->lyxserverDirED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
2005-01-16 21:01:41 +00:00
|
|
|
connect(pathsModule->pathPrefixED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
2002-11-17 05:37:27 +00:00
|
|
|
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()));
|
2003-02-09 00:11:51 +00:00
|
|
|
connect(identityModule->nameED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
|
|
|
connect(identityModule->emailED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
|
2005-04-26 11:12:20 +00:00
|
|
|
|
2004-12-03 11:02:06 +00:00
|
|
|
// initialize the validators
|
|
|
|
screenfontsModule->screenTinyED->setValidator(new QDoubleValidator(
|
|
|
|
screenfontsModule->screenTinyED));
|
|
|
|
screenfontsModule->screenSmallestED->setValidator(new QDoubleValidator(
|
|
|
|
screenfontsModule->screenSmallestED));
|
|
|
|
screenfontsModule->screenSmallerED->setValidator(new QDoubleValidator(
|
|
|
|
screenfontsModule->screenSmallerED));
|
|
|
|
screenfontsModule->screenSmallED->setValidator(new QDoubleValidator(
|
|
|
|
screenfontsModule->screenSmallED));
|
|
|
|
screenfontsModule->screenNormalED->setValidator(new QDoubleValidator(
|
|
|
|
screenfontsModule->screenNormalED));
|
|
|
|
screenfontsModule->screenLargeED->setValidator(new QDoubleValidator(
|
|
|
|
screenfontsModule->screenLargeED));
|
|
|
|
screenfontsModule->screenLargerED->setValidator(new QDoubleValidator(
|
|
|
|
screenfontsModule->screenLargerED));
|
|
|
|
screenfontsModule->screenLargestED->setValidator(new QDoubleValidator(
|
|
|
|
screenfontsModule->screenLargestED));
|
|
|
|
screenfontsModule->screenHugeED->setValidator(new QDoubleValidator(
|
|
|
|
screenfontsModule->screenHugeED));
|
|
|
|
screenfontsModule->screenHugerED->setValidator(new QDoubleValidator(
|
|
|
|
screenfontsModule->screenHugerED));
|
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
|
|
|
|
|
|
|
|
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
|
|
|
|
2005-04-15 08:56:46 +00:00
|
|
|
// save current selection
|
|
|
|
QString current = convertmod->converterFromCO->currentText()
|
|
|
|
+ " -> " + convertmod->converterToCO->currentText();
|
2005-04-26 11:12:20 +00:00
|
|
|
|
2002-11-17 08:02:55 +00:00
|
|
|
convertmod->converterFromCO->clear();
|
|
|
|
convertmod->converterToCO->clear();
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2004-03-31 16:50:59 +00:00
|
|
|
Formats::const_iterator cit = form_->formats().begin();
|
|
|
|
Formats::const_iterator end = form_->formats().end();
|
2002-11-17 08:02:55 +00:00
|
|
|
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
|
|
|
|
2004-03-31 16:50:59 +00:00
|
|
|
Converters::const_iterator ccit = form_->converters().begin();
|
|
|
|
Converters::const_iterator cend = form_->converters().end();
|
2002-11-17 07:11:02 +00:00
|
|
|
for (; ccit != cend; ++ccit) {
|
2004-11-26 14:52:54 +00:00
|
|
|
std::string const name = ccit->From->prettyname() + " -> "
|
2004-11-08 08:33:54 +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
|
|
|
}
|
2003-02-02 02:11:28 +00:00
|
|
|
|
2005-04-15 08:56:46 +00:00
|
|
|
// restore selection
|
|
|
|
if (!current.isEmpty()) {
|
|
|
|
QListBoxItem * item = convertmod->convertersLB->findItem(current);
|
|
|
|
convertmod->convertersLB->setCurrentItem(item);
|
|
|
|
}
|
|
|
|
// select first element if restoring failed
|
2003-02-02 02:11:28 +00:00
|
|
|
if (convertmod->convertersLB->currentItem() == -1)
|
|
|
|
convertmod->convertersLB->setCurrentItem(0);
|
2004-11-08 08:33:54 +00:00
|
|
|
|
|
|
|
updateConverterButtons();
|
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)
|
|
|
|
{
|
2004-03-31 16:50:59 +00:00
|
|
|
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));
|
2004-11-26 14:52:54 +00:00
|
|
|
|
2004-11-08 08:33:54 +00:00
|
|
|
updateConverterButtons();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::converter_changed()
|
|
|
|
{
|
|
|
|
updateConverterButtons();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::updateConverterButtons()
|
|
|
|
{
|
|
|
|
Format const & from(form_->formats().get(
|
|
|
|
convertersModule->converterFromCO->currentItem()));
|
|
|
|
Format const & to(form_->formats().get(
|
|
|
|
convertersModule->converterToCO->currentItem()));
|
|
|
|
int const sel = form_->converters().getNumber(from.name(), to.name());
|
|
|
|
bool const known = !(sel < 0);
|
2004-11-26 14:52:54 +00:00
|
|
|
bool const valid = !(convertersModule->converterED->text().isEmpty()
|
2004-11-08 08:33:54 +00:00
|
|
|
|| from.name() == to.name());
|
2004-11-26 14:52:54 +00:00
|
|
|
|
2004-11-08 08:33:54 +00:00
|
|
|
Converter const & c(form_->converters().get(
|
|
|
|
convertersModule->convertersLB->currentItem()));
|
|
|
|
string const old_command = c.command;
|
|
|
|
string const old_flag = c.flags;
|
|
|
|
string const new_command(fromqstr(convertersModule->converterED->text()));
|
|
|
|
string const new_flag(fromqstr(convertersModule->converterFlagED->text()));
|
2004-11-26 14:52:54 +00:00
|
|
|
|
2004-11-08 08:33:54 +00:00
|
|
|
bool modified = ((old_command != new_command) || (old_flag != new_flag));
|
2004-11-26 14:52:54 +00:00
|
|
|
|
2004-11-08 08:33:54 +00:00
|
|
|
convertersModule->converterModifyPB->setEnabled(valid && known && modified);
|
|
|
|
convertersModule->converterNewPB->setEnabled(valid && !known);
|
|
|
|
convertersModule->converterRemovePB->setEnabled(known);
|
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
|
|
|
{
|
2004-03-31 16:50:59 +00:00
|
|
|
Format const & from(form_->formats().get(convertersModule->converterFromCO->currentItem()));
|
|
|
|
Format const & to(form_->formats().get(convertersModule->converterToCO->currentItem()));
|
2004-11-08 08:33:54 +00:00
|
|
|
string const command(fromqstr(convertersModule->converterED->text()));
|
|
|
|
string const flags(fromqstr(convertersModule->converterFlagED->text()));
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2004-03-31 16:50:59 +00:00
|
|
|
Converter const * old = form_->converters().getConverter(from.name(), to.name());
|
2004-11-08 08:33:54 +00:00
|
|
|
form_->converters().add(from.name(), to.name(), command, flags);
|
2002-11-17 08:02:55 +00:00
|
|
|
if (!old) {
|
2004-03-31 16:50:59 +00:00
|
|
|
form_->converters().updateLast(form_->formats());
|
2002-11-17 08:02:55 +00:00
|
|
|
}
|
|
|
|
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()
|
|
|
|
{
|
2004-03-31 16:50:59 +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
|
|
|
|
2004-03-31 16:50:59 +00:00
|
|
|
Converter const * old = form_->converters().getConverter(from.name(), to.name());
|
|
|
|
form_->converters().add(from.name(), to.name(), name, flags);
|
2002-11-17 08:02:55 +00:00
|
|
|
if (!old) {
|
2004-03-31 16:50:59 +00:00
|
|
|
form_->converters().updateLast(form_->formats());
|
2002-11-17 08:02:55 +00:00
|
|
|
}
|
|
|
|
updateConverters();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::remove_converter()
|
|
|
|
{
|
2004-03-31 16:50:59 +00:00
|
|
|
Format const & from(form_->formats().get(convertersModule->converterFromCO->currentItem()));
|
|
|
|
Format const & to(form_->formats().get(convertersModule->converterToCO->currentItem()));
|
|
|
|
form_->converters().erase(from.name(), to.name());
|
2002-11-17 08:02:55 +00:00
|
|
|
updateConverters();
|
|
|
|
}
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2004-10-26 18:39:13 +00:00
|
|
|
void QPrefsDialog::updateCopiers()
|
|
|
|
{
|
|
|
|
// The choice widget
|
2005-04-15 08:56:46 +00:00
|
|
|
// save current selection
|
|
|
|
QString current = copiersModule->copierFormatCO->currentText();
|
2004-10-26 18:39:13 +00:00
|
|
|
copiersModule->copierFormatCO->clear();
|
|
|
|
|
|
|
|
for (Formats::const_iterator it = form_->formats().begin(),
|
|
|
|
end = form_->formats().end();
|
|
|
|
it != end; ++it) {
|
|
|
|
copiersModule->copierFormatCO->insertItem(toqstr(it->prettyname()));
|
|
|
|
}
|
|
|
|
|
|
|
|
// The browser widget
|
|
|
|
copiersModule->AllCopiersLB->clear();
|
|
|
|
|
|
|
|
for (Movers::iterator it = form_->movers().begin(),
|
|
|
|
end = form_->movers().end();
|
|
|
|
it != end; ++it) {
|
|
|
|
std::string const & command = it->second.command();
|
|
|
|
if (command.empty())
|
|
|
|
continue;
|
|
|
|
std::string const & fmt = it->first;
|
|
|
|
std::string const & pretty = form_->formats().prettyName(fmt);
|
|
|
|
|
|
|
|
copiersModule->AllCopiersLB->insertItem(toqstr(pretty));
|
|
|
|
}
|
|
|
|
|
2005-04-15 08:56:46 +00:00
|
|
|
// restore selection
|
|
|
|
if (!current.isEmpty()) {
|
|
|
|
QListBoxItem * item = copiersModule->AllCopiersLB->findItem(current);
|
|
|
|
copiersModule->AllCopiersLB->setCurrentItem(item);
|
|
|
|
}
|
|
|
|
// select first element if restoring failed
|
2004-10-26 18:39:13 +00:00
|
|
|
if (copiersModule->AllCopiersLB->currentItem() == -1)
|
|
|
|
copiersModule->AllCopiersLB->setCurrentItem(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
2005-01-19 15:03:31 +00:00
|
|
|
class SamePrettyName {
|
|
|
|
public:
|
2004-10-26 18:39:13 +00:00
|
|
|
SamePrettyName(string const & n) : pretty_name_(n) {}
|
|
|
|
|
|
|
|
bool operator()(::Format const & fmt) const {
|
|
|
|
return fmt.prettyname() == pretty_name_;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
string const pretty_name_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Format const * getFormat(std::string const & prettyname)
|
|
|
|
{
|
|
|
|
Formats::const_iterator it = ::formats.begin();
|
|
|
|
Formats::const_iterator const end = ::formats.end();
|
|
|
|
it = std::find_if(it, end, SamePrettyName(prettyname));
|
|
|
|
return it == end ? 0 : &*it;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace anon
|
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::switch_copierLB(int nr)
|
|
|
|
{
|
|
|
|
std::string const browser_text =
|
|
|
|
fromqstr(copiersModule->AllCopiersLB->currentText());
|
|
|
|
lyxerr << "switch_copierLB(" << nr << ")\n"
|
|
|
|
<< "browser_text " << browser_text << std::endl;
|
|
|
|
Format const * fmt = getFormat(browser_text);
|
|
|
|
if (fmt == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
string const & fmt_name = fmt->name();
|
|
|
|
string const & gui_name = fmt->prettyname();
|
|
|
|
string const & command = form_->movers().command(fmt_name);
|
|
|
|
|
|
|
|
lyxerr << "switch_copierLB(" << nr << ")\n"
|
|
|
|
<< "fmt_name " << fmt_name << '\n'
|
|
|
|
<< "gui_name " << gui_name << '\n'
|
|
|
|
<< "command " << command << std::endl;
|
|
|
|
|
|
|
|
copiersModule->copierED->clear();
|
|
|
|
int const combo_size = copiersModule->copierFormatCO->count();
|
|
|
|
for (int i = 0; i < combo_size; ++i) {
|
|
|
|
QString const qtext = copiersModule->copierFormatCO->text(i);
|
|
|
|
std::string const text = fromqstr(qtext);
|
|
|
|
if (text == gui_name) {
|
|
|
|
copiersModule->copierFormatCO->setCurrentItem(i);
|
|
|
|
copiersModule->copierED->setText(toqstr(command));
|
|
|
|
lyxerr << "found combo item " << i << std::endl;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2005-04-15 08:56:46 +00:00
|
|
|
updateCopierButtons();
|
2004-10-26 18:39:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::switch_copierCO(int nr)
|
|
|
|
{
|
|
|
|
std::string const combo_text =
|
|
|
|
fromqstr(copiersModule->copierFormatCO->currentText());
|
|
|
|
lyxerr << "switch_copierCO(" << nr << ")\n"
|
|
|
|
<< "combo_text " << combo_text << std::endl;
|
|
|
|
Format const * fmt = getFormat(combo_text);
|
|
|
|
if (fmt == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
string const & fmt_name = fmt->name();
|
|
|
|
string const & gui_name = fmt->prettyname();
|
|
|
|
string const & command = form_->movers().command(fmt_name);
|
|
|
|
|
|
|
|
lyxerr << "switch_copierCO(" << nr << ")\n"
|
|
|
|
<< "fmt_name " << fmt_name << '\n'
|
|
|
|
<< "gui_name " << gui_name << '\n'
|
|
|
|
<< "command " << command << std::endl;
|
|
|
|
|
|
|
|
copiersModule->copierED->setText(toqstr(command));
|
|
|
|
|
|
|
|
int const index = copiersModule->AllCopiersLB->currentItem();
|
|
|
|
if (index >= 0)
|
|
|
|
copiersModule->AllCopiersLB->setSelected(index, false);
|
|
|
|
|
|
|
|
int const browser_size = copiersModule->AllCopiersLB->count();
|
|
|
|
for (int i = 0; i < browser_size; ++i) {
|
|
|
|
QString const qtext = copiersModule->AllCopiersLB->text(i);
|
|
|
|
std::string const text = fromqstr(qtext);
|
|
|
|
if (text == gui_name) {
|
|
|
|
copiersModule->AllCopiersLB->setSelected(i, true);
|
|
|
|
int top = std::max(i - 5, 0);
|
|
|
|
copiersModule->AllCopiersLB->setTopItem(top);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-15 08:56:46 +00:00
|
|
|
void QPrefsDialog::copiers_changed()
|
|
|
|
{
|
|
|
|
updateCopierButtons();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::updateCopierButtons()
|
|
|
|
{
|
|
|
|
QString selected = copiersModule->copierFormatCO->currentText();
|
|
|
|
|
|
|
|
bool known = false;
|
|
|
|
for (unsigned int i = 0; i != copiersModule->AllCopiersLB->count(); i++) {
|
|
|
|
if (copiersModule->AllCopiersLB->text(i) == selected)
|
|
|
|
known = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool const valid = !copiersModule->copierED->text().isEmpty();
|
|
|
|
|
|
|
|
Format const * fmt = getFormat(fromqstr(selected));
|
|
|
|
string const old_command = form_->movers().command(fmt->name());
|
|
|
|
string const new_command(fromqstr(copiersModule->copierED->text()));
|
|
|
|
|
|
|
|
bool modified = (old_command != new_command);
|
|
|
|
|
|
|
|
copiersModule->copierModifyPB->setEnabled(valid && known && modified);
|
|
|
|
copiersModule->copierNewPB->setEnabled(valid && !known);
|
|
|
|
copiersModule->copierRemovePB->setEnabled(known);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-26 18:39:13 +00:00
|
|
|
void QPrefsDialog::new_copier()
|
|
|
|
{
|
|
|
|
std::string const combo_text =
|
|
|
|
fromqstr(copiersModule->copierFormatCO->currentText());
|
|
|
|
Format const * fmt = getFormat(combo_text);
|
|
|
|
if (fmt == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
string const command = fromqstr(copiersModule->copierED->text());
|
|
|
|
if (command.empty())
|
|
|
|
return;
|
|
|
|
|
|
|
|
form_->movers().set(fmt->name(), command);
|
|
|
|
|
|
|
|
updateCopiers();
|
|
|
|
int const last = copiersModule->AllCopiersLB->count() - 1;
|
|
|
|
copiersModule->AllCopiersLB->setCurrentItem(last);
|
2005-04-15 08:56:46 +00:00
|
|
|
|
|
|
|
updateCopierButtons();
|
2004-10-26 18:39:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::modify_copier()
|
|
|
|
{
|
|
|
|
std::string const combo_text =
|
|
|
|
fromqstr(copiersModule->copierFormatCO->currentText());
|
|
|
|
Format const * fmt = getFormat(combo_text);
|
|
|
|
if (fmt == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
string const command = fromqstr(copiersModule->copierED->text());
|
|
|
|
form_->movers().set(fmt->name(), command);
|
|
|
|
|
|
|
|
updateCopiers();
|
2005-04-15 08:56:46 +00:00
|
|
|
updateCopierButtons();
|
2004-10-26 18:39:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::remove_copier()
|
|
|
|
{
|
|
|
|
std::string const combo_text =
|
|
|
|
fromqstr(copiersModule->copierFormatCO->currentText());
|
|
|
|
Format const * fmt = getFormat(combo_text);
|
|
|
|
if (fmt == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
string const & fmt_name = fmt->name();
|
|
|
|
form_->movers().set(fmt_name, string());
|
|
|
|
|
|
|
|
updateCopiers();
|
2005-04-15 08:56:46 +00:00
|
|
|
updateCopierButtons();
|
2004-10-26 18:39:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-11-17 07:11:02 +00:00
|
|
|
void QPrefsDialog::updateFormats()
|
|
|
|
{
|
|
|
|
QPrefFileformatsModule * formatmod(fileformatsModule);
|
|
|
|
|
2005-04-15 08:56:46 +00:00
|
|
|
// save current selection
|
|
|
|
QString current = formatmod->guiNameED->text();
|
2005-04-26 11:12:20 +00:00
|
|
|
|
2002-11-17 07:11:02 +00:00
|
|
|
formatmod->formatsLB->clear();
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2004-03-31 16:50:59 +00:00
|
|
|
Formats::const_iterator cit = form_->formats().begin();
|
|
|
|
Formats::const_iterator end = form_->formats().end();
|
2002-11-17 07:11:02 +00:00
|
|
|
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
|
|
|
}
|
2003-02-02 02:11:28 +00:00
|
|
|
|
2005-04-15 08:56:46 +00:00
|
|
|
// restore selection
|
|
|
|
if (!current.isEmpty()) {
|
|
|
|
QListBoxItem * item = formatmod->formatsLB->findItem(current);
|
|
|
|
formatmod->formatsLB->setCurrentItem(item);
|
|
|
|
}
|
|
|
|
// select first element if restoring failed
|
2003-02-02 02:11:28 +00:00
|
|
|
if (formatmod->formatsLB->currentItem() == -1)
|
|
|
|
formatmod->formatsLB->setCurrentItem(0);
|
2002-11-17 07:11:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::switch_format(int nr)
|
|
|
|
{
|
2004-03-31 16:50:59 +00:00
|
|
|
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()));
|
2004-04-13 10:36:09 +00:00
|
|
|
fileformatsModule->editorED->setText(toqstr(f.editor()));
|
2002-11-17 07:11:02 +00:00
|
|
|
fileformatsModule->formatRemovePB->setEnabled(
|
2004-03-31 16:50:59 +00:00
|
|
|
!form_->converters().formatIsUsed(f.name()));
|
2005-04-15 08:56:46 +00:00
|
|
|
|
|
|
|
updateFormatsButtons();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::fileformat_changed()
|
|
|
|
{
|
|
|
|
updateFormatsButtons();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::updateFormatsButtons()
|
|
|
|
{
|
|
|
|
QString const format = fileformatsModule->formatED->text();
|
|
|
|
QString const gui_name = fileformatsModule->guiNameED->text();
|
|
|
|
int const sel = form_->formats().getNumber(fromqstr(format));
|
|
|
|
bool gui_name_known = false;
|
|
|
|
int where = sel;
|
|
|
|
for (unsigned int i = 0; i != fileformatsModule->formatsLB->count(); i++) {
|
|
|
|
if (fileformatsModule->formatsLB->text(i) == gui_name) {
|
|
|
|
gui_name_known = true;
|
|
|
|
where = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// assure that a gui name cannot be chosen twice
|
|
|
|
bool const known_otherwise = gui_name_known && (where != sel);
|
2005-04-26 11:12:20 +00:00
|
|
|
|
2005-04-15 08:56:46 +00:00
|
|
|
bool const known = !(sel < 0);
|
|
|
|
bool const valid = (!fileformatsModule->formatED->text().isEmpty()
|
|
|
|
&& !fileformatsModule->guiNameED->text().isEmpty());
|
|
|
|
|
|
|
|
Format const & f(form_->formats().get(
|
|
|
|
fileformatsModule->formatsLB->currentItem()));
|
|
|
|
string const old_pretty(f.prettyname());
|
|
|
|
string const old_shortcut(f.shortcut());
|
|
|
|
string const old_extension(f.extension());
|
|
|
|
string const old_viewer(f.viewer());
|
|
|
|
string const old_editor(f.editor());
|
|
|
|
|
|
|
|
string const new_pretty(fromqstr(gui_name));
|
|
|
|
string const new_shortcut(fromqstr(fileformatsModule->shortcutED->text()));
|
|
|
|
string const new_extension(fromqstr(fileformatsModule->extensionED->text()));
|
|
|
|
string const new_viewer(fromqstr(fileformatsModule->viewerED->text()));
|
|
|
|
string const new_editor(fromqstr(fileformatsModule->editorED->text()));
|
|
|
|
|
|
|
|
bool modified = ((old_pretty != new_pretty) || (old_shortcut != new_shortcut)
|
|
|
|
|| (old_extension != new_extension) || (old_viewer != new_viewer)
|
|
|
|
|| (old_editor != new_editor));
|
|
|
|
|
|
|
|
fileformatsModule->formatModifyPB->setEnabled(
|
|
|
|
valid && known && modified && !known_otherwise);
|
|
|
|
fileformatsModule->formatNewPB->setEnabled(valid && !known && !gui_name_known);
|
|
|
|
fileformatsModule->formatRemovePB->setEnabled(known);
|
2002-11-17 07:11:02 +00:00
|
|
|
}
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2002-11-17 07:11:02 +00:00
|
|
|
void QPrefsDialog::new_format()
|
|
|
|
{
|
2005-04-15 08:56:46 +00:00
|
|
|
string const name = fromqstr(fileformatsModule->formatED->text());
|
|
|
|
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());
|
|
|
|
string const editor = fromqstr(fileformatsModule->editorED->text());
|
|
|
|
|
|
|
|
form_->formats().add(name, extension, prettyname, shortcut, viewer, editor);
|
2004-03-31 16:50:59 +00:00
|
|
|
form_->formats().sort();
|
2002-11-17 07:11:02 +00:00
|
|
|
updateFormats();
|
2005-04-15 08:56:46 +00:00
|
|
|
fileformatsModule->formatsLB->setCurrentItem(form_->formats().getNumber(name));
|
2004-11-08 08:33:54 +00:00
|
|
|
form_->converters().update(form_->formats());
|
2005-04-26 11:12:20 +00:00
|
|
|
|
2002-11-17 07:11:02 +00:00
|
|
|
updateConverters();
|
2005-04-15 08:56:46 +00:00
|
|
|
updateFormatsButtons();
|
2002-11-17 07:11:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::modify_format()
|
|
|
|
{
|
2004-03-31 16:50:59 +00:00
|
|
|
Format const & oldformat(form_->formats().get(fileformatsModule->formatsLB->currentItem()));
|
2002-11-17 07:11:02 +00:00
|
|
|
string const oldpretty(oldformat.prettyname());
|
2002-12-17 20:37:13 +00:00
|
|
|
string const name(fromqstr(fileformatsModule->formatED->text()));
|
2004-03-31 16:50:59 +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());
|
2004-04-13 10:36:09 +00:00
|
|
|
string const editor = fromqstr(fileformatsModule->editorED->text());
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2004-04-13 10:36:09 +00:00
|
|
|
form_->formats().add(name, extension, prettyname, shortcut, viewer, editor);
|
2004-03-31 16:50:59 +00:00
|
|
|
form_->formats().sort();
|
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();
|
2005-04-15 08:56:46 +00:00
|
|
|
updateFormatsButtons();
|
2002-11-17 07:11:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QPrefsDialog::remove_format()
|
|
|
|
{
|
|
|
|
int const nr(fileformatsModule->formatsLB->currentItem());
|
|
|
|
if (nr < 0)
|
|
|
|
return;
|
2004-03-31 16:50:59 +00:00
|
|
|
form_->formats().erase(form_->formats().get(nr).name());
|
2002-11-17 07:11:02 +00:00
|
|
|
updateFormats();
|
2004-11-08 08:33:54 +00:00
|
|
|
form_->converters().update(form_->formats());
|
2005-04-26 11:12:20 +00:00
|
|
|
|
2002-11-17 07:11:02 +00:00
|
|
|
updateConverters();
|
2005-04-15 08:56:46 +00:00
|
|
|
updateFormatsButtons();
|
2002-11-17 07:11:02 +00:00
|
|
|
}
|
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));
|
2004-08-13 23:29:02 +00:00
|
|
|
QColor c(QColorDialog::getColor(ci->color(), qApp->focusWidget() ? qApp->focusWidget() : qApp->mainWidget()));
|
2002-11-17 09:42:25 +00:00
|
|
|
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);
|
|
|
|
}
|
2004-05-19 15:11:37 +00:00
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|