cosmetics

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24844 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2008-05-19 20:52:24 +00:00
parent 8bb1c2fc78
commit de6483b8ab
2 changed files with 231 additions and 230 deletions

View File

@ -322,8 +322,8 @@ static void setComboxFont(QComboBox * cb, string const & family,
//
/////////////////////////////////////////////////////////////////////
PrefPlaintext::PrefPlaintext(QWidget * parent)
: PrefModule(qt_(catOutput), qt_("Plain text"), 0, parent)
PrefPlaintext::PrefPlaintext(GuiPreferences * form)
: PrefModule(qt_(catOutput), qt_("Plain text"), form)
{
setupUi(this);
connect(plaintextLinelengthSB, SIGNAL(valueChanged(int)),
@ -353,8 +353,8 @@ void PrefPlaintext::update(LyXRC const & rc)
//
/////////////////////////////////////////////////////////////////////
PrefDate::PrefDate(QWidget * parent)
: PrefModule(qt_(catOutput), qt_("Date format"), 0, parent)
PrefDate::PrefDate(GuiPreferences * form)
: PrefModule(qt_(catOutput), qt_("Date format"), form)
{
setupUi(this);
connect(DateED, SIGNAL(textChanged(QString)),
@ -380,8 +380,8 @@ void PrefDate::update(LyXRC const & rc)
//
/////////////////////////////////////////////////////////////////////
PrefInput::PrefInput(GuiPreferences * form, QWidget * parent)
: PrefModule(qt_(catEditing), qt_("Keyboard/Mouse"), form, parent)
PrefInput::PrefInput(GuiPreferences * form)
: PrefModule(qt_(catEditing), qt_("Keyboard/Mouse"), form)
{
setupUi(this);
@ -416,9 +416,9 @@ void PrefInput::update(LyXRC const & rc)
}
QString PrefInput::testKeymap(QString keymap)
QString PrefInput::testKeymap(QString const & keymap)
{
return form_->browsekbmap(toqstr(internal_path(fromqstr(keymap))));
return form_->browsekbmap(internalPath(keymap));
}
@ -455,8 +455,8 @@ void PrefInput::on_keymapCB_toggled(bool keymap)
//
/////////////////////////////////////////////////////////////////////
PrefCompletion::PrefCompletion(GuiPreferences * form, QWidget * parent)
: PrefModule(qt_(catEditing), qt_("Input Completion"), form, parent)
PrefCompletion::PrefCompletion(GuiPreferences * form)
: PrefModule(qt_(catEditing), qt_("Input Completion"), form)
{
setupUi(this);
@ -517,8 +517,8 @@ void PrefCompletion::update(LyXRC const & rc)
//
/////////////////////////////////////////////////////////////////////
PrefLatex::PrefLatex(GuiPreferences * form, QWidget * parent)
: PrefModule(qt_(catOutput), qt_("LaTeX"), form, parent)
PrefLatex::PrefLatex(GuiPreferences * form)
: PrefModule(qt_(catOutput), qt_("LaTeX"), form)
{
setupUi(this);
connect(latexEncodingED, SIGNAL(textChanged(QString)),
@ -584,8 +584,8 @@ void PrefLatex::update(LyXRC const & rc)
//
/////////////////////////////////////////////////////////////////////
PrefScreenFonts::PrefScreenFonts(GuiPreferences * form, QWidget * parent)
: PrefModule(qt_(catLookAndFeel), qt_("Screen fonts"), form, parent)
PrefScreenFonts::PrefScreenFonts(GuiPreferences * form)
: PrefModule(qt_(catLookAndFeel), qt_("Screen fonts"), form)
{
setupUi(this);
@ -758,8 +758,8 @@ struct ColorSorter
} // namespace anon
PrefColors::PrefColors(GuiPreferences * form, QWidget * parent)
: PrefModule(qt_(catLookAndFeel), qt_("Colors"), form, parent)
PrefColors::PrefColors(GuiPreferences * form)
: PrefModule(qt_(catLookAndFeel), qt_("Colors"), form)
{
setupUi(this);
@ -807,7 +807,7 @@ void PrefColors::apply(LyXRC & /*rc*/) const
{
for (unsigned int i = 0; i < lcolors_.size(); ++i)
if (curcolors_[i] != newcolors_[i])
form_->setColor(lcolors_[i], fromqstr(newcolors_[i]));
form_->setColor(lcolors_[i], newcolors_[i]);
}
@ -857,8 +857,8 @@ void PrefColors::change_lyxObjects_selection()
//
/////////////////////////////////////////////////////////////////////
PrefDisplay::PrefDisplay(QWidget * parent)
: PrefModule(qt_(catLookAndFeel), qt_("Graphics"), 0, parent)
PrefDisplay::PrefDisplay(GuiPreferences * form)
: PrefModule(qt_(catLookAndFeel), qt_("Graphics"), form)
{
setupUi(this);
connect(instantPreviewCO, SIGNAL(activated(int)),
@ -928,8 +928,8 @@ void PrefDisplay::update(LyXRC const & rc)
//
/////////////////////////////////////////////////////////////////////
PrefPaths::PrefPaths(GuiPreferences * form, QWidget * parent)
: PrefModule(QString(), qt_("Paths"), form, parent)
PrefPaths::PrefPaths(GuiPreferences * form)
: PrefModule(QString(), qt_("Paths"), form)
{
setupUi(this);
connect(exampleDirPB, SIGNAL(clicked()), this, SLOT(select_exampledir()));
@ -1041,8 +1041,8 @@ void PrefPaths::select_lyxpipe()
//
/////////////////////////////////////////////////////////////////////
PrefSpellchecker::PrefSpellchecker(GuiPreferences * form, QWidget * parent)
: PrefModule(qt_(catLanguage), qt_("Spellchecker"), form, parent)
PrefSpellchecker::PrefSpellchecker(GuiPreferences * form)
: PrefModule(qt_(catLanguage), qt_("Spellchecker"), form)
{
setupUi(this);
@ -1150,8 +1150,8 @@ void PrefSpellchecker::select_dict()
/////////////////////////////////////////////////////////////////////
PrefConverters::PrefConverters(GuiPreferences * form, QWidget * parent)
: PrefModule(qt_(catFiles), qt_("Converters"), form, parent)
PrefConverters::PrefConverters(GuiPreferences * form)
: PrefModule(qt_(catFiles), qt_("Converters"), form)
{
setupUi(this);
@ -1347,10 +1347,23 @@ void PrefConverters::on_cacheCB_stateChanged(int state)
/////////////////////////////////////////////////////////////////////
//
// PrefFileformats
// FormatValidator
//
/////////////////////////////////////////////////////////////////////
//
class FormatValidator : public QValidator
{
public:
FormatValidator(QWidget *, Formats const & f);
void fixup(QString & input) const;
QValidator::State validate(QString & input, int & pos) const;
private:
virtual QString toString(Format const & format) const = 0;
int nr() const;
Formats const & formats_;
};
FormatValidator::FormatValidator(QWidget * parent, Formats const & f)
: QValidator(parent), formats_(f)
{
@ -1362,9 +1375,9 @@ void FormatValidator::fixup(QString & input) const
Formats::const_iterator cit = formats_.begin();
Formats::const_iterator end = formats_.end();
for (; cit != end; ++cit) {
string const name = str(cit);
QString const name = toString(*cit);
if (distance(formats_.begin(), cit) == nr()) {
input = toqstr(name);
input = name;
return;
}
}
@ -1377,9 +1390,9 @@ QValidator::State FormatValidator::validate(QString & input, int & /*pos*/) cons
Formats::const_iterator end = formats_.end();
bool unknown = true;
for (; unknown && cit != end; ++cit) {
string const name = str(cit);
QString const name = toString(*cit);
if (distance(formats_.begin(), cit) != nr())
unknown = toqstr(name) != input;
unknown = name != input;
}
if (unknown && !input.isEmpty())
@ -1396,31 +1409,54 @@ int FormatValidator::nr() const
}
FormatNameValidator::FormatNameValidator(QWidget * parent, Formats const & f)
/////////////////////////////////////////////////////////////////////
//
// FormatNameValidator
//
/////////////////////////////////////////////////////////////////////
class FormatNameValidator : public FormatValidator
{
public:
FormatNameValidator(QWidget * parent, Formats const & f)
: FormatValidator(parent, f)
{}
private:
QString toString(Format const & format) const
{
return toqstr(format.name());
}
};
/////////////////////////////////////////////////////////////////////
//
// FormatPrettynameValidator
//
/////////////////////////////////////////////////////////////////////
class FormatPrettynameValidator : public FormatValidator
{
}
string FormatNameValidator::str(Formats::const_iterator it) const
{
return it->name();
}
FormatPrettynameValidator::FormatPrettynameValidator(QWidget * parent, Formats const & f)
public:
FormatPrettynameValidator(QWidget * parent, Formats const & f)
: FormatValidator(parent, f)
{
}
{}
private:
QString toString(Format const & format) const
{
return toqstr(format.prettyname());
}
};
string FormatPrettynameValidator::str(Formats::const_iterator it) const
{
return it->prettyname();
}
/////////////////////////////////////////////////////////////////////
//
// PrefFileformats
//
/////////////////////////////////////////////////////////////////////
PrefFileformats::PrefFileformats(GuiPreferences * form, QWidget * parent)
: PrefModule(qt_(catFiles), qt_("File formats"), form, parent)
PrefFileformats::PrefFileformats(GuiPreferences * form)
: PrefModule(qt_(catFiles), qt_("File formats"), form)
{
setupUi(this);
formatED->setValidator(new FormatNameValidator(formatsCB, form_->formats()));
@ -1618,8 +1654,8 @@ void PrefFileformats::on_formatRemovePB_clicked()
//
/////////////////////////////////////////////////////////////////////
PrefLanguage::PrefLanguage(QWidget * parent)
: PrefModule(qt_(catLanguage), qt_("Language"), 0, parent)
PrefLanguage::PrefLanguage(GuiPreferences * form)
: PrefModule(qt_(catLanguage), qt_("Language"), form)
{
setupUi(this);
@ -1703,8 +1739,8 @@ void PrefLanguage::update(LyXRC const & rc)
//
/////////////////////////////////////////////////////////////////////
PrefPrinter::PrefPrinter(QWidget * parent)
: PrefModule(qt_(catOutput), qt_("Printer"), 0, parent)
PrefPrinter::PrefPrinter(GuiPreferences * form)
: PrefModule(qt_(catOutput), qt_("Printer"), form)
{
setupUi(this);
@ -1801,8 +1837,8 @@ void PrefPrinter::update(LyXRC const & rc)
//
/////////////////////////////////////////////////////////////////////
PrefUserInterface::PrefUserInterface(GuiPreferences * form, QWidget * parent)
: PrefModule(qt_(catLookAndFeel), qt_("User interface"), form, parent)
PrefUserInterface::PrefUserInterface(GuiPreferences * form)
: PrefModule(qt_(catLookAndFeel), qt_("User interface"), form)
{
setupUi(this);
@ -1873,14 +1909,15 @@ void PrefUserInterface::select_ui()
uiFileED->setText(file);
}
/////////////////////////////////////////////////////////////////////
//
// PrefEdit
//
/////////////////////////////////////////////////////////////////////
PrefEdit::PrefEdit(GuiPreferences * form, QWidget * parent)
: PrefModule(qt_(catEditing), qt_("Control"), form, parent)
PrefEdit::PrefEdit(GuiPreferences * form)
: PrefModule(qt_(catEditing), qt_("Control"), form)
{
setupUi(this);
@ -1951,8 +1988,8 @@ GuiShortcutDialog::GuiShortcutDialog(QWidget * parent) : QDialog(parent)
}
PrefShortcuts::PrefShortcuts(GuiPreferences * form, QWidget * parent)
: PrefModule(qt_(catEditing), qt_("Shortcuts"), form, parent)
PrefShortcuts::PrefShortcuts(GuiPreferences * form)
: PrefModule(qt_(catEditing), qt_("Shortcuts"), form)
{
setupUi(this);
@ -2069,7 +2106,7 @@ void PrefShortcuts::updateShortcutsTW()
KeyMap::BindingList::const_iterator it = bindinglist.begin();
KeyMap::BindingList::const_iterator it_end = bindinglist.end();
for (; it != it_end; ++it)
insertShortcutItem(it->request, it->sequence, item_type(it->tag));
insertShortcutItem(it->request, it->sequence, ItemType(it->tag));
shortcutsTW->sortItems(0, Qt::AscendingOrder);
QList<QTreeWidgetItem*> items = shortcutsTW->selectedItems();
@ -2080,7 +2117,7 @@ void PrefShortcuts::updateShortcutsTW()
}
void PrefShortcuts::setItemType(QTreeWidgetItem * item, item_type tag)
void PrefShortcuts::setItemType(QTreeWidgetItem * item, ItemType tag)
{
item->setData(0, Qt::UserRole, QVariant(tag));
QFont font;
@ -2105,14 +2142,14 @@ void PrefShortcuts::setItemType(QTreeWidgetItem * item, item_type tag)
QTreeWidgetItem * PrefShortcuts::insertShortcutItem(FuncRequest const & lfun,
KeySequence const & seq, item_type tag)
KeySequence const & seq, ItemType tag)
{
FuncCode action = lfun.action;
string const action_name = lyxaction.getActionName(action);
QString const lfun_name = toqstr(from_utf8(action_name)
+ ' ' + lfun.argument());
QString const shortcut = toqstr(seq.print(KeySequence::ForGui));
item_type item_tag = tag;
ItemType item_tag = tag;
QTreeWidgetItem * newItem = 0;
// for unbind items, try to find an existing item in the system bind list
@ -2174,7 +2211,7 @@ void PrefShortcuts::on_shortcutsTW_itemSelectionChanged()
if (items.isEmpty())
return;
item_type tag = static_cast<item_type>(items[0]->data(0, Qt::UserRole).toInt());
ItemType tag = static_cast<ItemType>(items[0]->data(0, Qt::UserRole).toInt());
if (tag == UserUnbind)
removePB->setText(qt_("Res&tore"));
else
@ -2235,7 +2272,7 @@ void PrefShortcuts::on_removePB_pressed()
string shortcut = fromqstr(items[i]->data(1, Qt::UserRole).toString());
string lfun = fromqstr(items[i]->text(0));
FuncRequest func = lyxaction.lookupFunc(lfun);
item_type tag = static_cast<item_type>(items[i]->data(0, Qt::UserRole).toInt());
ItemType tag = static_cast<ItemType>(items[i]->data(0, Qt::UserRole).toInt());
switch (tag) {
case System: {
@ -2357,8 +2394,8 @@ void PrefShortcuts::shortcut_clearPB_pressed()
//
/////////////////////////////////////////////////////////////////////
PrefIdentity::PrefIdentity(QWidget * parent)
: PrefModule(QString(), qt_("Identity"), 0, parent)
PrefIdentity::PrefIdentity(GuiPreferences * form)
: PrefModule(QString(), qt_("Identity"), form)
{
setupUi(this);
@ -2402,33 +2439,33 @@ GuiPreferences::GuiPreferences(GuiView & lv)
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
connect(restorePB, SIGNAL(clicked()), this, SLOT(slotRestore()));
add(new PrefUserInterface(this));
add(new PrefEdit(this));
add(new PrefShortcuts(this));
add(new PrefScreenFonts(this));
add(new PrefColors(this));
add(new PrefDisplay);
add(new PrefInput(this));
add(new PrefCompletion(this));
addModule(new PrefUserInterface(this));
addModule(new PrefEdit(this));
addModule(new PrefShortcuts(this));
addModule(new PrefScreenFonts(this));
addModule(new PrefColors(this));
addModule(new PrefDisplay(this));
addModule(new PrefInput(this));
addModule(new PrefCompletion(this));
add(new PrefPaths(this));
addModule(new PrefPaths(this));
add(new PrefIdentity);
addModule(new PrefIdentity(this));
add(new PrefLanguage);
add(new PrefSpellchecker(this));
addModule(new PrefLanguage(this));
addModule(new PrefSpellchecker(this));
add(new PrefPrinter);
add(new PrefDate);
add(new PrefPlaintext);
add(new PrefLatex(this));
addModule(new PrefPrinter(this));
addModule(new PrefDate(this));
addModule(new PrefPlaintext(this));
addModule(new PrefLatex(this));
PrefConverters * converters = new PrefConverters(this);
PrefFileformats * formats = new PrefFileformats(this);
connect(formats, SIGNAL(formatsChanged()),
converters, SLOT(updateGui()));
add(converters);
add(formats);
addModule(converters);
addModule(formats);
prefsPS->setCurrentPanel(qt_("User interface"));
// FIXME: hack to work around resizing bug in Qt >= 4.2
@ -2445,7 +2482,7 @@ GuiPreferences::GuiPreferences(GuiView & lv)
}
void GuiPreferences::add(PrefModule * module)
void GuiPreferences::addModule(PrefModule * module)
{
LASSERT(module, /**/);
if (module->category().isEmpty())
@ -2539,9 +2576,9 @@ void GuiPreferences::dispatchParams()
}
void GuiPreferences::setColor(ColorCode col, string const & hex)
void GuiPreferences::setColor(ColorCode col, QString const & hex)
{
colors_.push_back(lcolor.getLyXName(col) + ' ' + hex);
colors_.push_back(lcolor.getLyXName(col) + ' ' + fromqstr(hex));
}

View File

@ -46,9 +46,6 @@
#include "ui_PrefIdentityUi.h"
#include "ui_ShortcutUi.h"
#include <QDialog>
#include <QValidator>
#include <string>
#include <vector>
@ -61,15 +58,90 @@ class Movers;
namespace frontend {
class GuiPreferences;
class PrefModule;
class GuiPreferences : public GuiDialog, public Ui::PrefsUi
{
Q_OBJECT
public:
GuiPreferences(GuiView & lv);
void apply(LyXRC & rc) const;
void updateRc(LyXRC const & rc);
public Q_SLOTS:
void change_adaptor();
public:
/// Apply changes
void applyView();
/// update (do we need this?)
void updateContents();
std::vector<PrefModule *> modules_;
///
bool initialiseParams(std::string const &);
///
void clearParams() {}
///
void dispatchParams();
///
bool isBufferDependent() const { return false; }
/// various file pickers
QString browsebind(QString const & file) const;
QString browseUI(QString const & file) const;
QString browsekbmap(QString const & file) const;
QString browsedict(QString const & file) const;
/// general browse
QString browse(QString const & file, QString const & title) const;
/// set a color
void setColor(ColorCode col, QString const & hex);
/// update the screen fonts after change
void updateScreenFonts();
/// adjust the prefs paper sizes
PAPER_SIZE toPaperSize(int i) const;
/// adjust the prefs paper sizes
int fromPaperSize(PAPER_SIZE papersize) const;
LyXRC & rc() { return rc_; }
Converters & converters() { return converters_; }
Formats & formats() { return formats_; }
Movers & movers() { return movers_; }
private:
///
void addModule(PrefModule * module);
/// temporary lyxrc
LyXRC rc_;
/// temporary converters
Converters converters_;
/// temporary formats
Formats formats_;
/// temporary movers
Movers movers_;
/// A list of colors to be dispatched
std::vector<std::string> colors_;
bool redraw_gui_;
bool update_screen_font_;
};
class PrefModule : public QWidget
{
Q_OBJECT
public:
PrefModule(QString const & cat, QString const & t,
GuiPreferences * form = 0, QWidget * parent = 0)
: QWidget(parent), category_(cat), title_(t), form_(form)
GuiPreferences * form)
: QWidget(form), category_(cat), title_(t), form_(form)
{}
virtual void apply(LyXRC & rc) const = 0;
@ -92,7 +164,7 @@ class PrefPlaintext : public PrefModule, public Ui::PrefPlaintextUi
{
Q_OBJECT
public:
PrefPlaintext(QWidget * parent = 0);
PrefPlaintext(GuiPreferences * form);
virtual void apply(LyXRC & rc) const;
virtual void update(LyXRC const & rc);
@ -103,7 +175,7 @@ class PrefDate : public PrefModule, public Ui::PrefDateUi
{
Q_OBJECT
public:
PrefDate(QWidget * parent = 0);
PrefDate(GuiPreferences * form);
virtual void apply(LyXRC & rc) const;
virtual void update(LyXRC const & rc);
@ -114,7 +186,7 @@ class PrefInput : public PrefModule, public Ui::PrefInputUi
{
Q_OBJECT
public:
PrefInput(GuiPreferences * form, QWidget * parent = 0);
PrefInput(GuiPreferences * form);
virtual void apply(LyXRC & rc) const;
virtual void update(LyXRC const & rc);
@ -125,7 +197,7 @@ private Q_SLOTS:
void on_keymapCB_toggled(bool);
private:
QString testKeymap(QString keymap);
QString testKeymap(QString const & keymap);
};
@ -133,7 +205,7 @@ class PrefCompletion : public PrefModule, public Ui::PrefCompletionUi
{
Q_OBJECT
public:
PrefCompletion(GuiPreferences * form, QWidget * parent = 0);
PrefCompletion(GuiPreferences * form);
virtual void apply(LyXRC & rc) const;
virtual void update(LyXRC const & rc);
@ -144,7 +216,7 @@ class PrefLatex : public PrefModule, public Ui::PrefLatexUi
{
Q_OBJECT
public:
PrefLatex(GuiPreferences * form, QWidget * parent = 0);
PrefLatex(GuiPreferences * form);
virtual void apply(LyXRC & rc) const;
virtual void update(LyXRC const & rc);
@ -155,7 +227,7 @@ class PrefScreenFonts : public PrefModule, public Ui::PrefScreenFontsUi
{
Q_OBJECT
public:
PrefScreenFonts(GuiPreferences * form, QWidget * parent = 0);
PrefScreenFonts(GuiPreferences * form);
virtual void apply(LyXRC & rc) const;
virtual void update(LyXRC const & rc);
@ -171,7 +243,7 @@ class PrefColors : public PrefModule, public Ui::PrefColorsUi
{
Q_OBJECT
public:
PrefColors(GuiPreferences * form, QWidget * parent = 0);
PrefColors(GuiPreferences * form);
void apply(LyXRC & rc) const;
void update(LyXRC const & rc);
@ -182,12 +254,8 @@ private Q_SLOTS:
private:
std::vector<ColorCode> lcolors_;
// FIXME the use of mutable here is required due to the
// fact that initialization is not done in the controller
// but in the constructor.
std::vector<QString> curcolors_;
std::vector<QString> newcolors_;
};
@ -195,7 +263,7 @@ class PrefDisplay : public PrefModule, public Ui::PrefDisplayUi
{
Q_OBJECT
public:
PrefDisplay(QWidget * parent = 0);
PrefDisplay(GuiPreferences * form);
void apply(LyXRC & rc) const;
void update(LyXRC const & rc);
@ -206,7 +274,7 @@ class PrefPaths : public PrefModule, public Ui::PrefPathsUi
{
Q_OBJECT
public:
PrefPaths(GuiPreferences * form, QWidget * parent = 0);
PrefPaths(GuiPreferences * form);
void apply(LyXRC & rc) const;
void update(LyXRC const & rc);
@ -226,7 +294,7 @@ class PrefSpellchecker : public PrefModule, public Ui::PrefSpellcheckerUi
{
Q_OBJECT
public:
PrefSpellchecker(GuiPreferences * form, QWidget * parent = 0);
PrefSpellchecker(GuiPreferences * form);
void apply(LyXRC & rc) const;
void update(LyXRC const & rc);
@ -240,7 +308,7 @@ class PrefConverters : public PrefModule, public Ui::PrefConvertersUi
{
Q_OBJECT
public:
PrefConverters(GuiPreferences * form, QWidget * parent = 0);
PrefConverters(GuiPreferences * form);
void apply(LyXRC & rc) const;
void update(LyXRC const & rc);
@ -260,41 +328,11 @@ private:
};
class FormatValidator : public QValidator
{
public:
FormatValidator(QWidget *, Formats const & f);
void fixup(QString & input) const;
QValidator::State validate(QString & input, int & pos) const;
private:
virtual std::string str(Formats::const_iterator it) const = 0;
int nr() const;
Formats const & formats_;
};
class FormatNameValidator : public FormatValidator
{
public:
FormatNameValidator(QWidget *, Formats const & f);
private:
std::string str(Formats::const_iterator it) const;
};
class FormatPrettynameValidator : public FormatValidator
{
public:
FormatPrettynameValidator(QWidget *, Formats const & f);
private:
std::string str(Formats::const_iterator it) const;
};
class PrefFileformats : public PrefModule, public Ui::PrefFileformatsUi
{
Q_OBJECT
public:
PrefFileformats(GuiPreferences * form, QWidget * parent = 0);
PrefFileformats(GuiPreferences * form);
void apply(LyXRC & rc) const;
void update(LyXRC const & rc);
@ -327,7 +365,7 @@ class PrefLanguage : public PrefModule, public Ui::PrefLanguageUi
{
Q_OBJECT
public:
PrefLanguage(QWidget * parent = 0);
PrefLanguage(GuiPreferences * form);
void apply(LyXRC & rc) const;
void update(LyXRC const & rc);
@ -338,7 +376,7 @@ class PrefPrinter : public PrefModule, public Ui::PrefPrinterUi
{
Q_OBJECT
public:
PrefPrinter(QWidget * parent = 0);
PrefPrinter(GuiPreferences * form);
void apply(LyXRC & rc) const;
void update(LyXRC const & rc);
@ -349,7 +387,7 @@ class PrefUserInterface : public PrefModule, public Ui::PrefUi
{
Q_OBJECT
public:
PrefUserInterface(GuiPreferences * form, QWidget * parent = 0);
PrefUserInterface(GuiPreferences * form);
void apply(LyXRC & rc) const;
void update(LyXRC const & rc);
@ -363,7 +401,7 @@ class PrefEdit : public PrefModule, public Ui::PrefEditUi
{
Q_OBJECT
public:
PrefEdit(GuiPreferences * form, QWidget * parent = 0);
PrefEdit(GuiPreferences * form);
void apply(LyXRC & rc) const;
void update(LyXRC const & rc);
@ -382,7 +420,7 @@ class PrefShortcuts : public PrefModule, public Ui::PrefShortcuts
{
Q_OBJECT
private:
enum item_type {
enum ItemType {
System, //< loaded from a bind file
UserBind, //< \bind loaded from user.bind
UserUnbind, //< \unbind loaded from user.bind, with corresponding
@ -391,16 +429,16 @@ private:
//< corresponding entry in system bind file.
};
public:
PrefShortcuts(GuiPreferences * form, QWidget * parent = 0);
PrefShortcuts(GuiPreferences * form);
void apply(LyXRC & rc) const;
void update(LyXRC const & rc);
void updateShortcutsTW();
void modifyShortcut();
///
void setItemType(QTreeWidgetItem * item, item_type tag);
void setItemType(QTreeWidgetItem * item, ItemType tag);
QTreeWidgetItem * insertShortcutItem(FuncRequest const & lfun,
KeySequence const & shortcut, item_type tag);
KeySequence const & shortcut, ItemType tag);
public Q_SLOTS:
void select_bind();
@ -442,87 +480,13 @@ class PrefIdentity : public PrefModule, public Ui::PrefIdentityUi
{
Q_OBJECT
public:
PrefIdentity(QWidget * parent = 0);
PrefIdentity(GuiPreferences * form);
void apply(LyXRC & rc) const;
void update(LyXRC const & rc);
};
class GuiPreferences : public GuiDialog, public Ui::PrefsUi
{
Q_OBJECT
public:
GuiPreferences(GuiView & lv);
void apply(LyXRC & rc) const;
void updateRc(LyXRC const & rc);
public Q_SLOTS:
void change_adaptor();
public:
///
void add(PrefModule * module);
/// Apply changes
void applyView();
/// update (do we need this?)
void updateContents();
std::vector<PrefModule *> modules_;
///
bool initialiseParams(std::string const &);
///
void clearParams() {}
///
void dispatchParams();
///
bool isBufferDependent() const { return false; }
/// various file pickers
QString browsebind(QString const & file) const;
QString browseUI(QString const & file) const;
QString browsekbmap(QString const & file) const;
QString browsedict(QString const & file) const;
/// general browse
QString browse(QString const & file, QString const & title) const;
/// set a color
void setColor(ColorCode col, std::string const & hex);
/// update the screen fonts after change
void updateScreenFonts();
/// adjust the prefs paper sizes
PAPER_SIZE toPaperSize(int i) const;
/// adjust the prefs paper sizes
int fromPaperSize(PAPER_SIZE papersize) const;
LyXRC & rc() { return rc_; }
Converters & converters() { return converters_; }
Formats & formats() { return formats_; }
Movers & movers() { return movers_; }
private:
/// temporary lyxrc
LyXRC rc_;
/// temporary converters
Converters converters_;
/// temporary formats
Formats formats_;
/// temporary movers
Movers movers_;
/// A list of colors to be dispatched
std::vector<std::string> colors_;
bool redraw_gui_;
bool update_screen_font_;
};
} // namespace frontend
} // namespace lyx