remove preamble dialog from the qt frontend

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5939 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Edwin Leuven 2003-01-13 09:57:15 +00:00
parent 2903fd3fc5
commit c53189af58
9 changed files with 9 additions and 441 deletions

View File

@ -1,3 +1,12 @@
2003-01-12 Edwin Leuven <e.leuven@uva.nl>
* ui/QPreambleDialog.ui:
* QPreamble.[Ch]:
* QPreambleDialog.[Ch]:
* Dialogs.C:
* Dialogs_impl.h:
* Makefile.dialogs: Remove preamble dialog
2003-01-12 Alfredo Braunstein <abraunst@libero.it>
* QSpellcheckerDialog.C (spellcheck,update_contents): enable/disable

View File

@ -61,7 +61,6 @@ Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
logfile(lv, d),
minipage(lv, d),
paragraph(lv, d),
preamble(lv, d),
prefs(lv, d),
print(lv, d),
ref(lv, d),

View File

@ -36,7 +36,6 @@
#include "ControlLog.h"
#include "ControlMinipage.h"
#include "ControlParagraph.h"
#include "ControlPreamble.h"
#include "ControlPrefs.h"
#include "ControlPrint.h"
#include "ControlRef.h"
@ -89,8 +88,6 @@
#include "QMinipageDialog.h"
#include "QParagraph.h"
#include "QParagraphDialog.h"
#include "QPreamble.h"
#include "QPreambleDialog.h"
#include "QPrefs.h"
#include "QPrefsDialog.h"
#include "QPrint.h"
@ -182,9 +179,6 @@ MinipageDialog;
typedef GUI<ControlParagraph, QParagraph, OkApplyCancelReadOnlyPolicy, Qt2BC>
ParagraphDialog;
typedef GUI<ControlPreamble, QPreamble, NoRepeatedApplyReadOnlyPolicy, Qt2BC>
PreambleDialog;
typedef GUI<ControlPrefs, QPrefs, OkApplyCancelPolicy, Qt2BC>
PrefsDialog;
@ -250,7 +244,6 @@ struct Dialogs::Impl {
LogFileDialog logfile;
MinipageDialog minipage;
ParagraphDialog paragraph;
PreambleDialog preamble;
PrefsDialog prefs;
PrintDialog print;
RefDialog ref;

View File

@ -19,7 +19,6 @@ DIALOGS = \
QMath \
QMinipage \
QParagraph \
QPreamble \
QPrefs \
QPrint \
QRef \
@ -73,8 +72,6 @@ DIALOGSOURCES = \
QMinipage.C QMinipageDialog.C \
QParagraph.h QParagraphDialog.h \
QParagraph.C QParagraphDialog.C \
QPreamble.h QPreambleDialog.h \
QPreamble.C QPreambleDialog.C \
QPrefs.h QPrefsDialog.h \
QPrefs.C QPrefsDialog.C \
QPrint.h QLPrintDialog.h \
@ -126,7 +123,6 @@ MOCDIALOGS = \
QMathMatrixDialog_moc.C \
QMinipageDialog_moc.C \
QParagraphDialog_moc.C \
QPreambleDialog_moc.C \
QPrefsDialog_moc.C \
QLPrintDialog_moc.C \
QRefDialog_moc.C \
@ -184,8 +180,6 @@ UIDIALOGS = \
QMinipageDialogBase.C \
QParagraphDialogBase.h \
QParagraphDialogBase.C \
QPreambleDialogBase.h \
QPreambleDialogBase.C \
QPrefsDialogBase.h \
QPrefsDialogBase.C \
QPrintDialogBase.h \
@ -261,7 +255,6 @@ UIDIALOGS = \
QMathMatrixDialogBase_moc.C \
QMinipageDialogBase_moc.C \
QParagraphDialogBase_moc.C \
QPreambleDialogBase_moc.C \
QPrefsDialogBase_moc.C \
QPrintDialogBase_moc.C \
QRefDialogBase_moc.C \

View File

@ -1,56 +0,0 @@
/**
* \file QPreamble.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
*
* Full author contact details are available in file CREDITS
*/
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "qt_helpers.h"
#include "LyXView.h"
#include "ControlPreamble.h"
#include "QPreamble.h"
#include "QPreambleDialog.h"
#include "Qt2BC.h"
#include <qmultilineedit.h>
#include <qpushbutton.h>
typedef Qt2CB<ControlPreamble, Qt2DB<QPreambleDialog> > base_class;
QPreamble::QPreamble()
: base_class(qt_("LaTeX Preamble"))
{
}
void QPreamble::build_dialog()
{
dialog_.reset(new QPreambleDialog(this));
bc().setOK(dialog_->okPB);
bc().setApply(dialog_->applyPB);
bc().setCancel(dialog_->closePB);
}
void QPreamble::update_contents()
{
dialog_->preambleLE->setText(toqstr(controller().params()));
}
void QPreamble::apply()
{
controller().params(fromqstr(dialog_->preambleLE->text()));
}

View File

@ -1,42 +0,0 @@
// -*- C++ -*-
/**
* \file QPreamble.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
*
* Full author contact details are available in file CREDITS
*/
#ifndef QPREAMBLE_H
#define QPREAMBLE_H
#ifdef __GNUG__
#pragma interface
#endif
#include "Qt2Base.h"
class ControlPreamble;
class QPreambleDialog;
///
class QPreamble
: public Qt2CB<ControlPreamble, Qt2DB<QPreambleDialog> >
{
public:
///
friend class QPreambleDialog;
///
QPreamble();
private:
/// Apply changes
virtual void apply();
/// update
virtual void update_contents();
/// build the dialog
virtual void build_dialog();
};
#endif // QPREAMBLE_H

View File

@ -1,113 +0,0 @@
/**
* \file QPreambleDialog.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
*
* Full author contact details are available in file CREDITS
*/
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "Lsstream.h"
#include "support/lyxlib.h"
#include "support/forkedcall.h"
#include "support/filetools.h"
#include "qt_helpers.h"
#include "LyXView.h"
#include "ControlPreamble.h"
#include "QPreamble.h"
#include "QPreambleDialog.h"
#include <qpushbutton.h>
#include <qmultilineedit.h>
#include <qinputdialog.h>
#include <fstream>
using std::getline;
QPreambleDialog::QPreambleDialog(QPreamble * form)
: QPreambleDialogBase(0, 0, false, 0),
form_(form)
{
connect(okPB, SIGNAL(clicked()),
form, SLOT(slotOK()));
connect(applyPB, SIGNAL(clicked()),
form, SLOT(slotApply()));
connect(closePB, SIGNAL(clicked()),
form, SLOT(slotClose()));
}
void QPreambleDialog::closeEvent(QCloseEvent * e)
{
form_->slotWMHide();
e->accept();
}
void QPreambleDialog::change_adaptor()
{
form_->changed();
}
void QPreambleDialog::editClicked()
{
// find an editor
string editor = GetEnv("EDITOR");
if (editor.empty()) {
static string lastentry;
editor = fromqstr(QInputDialog::getText(
qt_("Enter editor program"), qt_("Editor"), QLineEdit::Normal,
toqstr(lastentry)));
if (editor.empty())
return;
lastentry = editor;
}
string const text(fromqstr(preambleLE->text()));
string const filename(lyx::tempName("", "preamble"));
std::ofstream file(filename.c_str());
// FIXME ?
if (!file)
return;
file << text;
file.close();
editor += ' ' + filename;
Forkedcall call;
// FIXME: make async
if (call.startscript(Forkedcall::Wait, editor)) {
lyx::unlink(filename);
return;
}
std::ifstream in(filename.c_str());
if (!in) {
lyx::unlink(filename);
return;
}
ostringstream newtext;
newtext << in.rdbuf();
// close the files before we delete the file
in.close();
lyx::unlink(filename);
preambleLE->setText(toqstr(newtext.str()));
}

View File

@ -1,36 +0,0 @@
// -*- C++ -*-
/**
* \file QPreambleDialog.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
*
* Full author contact details are available in file CREDITS
*/
#ifndef QPreambleDIAPreamble_H
#define QPreambleDIAPreamble_H
#ifdef __GNUG__
#pragma interface
#endif
#include "ui/QPreambleDialogBase.h"
class QPreamble;
class QPreambleDialog : public QPreambleDialogBase {
Q_OBJECT
public:
QPreambleDialog(QPreamble * form);
protected slots:
virtual void editClicked();
virtual void change_adaptor();
protected:
virtual void closeEvent(QCloseEvent * e);
private:
QPreamble * form_;
};
#endif // QPreambleDIAPreamble_H

View File

@ -1,179 +0,0 @@
<!DOCTYPE UI><UI>
<class>QPreambleDialogBase</class>
<include location="global">config.h</include>
<include location="local">qt_helpers.h</include>
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
<cstring>QPreambleDialogBase</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
<width>412</width>
<height>328</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>LaTeX pre-amble</string>
</property>
<property stdset="1">
<name>sizeGripEnabled</name>
<bool>true</bool>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
<number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QMultiLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>preambleLE</cstring>
</property>
<property>
<name>toolTip</name>
<string>The LaTeX pre-amble</string>
</property>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout2</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>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>editPB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Edit ...</string>
</property>
<property stdset="1">
<name>default</name>
<bool>true</bool>
</property>
<property>
<name>toolTip</name>
<string>Edit the pre-amble in an external editor</string>
</property>
</widget>
<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>okPB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;OK</string>
</property>
<property stdset="1">
<name>default</name>
<bool>true</bool>
</property>
<property>
<name>toolTip</name>
<string></string>
</property>
</widget>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>applyPB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Apply</string>
</property>
<property stdset="1">
<name>default</name>
<bool>true</bool>
</property>
<property>
<name>toolTip</name>
<string></string>
</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>preambleLE</sender>
<signal>textChanged()</signal>
<receiver>QPreambleDialogBase</receiver>
<slot>change_adaptor()</slot>
</connection>
<connection>
<sender>editPB</sender>
<signal>clicked()</signal>
<receiver>QPreambleDialogBase</receiver>
<slot>editClicked()</slot>
</connection>
<slot access="public">change_adaptor()</slot>
<slot access="public">editClicked()</slot>
</connections>
<tabstops>
<tabstop>preambleLE</tabstop>
<tabstop>editPB</tabstop>
<tabstop>okPB</tabstop>
<tabstop>applyPB</tabstop>
<tabstop>closePB</tabstop>
</tabstops>
</UI>