]> git.lyx.org Git - features.git/commitdiff
bibitem dialog for Qt2. Took longer to build than to write ;)
authorJohn Levon <levon@movementarian.org>
Sun, 26 Aug 2001 15:34:36 +0000 (15:34 +0000)
committerJohn Levon <levon@movementarian.org>
Sun, 26 Aug 2001 15:34:36 +0000 (15:34 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2589 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt2/ChangeLog
src/frontends/qt2/Dialogs.C
src/frontends/qt2/Makefile.am
src/frontends/qt2/Makefile.dialogs
src/frontends/qt2/QBibitem.C [new file with mode: 0644]
src/frontends/qt2/QBibitem.h [new file with mode: 0644]
src/frontends/qt2/QBibitemDialog.C [new file with mode: 0644]
src/frontends/qt2/QBibitemDialog.h [new file with mode: 0644]
src/frontends/qt2/QBibtexDialog.C
src/frontends/qt2/QBibtexDialog.h
src/frontends/qt2/ui/QBibitemDialog.ui [new file with mode: 0644]

index f25dd282189aeff37577f496a529a0f0e144be7e..762a22e1f0b1cc9021a848ecf04092b4fd33ea81 100644 (file)
@@ -1,3 +1,12 @@
+2001-08-26  John Levon  <moz@compsoc.man.ac.uk>
+
+       * Dialogs.C:
+       * Makefile.am:
+       * Makefile.dialogs:
+       * QBibitem.[Ch]:
+       * QBibitemDialog.[Ch]:
+       * ui/QBibitemDialog.ui: add Bibitem dialog
 2001-08-26  John Levon  <moz@compsoc.man.ac.uk>
 
        * Dialogs.C:
index 7b125f1cf189acbd74bab59194ae7e0836bcc9a5..ec8556dc43c2716599bbefafa0c2436a2001c007 100644 (file)
@@ -13,6 +13,7 @@
 
 // the dialog definitions
 #include "QAboutDialog.h"
+#include "QBibitemDialog.h"
 #include "QBibtexDialog.h"
 #include "QCitationDialog.h"
 #include "QIndexDialog.h"
@@ -20,6 +21,7 @@
 #include "QURLDialog.h"
  
 #include "QAbout.h"
+#include "QBibitem.h"
 #include "QBibtex.h"
 #include "QCharacter.h"
 #include "QCitation.h"
@@ -40,6 +42,7 @@
 
 // the controllers
 #include "controllers/ControlAboutlyx.h"
+#include "controllers/ControlBibitem.h"
 #include "controllers/ControlBibtex.h"
 #include "controllers/ControlCitation.h"
 #include "controllers/ControlIndex.h"
 #include "controllers/ControlSplash.h"
 #include "controllers/ControlUrl.h" 
 #if 0
-#include "controllers/ControlCopyright.h"
-#include "controllers/ControlCredits.h"
-#include "controllers/ControlBibitem.h"
 #include "controllers/ControlButtons.h"
 #include "controllers/ControlCharacter.h"
 #include "controllers/ControlCitation.h"
-#include "controllers/ControlCommand.h"
 #include "controllers/ControlERT.h"
 #include "controllers/ControlError.h"
 #include "controllers/ControlExternal.h"
@@ -87,6 +86,7 @@ Dialogs::Dialogs(LyXView * lv)
        // dialogs that have been converted to new scheme
        add(new GUICitation<QCitation, Qt2BC>(*lv, *this));
        add(new GUIAboutlyx<QAbout, Qt2BC>(*lv, *this));
+       add(new GUIBibitem<QBibitem, Qt2BC>(*lv, *this));
        add(new GUIBibtex<QBibtex, Qt2BC>(*lv, *this));
        add(new GUIIndex<QIndex, Qt2BC>(*lv, *this));
        add(new GUIRef<QRef, Qt2BC>(*lv, *this));
index d5eea29361958d656824f9c2797f6cefb3c9cc41..cde332acf3c08188d3b04d4ce48ebfdfe935f575 100644 (file)
@@ -24,8 +24,6 @@ libqt2_la_OBJADD = \
        ../xforms/Color.lo \
        ../xforms/FloatMenuImpl.lo \
        ../xforms/FormBaseDeprecated.lo \
-       ../xforms/FormBibitem.lo \
-       ../xforms/FormBibtex.lo \
        ../xforms/FormBrowser.lo \
        ../xforms/FormDocument.lo \
        ../xforms/FormError.lo \
index 2ed9d11e0774beb1e81aefe1fde9eb862dc1c4d5..9ffa79424dfe9ba2d43897fcd92e9267eb9658a0 100644 (file)
@@ -2,6 +2,7 @@
 
 DIALOGS = \
        QAbout \
+       QBibitem \
        QBibtex \
        QCharacter \
        QCitation \
@@ -19,6 +20,8 @@ DIALOGS = \
 DIALOGSOURCES = \
        QAbout.h QAboutDialog.h \
        QAbout.C QAboutDialog.C \
+       QBibitem.h QBibitemDialog.h \
+       QBibitem.C QBibitemDialog.C \
        QBibtex.h QBibtexDialog.h \
        QBibtex.C QBibtexDialog.C \
        QCharacter.h QCharacterDialog.h \
@@ -48,6 +51,7 @@ DIALOGSOURCES = \
  
 MOCDIALOGS = \
        QAboutDialog_moc.C \
+       QBibitemDialog_moc.C \
        QBibtexDialog_moc.C \
        QCharacterDialog_moc.C \
        QCitationDialog_moc.C \
@@ -65,6 +69,8 @@ MOCDIALOGS = \
 UIDIALOGS = \
        QAboutDialogBase.h \
        QAboutDialogBase.C \
+       QBibitemDialogBase.h \
+       QBibitemDialogBase.C \
        QBibtexDialogBase.h \
        QBibtexDialogBase.C \
        QCharacterDialogBase.h \
@@ -92,6 +98,7 @@ UIDIALOGS = \
  
 UIMOCDIALOGS = \
        QAboutDialogBase_moc.C \
+       QBibitemDialogBase_moc.C \
        QBibtexDialogBase_moc.C \
        QCharacterDialogBase_moc.C \
        QCitationDialogBase_moc.C \
diff --git a/src/frontends/qt2/QBibitem.C b/src/frontends/qt2/QBibitem.C
new file mode 100644 (file)
index 0000000..5fe69f5
--- /dev/null
@@ -0,0 +1,59 @@
+/**
+ * \file QBibitem.C
+ * Copyright 2001 the LyX Team
+ * Read the file COPYING
+ *
+ * \author John Levon <moz@compsoc.man.ac.uk>
+ */
+
+#include <config.h>
+
+#include "support/lstrings.h"
+
+#include "QBibitemDialog.h"
+#include "ControlBibitem.h"
+#include "QBibitem.h"
+#include "Qt2BC.h"
+#include "gettext.h"
+#include "debug.h" 
+
+#include <qlineedit.h>
+#include <qpushbutton.h>
+
+typedef Qt2CB<ControlBibitem, Qt2DB<QBibitemDialog> > base_class;
+
+QBibitem::QBibitem(ControlBibitem & c)
+       : base_class(c, _("Bibliography Item"))
+{
+}
+
+
+void QBibitem::build_dialog()
+{
+       dialog_.reset(new QBibitemDialog(this));
+
+       bc().setOK(dialog_->okPB);
+       bc().setCancel(dialog_->closePB);
+       bc().addReadOnly(dialog_->keyED);
+       bc().addReadOnly(dialog_->labelED);
+}
+
+
+void QBibitem::update_contents()
+{
+       dialog_->keyED->setText(controller().params().getContents().c_str());
+       dialog_->labelED->setText(controller().params().getOptions().c_str());
+}
+
+
+void QBibitem::apply()
+{
+       controller().params().setContents(dialog_->keyED->text().latin1()); 
+       controller().params().setOptions(dialog_->labelED->text().latin1()); 
+}
+
+
+bool QBibitem::isValid()
+{
+       return !string(dialog_->keyED->text().latin1()).empty();
+}
diff --git a/src/frontends/qt2/QBibitem.h b/src/frontends/qt2/QBibitem.h
new file mode 100644 (file)
index 0000000..aafbee1
--- /dev/null
@@ -0,0 +1,38 @@
+// -*- C++ -*-
+/**
+ * \file QBibitem.h
+ * Copyright 2001 the LyX Team
+ * Read the file COPYING
+ *
+ * \author John Levon <moz@compsoc.man.ac.uk>
+ */
+
+#ifndef QBIBITEM_H
+#define QBIBITEM_H
+
+#include "Qt2Base.h"
+
+class ControlBibitem;
+class QBibitemDialog;
+
+class QBibitem :
+       public Qt2CB<ControlBibitem, Qt2DB<QBibitemDialog> > 
+{
+       friend class QBibitemDialog;
+public: 
+       QBibitem(ControlBibitem &);
+
+protected:
+       virtual bool isValid();
+private: 
+       /// Apply changes
+       virtual void apply();
+       /// update
+       virtual void update_contents();
+       /// build the dialog
+       virtual void build_dialog();
+};
+
+#endif // QBIBITEM_H
diff --git a/src/frontends/qt2/QBibitemDialog.C b/src/frontends/qt2/QBibitemDialog.C
new file mode 100644 (file)
index 0000000..71d1114
--- /dev/null
@@ -0,0 +1,38 @@
+/**
+ * \file QBibitemDialog.C
+ * Copyright 2001 the LyX Team
+ * Read the file COPYING
+ *
+ * \author John Levon <moz@compsoc.man.ac.uk>
+ */
+
+#include <qpushbutton.h>
+#include <qlineedit.h>
+#include "QBibitemDialog.h"
+#include "QBibitem.h"
+#include "Dialogs.h"
+#include "ControlBibitem.h" 
+
+QBibitemDialog::QBibitemDialog(QBibitem * form)
+       : QBibitemDialogBase(0, 0, false, 0),
+       form_(form)
+{
+       connect(okPB, SIGNAL(clicked()),
+               form, SLOT(slotOK()));
+       connect(closePB, SIGNAL(clicked()),
+               form, SLOT(slotClose()));
+}
+
+void QBibitemDialog::change_adaptor()
+{
+       form_->changed();
+}
+
+
+void QBibitemDialog::closeEvent(QCloseEvent *e)
+{
+       form_->slotWMHide();
+       e->accept();
+}
diff --git a/src/frontends/qt2/QBibitemDialog.h b/src/frontends/qt2/QBibitemDialog.h
new file mode 100644 (file)
index 0000000..282d325
--- /dev/null
@@ -0,0 +1,35 @@
+/**
+ * \file QBibitemDialog.h
+ * Copyright 2001 the LyX Team
+ * Read the file COPYING
+ *
+ * \author John Levon <moz@compsoc.man.ac.uk>
+ */
+
+#ifndef QBIBITEMDIALOG_H
+#define QBIBITEMDIALOG_H
+#include <config.h>
+#include "ui/QBibitemDialogBase.h"
+
+class QBibitem;
+
+class QBibitemDialog : public QBibitemDialogBase
+{ Q_OBJECT
+
+public:
+       QBibitemDialog(QBibitem * form);
+
+protected slots:
+       virtual void change_adaptor();
+
+protected:
+       virtual void closeEvent(QCloseEvent * e);
+
+private:
+       QBibitem * form_;
+};
+
+#endif // QBIBITEMDIALOG_H
index efa1c595ae306f6d5b8bcde4fb24db7f6ea89248..41090aefeb28f3a074f70fbcee8a033a565972c1 100644 (file)
@@ -32,11 +32,6 @@ QBibtexDialog::QBibtexDialog(QBibtex * form)
 }
 
  
-QBibtexDialog::~QBibtexDialog()
-{
-}
-
-
 void QBibtexDialog::change_adaptor()
 {
        form_->changed();
index 527652d2c98e0cebbbc2ebac1f0f721b1d270548..9c195d75c7e4d83e8901518fa676f54ac7963349 100644 (file)
@@ -20,7 +20,6 @@ class QBibtexDialog : public QBibtexDialogBase
 
 public:
        QBibtexDialog(QBibtex * form);
-       ~QBibtexDialog();
 
 protected slots:
        virtual void change_adaptor();
diff --git a/src/frontends/qt2/ui/QBibitemDialog.ui b/src/frontends/qt2/ui/QBibitemDialog.ui
new file mode 100644 (file)
index 0000000..94a17fe
--- /dev/null
@@ -0,0 +1,220 @@
+<!DOCTYPE UI><UI>
+<class>QBibitemDialogBase</class>
+<widget>
+    <class>QDialog</class>
+    <property stdset="1">
+        <name>name</name>
+        <cstring>QBibitemDialogBase</cstring>
+    </property>
+    <property stdset="1">
+        <name>geometry</name>
+        <rect>
+            <x>0</x>
+            <y>0</y>
+            <width>197</width>
+            <height>134</height>
+        </rect>
+    </property>
+    <property stdset="1">
+        <name>caption</name>
+        <string>Index</string>
+    </property>
+    <vbox>
+        <property stdset="1">
+            <name>margin</name>
+            <number>11</number>
+        </property>
+        <property stdset="1">
+            <name>spacing</name>
+            <number>6</number>
+        </property>
+        <widget>
+            <class>QLayoutWidget</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>Layout13</cstring>
+            </property>
+            <hbox>
+                <property stdset="1">
+                    <name>margin</name>
+                    <number>0</number>
+                </property>
+                <property stdset="1">
+                    <name>spacing</name>
+                    <number>6</number>
+                </property>
+                <widget>
+                    <class>QLabel</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>keyLA</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>text</name>
+                        <string>&amp;Key</string>
+                    </property>
+                    <property>
+                        <name>buddy</name>
+                        <cstring>keyED</cstring>
+                    </property>
+                    <property>
+                        <name>toolTip</name>
+                        <string>The citation key</string>
+                    </property>
+                </widget>
+                <widget>
+                    <class>QLineEdit</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>keyED</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>sizePolicy</name>
+                        <sizepolicy>
+                            <hsizetype>7</hsizetype>
+                            <vsizetype>0</vsizetype>
+                        </sizepolicy>
+                    </property>
+                    <property>
+                        <name>toolTip</name>
+                        <string>The citation key</string>
+                    </property>
+                </widget>
+            </hbox>
+        </widget>
+        <widget>
+            <class>QLayoutWidget</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>Layout14</cstring>
+            </property>
+            <hbox>
+                <property stdset="1">
+                    <name>margin</name>
+                    <number>0</number>
+                </property>
+                <property stdset="1">
+                    <name>spacing</name>
+                    <number>6</number>
+                </property>
+                <widget>
+                    <class>QLabel</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>labelLA</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>text</name>
+                        <string>&amp;Label</string>
+                    </property>
+                    <property>
+                        <name>buddy</name>
+                        <cstring>labelED</cstring>
+                    </property>
+                    <property>
+                        <name>toolTip</name>
+                        <string>The label as it appears in the document</string>
+                    </property>
+                </widget>
+                <widget>
+                    <class>QLineEdit</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>labelED</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>sizePolicy</name>
+                        <sizepolicy>
+                            <hsizetype>7</hsizetype>
+                            <vsizetype>0</vsizetype>
+                        </sizepolicy>
+                    </property>
+                    <property>
+                        <name>toolTip</name>
+                        <string>The label as it appears in the document</string>
+                    </property>
+                </widget>
+            </hbox>
+        </widget>
+        <widget>
+            <class>QLayoutWidget</class>
+            <property stdset="1">
+                <name>name</name>
+                <cstring>Layout10</cstring>
+            </property>
+            <hbox>
+                <property stdset="1">
+                    <name>margin</name>
+                    <number>0</number>
+                </property>
+                <property stdset="1">
+                    <name>spacing</name>
+                    <number>6</number>
+                </property>
+                <spacer>
+                    <property>
+                        <name>name</name>
+                        <cstring>Spacer1</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">
+                        <name>name</name>
+                        <cstring>okPB</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>text</name>
+                        <string>&amp;OK</string>
+                    </property>
+                    <property stdset="1">
+                        <name>default</name>
+                        <bool>true</bool>
+                    </property>
+                </widget>
+                <widget>
+                    <class>QPushButton</class>
+                    <property stdset="1">
+                        <name>name</name>
+                        <cstring>closePB</cstring>
+                    </property>
+                    <property stdset="1">
+                        <name>text</name>
+                        <string>&amp;Close</string>
+                    </property>
+                </widget>
+            </hbox>
+        </widget>
+    </vbox>
+</widget>
+<connections>
+    <connection>
+        <sender>keyED</sender>
+        <signal>textChanged(const QString&amp;)</signal>
+        <receiver>QBibitemDialogBase</receiver>
+        <slot>change_adaptor()</slot>
+    </connection>
+    <connection>
+        <sender>labelED</sender>
+        <signal>textChanged(const QString&amp;)</signal>
+        <receiver>QBibitemDialogBase</receiver>
+        <slot>change_adaptor()</slot>
+    </connection>
+    <slot access="public">change_adaptor()</slot>
+</connections>
+</UI>