Add skeleton prefs controller and dialog to allow further work

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5622 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2002-11-13 02:22:48 +00:00
parent 6c81bd2680
commit 513bdcc5e5
14 changed files with 344 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2002-11-13 John Levon <levon@movementarian.org>
* Makefile.am:
* ControlPrefs.h:
* ControlPrefs.C: add skeleton controller
2002-11-12 John Levon <levon@movementarian.org>
* biblio.C: fix warnings

View File

@ -0,0 +1,38 @@
/**
* \file ControlPrefs.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
*
* Full author contact details are available in file CREDITS
*/
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "ControlPrefs.h"
//#include "frontends/Dialogs.h"
#include "commandtags.h"
#include "frontends/LyXView.h"
ControlPrefs::ControlPrefs(LyXView & lv, Dialogs & d)
: ControlDialogBI(lv, d)
{}
void ControlPrefs::apply()
{
lyxrc = rc_;
}
void ControlPrefs::save()
{
lyxrc = rc_;
lv_.dispatch(FuncRequest(LFUN_SAVEPREFERENCES));
}

View File

@ -0,0 +1,48 @@
// -*- C++ -*-
/**
* \file ControlPrefs.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
*
* Full author contact details are available in file CREDITS
*/
#ifndef CONTROLPREFS_H
#define CONTROLPREFS_H
#ifdef __GNUG__
#pragma interface
#endif
#include "ControlDialog_impl.h"
#include "LString.h"
#include "funcrequest.h"
#include "lyxrc.h"
class ControlPrefs : public ControlDialogBI {
public:
ControlPrefs(LyXView &, Dialogs &);
// FIXME: we should probably devolve the individual
// settings to methods here. But for now, this will
// do
LyXRC & rc() { return rc_; }
LyXRC const & rc() const { return rc_; }
/// save the rc
void save();
private:
/// apply current lyxrc
virtual void apply();
/// temporary lyxrc
LyXRC rc_;
};
#endif // CONTROLPREFS_H

View File

@ -71,6 +71,8 @@ libcontrollers_la_SOURCES= \
ControlParagraph.h \
ControlPreamble.C \
ControlPreamble.h \
ControlPrefs.C \
ControlPrefs.h \
ControlPrint.C \
ControlPrint.h \
ControlRef.C \

View File

@ -1,3 +1,14 @@
2002-11-13 John Levon <levon@movementarian.org>
* Dialogs.C:
* Dialogs2.C:
* Dialog_impl.h:
* Makefile.dialogs:
* QPrefs.h:
* QPrefs.C:
* QPrefsDialog.h:
* QPrefsDialog.C: add skeleton dialog
2002-11-13 John Levon <levon@movementarian.org>
* ui/QBibtexDialog.ui: add some change_adaptors()

View File

@ -62,6 +62,7 @@ Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
minipage(lv, d),
paragraph(lv, d),
preamble(lv, d),
prefs(lv, d),
print(lv, d),
ref(lv, d),
search(lv, d),

View File

@ -172,11 +172,14 @@ void Dialogs::updateParagraph()
void Dialogs::showPreamble()
{
// FIXME
}
void Dialogs::showPreferences()
{}
{
pimpl_->prefs.controller().show();
}
void Dialogs::showPrint()

View File

@ -37,6 +37,7 @@
#include "ControlMinipage.h"
#include "ControlParagraph.h"
#include "ControlPreamble.h"
#include "ControlPrefs.h"
#include "ControlPrint.h"
#include "ControlRef.h"
#include "ControlSearch.h"
@ -89,7 +90,8 @@
#include "QParagraphDialog.h"
#include "QPreamble.h"
#include "QPreambleDialog.h"
//#include "QPreferences.h"
#include "QPrefs.h"
#include "QPrefsDialog.h"
#include "QPrint.h"
#include "QLPrintDialog.h"
#include "QRef.h"
@ -181,6 +183,9 @@ ParagraphDialog;
typedef GUI<ControlPreamble, QPreamble, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
PreambleDialog;
typedef GUI<ControlPrefs, QPrefs, OkApplyCancelPolicy, Qt2BC>
PrefsDialog;
typedef GUI<ControlPrint, QPrint, OkApplyCancelPolicy, Qt2BC>
PrintDialog;
@ -241,6 +246,7 @@ struct Dialogs::Impl {
MinipageDialog minipage;
ParagraphDialog paragraph;
PreambleDialog preamble;
PrefsDialog prefs;
PrintDialog print;
RefDialog ref;
SearchDialog search;

View File

@ -20,8 +20,8 @@ libqt2_la_SOURCES = \
Alert_pimpl.C \
qgridview.h \
qgridview.cpp \
bulletstrings.h \
bulletstrings.C \
bulletstrings.h \
bulletstrings.C \
BulletsModule.C \
BulletsModule.h \
QBrowseBox.C \

View File

@ -20,6 +20,7 @@ DIALOGS = \
QMinipage \
QParagraph \
QPreamble \
QPrefs \
QPrint \
QRef \
QSearch \
@ -73,6 +74,8 @@ DIALOGSOURCES = \
QParagraph.C QParagraphDialog.C \
QPreamble.h QPreambleDialog.h \
QPreamble.C QPreambleDialog.C \
QPrefs.h QPrefsDialog.h \
QPrefs.C QPrefsDialog.C \
QPrint.h QLPrintDialog.h \
QPrint.C QLPrintDialog.C \
QRef.h QRefDialog.h \
@ -121,6 +124,7 @@ MOCDIALOGS = \
QMinipageDialog_moc.C \
QParagraphDialog_moc.C \
QPreambleDialog_moc.C \
QPrefsDialog_moc.C \
QLPrintDialog_moc.C \
QRefDialog_moc.C \
QSearchDialog_moc.C \
@ -178,6 +182,8 @@ UIDIALOGS = \
QParagraphDialogBase.C \
QPreambleDialogBase.h \
QPreambleDialogBase.C \
QPrefsDialogBase.h \
QPrefsDialogBase.C \
QPrintDialogBase.h \
QPrintDialogBase.C \
QRefDialogBase.h \
@ -236,6 +242,7 @@ UIMOCDIALOGS = \
QMinipageDialogBase_moc.C \
QParagraphDialogBase_moc.C \
QPreambleDialogBase_moc.C \
QPrefsDialogBase_moc.C \
QPrintDialogBase_moc.C \
QRefDialogBase_moc.C \
QSearchDialogBase_moc.C \

View File

@ -0,0 +1,59 @@
/**
* \file QPrefs.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
*
* Full author contact details are available in file CREDITS
*/
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "ControlPrefs.h"
#include "QPrefsDialog.h"
#include "QPrefs.h"
#include "Qt2BC.h"
#include "lyxrc.h"
#include <qpushbutton.h>
typedef Qt2CB<ControlPrefs, Qt2DB<QPrefsDialog> > base_class;
QPrefs::QPrefs()
: base_class(_("LyX: Preferences"))
{
}
void QPrefs::build_dialog()
{
dialog_.reset(new QPrefsDialog(this));
// FIXME: wrong
bc().setOK(dialog_->savePB);
bc().setApply(dialog_->applyPB);
bc().setCancel(dialog_->closePB);
bc().setRestore(dialog_->restorePB);
}
void QPrefs::apply()
{
LyXRC & rc(controller().rc());
// do something ...
}
void QPrefs::update_contents()
{
LyXRC const & rc(controller().rc());
// do something ...
}

View File

@ -0,0 +1,44 @@
// -*- C++ -*-
/**
* \file QPrefs.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
*
* Full author contact details are available in file CREDITS
*/
#ifndef QPREFS_H
#define QPREFS_H
#ifdef __GNUG__
#pragma interface
#endif
#include "Qt2Base.h"
#include "ControlPrefs.h"
class QPrefsDialog;
class QPrefs
: public Qt2CB<ControlPrefs, Qt2DB<QPrefsDialog> >
{
public:
friend class QPrefsDialog;
QPrefs();
private:
/// Apply changes
virtual void apply();
/// update (do we need this?)
virtual void update_contents();
/// build the dialog
virtual void build_dialog();
};
#endif // QPREFS_H

View File

@ -0,0 +1,76 @@
/**
* \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>
#include "gettext.h"
#include "ControlPrefs.h"
#include "QPrefs.h"
#ifdef __GNUG__
#pragma implementation
#endif
#include "QPrefsDialog.h"
#include "ui/ClassModuleBase.h"
#include "ui/PackagesModuleBase.h"
#include "ui/PaperModuleBase.h"
#include "ui/LanguageModuleBase.h"
#include "ui/BulletsModuleBase.h"
#include "BulletsModule.h"
#include "ui/BiblioModuleBase.h"
#include "ui/NumberingModuleBase.h"
#include "ui/MarginsModuleBase.h"
#include "ui/PreambleModuleBase.h"
#include "Spacing.h"
#include "support/lstrings.h"
#include "lyxrc.h"
#include "buffer.h"
#include <qwidgetstack.h>
#include <qlistbox.h>
#include <qlabel.h>
#include <qmultilineedit.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qcombobox.h>
#include <qradiobutton.h>
#include <qcheckbox.h>
#include <qspinbox.h>
#include "lengthcombo.h"
QPrefsDialog::QPrefsDialog(QPrefs * form)
: QPrefsDialogBase(0, 0, false, 0), form_(form)
{
// FIXME: wrong
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()));
}
QPrefsDialog::~QPrefsDialog()
{
}
void QPrefsDialog::closeEvent(QCloseEvent * e)
{
form_->slotWMHide();
e->accept();
}

View File

@ -0,0 +1,39 @@
// -*- C++ -*-
/**
* \file QPrefsDialog.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
*
* Full author contact details are available in file CREDITS
*/
#ifndef QPREFSDIALOG_H
#define QPREFSDIALOG_H
#ifdef __GNUG__
#pragma interface
#endif
#include "ui/QPrefsDialogBase.h"
class QPrefs;
class QPrefsDialog : public QPrefsDialogBase {
Q_OBJECT
public:
friend class QPrefs;
QPrefsDialog(QPrefs *);
~QPrefsDialog();
protected:
void closeEvent(QCloseEvent * e);
private:
QPrefs * form_;
};
#endif // PREFSDIALOG_H