From 0a26faefd1d74f11b611779d8b474fffb04ec680 Mon Sep 17 00:00:00 2001 From: Kalle Dalheimer Date: Mon, 2 Apr 2001 20:08:43 +0000 Subject: [PATCH] implemented credits dialog git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1876 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt2/ChangeLog | 4 + src/frontends/qt2/Dialogs.C | 8 +- src/frontends/qt2/FormCitationDialog.ui | 16 +- src/frontends/qt2/FormCitationDialogImpl.C | 38 ++--- src/frontends/qt2/FormCredits.C | 57 +++++++ src/frontends/qt2/FormCredits.h | 40 +++++ src/frontends/qt2/FormCreditsDialog.ui | 167 +++++++++++++++++++++ src/frontends/qt2/FormCreditsDialogImpl.C | 27 ++++ src/frontends/qt2/FormCreditsDialogImpl.h | 18 +++ src/frontends/qt2/Makefile.am | 49 ++---- src/frontends/qt2/dialogs-qt2.txt | 19 ++- 11 files changed, 374 insertions(+), 69 deletions(-) create mode 100644 src/frontends/qt2/FormCredits.C create mode 100644 src/frontends/qt2/FormCredits.h create mode 100644 src/frontends/qt2/FormCreditsDialog.ui create mode 100644 src/frontends/qt2/FormCreditsDialogImpl.C create mode 100644 src/frontends/qt2/FormCreditsDialogImpl.h diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 007229a635..1bd4938480 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,7 @@ +2001-04-02 Kalle Dalheimer + + * Makefile.am: Simplified Makefile.am + 2001-03-31 Kalle Dalheimer * FormCitationDialogImpl.C (doPreviousNext): Propagated search diff --git a/src/frontends/qt2/Dialogs.C b/src/frontends/qt2/Dialogs.C index 29d85dc15e..b2b7166353 100644 --- a/src/frontends/qt2/Dialogs.C +++ b/src/frontends/qt2/Dialogs.C @@ -19,9 +19,9 @@ #include "FormCitationDialogImpl.h" #include "FormCopyrightDialogImpl.h" +#include "FormCreditsDialogImpl.h" #undef emit -#include "../xforms/FormCredits.h" #include "../xforms/FormError.h" #include "../xforms/FormGraphics.h" #include "../xforms/FormPreferences.h" @@ -30,6 +30,7 @@ #include "FormCharacter.h" #include "FormCitation.h" #include "FormCopyright.h" +#include "FormCredits.h" //#include "FormDocument.h" //#include "FormIndex.h" #include "FormParagraph.h" @@ -46,6 +47,7 @@ #include "controllers/ControlCitation.h" #include "controllers/ControlCopyright.h" +#include "controllers/ControlCredits.h" #include "GUI.h" @@ -63,15 +65,13 @@ Dialogs::Dialogs(LyXView * lv) // dialogs that have been converted to new scheme add( new GUICitation( *lv, *this ) ); add( new GUICopyright( *lv, *this ) ); + add( new GUICredits( *lv, *this ) ); // ------------------------------------------ // dialogs that are still old-style add( new FormCharacter(lv, this)); - // REMOVED THIS UNTIL CHANGED TO NEW SCHEME -- Kalle, 2001-03-22 - // add( new FormCredits(lv, this)); - // add(new FormDocument(lv, this)); diff --git a/src/frontends/qt2/FormCitationDialog.ui b/src/frontends/qt2/FormCitationDialog.ui index 50ca0bfd00..07a925aaf3 100644 --- a/src/frontends/qt2/FormCitationDialog.ui +++ b/src/frontends/qt2/FormCitationDialog.ui @@ -683,12 +683,6 @@ FormCitationDialog slotDelClicked() - - upPB - clicked() - FormCitationDialog - slotIUpClicked() - downPB clicked() @@ -743,18 +737,24 @@ FormCitationDialog slotCiteSelected(int) - slotTextAfterReturn() + + upPB + clicked() + FormCitationDialog + slotUpClicked() + slotAddClicked() slotBibSelected(int) slotCitationStyleSelected(int) slotCiteSelected(int) slotDelClicked() slotDownClicked() - slotIUpClicked() + slotUpClicked() slotNextClicked() slotPreviousClicked() slotRestoreClicked() slotSearchTypeSelected(bool) + slotTextAfterReturn() slotTextBeforeReturn() diff --git a/src/frontends/qt2/FormCitationDialogImpl.C b/src/frontends/qt2/FormCitationDialogImpl.C index 07c1692e42..0fc1074c3b 100644 --- a/src/frontends/qt2/FormCitationDialogImpl.C +++ b/src/frontends/qt2/FormCitationDialogImpl.C @@ -1,5 +1,5 @@ /** - * $Id: FormCitationDialogImpl.C,v 1.5 2001/03/31 08:39:24 kalle Exp $ + * $Id: FormCitationDialogImpl.C,v 1.6 2001/04/02 20:08:43 kalle Exp $ */ #include "FormCitationDialogImpl.h" @@ -61,7 +61,7 @@ void FormCitationDialogImpl::slotBibSelected( int sel ) citeLB->clearSelection(); if (sel < 0 || sel >= (int)form_->bibkeys.size()) { - form_->bc().input( ButtonPolicy::SMI_NOOP ); + // form_->bc().input( ButtonPolicy::SMI_NOOP ); return; } @@ -94,7 +94,7 @@ void FormCitationDialogImpl::slotBibSelected( int sel ) } } - form_->bc().input( ButtonPolicy::SMI_VALID ); + // form_->bc().input( ButtonPolicy::SMI_VALID ); } @@ -103,7 +103,7 @@ void FormCitationDialogImpl::slotCiteSelected( int sel ) biblio::InfoMap const & theMap = form_->controller().bibkeysInfo(); if (sel < 0 || sel >= (int)form_->citekeys.size()) { - form_->bc().input( ButtonPolicy::SMI_NOOP ); + // form_->bc().input( ButtonPolicy::SMI_NOOP ); return; } @@ -127,7 +127,7 @@ void FormCitationDialogImpl::slotCiteSelected( int sel ) infoML->setText( biblio::getInfo( theMap, form_->bibkeys[sel] ).c_str() ); } - form_->bc().input( ButtonPolicy::SMI_VALID ); + // form_->bc().input( ButtonPolicy::SMI_VALID ); } @@ -135,7 +135,7 @@ void FormCitationDialogImpl::slotAddClicked() { int const sel = bibLB->currentItem(); if (sel < 0 || sel >= (int)form_->bibkeys.size()) { - form_->bc().input( ButtonPolicy::SMI_NOOP ); + // form_->bc().input( ButtonPolicy::SMI_NOOP ); return; } @@ -149,7 +149,7 @@ void FormCitationDialogImpl::slotAddClicked() form_->setBibButtons(FormCitation::OFF); form_->setCiteButtons(FormCitation::ON); - form_->bc().input( ButtonPolicy::SMI_VALID ); + // form_->bc().input( ButtonPolicy::SMI_VALID ); } @@ -157,7 +157,7 @@ void FormCitationDialogImpl::slotDelClicked() { int const sel = citeLB->currentItem(); if (sel < 0 || sel >= (int)form_->citekeys.size()) { - form_->bc().input( ButtonPolicy::SMI_NOOP ); + // form_->bc().input( ButtonPolicy::SMI_NOOP ); return; } @@ -168,7 +168,7 @@ void FormCitationDialogImpl::slotDelClicked() form_->setBibButtons(FormCitation::ON); form_->setCiteButtons(FormCitation::OFF); - form_->bc().input( ButtonPolicy::SMI_VALID ); + // form_->bc().input( ButtonPolicy::SMI_VALID ); } @@ -176,7 +176,7 @@ void FormCitationDialogImpl::slotUpClicked() { int const sel = citeLB->currentItem(); if (sel < 1 || sel >= (int)form_->citekeys.size()) { - form_->bc().input( ButtonPolicy::SMI_NOOP ); + // form_->bc().input( ButtonPolicy::SMI_NOOP ); return; } @@ -192,7 +192,7 @@ void FormCitationDialogImpl::slotUpClicked() form_->citekeys.insert(it-1, tmp); form_->setCiteButtons(FormCitation::ON); - form_->bc().input( ButtonPolicy::SMI_VALID ); + // form_->bc().input( ButtonPolicy::SMI_VALID ); } @@ -200,7 +200,7 @@ void FormCitationDialogImpl::slotDownClicked() { int const sel = citeLB->currentItem(); if (sel < 0 || sel >= (int)form_->citekeys.size()-1) { - form_->bc().input( ButtonPolicy::SMI_NOOP ); + // form_->bc().input( ButtonPolicy::SMI_NOOP ); return; } @@ -216,7 +216,7 @@ void FormCitationDialogImpl::slotDownClicked() form_->citekeys.insert(it+1, tmp); form_->setCiteButtons(FormCitation::ON); - form_->bc().input( ButtonPolicy::SMI_VALID ); + // form_->bc().input( ButtonPolicy::SMI_VALID ); } @@ -263,13 +263,13 @@ void FormCitationDialogImpl::doPreviousNext( bool next ) start, type, dir, caseSensitive ); if (cit == form_->bibkeys.end()) { - form_->bc().input( ButtonPolicy::SMI_NOOP ); + // form_->bc().input( ButtonPolicy::SMI_NOOP ); return; } int const found = int(cit - form_->bibkeys.begin()); if (found == sel) { - form_->bc().input( ButtonPolicy::SMI_NOOP ); + // form_->bc().input( ButtonPolicy::SMI_NOOP ); return; } @@ -279,24 +279,24 @@ void FormCitationDialogImpl::doPreviousNext( bool next ) bibLB->setSelected( found, true ); slotBibSelected( 0 ); - form_->bc().input( ButtonPolicy::SMI_VALID ); + // form_->bc().input( ButtonPolicy::SMI_VALID ); } void FormCitationDialogImpl::slotCitationStyleSelected( int ) { - form_->bc().input( ButtonPolicy::SMI_VALID ); + // form_->bc().input( ButtonPolicy::SMI_VALID ); } void FormCitationDialogImpl::slotTextBeforeReturn() { - form_->bc().input( ButtonPolicy::SMI_VALID ); + // form_->bc().input( ButtonPolicy::SMI_VALID ); } void FormCitationDialogImpl::slotTextAfterReturn() { - form_->bc().input( ButtonPolicy::SMI_VALID ); + // form_->bc().input( ButtonPolicy::SMI_VALID ); } diff --git a/src/frontends/qt2/FormCredits.C b/src/frontends/qt2/FormCredits.C new file mode 100644 index 0000000000..ae950c03a1 --- /dev/null +++ b/src/frontends/qt2/FormCredits.C @@ -0,0 +1,57 @@ +/** + * \file FormCredits.C + * Copyright 2001 The LyX Team. + * See the file COPYING. + * + * \author Edwin Leuven, leuven@fee.uva.nl + * \author Angus Leeming, a.leeming@.ac.uk + * \author Kalle Dalheimer, kalle@klaralvdalens-datakonsult.se + */ + +#ifdef __GNUG__ +#pragma implementation +#endif + +#include + +#include "FormCreditsDialogImpl.h" +#include +#include +#undef emit + +#include "qt2BC.h" +#include "ControlCredits.h" +#include "FormCredits.h" +#include "Lsstream.h" + +using std::getline; + +typedef Qt2CB > base_class; + +FormCredits::FormCredits(ControlCredits & c) + : base_class(c, _("Credits")) +{} + + +void FormCredits::build() +{ + // PENDING(kalle) Parent? + dialog_.reset(new FormCreditsDialogImpl( this )); + + // Manage the cancel/close button + bc().setCancel(dialog_->okPB); + bc().refresh(); + + std::stringstream ss; + QString xformscredits = controller().getCredits( ss ).str().c_str(); + QStringList xformslist = QStringList::split( '\n', controller().getCredits( ss ).str().c_str(), true ); + for( QStringList::Iterator it = xformslist.begin(); it != xformslist.end(); ++it ) { + QString line = *it; + if( line.left( 2 ) == "@b" ) + dialog_->creditsTV->append( "" + line.mid( 2 ) + "" ); + else if( line.left( 2 ) == "@i" ) + dialog_->creditsTV->append( "" + line.mid( 2 ) + "" ); + else + dialog_->creditsTV->append( line ); + } +} diff --git a/src/frontends/qt2/FormCredits.h b/src/frontends/qt2/FormCredits.h new file mode 100644 index 0000000000..09cad82b79 --- /dev/null +++ b/src/frontends/qt2/FormCredits.h @@ -0,0 +1,40 @@ +/** + * \file FormCredits.h + * Copyright 2001 The LyX Team. + * See the file COPYING. + * + * \author Edwin Leuven, leuven@fee.uva.nl + * \author Angus Leeming, a.leeming@.ac.uk + * \author Kalle Dalheimer, kalle@klaralvdalens-datakonsult.se + */ + +#ifndef FORMCREDITS_H +#define FORMCREDITS_H + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "Qt2Base.h" + +class ControlCredits; +class FormCreditsDialogImpl; + +/** This class provides a Qt2 implementation of the FormCredits Dialog. + */ +class FormCredits : public Qt2CB > { +public: + /// + FormCredits(ControlCredits &); + +private: + /// not needed. + virtual void apply() {} + /// not needed. + virtual void update() {} + /// Build the dialog + virtual void build(); +}; + +#endif + diff --git a/src/frontends/qt2/FormCreditsDialog.ui b/src/frontends/qt2/FormCreditsDialog.ui new file mode 100644 index 0000000000..0f3f8399c0 --- /dev/null +++ b/src/frontends/qt2/FormCreditsDialog.ui @@ -0,0 +1,167 @@ + +FormCreditsDialog + + QDialog + + name + FormCreditsDialog + + + geometry + + 0 + 0 + 366 + 301 + + + + caption + Form1 + + + + margin + 11 + + + spacing + 6 + + + QLabel + + name + TextLabel1 + + + text + All these people have contributed to the LyX project. Thanks, + + + alignment + AlignCenter + + + hAlign + + + + QLabel + + name + TextLabel2 + + + font + + 1 + + + + text + Matthias + + + alignment + AlignCenter + + + hAlign + + + + QTextView + + name + creditsTV + + + minimumSize + + 0 + 200 + + + + textFormat + RichText + + + + QLayoutWidget + + name + Layout8 + + + + margin + 0 + + + spacing + 6 + + + + name + Spacer1 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QPushButton + + name + okPB + + + text + OK + + + default + true + + + + + name + Spacer2 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + + + + diff --git a/src/frontends/qt2/FormCreditsDialogImpl.C b/src/frontends/qt2/FormCreditsDialogImpl.C new file mode 100644 index 0000000000..831f7701aa --- /dev/null +++ b/src/frontends/qt2/FormCreditsDialogImpl.C @@ -0,0 +1,27 @@ +#include "FormCreditsDialogImpl.h" +#include "FormCredits.h" +#include + +/* + * Constructs a FormCreditsDialogImpl which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +FormCreditsDialogImpl::FormCreditsDialogImpl( FormCredits* form, QWidget* parent, + const char* name, bool modal, WFlags fl ) + : FormCreditsDialog( parent, name, modal, fl ) +{ + connect( okPB, SIGNAL( clicked() ), + form, SLOT( slotCancel() ) ); +} + +/* + * Destroys the object and frees any allocated resources + */ +FormCreditsDialogImpl::~FormCreditsDialogImpl() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/frontends/qt2/FormCreditsDialogImpl.h b/src/frontends/qt2/FormCreditsDialogImpl.h new file mode 100644 index 0000000000..85cb0e056d --- /dev/null +++ b/src/frontends/qt2/FormCreditsDialogImpl.h @@ -0,0 +1,18 @@ +#ifndef FORMCREDITSDIALOGIMPL_H +#define FORMCREDITSDIALOGIMPL_H +#include "FormCreditsDialog.h" + +class FormCredits; + +class FormCreditsDialogImpl : public FormCreditsDialog +{ + Q_OBJECT + +public: + FormCreditsDialogImpl( FormCredits* form, QWidget* parent = 0, + const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~FormCreditsDialogImpl(); + +}; + +#endif // FORMCREDITSDIALOGIMPL_H diff --git a/src/frontends/qt2/Makefile.am b/src/frontends/qt2/Makefile.am index 83bbf40fb8..8162520335 100644 --- a/src/frontends/qt2/Makefile.am +++ b/src/frontends/qt2/Makefile.am @@ -16,6 +16,8 @@ BUILTSOURCES = \ moc_FormCitationDialogImpl.C \ moc_FormCopyrightDialog.C \ moc_FormCopyrightDialogImpl.C \ + moc_FormCreditsDialog.C \ + moc_FormCreditsDialogImpl.C \ moc_chardlg.C \ moc_chardlgimpl.C \ moc_paragraphdlg.C \ @@ -113,6 +115,12 @@ libqt2_la_SOURCES = \ FormCopyrightDialog.h \ FormCopyrightDialogImpl.C \ FormCopyrightDialogImpl.h \ + FormCredits.C \ + FormCredits.h \ + FormCreditsDialog.C \ + FormCreditsDialog.h \ + FormCreditsDialogImpl.C \ + FormCreditsDialogImpl.h \ FormParagraph.C \ FormParagraph.h \ paragraphdlg.C \ @@ -160,7 +168,7 @@ dist-hook: done ; \ done -moc_Qt2Base.C: Qt2Base.h +moc_%.C: %.h $(MOC) -o $@ $< FormCitation.C: FormCitationDialog.h @@ -168,72 +176,45 @@ FormCitationDialog.h: FormCitationDialog.ui $(UIC) -o $@ $< FormCitationDialog.C: FormCitationDialog.ui $(UIC) -impl FormCitationDialog.h -o $@ $< -moc_FormCitationDialog.C: FormCitationDialog.h - $(MOC) -o $@ $< -moc_FormCitationDialogImpl.C: FormCitationDialogImpl.h - $(MOC) -o $@ $< FormCopyright.C: FormCopyrightDialogImpl.h FormCopyrightDialog.h: FormCopyrightDialog.ui $(UIC) -o $@ $< FormCopyrightDialog.C: FormCopyrightDialog.ui $(UIC) -impl FormCopyrightDialog.h -o $@ $< -moc_FormCopyrightDialog.C: FormCopyrightDialog.h - $(MOC) -o $@ $< -moc_FormCopyrightDialogImpl.C: FormCopyrightDialogImpl.h - $(MOC) -o $@ $< + +FormCredits.C: FormCreditsDialogImpl.h +FormCreditsDialog.h: FormCreditsDialog.ui + $(UIC) -o $@ $< +FormCreditsDialog.C: FormCreditsDialog.ui + $(UIC) -impl FormCreditsDialog.h -o $@ $< FormParagraph.C: paragraphdlg.h paragraphdlg.h: paragraphdlg.ui $(UIC) -o $@ $< paragraphdlg.C: paragraphdlg.ui $(UIC) -impl paragraphdlg.h -o $@ $< -moc_paragraphdlg.C: paragraphdlg.h - $(MOC) -o $@ $< -moc_paragraphdlgimpl.C: paragraphdlgimpl.h - $(MOC) -o $@ $< FormPrint.C: printdlg.h printdlg.h: printdlg.ui $(UIC) -o $@ $< printdlg.C: printdlg.ui $(UIC) -impl printdlg.h -o $@ $< -moc_printdlg.C: printdlg.h - $(MOC) -o $@ $< -moc_printdlgimpl.C: printdlgimpl.h - $(MOC) -o $@ $< FormTabularCreate.C: tabularcreatedlg.h tabularcreatedlg.h: tabularcreatedlg.ui $(UIC) -o $@ $< tabularcreatedlg.C: tabularcreatedlg.ui $(UIC) -impl tabularcreatedlg.h -o $@ $< -moc_tabularcreatedlg.C: tabularcreatedlg.h - $(MOC) -o $@ $< -moc_tabularcreatedlgimpl.C: tabularcreatedlgimpl.h - $(MOC) -o $@ $< -moc_emptytable.C: emptytable.h - $(MOC) -o $@ $< FormCharacter.C: chardlg.h chardlg.h: chardlg.ui $(UIC) -o $@ $< chardlg.C: chardlg.ui $(UIC) -impl chardlg.h -o $@ $< -moc_chardlg.C: chardlg.h - $(MOC) -o $@ $< -moc_chardlgimpl.C: chardlgimpl.h - $(MOC) -o $@ $< FormSearch.C: searchdlg.h searchdlg.h: searchdlg.ui $(UIC) -o $@ $< searchdlg.C: searchdlg.ui $(UIC) -impl searchdlg.h -o $@ $< -moc_searchdlg.C: searchdlg.h - $(MOC) -o $@ $< -moc_searchdlgimpl.C: searchdlgimpl.h - $(MOC) -o $@ $< - -moc_FileDialog_private.C: FileDialog_private.h - $(MOC) -o $@ $< diff --git a/src/frontends/qt2/dialogs-qt2.txt b/src/frontends/qt2/dialogs-qt2.txt index 881c9d8c03..2197cd39fc 100644 --- a/src/frontends/qt2/dialogs-qt2.txt +++ b/src/frontends/qt2/dialogs-qt2.txt @@ -1,22 +1,33 @@ Dialog Maintainer MVC conversion ---------------------------------------------- +Bibitem +Bibtex Character Edwin Citation Kalle In progress +Command +Connections Copyright Kalle Done -Credits -Document Kalle In progress +Credits Kalle In progress +Document Kalle In progress (Not yet prepared) Error +External File Edwin Graphics +Include Index Kalle -Paragraph Edwin +Log +Minipage +Paragraph Edwin Not yet prepared +Preamble Preferences Print Edwin Ref Kalle Search Edwin Splash Edwin -Tabular +Tabular Not yet prepared TabularCreate Edwin Toc Kalle Url Kalle +VCLog +