some small updates

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2578 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2001-08-23 21:21:50 +00:00
parent 1aaf551af0
commit 6dac02d3bb
17 changed files with 90 additions and 72 deletions

View File

@ -1,3 +1,25 @@
2001-08-23 John Levon <moz@compsoc.man.ac.uk>
* Dialogs.C:
* Makefile.am:
* Qt2BC.h:
* Qt2BC.C:
* QAbout.C:
* QCitation.C:
* QDocument.h:
* Qt2Base.C:
* Qt2Base.h: rename qt2BC -> Qt2BC, set focus for widget enable
* QIndex.h:
* QIndex.C:
* ui/QIndexDialog.ui: use the BC properly
* Qt2Base.h:
* Qt2Base.C: add a virtual isValid(), and predicate what changed()
tells the BC on the return value
* README: update
2001-08-21 John Levon <moz@compsoc.man.ac.uk>
* Dialogs.C: add QIndex

View File

@ -30,7 +30,7 @@
#include "Dialogs.h"
#include "BufferView.h"
#include "buffer.h"
#include "qt2BC.h"
#include "Qt2BC.h"
// xforms implementations
#include "../xforms/FormError.h"
@ -84,9 +84,9 @@ Dialogs::Dialogs(LyXView * lv)
splash_.reset(new QSplash(lv, this));
// dialogs that have been converted to new scheme
add(new GUICitation<QCitation, qt2BC>(*lv, *this));
add(new GUIAboutlyx<QAbout, qt2BC>(*lv, *this));
add(new GUIIndex<QIndex, qt2BC>(*lv, *this));
add(new GUICitation<QCitation, Qt2BC>(*lv, *this));
add(new GUIAboutlyx<QAbout, Qt2BC>(*lv, *this));
add(new GUIIndex<QIndex, Qt2BC>(*lv, *this));
// reduce the number of connections needed in
// dialogs by a simple connection here.

View File

@ -82,7 +82,7 @@ libqt2_la_SOURCES = \
FileDialog_private.C \
Qt2Base.C \
Qt2Base.h \
Qt2BC.C \
Qt2BC.h \
emptytable.C \
emptytable.h \
qt2BC.C \
qt2BC.h
emptytable.h

View File

@ -20,7 +20,7 @@
#include "QtLyXView.h"
#include "ButtonControllerBase.h"
#include "qt2BC.h"
#include "Qt2BC.h"
#include "ControlAboutlyx.h"
#include "QAbout.h"

View File

@ -24,7 +24,7 @@
#include <qpushbutton.h>
#include "QtLyXView.h"
#include "qt2BC.h"
#include "Qt2BC.h"
#include "ControlCitation.h"
#include "gettext.h"
#include "support/lstrings.h"

View File

@ -11,7 +11,6 @@
#include "QCitationDialog.h"
#include "Dialogs.h"
#include "QCitation.h"
#include "qt2BC.h"
#include "controllers/ControlCitation.h"
#include <qcheckbox.h>
@ -41,6 +40,8 @@ QCitationDialog::QCitationDialog(QCitation * form, QWidget * parent, const char
form, SLOT(slotRestore()));
connect(applyPB, SIGNAL(clicked()),
form, SLOT(slotApply()));
connect(searchED, SIGNAL(returnPressed()),
form, SLOT(slotNextClicked()));
}

View File

@ -15,7 +15,7 @@
#include <boost/smart_ptr.hpp>
#include "Qt2Base.h"
#include "qt2BC.h"
#include "Qt2BC.h"
#include "QtLyXView.h"
#ifdef __GNUG_
@ -69,7 +69,7 @@ private:
BULLETBMTABLE
};
/// Pointer to the actual instantiation of the ButtonController.
virtual qt2BC & bc();
virtual Qt2BC & bc();
/// Build the dialog
virtual void build();
// /// Filter the inputs
@ -158,12 +158,12 @@ private:
// ///
// boost::scoped_ptr<Combox> combo_doc_class;
/// The ButtonController
ButtonController<NoRepeatedApplyReadOnlyPolicy, qt2BC> bc_;
ButtonController<NoRepeatedApplyReadOnlyPolicy, Qt2BC> bc_;
};
inline
qt2BC & QDocument::bc()
Qt2BC & QDocument::bc()
{
return bc_;
}

View File

@ -13,7 +13,7 @@
#include "BufferView.h"
#include "Dialogs.h"
#include "qt2BC.h"
#include "Qt2BC.h"
#include "QIndex.h"
#include "gettext.h"
#include "buffer.h"
@ -48,24 +48,10 @@ void QIndex::build()
void QIndex::update()
{
dialog_->keywordED->setText(controller().params().getContents().c_str());
if (readonly) {
dialog_->keywordED->setFocusPolicy(QWidget::NoFocus);
dialog_->okPB->setEnabled(false);
dialog_->cancelPB->setText(_("Close"));
} else {
dialog_->keywordED->setFocusPolicy(QWidget::StrongFocus);
dialog_->keywordED->setFocus();
dialog_->okPB->setEnabled(true);
dialog_->cancelPB->setText(_("Cancel"));
}
}
void QIndex::apply()
{
if (readonly)
return;
controller().params().setContents(dialog_->keywordED->text().latin1());
}

View File

@ -40,9 +40,6 @@ private:
void createIndex(string const &);
/// edit an Index inset
void showIndex(InsetCommand * const);
/// is the inset we are reading from a readonly buffer ?
bool readonly;
};
#endif // QINDEX_H

View File

@ -36,6 +36,12 @@ void QIndexDialog::close_adaptor()
}
void QIndexDialog::change_adaptor()
{
form_->changed();
}
void QIndexDialog::closeEvent(QCloseEvent *e)
{
form_->slotWMHide();

View File

@ -23,11 +23,12 @@ public:
~QIndexDialog();
public slots:
void ok_adaptor();
void close_adaptor();
virtual void ok_adaptor();
virtual void close_adaptor();
virtual void change_adaptor();
protected:
void closeEvent(QCloseEvent * e);
virtual void closeEvent(QCloseEvent * e);
private:
QIndex * form_;

View File

@ -1,5 +1,5 @@
/**
* \file qt2BC.C
* \file Qt2BC.C
* Copyright 2001 the LyX Team
* Read the file COPYING
*
@ -13,28 +13,31 @@
#pragma implementation
#endif
#include "qt2BC.h"
#include "Qt2BC.h"
#include <qbutton.h>
qt2BC::qt2BC(string const & cancel, string const & close)
Qt2BC::Qt2BC(string const & cancel, string const & close)
: GuiBC<QButton, QWidget>(cancel, close)
{}
void qt2BC::setButtonEnabled(QButton * obj, bool enabled)
void Qt2BC::setButtonEnabled(QButton * obj, bool enabled)
{
obj->setEnabled(enabled);
}
void qt2BC::setWidgetEnabled(QWidget * obj, bool enabled)
void Qt2BC::setWidgetEnabled(QWidget * obj, bool enabled)
{
obj->setEnabled(enabled);
QWidget::FocusPolicy const p =
(enabled) ? QWidget::StrongFocus : QWidget::NoFocus;
obj->setFocusPolicy(p);
}
void qt2BC::setButtonLabel(QButton * obj, string const & label)
void Qt2BC::setButtonLabel(QButton * obj, string const & label)
{
obj->setText(label.c_str());
}

View File

@ -1,6 +1,6 @@
// -*- C++ -*-
/**
* \file qt2BC.h
* \file Qt2BC.h
* Copyright 2001 the LyX Team
* Read the file COPYING
*
@ -27,11 +27,11 @@ class QButton;
the activation policy and which buttons correspond to which output of the
state machine.
*/
class qt2BC : public GuiBC<QButton, QWidget>
class Qt2BC : public GuiBC<QButton, QWidget>
{
public:
///
qt2BC(string const &, string const &);
Qt2BC(string const &, string const &);
private:
/// Updates the button sensitivity (enabled/disabled)

View File

@ -21,14 +21,14 @@
#include "QtLyXView.h"
#include "Dialogs.h"
#include "Qt2Base.h"
#include "qt2BC.h"
#include "Qt2BC.h"
#include "support/LAssert.h"
#include <stdio.h>
Qt2Base::Qt2Base(ControlButtons & c, QString const & t)
: ViewBC<qt2BC>(c), title_(t)
: ViewBC<Qt2BC>(c), title_(t)
{}
@ -58,9 +58,18 @@ void Qt2Base::hide()
}
bool Qt2Base::isValid()
{
return true;
}
void Qt2Base::changed()
{
bc().valid();
if (isValid())
bc().valid();
else
bc().invalid();
}

View File

@ -32,11 +32,11 @@ class QDialog;
#include <boost/smart_ptr.hpp>
class qt2BC;
class Qt2BC;
/** This class is an Qt2 GUI base class.
*/
class Qt2Base : public QObject, public ViewBC<qt2BC>
class Qt2Base : public QObject, public ViewBC<Qt2BC>
{
Q_OBJECT
public:
@ -56,6 +56,9 @@ protected:
/// the dialog has changed contents
virtual void changed();
/// is the dialog currently valid ?
virtual bool isValid();
protected slots:
// dialog closed from WM
void slotWMHide();

View File

@ -18,7 +18,8 @@ widget types :
CB - check box
CO -
ED -
ED - line edit
LA - label
ML -
PB - push button
(FIXME: complete this)
@ -26,26 +27,11 @@ PB - push button
Dialog Maintainer MVC conversion
----------------------------------------------
Bibitem
Bibtex
Character Edwin
Citation Kalle In progress
Command
Connections
Copyright Kalle Done
Credits Kalle In progress
Citation Kalle Done ?
Document Kalle In progress (Not yet prepared)
Error
External
File Edwin
Graphics
Include
Index Kalle
Log
Minipage
Index Kalle Done
Paragraph Edwin Not yet prepared
Preamble
Preferences
Print Edwin
Ref Kalle
Search Edwin
@ -54,6 +40,3 @@ Tabular Not yet prepared
TabularCreate Edwin
Toc Kalle
Url Kalle
VCLog

View File

@ -11,7 +11,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>212</width>
<width>208</width>
<height>82</height>
</rect>
</property>
@ -154,7 +154,14 @@
<receiver>QIndexDialogBase</receiver>
<slot>close_adaptor()</slot>
</connection>
<slot access="public">ok_adaptor()</slot>
<connection>
<sender>keywordED</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>QIndexDialogBase</receiver>
<slot>change_adaptor()</slot>
</connection>
<slot access="public">close_adaptor()</slot>
<slot access="public">change_adaptor()</slot>
<slot access="public">ok_adaptor()</slot>
</connections>
</UI>