From 76ff845d19eaadf86f878f7c757dfd5a7dc89344 Mon Sep 17 00:00:00 2001 From: Edwin Leuven Date: Tue, 29 Jan 2002 10:05:09 +0000 Subject: [PATCH] add showfile dialog to qt2 frontend git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3448 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt2/ChangeLog | 12 + src/frontends/qt2/Dialogs.C | 16 +- src/frontends/qt2/Makefile.am | 7 - src/frontends/qt2/Makefile.dialogs | 7 + src/frontends/qt2/QShowFile.C | 48 + src/frontends/qt2/QShowFile.h | 35 + src/frontends/qt2/QShowFileDialog.C | 29 + src/frontends/qt2/QShowFileDialog.h | 31 + src/frontends/qt2/ui/QCitationDialog.ui | 1240 +++++++++++------------ src/frontends/qt2/ui/QShowFileDialog.ui | 102 ++ 10 files changed, 857 insertions(+), 670 deletions(-) create mode 100644 src/frontends/qt2/QShowFile.C create mode 100644 src/frontends/qt2/QShowFile.h create mode 100644 src/frontends/qt2/QShowFileDialog.C create mode 100644 src/frontends/qt2/QShowFileDialog.h create mode 100644 src/frontends/qt2/ui/QShowFileDialog.ui diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index e6cea762c9..459c1f6d36 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,15 @@ +2002-01-29 Edwin Leuven + + * Makefile.am: + * Dialogs.C: + * Makefile.dialogs: + * QShowFile.h: + * QShowFile.C: + * QShowFileDialog.h: + * QShowFileDialog.C: + * ui/QShowFileDialog.ui: add showfile dialog + * ui/QCitationDialog.ui: minor layout tweaks + 2002-01-25 Angus Leeming * Dialogs.C: removed now redundant #include "QParagraph.h". diff --git a/src/frontends/qt2/Dialogs.C b/src/frontends/qt2/Dialogs.C index 30880a9066..c4a0c7dea9 100644 --- a/src/frontends/qt2/Dialogs.C +++ b/src/frontends/qt2/Dialogs.C @@ -30,6 +30,7 @@ #include "QPrintDialog.h" #include "QRefDialog.h" #include "QSearchDialog.h" +#include "QShowFileDialog.h" #include "QSpellcheckerDialog.h" #include "QTabularCreateDialog.h" #include "QTexinfoDialog.h" @@ -56,6 +57,7 @@ #include "QPrint.h" #include "QRef.h" #include "QSearch.h" +#include "QShowFile.h" #include "QSpellchecker.h" #include "QTabularCreate.h" #include "QTexinfo.h" @@ -71,11 +73,9 @@ #include "Qt2BC.h" // xforms stuff -#include "xforms/FormBrowser.h" -#include "xforms/form_browser.h" -#include "xforms/FormDocument.h" +//#include "xforms/FormDocument.h" #include "xforms/FormMathsPanel.h" -#include "xforms/FormParagraph.h" +//#include "xforms/FormParagraph.h" #include "xforms/FormPreferences.h" #include "xforms/FormShowFile.h" #include "xforms/FormTabular.h" @@ -107,6 +107,7 @@ Dialogs::Dialogs(LyXView * lv) add(new GUIPrint(*lv, *this)); add(new GUIRef(*lv, *this)); add(new GUISearch(*lv, *this)); + add(new GUIShowFile(*lv, *this)); add(new GUISpellchecker(*lv, *this)); add(new GUITabularCreate(*lv, *this)); add(new GUITexinfo(*lv, *this)); @@ -115,13 +116,10 @@ Dialogs::Dialogs(LyXView * lv) add(new GUIUrl(*lv, *this)); add(new GUIVCLog(*lv, *this)); - // dialogs not yet converted - add(new GUIShowFile(*lv, *this)); - // dialogs not yet MVCd - add(new FormDocument(lv, this)); +// add(new FormDocument(lv, this)); add(new FormMathsPanel(lv, this)); - add(new FormParagraph(lv, this)); +// add(new FormParagraph(lv, this)); add(new FormPreferences(lv, this)); add(new FormTabular(lv, this)); diff --git a/src/frontends/qt2/Makefile.am b/src/frontends/qt2/Makefile.am index 6d2572b328..65ab5d7b73 100644 --- a/src/frontends/qt2/Makefile.am +++ b/src/frontends/qt2/Makefile.am @@ -24,7 +24,6 @@ libqt2_la_LIBADD = \ ../xforms/DropDown.lo \ ../xforms/FormBase.lo \ ../xforms/FormBaseDeprecated.lo \ - ../xforms/FormBrowser.lo \ ../xforms/FormMathsBitmap.lo \ ../xforms/FormMathsDeco.lo \ ../xforms/FormMathsDelim.lo \ @@ -32,19 +31,14 @@ libqt2_la_LIBADD = \ ../xforms/FormMathsPanel.lo \ ../xforms/FormMathsStyle.lo \ ../xforms/FormMathsSpace.lo \ - ../xforms/FormParagraph.lo \ ../xforms/FormPreferences.lo \ - ../xforms/FormShowFile.lo \ ../xforms/FormTabular.lo \ - ../xforms/FormDocument.lo \ ../xforms/FormInset.lo \ ../xforms/MathsSymbols.lo \ ../xforms/Menubar_pimpl.lo \ ../xforms/RadioButtonGroup.lo \ ../xforms/Toolbar_pimpl.lo \ ../xforms/bmtable.lo \ - ../xforms/form_browser.lo \ - ../xforms/form_document.lo \ ../xforms/form_preferences.lo \ ../xforms/form_tabular.lo \ ../xforms/form_maths_deco.lo \ @@ -53,7 +47,6 @@ libqt2_la_LIBADD = \ ../xforms/form_maths_panel.lo \ ../xforms/form_maths_space.lo \ ../xforms/form_maths_style.lo \ - ../xforms/form_paragraph.lo \ ../xforms/input_validators.lo \ ../xforms/xformsBC.lo \ ../xforms/xforms_helpers.lo \ diff --git a/src/frontends/qt2/Makefile.dialogs b/src/frontends/qt2/Makefile.dialogs index 468fc246f6..bedd976d50 100644 --- a/src/frontends/qt2/Makefile.dialogs +++ b/src/frontends/qt2/Makefile.dialogs @@ -19,6 +19,7 @@ DIALOGS = \ QPrint \ QRef \ QSearch \ + QShowFile \ QSpellchecker \ QTabularCreate \ QTexinfo \ @@ -64,6 +65,8 @@ DIALOGSOURCES = \ QRef.C QRefDialog.C \ QSearch.h QSearchDialog.h \ QSearch.C QSearchDialog.C \ + QShowFile.h QShowFileDialog.h \ + QShowFile.C QShowFileDialog.C \ QSpellchecker.h QSpellcheckerDialog.h \ QSpellchecker.C QSpellcheckerDialog.C \ QTabularCreate.h QTabularCreateDialog.h \ @@ -98,6 +101,7 @@ MOCDIALOGS = \ QPrintDialog_moc.C \ QRefDialog_moc.C \ QSearchDialog_moc.C \ + QShowFileDialog_moc.C \ QSpellcheckerDialog_moc.C \ QTabularCreateDialog_moc.C \ QTexinfoDialog_moc.C \ @@ -143,6 +147,8 @@ UIDIALOGS = \ QRefDialogBase.C \ QSearchDialogBase.h \ QSearchDialogBase.C \ + QShowFileDialogBase.h \ + QShowFileDialogBase.C \ QSpellcheckerDialogBase.h \ QSpellcheckerDialogBase.C \ QTabularCreateDialogBase.h \ @@ -177,6 +183,7 @@ UIMOCDIALOGS = \ QPrintDialogBase_moc.C \ QRefDialogBase_moc.C \ QSearchDialogBase_moc.C \ + QShowFileDialogBase_moc.C \ QSpellcheckerDialogBase_moc.C \ QTabularCreateDialogBase_moc.C \ QTexinfoDialogBase_moc.C \ diff --git a/src/frontends/qt2/QShowFile.C b/src/frontends/qt2/QShowFile.C new file mode 100644 index 0000000000..fc944dc022 --- /dev/null +++ b/src/frontends/qt2/QShowFile.C @@ -0,0 +1,48 @@ +/** + * \file QShowFile.C + * Copyright 2001 the LyX Team + * Read the file COPYING + * + * \author John Levon + */ + +#include + +#include "QShowFileDialog.h" +#include "ControlShowFile.h" +#include "QShowFile.h" +#include "Qt2BC.h" +#include "gettext.h" + +#include +#include + +typedef Qt2CB > base_class; + +QShowFile::QShowFile(ControlShowFile & c) + : base_class(c, _("ShowFile")) +{ +} + + +void QShowFile::build_dialog() +{ + dialog_.reset(new QShowFileDialog(this)); + + bc().setCancel(dialog_->closePB); +} + + +void QShowFile::update_contents() +{ + dialog_->setName(controller().getFileName().c_str()); + + string contents = controller().getFileContents(); + if (contents.empty()) { + contents = "Error -> Cannot load file!"; + } + + dialog_->text->setText(contents.c_str()); +} + + diff --git a/src/frontends/qt2/QShowFile.h b/src/frontends/qt2/QShowFile.h new file mode 100644 index 0000000000..8838f44cc4 --- /dev/null +++ b/src/frontends/qt2/QShowFile.h @@ -0,0 +1,35 @@ +// -*- C++ -*- +/** + * \file QShowFile.h + * Copyright 2001 the LyX Team + * Read the file COPYING + * + * \author John Levon + */ + +#ifndef QSHOWFILE_H +#define QSHOWFILE_H + +#include "Qt2Base.h" + +class ControlShowFile; +class QShowFileDialog; + +class QShowFile : + public Qt2CB > +{ + friend class QShowFileDialog; + +public: + QShowFile(ControlShowFile &); + +private: + /// Apply changes + virtual void apply() {}; + /// update + virtual void update_contents(); + /// build the dialog + virtual void build_dialog(); +}; + +#endif // QSHOWFILE_H diff --git a/src/frontends/qt2/QShowFileDialog.C b/src/frontends/qt2/QShowFileDialog.C new file mode 100644 index 0000000000..2d64f7b034 --- /dev/null +++ b/src/frontends/qt2/QShowFileDialog.C @@ -0,0 +1,29 @@ +/** + * \file QShowFileDialog.C + * Copyright 2001 the LyX Team + * Read the file COPYING + * + * \author John Levon + */ + +#include "QShowFileDialog.h" +#include "Dialogs.h" +#include "QShowFile.h" + +#include +#include + +QShowFileDialog::QShowFileDialog(QShowFile * form) + : QShowFileDialogBase(0, 0, false, 0), + form_(form) +{ + connect(closePB, SIGNAL(clicked()), + form, SLOT(slotClose())); +} + + +void QShowFileDialog::closeEvent(QCloseEvent * e) +{ + form_->slotWMHide(); + e->accept(); +} diff --git a/src/frontends/qt2/QShowFileDialog.h b/src/frontends/qt2/QShowFileDialog.h new file mode 100644 index 0000000000..517f85d021 --- /dev/null +++ b/src/frontends/qt2/QShowFileDialog.h @@ -0,0 +1,31 @@ +/** + * \file QShowFileDialog.h + * Copyright 2001 the LyX Team + * Read the file COPYING + * + * \author John Levon + */ + +#ifndef QSHOWFILEDIALOG_H +#define QSHOWFILEDIALOG_H + +#include + +#include "ui/QShowFileDialogBase.h" + +class QShowFile; + +class QShowFileDialog : public QShowFileDialogBase +{ Q_OBJECT + +public: + QShowFileDialog(QShowFile * form); + +protected: + virtual void closeEvent(QCloseEvent * e); + +private: + QShowFile * form_; +}; + +#endif // QSHOWFILEDIALOG_H diff --git a/src/frontends/qt2/ui/QCitationDialog.ui b/src/frontends/qt2/ui/QCitationDialog.ui index c51a9a501d..a423d474a5 100644 --- a/src/frontends/qt2/ui/QCitationDialog.ui +++ b/src/frontends/qt2/ui/QCitationDialog.ui @@ -13,15 +13,15 @@ 0 0 - 522 - 365 + 509 + 351 caption Citation - + margin 11 @@ -30,656 +30,7 @@ spacing 6 - - QLayoutWidget - - name - Layout17 - - - - margin - 0 - - - spacing - 6 - - - QLayoutWidget - - name - Layout24 - - - - margin - 0 - - - spacing - 6 - - - QLayoutWidget - - name - Layout1 - - - - margin - 0 - - - spacing - 6 - - - QPushButton - - name - addPB - - - sizePolicy - - 0 - 0 - - - - text - - - - pixmap - image0 - - - toolTip - Add the selected citation - - - - QPushButton - - name - delPB - - - sizePolicy - - 0 - 0 - - - - text - - - - pixmap - image1 - - - toolTip - Remove the selected citation - - - - QPushButton - - name - upPB - - - sizePolicy - - 0 - 0 - - - - text - - - - pixmap - image2 - - - toolTip - Move the selected citation up - - - - QPushButton - - name - downPB - - - sizePolicy - - 0 - 0 - - - - text - - - - pixmap - image3 - - - toolTip - Move the selected citation down - - - - - - QLabel - - name - bibliographyKeysLA - - - text - Bibliography keys - - - - QLabel - - name - insetKeysLA - - - text - Inset keys - - - - QListBox - - - text - New Item - - - - name - bibLB - - - toolTip - Available citation keys - - - - QListBox - - - text - New Item - - - - name - citeLB - - - selectionMode - Single - - - toolTip - Citations currently selected - - - - - - QLayoutWidget - - name - Layout16 - - - - margin - 0 - - - spacing - 6 - - - QLayoutWidget - - name - Layout13 - - - - margin - 0 - - - spacing - 6 - - - QLabel - - name - infoLA - - - text - Info - - - - QMultiLineEdit - - name - infoML - - - focusPolicy - NoFocus - - - wordWrap - WidgetWidth - - - readOnly - true - - - toolTip - Citation entry - - - - - - QGroupBox - - name - GroupBox4 - - - title - Search - - - - margin - 11 - - - spacing - 6 - - - QLineEdit - - name - searchED - - - toolTip - Search the available citations - - - - QLayoutWidget - - name - Layout37 - - - - margin - 0 - - - spacing - 6 - - - QCheckBox - - name - searchTypeCB - - - text - Regular E&xpression - - - toolTip - Interpret search entry as a regular expression - - - - - name - Spacer2_2 - - - orientation - Horizontal - - - sizeType - Expanding - - - sizeHint - - 20 - 20 - - - - - QPushButton - - name - previousPB - - - text - &Previous - - - - - - QLayoutWidget - - name - Layout38 - - - - margin - 0 - - - spacing - 6 - - - QCheckBox - - name - searchCaseCB - - - text - &Case sensitive - - - toolTip - Make the search case-sensitive - - - - - name - Spacer3_2 - - - orientation - Horizontal - - - sizeType - Expanding - - - sizeHint - - 20 - 20 - - - - - QPushButton - - name - nextPB - - - text - &Next - - - - - - - - - - - - QLayoutWidget - - name - Layout18 - - - - margin - 0 - - - spacing - 6 - - - QLayoutWidget - - name - Layout19 - - - - margin - 0 - - - spacing - 6 - - - QLabel - - name - citationStyleLA - - - text - Citation style - - - - QComboBox - - name - citationStyleCO - - - sizePolicy - - 3 - 0 - - - - toolTip - Natbib citation style to use - - - - - - - name - Spacer16 - - - orientation - Horizontal - - - sizeType - Expanding - - - sizeHint - - 20 - 20 - - - - - QLayoutWidget - - name - Layout17 - - - - margin - 0 - - - spacing - 6 - - - QCheckBox - - name - fulllistCB - - - text - &Full author list - - - toolTip - List all authors - - - - QCheckBox - - name - forceuppercaseCB - - - text - Force &upper case - - - toolTip - Force upper case in citation - - - - - - - - QLayoutWidget - - name - Layout14 - - - - margin - 0 - - - spacing - 6 - - - QLineEdit - - name - textAfterED - - - sizePolicy - - 7 - 0 - - - - toolTip - Text to place after citation - - - - QLabel - - name - textAfterLA - - - text - Text after - - - - QLineEdit - - name - textBeforeED - - - sizePolicy - - 7 - 0 - - - - toolTip - Text to place before citation - - - - QLabel - - name - textBeforeLA - - - text - Text before - - - - - + QLayoutWidget name @@ -769,7 +120,588 @@ - + + QLabel + + name + textAfterLA + + + text + Text after + + + + QLabel + + name + citationStyleLA + + + text + Citation style + + + + QComboBox + + name + citationStyleCO + + + sizePolicy + + 3 + 0 + + + + toolTip + Natbib citation style to use + + + + QLabel + + name + textBeforeLA + + + text + Text before + + + + QLayoutWidget + + name + Layout16 + + + + margin + 0 + + + spacing + 6 + + + QLayoutWidget + + name + Layout13 + + + + margin + 0 + + + spacing + 6 + + + QLabel + + name + infoLA + + + text + Info + + + + QMultiLineEdit + + name + infoML + + + focusPolicy + NoFocus + + + wordWrap + WidgetWidth + + + readOnly + true + + + toolTip + Citation entry + + + + + + QGroupBox + + name + GroupBox4 + + + title + Search + + + + margin + 11 + + + spacing + 6 + + + QLineEdit + + name + searchED + + + toolTip + Search the available citations + + + + QLayoutWidget + + name + Layout37 + + + + margin + 0 + + + spacing + 6 + + + QCheckBox + + name + searchTypeCB + + + text + Regular E&xpression + + + toolTip + Interpret search entry as a regular expression + + + + + name + Spacer2_2 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QPushButton + + name + previousPB + + + text + &Previous + + + + + + QLayoutWidget + + name + Layout38 + + + + margin + 0 + + + spacing + 6 + + + QCheckBox + + name + searchCaseCB + + + text + &Case sensitive + + + toolTip + Make the search case-sensitive + + + + + name + Spacer3_2 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QPushButton + + name + nextPB + + + text + &Next + + + + + + + + + + QLayoutWidget + + name + Layout24 + + + + margin + 0 + + + spacing + 6 + + + QLayoutWidget + + name + Layout1 + + + + margin + 0 + + + spacing + 6 + + + QPushButton + + name + addPB + + + sizePolicy + + 0 + 0 + + + + text + + + + pixmap + image0 + + + toolTip + Add the selected citation + + + + QPushButton + + name + delPB + + + sizePolicy + + 0 + 0 + + + + text + + + + pixmap + image1 + + + toolTip + Remove the selected citation + + + + QPushButton + + name + upPB + + + sizePolicy + + 0 + 0 + + + + text + + + + pixmap + image2 + + + toolTip + Move the selected citation up + + + + QPushButton + + name + downPB + + + sizePolicy + + 0 + 0 + + + + text + + + + pixmap + image3 + + + toolTip + Move the selected citation down + + + + + + QLabel + + name + bibliographyKeysLA + + + text + Available + + + + QLabel + + name + insetKeysLA + + + text + Selected + + + + QListBox + + + text + New Item + + + + name + bibLB + + + toolTip + Available citation keys + + + + QListBox + + + text + New Item + + + + name + citeLB + + + selectionMode + Single + + + toolTip + Citations currently selected + + + + + + QLineEdit + + name + textAfterED + + + sizePolicy + + 7 + 0 + + + + toolTip + Text to place after citation + + + + QLayoutWidget + + name + Layout15 + + + + margin + 0 + + + spacing + 6 + + + + name + Spacer8 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QCheckBox + + name + fulllistCB + + + text + &Full author list + + + toolTip + List all authors + + + + QCheckBox + + name + forceuppercaseCB + + + text + Force &upper case + + + toolTip + Force upper case in citation + + + + + + QLineEdit + + name + textBeforeED + + + sizePolicy + + 7 + 0 + + + + toolTip + Text to place before citation + + + diff --git a/src/frontends/qt2/ui/QShowFileDialog.ui b/src/frontends/qt2/ui/QShowFileDialog.ui new file mode 100644 index 0000000000..4036299798 --- /dev/null +++ b/src/frontends/qt2/ui/QShowFileDialog.ui @@ -0,0 +1,102 @@ + +QShowFileDialogBase +config.h +gettext.h + + QDialog + + name + QShowFileDialogBase + + + geometry + + 0 + 0 + 305 + 259 + + + + caption + File: + + + + margin + 11 + + + spacing + 6 + + + QTextView + + name + text + + + toolTip + + + + + QLayoutWidget + + name + Layout3 + + + + margin + 0 + + + spacing + 6 + + + + name + Spacer3 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QPushButton + + name + closePB + + + text + &Close + + + default + true + + + + + + + + change_adaptor() + +