add showfile dialog to qt2 frontend

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3448 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Edwin Leuven 2002-01-29 10:05:09 +00:00
parent b28cf0655f
commit 76ff845d19
10 changed files with 857 additions and 670 deletions

View File

@ -1,3 +1,15 @@
2002-01-29 Edwin Leuven <leuven@fee.uva.nl>
* 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 <a.leeming@ic.ac.uk>
* Dialogs.C: removed now redundant #include "QParagraph.h".

View File

@ -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<QPrint, Qt2BC>(*lv, *this));
add(new GUIRef<QRef, Qt2BC>(*lv, *this));
add(new GUISearch<QSearch, Qt2BC>(*lv, *this));
add(new GUIShowFile<QShowFile, Qt2BC>(*lv, *this));
add(new GUISpellchecker<QSpellchecker, Qt2BC>(*lv, *this));
add(new GUITabularCreate<QTabularCreate, Qt2BC>(*lv, *this));
add(new GUITexinfo<QTexinfo, Qt2BC>(*lv, *this));
@ -115,13 +116,10 @@ Dialogs::Dialogs(LyXView * lv)
add(new GUIUrl<QURL, Qt2BC>(*lv, *this));
add(new GUIVCLog<QVCLog, Qt2BC>(*lv, *this));
// dialogs not yet converted
add(new GUIShowFile<FormShowFile, xformsBC>(*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));

View File

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

View File

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

View File

@ -0,0 +1,48 @@
/**
* \file QShowFile.C
* Copyright 2001 the LyX Team
* Read the file COPYING
*
* \author John Levon <moz@compsoc.man.ac.uk>
*/
#include <config.h>
#include "QShowFileDialog.h"
#include "ControlShowFile.h"
#include "QShowFile.h"
#include "Qt2BC.h"
#include "gettext.h"
#include <qtextview.h>
#include <qpushbutton.h>
typedef Qt2CB<ControlShowFile, Qt2DB<QShowFileDialog> > 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());
}

View File

@ -0,0 +1,35 @@
// -*- C++ -*-
/**
* \file QShowFile.h
* Copyright 2001 the LyX Team
* Read the file COPYING
*
* \author John Levon <moz@compsoc.man.ac.uk>
*/
#ifndef QSHOWFILE_H
#define QSHOWFILE_H
#include "Qt2Base.h"
class ControlShowFile;
class QShowFileDialog;
class QShowFile :
public Qt2CB<ControlShowFile, Qt2DB<QShowFileDialog> >
{
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

View File

@ -0,0 +1,29 @@
/**
* \file QShowFileDialog.C
* Copyright 2001 the LyX Team
* Read the file COPYING
*
* \author John Levon <moz@compsoc.man.ac.uk>
*/
#include "QShowFileDialog.h"
#include "Dialogs.h"
#include "QShowFile.h"
#include <qwidget.h>
#include <qpushbutton.h>
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();
}

View File

@ -0,0 +1,31 @@
/**
* \file QShowFileDialog.h
* Copyright 2001 the LyX Team
* Read the file COPYING
*
* \author John Levon <moz@compsoc.man.ac.uk>
*/
#ifndef QSHOWFILEDIALOG_H
#define QSHOWFILEDIALOG_H
#include <config.h>
#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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,102 @@
<!DOCTYPE UI><UI>
<class>QShowFileDialogBase</class>
<include location="global">config.h</include>
<include location="local">gettext.h</include>
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
<cstring>QShowFileDialogBase</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
<width>305</width>
<height>259</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>File: </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>QTextView</class>
<property stdset="1">
<name>name</name>
<cstring>text</cstring>
</property>
<property>
<name>toolTip</name>
<string></string>
</property>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout3</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>Spacer3</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>closePB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Close</string>
</property>
<property stdset="1">
<name>default</name>
<bool>true</bool>
</property>
</widget>
</hbox>
</widget>
</vbox>
</widget>
<connections>
<slot access="public">change_adaptor()</slot>
</connections>
</UI>