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
This commit is contained in:
John Levon 2001-08-26 15:34:36 +00:00
parent ef3a25c069
commit b90b704bdd
11 changed files with 410 additions and 12 deletions

View 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:

View 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"
@ -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<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));

View 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 \

View 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 \

View File

@ -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();
}

View File

@ -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

View File

@ -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();
}

View File

@ -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

View File

@ -32,11 +32,6 @@ QBibtexDialog::QBibtexDialog(QBibtex * form)
}
QBibtexDialog::~QBibtexDialog()
{
}
void QBibtexDialog::change_adaptor()
{
form_->changed();

View File

@ -20,7 +20,6 @@ class QBibtexDialog : public QBibtexDialogBase
public:
QBibtexDialog(QBibtex * form);
~QBibtexDialog();
protected slots:
virtual void change_adaptor();

View File

@ -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>