From b90b704bdd22b66c0a7aa0b952332819f0c8a742 Mon Sep 17 00:00:00 2001 From: John Levon Date: Sun, 26 Aug 2001 15:34:36 +0000 Subject: [PATCH] bibitem dialog for Qt2. Took longer to build than to write ;) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2589 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt2/ChangeLog | 9 + src/frontends/qt2/Dialogs.C | 8 +- src/frontends/qt2/Makefile.am | 2 - src/frontends/qt2/Makefile.dialogs | 7 + src/frontends/qt2/QBibitem.C | 59 +++++++ src/frontends/qt2/QBibitem.h | 38 +++++ src/frontends/qt2/QBibitemDialog.C | 38 +++++ src/frontends/qt2/QBibitemDialog.h | 35 ++++ src/frontends/qt2/QBibtexDialog.C | 5 - src/frontends/qt2/QBibtexDialog.h | 1 - src/frontends/qt2/ui/QBibitemDialog.ui | 220 +++++++++++++++++++++++++ 11 files changed, 410 insertions(+), 12 deletions(-) create mode 100644 src/frontends/qt2/QBibitem.C create mode 100644 src/frontends/qt2/QBibitem.h create mode 100644 src/frontends/qt2/QBibitemDialog.C create mode 100644 src/frontends/qt2/QBibitemDialog.h create mode 100644 src/frontends/qt2/ui/QBibitemDialog.ui diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index f25dd28218..762a22e1f0 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,12 @@ +2001-08-26 John Levon + + * Dialogs.C: + * Makefile.am: + * Makefile.dialogs: + * QBibitem.[Ch]: + * QBibitemDialog.[Ch]: + * ui/QBibitemDialog.ui: add Bibitem dialog + 2001-08-26 John Levon * Dialogs.C: diff --git a/src/frontends/qt2/Dialogs.C b/src/frontends/qt2/Dialogs.C index 7b125f1cf1..ec8556dc43 100644 --- a/src/frontends/qt2/Dialogs.C +++ b/src/frontends/qt2/Dialogs.C @@ -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" @@ -47,13 +50,9 @@ #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(*lv, *this)); add(new GUIAboutlyx(*lv, *this)); + add(new GUIBibitem(*lv, *this)); add(new GUIBibtex(*lv, *this)); add(new GUIIndex(*lv, *this)); add(new GUIRef(*lv, *this)); diff --git a/src/frontends/qt2/Makefile.am b/src/frontends/qt2/Makefile.am index d5eea29361..cde332acf3 100644 --- a/src/frontends/qt2/Makefile.am +++ b/src/frontends/qt2/Makefile.am @@ -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 \ diff --git a/src/frontends/qt2/Makefile.dialogs b/src/frontends/qt2/Makefile.dialogs index 2ed9d11e07..9ffa79424d 100644 --- a/src/frontends/qt2/Makefile.dialogs +++ b/src/frontends/qt2/Makefile.dialogs @@ -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 index 0000000000..5fe69f55b9 --- /dev/null +++ b/src/frontends/qt2/QBibitem.C @@ -0,0 +1,59 @@ +/** + * \file QBibitem.C + * Copyright 2001 the LyX Team + * Read the file COPYING + * + * \author John Levon + */ + +#include + +#include "support/lstrings.h" + +#include "QBibitemDialog.h" +#include "ControlBibitem.h" +#include "QBibitem.h" +#include "Qt2BC.h" +#include "gettext.h" +#include "debug.h" + +#include +#include + +typedef Qt2CB > 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 index 0000000000..aafbee1914 --- /dev/null +++ b/src/frontends/qt2/QBibitem.h @@ -0,0 +1,38 @@ +// -*- C++ -*- +/** + * \file QBibitem.h + * Copyright 2001 the LyX Team + * Read the file COPYING + * + * \author John Levon + */ + +#ifndef QBIBITEM_H +#define QBIBITEM_H + +#include "Qt2Base.h" + +class ControlBibitem; +class QBibitemDialog; + +class QBibitem : + public Qt2CB > +{ + 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 index 0000000000..71d1114f00 --- /dev/null +++ b/src/frontends/qt2/QBibitemDialog.C @@ -0,0 +1,38 @@ +/** + * \file QBibitemDialog.C + * Copyright 2001 the LyX Team + * Read the file COPYING + * + * \author John Levon + */ + +#include +#include + +#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 index 0000000000..282d325668 --- /dev/null +++ b/src/frontends/qt2/QBibitemDialog.h @@ -0,0 +1,35 @@ +/** + * \file QBibitemDialog.h + * Copyright 2001 the LyX Team + * Read the file COPYING + * + * \author John Levon + */ + +#ifndef QBIBITEMDIALOG_H +#define QBIBITEMDIALOG_H + +#include + +#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 diff --git a/src/frontends/qt2/QBibtexDialog.C b/src/frontends/qt2/QBibtexDialog.C index efa1c595ae..41090aefeb 100644 --- a/src/frontends/qt2/QBibtexDialog.C +++ b/src/frontends/qt2/QBibtexDialog.C @@ -32,11 +32,6 @@ QBibtexDialog::QBibtexDialog(QBibtex * form) } -QBibtexDialog::~QBibtexDialog() -{ -} - - void QBibtexDialog::change_adaptor() { form_->changed(); diff --git a/src/frontends/qt2/QBibtexDialog.h b/src/frontends/qt2/QBibtexDialog.h index 527652d2c9..9c195d75c7 100644 --- a/src/frontends/qt2/QBibtexDialog.h +++ b/src/frontends/qt2/QBibtexDialog.h @@ -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 index 0000000000..94a17fe6b8 --- /dev/null +++ b/src/frontends/qt2/ui/QBibitemDialog.ui @@ -0,0 +1,220 @@ + +QBibitemDialogBase + + QDialog + + name + QBibitemDialogBase + + + geometry + + 0 + 0 + 197 + 134 + + + + caption + Index + + + + margin + 11 + + + spacing + 6 + + + QLayoutWidget + + name + Layout13 + + + + margin + 0 + + + spacing + 6 + + + QLabel + + name + keyLA + + + text + &Key + + + buddy + keyED + + + toolTip + The citation key + + + + QLineEdit + + name + keyED + + + sizePolicy + + 7 + 0 + + + + toolTip + The citation key + + + + + + QLayoutWidget + + name + Layout14 + + + + margin + 0 + + + spacing + 6 + + + QLabel + + name + labelLA + + + text + &Label + + + buddy + labelED + + + toolTip + The label as it appears in the document + + + + QLineEdit + + name + labelED + + + sizePolicy + + 7 + 0 + + + + toolTip + The label as it appears in the document + + + + + + QLayoutWidget + + name + Layout10 + + + + margin + 0 + + + spacing + 6 + + + + name + Spacer1 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QPushButton + + name + okPB + + + text + &OK + + + default + true + + + + QPushButton + + name + closePB + + + text + &Close + + + + + + + + + keyED + textChanged(const QString&) + QBibitemDialogBase + change_adaptor() + + + labelED + textChanged(const QString&) + QBibitemDialogBase + change_adaptor() + + change_adaptor() + +