Add texinfo dialog to qt2 frontend

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3419 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Edwin Leuven 2002-01-19 13:48:05 +00:00
parent 0a1aedb25a
commit cd7ee54cb1
8 changed files with 574 additions and 0 deletions

View File

@ -1,3 +1,11 @@
2002-01-19 Edwin Leuven <leuven@fee.uva.nl>
* QTexinfo.[Ch]: added
* QTexinfoDialog.[Ch]: added
* ui/QTexinfoDialog.ui: added
* Dialogs.C: add dialog
* Makefile.dialogs: idem
2002-01-18 Edwin Leuven <leuven@fee.uva.nl>
* QMinipage.C: compiles fixes (lyxlength related)

View File

@ -31,6 +31,7 @@
#include "QSearchDialog.h"
#include "QSpellcheckerDialog.h"
#include "QTabularCreateDialog.h"
#include "QTexinfoDialog.h"
#include "QThesaurusDialog.h"
#include "QURLDialog.h"
#include "QVCLogDialog.h"
@ -55,6 +56,7 @@
#include "QSearch.h"
#include "QSpellchecker.h"
#include "QTabularCreate.h"
#include "QTexinfo.h"
#include "QThesaurus.h"
#include "QURL.h"
#include "QVCLog.h"
@ -109,6 +111,7 @@ Dialogs::Dialogs(LyXView * lv)
add(new GUISearch<QSearch, Qt2BC>(*lv, *this));
add(new GUISpellchecker<QSpellchecker, Qt2BC>(*lv, *this));
add(new GUITabularCreate<QTabularCreate, Qt2BC>(*lv, *this));
add(new GUITexinfo<QTexinfo, Qt2BC>(*lv, *this));
add(new GUIThesaurus<QThesaurus, Qt2BC>(*lv, *this));
add(new GUIUrl<QURL, Qt2BC>(*lv, *this));
add(new GUIVCLog<QVCLog, Qt2BC>(*lv, *this));

View File

@ -22,6 +22,7 @@ DIALOGS = \
QSearch \
QSpellchecker \
QTabularCreate \
QTexinfo \
QThesaurus \
QToc \
QURL \
@ -70,6 +71,8 @@ DIALOGSOURCES = \
QSpellchecker.C QSpellcheckerDialog.C \
QTabularCreate.h QTabularCreateDialog.h \
QTabularCreate.C QTabularCreateDialog.C \
QTexinfo.h QTexinfoDialog.h \
QTexinfo.C QTexinfoDialog.C \
QThesaurus.h QThesaurusDialog.h \
QThesaurus.C QThesaurusDialog.C \
QToc.h QTocDialog.h \
@ -101,6 +104,7 @@ MOCDIALOGS = \
QSearchDialog_moc.C \
QSpellcheckerDialog_moc.C \
QTabularCreateDialog_moc.C \
QTexinfoDialog_moc.C \
QThesaurusDialog_moc.C \
QTocDialog_moc.C \
QURLDialog_moc.C \
@ -149,6 +153,8 @@ UIDIALOGS = \
QSpellcheckerDialogBase.C \
QTabularCreateDialogBase.h \
QTabularCreateDialogBase.C \
QTexinfoDialogBase.h \
QTexinfoDialogBase.C \
QThesaurusDialogBase.h \
QThesaurusDialogBase.C \
QTocDialogBase.h \
@ -180,7 +186,12 @@ UIMOCDIALOGS = \
QSearchDialogBase_moc.C \
QSpellcheckerDialogBase_moc.C \
QTabularCreateDialogBase_moc.C \
QTexinfoDialogBase_moc.C \
QThesaurusDialogBase_moc.C \
QTocDialogBase_moc.C \
QURLDialogBase_moc.C \
QVCLogDialogBase_moc.C

View File

@ -0,0 +1,67 @@
/**
* \file QTexinfo.C
* Copyright 2002 the LyX Team
* Read the file COPYING
*
* \author Edwin Leuven <leuven@fee.uva.nl>
*/
#include <config.h>
#include <vector>
#ifdef __GNUG__
#pragma implementation
#endif
#include "ControlTexinfo.h"
#include "QTexinfoDialog.h"
#include "QTexinfo.h"
#include "Qt2BC.h"
#include "gettext.h"
#include "helper_funcs.h"
#include <qlistbox.h>
#include <qpushbutton.h>
#include <qcheckbox.h>
typedef Qt2CB<ControlTexinfo, Qt2DB<QTexinfoDialog> > base_class;
QTexinfo::QTexinfo(ControlTexinfo & c)
: base_class(c, _("LaTeX Information")), warningPosted(false), activeStyle(ControlTexinfo::cls)
{
}
void QTexinfo::build_dialog()
{
dialog_.reset(new QTexinfoDialog(this));
updateStyles(ControlTexinfo::cls);
bc().setCancel(dialog_->closePB);
}
void QTexinfo::updateStyles(ControlTexinfo::texFileSuffix whichStyle)
{
bool const withFullPath = dialog_->path->isChecked();
string const str = controller().getContents(whichStyle, withFullPath);
std::vector<string> flist = getVectorFromString(str,"\n");
dialog_->fileList->clear();
for (vector<string>::const_iterator fitem = flist.begin();
fitem != flist.end(); ++fitem) {
dialog_->fileList->insertItem((*fitem).c_str());
}
activeStyle = whichStyle;
}
void QTexinfo::updateStyles()
{
updateStyles(activeStyle);
}

View File

@ -0,0 +1,50 @@
// -*- C++ -*-
/**
* \file QTexinfo.h
* Copyright 2002 the LyX Team
* Read the file COPYING
*
* \author Edwin Leuven <leuven@fee.uva.nl>
*/
#ifndef QTEXINFO_H
#define QTEXINFO_H
#ifdef __GNUG__
#pragma interface
#endif
#include "Qt2Base.h"
#include "ControlTexinfo.h"
class QTexinfoDialog;
///
class QTexinfo
: public Qt2CB<ControlTexinfo, Qt2DB<QTexinfoDialog> >
{
public:
///
friend class QTexinfoDialog;
///
QTexinfo(ControlTexinfo &);
private:
/// Apply changes
virtual void apply() { };
/// update (do we need this?)
virtual void update_contents() {};
/// build the dialog
virtual void build_dialog();
///
void updateStyles(ControlTexinfo::texFileSuffix);
///
void updateStyles();
///
bool warningPosted;
///
ControlTexinfo::texFileSuffix activeStyle;
};
#endif // QTEXINFO_H

View File

@ -0,0 +1,83 @@
/**
* \file QTexinfoDialog.C
* Copyright 2002 the LyX Team
* Read the file COPYING
*
* \author Edwin Leuven <leuven@fee.uva.nl>
*/
#include <config.h>
#include <vector>
#include "LString.h"
#include "ControlTexinfo.h"
#include "QTexinfoDialog.h"
#include "Dialogs.h"
#include "QTexinfo.h"
#include <qlistbox.h>
#include <qpushbutton.h>
#include <qcombobox.h>
QTexinfoDialog::QTexinfoDialog(QTexinfo * form)
: QTexinfoDialogBase(0, 0, false, 0),
form_(form)
{
connect(closePB, SIGNAL(clicked()),
form, SLOT(slotClose()));
}
void QTexinfoDialog::change_adaptor()
{
form_->changed();
}
void QTexinfoDialog::closeEvent(QCloseEvent * e)
{
form_->slotWMHide();
e->accept();
}
void QTexinfoDialog::helpClicked()
{
form_->controller().help();
}
void QTexinfoDialog::rescanClicked()
{
// build new *Files.lst
form_->controller().rescanStyles();
form_->updateStyles();
}
void QTexinfoDialog::viewClicked()
{
string const sel(fileList->currentText());
// a valid entry?
if (!sel.empty()) {
form_->controller().viewFile(sel.c_str());
}
}
void QTexinfoDialog::update()
{
int item = whatStyle->currentItem();
switch (item) {
case 0:
form_->updateStyles(ControlTexinfo::cls);
break;
case 1:
form_->updateStyles(ControlTexinfo::sty);
break;
case 2:
form_->updateStyles(ControlTexinfo::bst);
break;
default:
break;
}
}

View File

@ -0,0 +1,38 @@
/**
* \file QTexinfoDialog.h
* Copyright 2002 the LyX Team
* Read the file COPYING
*
* \author Edwin Leuven <leuven@fee.uva.nl>
*/
#ifndef QTEXINFODIALOG_H
#define QTEXINFODIALOG_H
#include <config.h>
#include "ui/QTexinfoDialogBase.h"
class QTexinfo;
class QTexinfoDialog : public QTexinfoDialogBase
{ Q_OBJECT
public:
QTexinfoDialog(QTexinfo * form);
protected slots:
virtual void change_adaptor();
virtual void helpClicked();
virtual void rescanClicked();
virtual void viewClicked();
virtual void update();
protected:
virtual void closeEvent(QCloseEvent * e);
private:
QTexinfo * form_;
};
#endif // QTEXINFODIALOG_H

View File

@ -0,0 +1,314 @@
<!DOCTYPE UI><UI>
<class>QTexinfoDialogBase</class>
<include location="global">config.h</include>
<include location="local">gettext.h</include>
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
<cstring>QTexinfoDialogBase</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
<width>299</width>
<height>290</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Form1</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>Layout1</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>QComboBox</class>
<item>
<property>
<name>text</name>
<string>LaTeX classes</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>LaTeX styles</string>
</property>
</item>
<item>
<property>
<name>text</name>
<string>BibTeX styles</string>
</property>
</item>
<property stdset="1">
<name>name</name>
<cstring>whatStyle</cstring>
</property>
<property>
<name>toolTip</name>
<string>Selected classes or styles</string>
</property>
</widget>
<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>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>path</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Show &amp;path</string>
</property>
<property>
<name>toolTip</name>
<string>Toggles view of the file list</string>
</property>
</widget>
</hbox>
</widget>
<widget>
<class>QListBox</class>
<item>
<property>
<name>text</name>
<string>New Item</string>
</property>
</item>
<property stdset="1">
<name>name</name>
<cstring>fileList</cstring>
</property>
<property>
<name>toolTip</name>
<string>Installed files</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>Spacer5</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>rescanPB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Rescan</string>
</property>
<property>
<name>toolTip</name>
<string>Built new file list</string>
</property>
</widget>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>viewPB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;View</string>
</property>
<property>
<name>toolTip</name>
<string>Show contents of marked file. Only possible when files are shown with path</string>
</property>
</widget>
</hbox>
</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>helpPB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Help</string>
</property>
<property>
<name>toolTip</name>
<string>Bring up help file</string>
</property>
</widget>
<spacer>
<property>
<name>name</name>
<cstring>Spacer4</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>
<name>toolTip</name>
<string>Close this dialog</string>
</property>
</widget>
</hbox>
</widget>
</vbox>
</widget>
<connections>
<connection>
<sender>viewPB</sender>
<signal>clicked()</signal>
<receiver>QTexinfoDialogBase</receiver>
<slot>viewClicked()</slot>
</connection>
<connection>
<sender>helpPB</sender>
<signal>clicked()</signal>
<receiver>QTexinfoDialogBase</receiver>
<slot>helpClicked()</slot>
</connection>
<connection>
<sender>rescanPB</sender>
<signal>clicked()</signal>
<receiver>QTexinfoDialogBase</receiver>
<slot>rescanClicked()</slot>
</connection>
<connection>
<sender>path</sender>
<signal>stateChanged(int)</signal>
<receiver>QTexinfoDialogBase</receiver>
<slot>update()</slot>
</connection>
<connection>
<sender>whatStyle</sender>
<signal>activated(int)</signal>
<receiver>QTexinfoDialogBase</receiver>
<slot>update()</slot>
</connection>
<slot access="protected">helpClicked()</slot>
<slot access="protected">rescanClicked()</slot>
<slot access="protected">update()</slot>
<slot access="protected">viewClicked()</slot>
</connections>
<tabstops>
<tabstop>whatStyle</tabstop>
<tabstop>path</tabstop>
<tabstop>viewPB</tabstop>
<tabstop>rescanPB</tabstop>
<tabstop>helpPB</tabstop>
<tabstop>closePB</tabstop>
</tabstops>
</UI>