]> git.lyx.org Git - features.git/commitdiff
some small updates
authorJohn Levon <levon@movementarian.org>
Thu, 23 Aug 2001 21:21:50 +0000 (21:21 +0000)
committerJohn Levon <levon@movementarian.org>
Thu, 23 Aug 2001 21:21:50 +0000 (21:21 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2578 a592a061-630c-0410-9148-cb99ea01b6c8

19 files changed:
src/frontends/qt2/ChangeLog
src/frontends/qt2/Dialogs.C
src/frontends/qt2/Makefile.am
src/frontends/qt2/QAbout.C
src/frontends/qt2/QCitation.C
src/frontends/qt2/QCitationDialog.C
src/frontends/qt2/QDocument.h
src/frontends/qt2/QIndex.C
src/frontends/qt2/QIndex.h
src/frontends/qt2/QIndexDialog.C
src/frontends/qt2/QIndexDialog.h
src/frontends/qt2/Qt2BC.C [new file with mode: 0644]
src/frontends/qt2/Qt2BC.h [new file with mode: 0644]
src/frontends/qt2/Qt2Base.C
src/frontends/qt2/Qt2Base.h
src/frontends/qt2/README
src/frontends/qt2/qt2BC.C [deleted file]
src/frontends/qt2/qt2BC.h [deleted file]
src/frontends/qt2/ui/QIndexDialog.ui

index fd9b2d087bc5e36a6b32bdd8d8ac94dd403fec88..6b8f750e4c48d9b0a8b3e0e38bfe29e2888f303f 100644 (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
index 9b4e8e3058f477a4550071c026f5e53ed87b85fd..9043dfd44e22f9a3297687a8a27b31798ac18a0b 100644 (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.
index afbd48adde6caac8ca45ed107d0a8b659de49119..3bf86c4bc55bd5f2b081b8124bf92ef627ccf01d 100644 (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
index c2de642c35e841f985d819c0c21c96a3e173fd29..f78f63f809c1e92aef7d760c96b1019a27176480 100644 (file)
@@ -20,7 +20,7 @@
 #include "QtLyXView.h"
  
 #include "ButtonControllerBase.h"
-#include "qt2BC.h"
+#include "Qt2BC.h"
 #include "ControlAboutlyx.h"
 #include "QAbout.h"
 
index d4072e20fbd6027f306e798a3d36e2a5ac8c4e66..6be562f62150ae4e950c153272e1cb6f0c46a73a 100644 (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"
index 70e6e8254e29054d37e0e88d7af1aa74fc992451..aeaaae23c4ec8685676896df8c98da9689750bc6 100644 (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()));
 }
 
  
index 5f390bd1466835600fa6ab6cea6ccf49bfcc8176..858aec385e0c0adbb30783df478c35843368e83e 100644 (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_;
 }
index a59c75ddceaecdffbea70375097420b45fa1ae66..fc27d181a0d85e9590685427d2974fbb7e0303ae 100644 (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());
 }
index f0f71d2871b2207e3889dcd833fb840c0cebccdf..a65bebb1ac43aec9b855e3127bc2e77d01077023 100644 (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
index 287151e3231018c299364ebb8191fc3d73b7ff3b..636cec703dd643b23ddd343631887dd7b079afd1 100644 (file)
@@ -36,6 +36,12 @@ void QIndexDialog::close_adaptor()
 }
 
 
+void QIndexDialog::change_adaptor()
+{
+       form_->changed();
+}
+
 void QIndexDialog::closeEvent(QCloseEvent *e)
 {
        form_->slotWMHide();
index 302e4acf2be24e3f77d50e854e1a139c0f443fc9..c81c97ec97a9b2ec4fca131c0eca55e7f7b6fb36 100644 (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_;
diff --git a/src/frontends/qt2/Qt2BC.C b/src/frontends/qt2/Qt2BC.C
new file mode 100644 (file)
index 0000000..74b6ec8
--- /dev/null
@@ -0,0 +1,43 @@
+/**
+ * \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());
+}
diff --git a/src/frontends/qt2/Qt2BC.h b/src/frontends/qt2/Qt2BC.h
new file mode 100644 (file)
index 0000000..91709c7
--- /dev/null
@@ -0,0 +1,47 @@
+// -*- 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
index 29b0c4975bd05e950843d49db6123ae53ece0ee3..8d45b53462ad3186a4b6bff143e19be94f098053 100644 (file)
 #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();
 }
 
 
index cf697c0bdc8633944926df06350bfcfb8065f82d..8ee56422db6bd9647ed93b2303567fba6ddf0bf1 100644 (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();
index 15716ea6670552ca36b1c0e5022931c0f4644b30..5ae2da9d77c34b9b8d788b018c0564ecbe4266a2 100644 (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
-
-
diff --git a/src/frontends/qt2/qt2BC.C b/src/frontends/qt2/qt2BC.C
deleted file mode 100644 (file)
index 4e44a77..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * \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());
-}
diff --git a/src/frontends/qt2/qt2BC.h b/src/frontends/qt2/qt2BC.h
deleted file mode 100644 (file)
index 31ea658..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-// -*- 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
index 4617a069bda2e3ccd821507f31c44b8922710169..bbdce920ea4997d6af1d6cb42d668994582ab0e3 100644 (file)
@@ -11,7 +11,7 @@
         <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&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>