+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
#include "Dialogs.h"
#include "BufferView.h"
#include "buffer.h"
-#include "qt2BC.h"
+#include "Qt2BC.h"
// xforms implementations
#include "../xforms/FormError.h"
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.
FileDialog_private.C \
Qt2Base.C \
Qt2Base.h \
+ Qt2BC.C \
+ Qt2BC.h \
emptytable.C \
- emptytable.h \
- qt2BC.C \
- qt2BC.h
+ emptytable.h
#include "QtLyXView.h"
#include "ButtonControllerBase.h"
-#include "qt2BC.h"
+#include "Qt2BC.h"
#include "ControlAboutlyx.h"
#include "QAbout.h"
#include <qpushbutton.h>
#include "QtLyXView.h"
-#include "qt2BC.h"
+#include "Qt2BC.h"
#include "ControlCitation.h"
#include "gettext.h"
#include "support/lstrings.h"
#include "QCitationDialog.h"
#include "Dialogs.h"
#include "QCitation.h"
-#include "qt2BC.h"
#include "controllers/ControlCitation.h"
#include <qcheckbox.h>
form, SLOT(slotRestore()));
connect(applyPB, SIGNAL(clicked()),
form, SLOT(slotApply()));
+ connect(searchED, SIGNAL(returnPressed()),
+ form, SLOT(slotNextClicked()));
}
#include <boost/smart_ptr.hpp>
#include "Qt2Base.h"
-#include "qt2BC.h"
+#include "Qt2BC.h"
#include "QtLyXView.h"
#ifdef __GNUG_
BULLETBMTABLE
};
/// Pointer to the actual instantiation of the ButtonController.
- virtual qt2BC & bc();
+ virtual Qt2BC & bc();
/// Build the dialog
virtual void build();
// /// Filter the inputs
// ///
// 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_;
}
#include "BufferView.h"
#include "Dialogs.h"
-#include "qt2BC.h"
+#include "Qt2BC.h"
#include "QIndex.h"
#include "gettext.h"
#include "buffer.h"
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());
}
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
}
+void QIndexDialog::change_adaptor()
+{
+ form_->changed();
+}
+
+
void QIndexDialog::closeEvent(QCloseEvent *e)
{
form_->slotWMHide();
~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_;
--- /dev/null
+/**
+ * \file Qt2BC.C
+ * Copyright 2001 the LyX Team
+ * Read the file COPYING
+ *
+ * \author Allan Rae <rae@lyx.org>
+ * \author Angus Leeming <a.leeming@ic.ac.uk>
+ */
+
+#include <config.h>
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "Qt2BC.h"
+
+#include <qbutton.h>
+
+Qt2BC::Qt2BC(string const & cancel, string const & close)
+ : GuiBC<QButton, QWidget>(cancel, close)
+{}
+
+
+void Qt2BC::setButtonEnabled(QButton * obj, bool enabled)
+{
+ obj->setEnabled(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)
+{
+ obj->setText(label.c_str());
+}
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file Qt2BC.h
+ * Copyright 2001 the LyX Team
+ * Read the file COPYING
+ *
+ * \author Allan Rae, rae@lyx.org
+ * \author Angus Leeming, a.leeming@ic.ac.uk
+ * \author Baruch Even, baruch.even@writeme.com
+ */
+
+#ifndef QT2BC_H
+#define QT2BC_H
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "ButtonController.h"
+
+class QWidget;
+class QButton;
+
+/** General purpose button controller for up to four buttons.
+ Controls the activation of the OK, Apply and Cancel buttons.
+ Actually supports 4 buttons in all and it's up to the user to decide on
+ the activation policy and which buttons correspond to which output of the
+ state machine.
+*/
+class Qt2BC : public GuiBC<QButton, QWidget>
+{
+public:
+ ///
+ Qt2BC(string const &, string const &);
+
+private:
+ /// Updates the button sensitivity (enabled/disabled)
+ void setButtonEnabled(QButton *, bool enabled);
+
+ /// Updates the widget sensitivity (enabled/disabled)
+ void setWidgetEnabled(QWidget *, bool enabled);
+
+ /// Set the label on the button
+ void setButtonLabel(QButton *, string const & label);
+};
+
+#endif // QT2BC_H
#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)
{}
}
+bool Qt2Base::isValid()
+{
+ return true;
+}
+
+
void Qt2Base::changed()
{
- bc().valid();
+ if (isValid())
+ bc().valid();
+ else
+ bc().invalid();
}
#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:
/// the dialog has changed contents
virtual void changed();
+ /// is the dialog currently valid ?
+ virtual bool isValid();
+
protected slots:
// dialog closed from WM
void slotWMHide();
CB - check box
CO -
-ED -
+ED - line edit
+LA - label
ML -
PB - push button
(FIXME: complete this)
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
TabularCreate Edwin
Toc Kalle
Url Kalle
-VCLog
-
-
+++ /dev/null
-/**
- * \file qt2BC.C
- * Copyright 2001 the LyX Team
- * Read the file COPYING
- *
- * \author Allan Rae <rae@lyx.org>
- * \author Angus Leeming <a.leeming@ic.ac.uk>
- */
-
-#include <config.h>
-
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
-#include "qt2BC.h"
-
-#include <qbutton.h>
-
-qt2BC::qt2BC(string const & cancel, string const & close)
- : GuiBC<QButton, QWidget>(cancel, close)
-{}
-
-
-void qt2BC::setButtonEnabled(QButton * obj, bool enabled)
-{
- obj->setEnabled(enabled);
-}
-
-
-void qt2BC::setWidgetEnabled(QWidget * obj, bool enabled)
-{
- obj->setEnabled(enabled);
-}
-
-
-void qt2BC::setButtonLabel(QButton * obj, string const & label)
-{
- obj->setText(label.c_str());
-}
+++ /dev/null
-// -*- C++ -*-
-/**
- * \file qt2BC.h
- * Copyright 2001 the LyX Team
- * Read the file COPYING
- *
- * \author Allan Rae, rae@lyx.org
- * \author Angus Leeming, a.leeming@ic.ac.uk
- * \author Baruch Even, baruch.even@writeme.com
- */
-
-#ifndef QT2BC_H
-#define QT2BC_H
-
-#ifdef __GNUG__
-#pragma interface
-#endif
-
-#include "ButtonController.h"
-
-class QWidget;
-class QButton;
-
-/** General purpose button controller for up to four buttons.
- Controls the activation of the OK, Apply and Cancel buttons.
- Actually supports 4 buttons in all and it's up to the user to decide on
- the activation policy and which buttons correspond to which output of the
- state machine.
-*/
-class qt2BC : public GuiBC<QButton, QWidget>
-{
-public:
- ///
- qt2BC(string const &, string const &);
-
-private:
- /// Updates the button sensitivity (enabled/disabled)
- void setButtonEnabled(QButton *, bool enabled);
-
- /// Updates the widget sensitivity (enabled/disabled)
- void setWidgetEnabled(QWidget *, bool enabled);
-
- /// Set the label on the button
- void setButtonLabel(QButton *, string const & label);
-};
-
-#endif // QT2BC_H
<rect>
<x>0</x>
<y>0</y>
- <width>212</width>
+ <width>208</width>
<height>82</height>
</rect>
</property>
<receiver>QIndexDialogBase</receiver>
<slot>close_adaptor()</slot>
</connection>
- <slot access="public">ok_adaptor()</slot>
+ <connection>
+ <sender>keywordED</sender>
+ <signal>textChanged(const QString&)</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>