]> git.lyx.org Git - features.git/commitdiff
Qt2 compiles again
authorKalle Dalheimer <kalle@kdab.net>
Sat, 31 Mar 2001 08:39:24 +0000 (08:39 +0000)
committerKalle Dalheimer <kalle@kdab.net>
Sat, 31 Mar 2001 08:39:24 +0000 (08:39 +0000)
Percolated fixes to citation search from XForms to Qt2

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1865 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt2/.cvsignore
src/frontends/qt2/ChangeLog
src/frontends/qt2/FormCitation.C
src/frontends/qt2/FormCitationDialog.ui
src/frontends/qt2/FormCitationDialogImpl.C
src/frontends/qt2/FormCitationDialogImpl.h
src/frontends/qt2/FormCopyright.C
src/frontends/qt2/Qt2Base.C
src/frontends/qt2/Qt2Base.h
src/frontends/qt2/qt2BC.C
src/frontends/qt2/qt2BC.h

index 6904cd62bd1bb267346b6eb199caa3f6a9f5611d..638ccd4ddcd022c5fa1b81cf9eadd412e1b1baa3 100644 (file)
@@ -6,8 +6,6 @@ Makefile
 libqt2.la
 moc_*.C
 *_moc.C
-FormDocumentDialogBase.h
-FormDocumentDialogBase.C
 FormCitationDialog.h
 FormCitationDialog.C
 FormCopyrightDialog.C
index 5adbb8fd016783c1fcbca8bcb2146088715d7930..007229a6358db116a8a0bd291852f17c15e7d8a8 100644 (file)
@@ -1,3 +1,9 @@
+2001-03-31  Kalle Dalheimer  <kalle@klaralvdalens-datakonsult.se>
+
+       * FormCitationDialogImpl.C (doPreviousNext): Propagated search
+       fixes from XForms
+       * several files: MVC for citation dialog
+
 2001-03-30  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * Qt2Base.[Ch]: changed ControlBase to ControlButton.
index 99431eccf7664b08834db986f65793249b0dd821..53adc6a43b054759a4269139c4317537818c24f1 100644 (file)
@@ -20,6 +20,7 @@
 #include "FormCitationDialogImpl.h"
 #include "FormCitation.h"
 
+#include <qcheckbox.h>
 #include <qcombobox.h>
 #include <qlineedit.h>
 #include <qlistbox.h>
@@ -72,8 +73,8 @@ void FormCitation::build()
     // PENDING(kalle) Parent?
     dialog_.reset( new FormCitationDialogImpl( this ));
 
-    dialog_->searchTypePB->setOn( false );
-    dialog_->searchTypePB->setText( _( "Simple" ) );
+    dialog_->searchTypeCB->setChecked( false );
+    dialog_->searchCaseCB->setChecked( false );
     
     // Manage the ok, apply, restore and cancel/close buttons
     bc().setOK(dialog_->okPB);
@@ -125,7 +126,8 @@ void FormCitation::updateBrowser( QListBox* browser,
     for (vector<string>::const_iterator it = keys.begin();
         it < keys.end(); ++it) {
        string key = frontStrip(strip(*it));
-       browser->insertItem( key.c_str() );
+       if( !key.empty() )
+           browser->insertItem( key.c_str() );
     }
 }
 
index 6a45408305d496fcd4e14291848f0597ce102ced..50ca0bfd004d858cf131865d124359c67302f296 100644 (file)
@@ -12,7 +12,7 @@
             <x>0</x>
             <y>0</y>
             <width>369</width>
-            <height>497</height>
+            <height>525</height>
         </rect>
     </property>
     <property stdset="1">
                     <name>spacing</name>
                     <number>6</number>
                 </property>
+                <widget>
+                    <class>QLineEdit</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>searchED</cstring>
+                    </property>
+                </widget>
                 <widget>
                     <class>QLayoutWidget</class>
                     <property stdset="1">
                         <name>name</name>
-                        <cstring>Layout35</cstring>
+                        <cstring>Layout37</cstring>
                     </property>
                     <hbox>
                         <property stdset="1">
                             <number>6</number>
                         </property>
                         <widget>
-                            <class>QLineEdit</class>
+                            <class>QCheckBox</class>
                             <property stdset="1">
                                 <name>name</name>
-                                <cstring>searchED</cstring>
+                                <cstring>searchTypeCB</cstring>
+                            </property>
+                            <property stdset="1">
+                                <name>text</name>
+                                <string>Regular E&amp;xpression</string>
                             </property>
                         </widget>
+                        <spacer>
+                            <property>
+                                <name>name</name>
+                                <cstring>Spacer2_2</cstring>
+                            </property>
+                            <property stdset="1">
+                                <name>orientation</name>
+                                <enum>Horizontal</enum>
+                            </property>
+                            <property stdset="1">
+                                <name>sizeType</name>
+                                <enum>Expanding</enum>
+                            </property>
+                            <property>
+                                <name>sizeHint</name>
+                                <size>
+                                    <width>20</width>
+                                    <height>20</height>
+                                </size>
+                            </property>
+                        </spacer>
                         <widget>
                             <class>QPushButton</class>
                             <property stdset="1">
                     <class>QLayoutWidget</class>
                     <property stdset="1">
                         <name>name</name>
-                        <cstring>Layout36</cstring>
+                        <cstring>Layout38</cstring>
                     </property>
                     <hbox>
                         <property stdset="1">
                             <number>6</number>
                         </property>
                         <widget>
-                            <class>QPushButton</class>
+                            <class>QCheckBox</class>
                             <property stdset="1">
                                 <name>name</name>
-                                <cstring>searchTypePB</cstring>
+                                <cstring>searchCaseCB</cstring>
                             </property>
                             <property stdset="1">
                                 <name>text</name>
-                                <string>Simple</string>
-                            </property>
-                            <property stdset="1">
-                                <name>toggleButton</name>
-                                <bool>true</bool>
-                            </property>
-                            <property stdset="1">
-                                <name>toggleButton</name>
-                                <bool>true</bool>
+                                <string>&amp;Case sensitive</string>
                             </property>
                         </widget>
                         <spacer>
                             <property>
                                 <name>name</name>
-                                <cstring>Spacer2_2</cstring>
+                                <cstring>Spacer3_2</cstring>
                             </property>
                             <property stdset="1">
                                 <name>orientation</name>
         <receiver>FormCitationDialog</receiver>
         <slot>slotRestoreClicked()</slot>
     </connection>
-    <connection>
-        <sender>searchTypePB</sender>
-        <signal>toggled(bool)</signal>
-        <receiver>FormCitationDialog</receiver>
-        <slot>slotSearchTypeSelected(bool)</slot>
-    </connection>
     <connection>
         <sender>previousPB</sender>
         <signal>clicked()</signal>
index 86d9a6d8dfb64c6eccef7a40721487f1733d1d88..07c1692e4289cf6fc830061c0b5859d301ae3876 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * $Id: FormCitationDialogImpl.C,v 1.4 2001/03/29 21:17:17 kalle Exp $
+ * $Id: FormCitationDialogImpl.C,v 1.5 2001/03/31 08:39:24 kalle Exp $
  */
 
 #include "FormCitationDialogImpl.h"
@@ -9,6 +9,7 @@
 #include "controllers/biblio.h"
 #include "controllers/ControlCitation.h"
 
+#include <qcheckbox.h>
 #include <qlineedit.h>
 #include <qlistbox.h>
 #include <qmultilineedit.h>
@@ -56,33 +57,33 @@ FormCitationDialogImpl::~FormCitationDialogImpl()
 void FormCitationDialogImpl::slotBibSelected( int sel )
 {
     biblio::InfoMap const & theMap = form_->controller().bibkeysInfo();
-    
+
     citeLB->clearSelection();
-    
+
     if (sel < 0 || sel >= (int)form_->bibkeys.size()) {
        form_->bc().input( ButtonPolicy::SMI_NOOP );
        return;
     }
-    
+
     // Put into browser_info the additional info associated with
     // the selected browser_bib key
     infoML->clear();
-    
+
     infoML->setText( biblio::getInfo( theMap,
                                      form_->bibkeys[sel-1] ).c_str() );
 
     // Highlight the selected browser_bib key in browser_cite if
     // present
     vector<string>::const_iterator cit =
-       std::find(form_->citekeys.begin(), form_->citekeys.end(), 
+       std::find(form_->citekeys.begin(), form_->citekeys.end(),
                  form_->bibkeys[sel]);
-       
+
     if (cit != form_->citekeys.end()) {
        int const n = int(cit - form_->citekeys.begin());
        citeLB->setSelected( n, true );
        citeLB->setTopItem( n );
     }
-    
+
     if (!form_->controller().isReadonly()) {
        if (cit != form_->citekeys.end()) {
            form_->setBibButtons(FormCitation::OFF);
@@ -105,21 +106,21 @@ void FormCitationDialogImpl::slotCiteSelected( int sel )
        form_->bc().input( ButtonPolicy::SMI_NOOP );
        return;
     }
-       
+
     if (!form_->controller().isReadonly()) {
        form_->setBibButtons(FormCitation::OFF);
        form_->setCiteButtons(FormCitation::ON);
     }
-       
+
     // Highlight the selected browser_cite key in browser_bib
     vector<string>::const_iterator cit =
        std::find(form_->bibkeys.begin(), form_->bibkeys.end(), form_->citekeys[sel]);
-       
+
     if (cit != form_->bibkeys.end()) {
        int const n = int(cit - form_->bibkeys.begin());
        bibLB->setSelected( n, true );
        bibLB->setTopItem( n );
-           
+
        // Put into browser_info the additional info associated
        // with the selected browser_cite key
        infoML->clear();
@@ -137,14 +138,14 @@ void FormCitationDialogImpl::slotAddClicked()
        form_->bc().input( ButtonPolicy::SMI_NOOP );
        return;
     }
-       
+
     // Add the selected browser_bib key to browser_cite
     citeLB->insertItem( form_->bibkeys[sel].c_str() );
     form_->citekeys.push_back( form_->bibkeys[sel] );
 
     int const n = int(form_->citekeys.size());
     citeLB->setSelected( n-1, true );
-       
+
     form_->setBibButtons(FormCitation::OFF);
     form_->setCiteButtons(FormCitation::ON);
 
@@ -159,11 +160,11 @@ void FormCitationDialogImpl::slotDelClicked()
        form_->bc().input( ButtonPolicy::SMI_NOOP );
        return;
     }
-    
+
     // Remove the selected key from browser_cite
     citeLB->removeItem( sel );
     form_->citekeys.erase(form_->citekeys.begin() + sel );
-    
+
     form_->setBibButtons(FormCitation::ON);
     form_->setCiteButtons(FormCitation::OFF);
 
@@ -178,14 +179,14 @@ void FormCitationDialogImpl::slotUpClicked()
        form_->bc().input( ButtonPolicy::SMI_NOOP );
        return;
     }
-    
+
     // Move the selected key up one line
     vector<string>::iterator it = form_->citekeys.begin() + sel;
     string const tmp = *it;
-    
+
     citeLB->removeItem( sel );
     form_->citekeys.erase(it);
-    
+
     citeLB->insertItem( tmp.c_str(), sel-1 );
     citeLB->setSelected( sel-1, true );
     form_->citekeys.insert(it-1, tmp);
@@ -202,91 +203,82 @@ void FormCitationDialogImpl::slotDownClicked()
        form_->bc().input( ButtonPolicy::SMI_NOOP );
        return;
     }
-    
+
     // Move the selected key down one line
     vector<string>::iterator it = form_->citekeys.begin() + sel;
     string const tmp = *it;
-    
+
     citeLB->removeItem( sel );
     form_->citekeys.erase(it);
-    
+
     citeLB->insertItem( tmp.c_str(), sel+1 );
     citeLB->setSelected( sel+1, true );
     form_->citekeys.insert(it+1, tmp);
     form_->setCiteButtons(FormCitation::ON);
-    
-    form_->bc().input( ButtonPolicy::SMI_VALID );
-}
 
-
-void FormCitationDialogImpl::slotSearchTypeToggled( bool toggle )
-{
-    if( toggle )
-       searchTypePB->setText( _( "Regex" ) );
-    else
-       searchTypePB->setText( _( "Simple" ) );
-    
-    form_->bc().input( ButtonPolicy::SMI_NOOP );
+    form_->bc().input( ButtonPolicy::SMI_VALID );
 }
 
 
 void FormCitationDialogImpl::slotPreviousClicked()
 {
     doPreviousNext( false );
-}      
+}
 
 
 void FormCitationDialogImpl::slotNextClicked()
 {
     doPreviousNext( true );
-}      
+}
 
 
 void FormCitationDialogImpl::doPreviousNext( bool next )
 {
     biblio::InfoMap const & theMap = form_->controller().bibkeysInfo();
     string const str = searchED->text().latin1();
-       
+
     biblio::Direction const dir =
        next ?
        biblio::FORWARD : biblio::BACKWARD;
-       
+
     biblio::Search const type =
-       searchTypePB->isOn() ?
+       searchTypeCB->isChecked() ?
        biblio::REGEX : biblio::SIMPLE;
-       
+
     vector<string>::const_iterator start = form_->bibkeys.begin();
     int const sel = bibLB->currentItem();
     if (sel >= 0 && sel <= int(form_->bibkeys.size()-1))
        start += sel;
-       
+
     // Find the NEXT instance...
     if (dir == biblio::FORWARD)
        start += 1;
     else
        start -= 1;
-       
+
+    bool const caseSensitive = searchCaseCB->isChecked();
+    
     vector<string>::const_iterator const cit =
        biblio::searchKeys(theMap, form_->bibkeys, str,
-                          start, type, dir);
-       
+                          start, type, dir, caseSensitive );
+
     if (cit == form_->bibkeys.end()) {
        form_->bc().input( ButtonPolicy::SMI_NOOP );
        return;
     }
-       
+
     int const found = int(cit - form_->bibkeys.begin());
     if (found == sel) {
        form_->bc().input( ButtonPolicy::SMI_NOOP );
        return;
     }
-       
+
     // Update the display
     int const top = max(found-5, 1);
     bibLB->setTopItem( top );
     bibLB->setSelected( found, true );
     slotBibSelected( 0 );
-    
+
     form_->bc().input( ButtonPolicy::SMI_VALID );
 }
 
index a65126e38a4358645a012853f8307815aba64330..e3c3bb89101adb29520edf431592a00f957d8353 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * $Id: FormCitationDialogImpl.h,v 1.2 2001/03/29 21:17:17 kalle Exp $
+ * $Id: FormCitationDialogImpl.h,v 1.3 2001/03/31 08:39:24 kalle Exp $
  */
 
 #ifndef FORMCITATIONDIALOGIMPL_H
@@ -25,7 +25,6 @@ protected slots:
     virtual void slotDownClicked();
     virtual void slotPreviousClicked();
     virtual void slotNextClicked();
-    virtual void slotSearchTypeToggled( bool );
     virtual void slotCitationStyleSelected( int );
     virtual void slotTextBeforeReturn();
     virtual void slotTextAfterReturn();
index 67473e5afa4b4db7a4b90ef0e793a9664e9f5cc3..d90767a7788a79489df1c8c52a4a292805723736 100644 (file)
@@ -22,6 +22,7 @@
 #include <qlabel.h>
 #include <qpushbutton.h>
 #undef emit
+#include "ButtonControllerBase.h"
 #include "qt2BC.h"
 #include "ControlCopyright.h"
 #include "FormCopyright.h"
@@ -40,11 +41,11 @@ void FormCopyright::build()
     dialog_.reset( new FormCopyrightDialogImpl() );
     connect( dialog_.get()->closePB, SIGNAL( clicked() ),
             this, SLOT( slotCancel() ) );
-    
+
     dialog_->copyrightLA->setText( controller().getCopyright().c_str() );
     dialog_->licenseLA->setText( controller().getLicence().c_str() );
     dialog_->disclaimerLA->setText( controller().getDisclaimer().c_str() );
-    
+
     // Manage the cancel/close button
     bc().setCancel(dialog_->closePB);
     bc().refresh();
index b9ef03c270499622b912b7dde536e2a63d062fc2..0e2e63b7b03504ca36cb86fcbfdad6018ca861f3 100644 (file)
@@ -28,7 +28,7 @@
 #include <stdio.h>
 
 
-Qt2Base::Qt2Base(ControlButton & c, string const & t)
+Qt2Base::Qt2Base(::ControlButton & c, QString const & t)
        : ViewBC<qt2BC>(c), title_(t)
 {}
 
@@ -39,13 +39,13 @@ void Qt2Base::show()
     if (!form()) {
        build();
     }
-    
+
     update();  // make sure its up-to-date
-    
+
     if (form()->isVisible()) {
        form()->raise();
     } else {
-       form()->setCaption( title_.c_str() );
+       form()->setCaption( title_ );
        form()->show();
     }
 }
index 5cbf618dc2e8f40242f9ffcc77002c3a7cf753f9..8dcb95f5043c78bd973fd4a5f4fa068c86f19267 100644 (file)
@@ -28,6 +28,7 @@ class QDialog;
 #include "ViewBase.h"
 #include "LString.h"
 #include "ButtonPolicies.h"
+#include "ControlButton.h"
 
 class qt2BC;
 
@@ -38,7 +39,7 @@ class Qt2Base : public QObject, public ViewBC<qt2BC>
     Q_OBJECT
 public:
        ///
-       Qt2Base(ControlButton &, string const &);
+       Qt2Base(::ControlButton &, const QString &);
        ///
        virtual ~Qt2Base() {}
 
@@ -75,7 +76,7 @@ private:
 
 private:
        /// dialog title, displayed by WM.
-       string title_;
+       QString title_;
 };
 
 
@@ -84,7 +85,7 @@ class Qt2DB: public Qt2Base
 {
 protected:
        ///
-       Qt2DB(ControlButton &, string const &);
+       Qt2DB(::ControlButton &, const QString&);
        /// Pointer to the actual instantiation of the Qt dialog
        virtual QDialog* form() const;
        /// Real GUI implementation.
@@ -93,7 +94,7 @@ protected:
 
 
 template <class Dialog>
-Qt2DB<Dialog>::Qt2DB(ControlButton & c, string const & t)
+Qt2DB<Dialog>::Qt2DB(::ControlButton & c, const QString& t)
        : Qt2Base(c, t)
 {}
 
@@ -110,14 +111,14 @@ class Qt2CB: public Base
 {
 protected:
        ///
-       Qt2CB(ControlButton &, string const &);
+       Qt2CB(::ControlButton &, const QString&);
        /// The parent controller
        Controller & controller() const;
 };
 
 
 template <class Controller, class Base>
-Qt2CB<Controller, Base>::Qt2CB(ControlButton & c, string const & t)
+Qt2CB<Controller, Base>::Qt2CB(::ControlButton & c, const QString& t)
        : Base(c, t)
 {}
 
index 834c269905458f14e93ab3609509ab30710742e5..c2d195fc9880fe58b8340c873a7290b99cdc53cd 100644 (file)
@@ -48,9 +48,9 @@ void qt2BC::refresh()
        }
        if (cancel_) {
                if (bp().buttonStatus(ButtonPolicy::CANCEL)) {
-                   cancel_->setText( cancel_label.c_str() );
+                   cancel_->setText( cancel_label_.c_str() );
                } else {
-                   cancel_->setText( close_label.c_str() );
+                   cancel_->setText( close_label_.c_str() );
                }
        }
        if (!read_only_.empty()) {
index d2dec836e38963813667133f9d2e05687e7ea6e1..1f7de47f1691eaa78385ed5d0da21566466a53a6 100644 (file)
@@ -28,6 +28,8 @@
 class QWidget;
 class QButton;
 
+#include <boost/utility.hpp>
+#include "ButtonControllerBase.h"
 #include "ButtonController.h"
 
 /** General purpose button controller for up to four buttons.