Log and VCLog dialogs for qt2

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2609 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2001-08-29 00:37:04 +00:00
parent ae3b2c7874
commit 7e1ba5f1f9
14 changed files with 639 additions and 9 deletions

View File

@ -1,3 +1,15 @@
2001-08-29 John Levon <moz@compsoc.man.ac.uk>
* QLog.[Ch]:
* QLogDialog.[Ch]:
* ui/QLogDialog.ui:
* QVCLog.[Ch]:
* QVCLogDialog.[Ch]:
* ui/QVCLogDialog.ui:
* Dialogs.C:
* Makefile.am:
* Makefile.dialogs: add log and vclog dialogs
2001-08-28 John Levon <moz@compsoc.man.ac.uk>
* Dialogs.C:

View File

@ -23,10 +23,12 @@
#include "QGraphicsDialog.h"
#include "QIncludeDialog.h"
#include "QIndexDialog.h"
#include "QLogDialog.h"
#include "QRefDialog.h"
#include "QTabularCreateDialog.h"
#include "QThesaurusDialog.h"
#include "QURLDialog.h"
#include "QVCLogDialog.h"
#include "QAbout.h"
#include "QBibitem.h"
@ -39,6 +41,7 @@
#include "QGraphics.h"
#include "QInclude.h"
#include "QIndex.h"
#include "QLog.h"
#include "QParagraph.h"
#include "QPrint.h"
#include "QRef.h"
@ -47,6 +50,7 @@
#include "QTabularCreate.h"
#include "QThesaurus.h"
#include "QURL.h"
#include "QVCLog.h"
#include "QtLyXView.h"
#include "Dialogs.h"
@ -66,17 +70,18 @@
#include "controllers/ControlGraphics.h"
#include "controllers/ControlInclude.h"
#include "controllers/ControlIndex.h"
#include "controllers/ControlLog.h"
#include "controllers/ControlRef.h"
#include "controllers/ControlSplash.h"
#include "controllers/ControlTabularCreate.h"
#include "controllers/ControlThesaurus.h"
#include "controllers/ControlUrl.h"
#include "controllers/ControlVCLog.h"
#if 0
#include "controllers/ControlButtons.h"
#include "controllers/ControlCitation.h"
#include "controllers/ControlFloat.h"
#include "controllers/ControlLabel.h"
#include "controllers/ControlLog.h"
#include "controllers/ControlMinipage.h"
#include "controllers/ControlPreamble.h"
#include "controllers/ControlPrint.h"
@ -84,7 +89,6 @@
#include "controllers/ControlSearch.h"
#include "controllers/ControlSpellchecker.h"
#include "controllers/ControlToc.h"
#include "controllers/ControlVCLog.h"
#endif
#include "GUI.h"
@ -109,10 +113,12 @@ Dialogs::Dialogs(LyXView * lv)
add(new GUIGraphics<QGraphics, Qt2BC>(*lv, *this));
add(new GUIInclude<QInclude, Qt2BC>(*lv, *this));
add(new GUIIndex<QIndex, Qt2BC>(*lv, *this));
add(new GUILog<QLog, Qt2BC>(*lv, *this));
add(new GUIRef<QRef, Qt2BC>(*lv, *this));
add(new GUITabularCreate<QTabularCreate, Qt2BC>(*lv, *this));
add(new GUIThesaurus<QThesaurus, Qt2BC>(*lv, *this));
add(new GUIUrl<QURL, Qt2BC>(*lv, *this));
add(new GUIVCLog<QVCLog, Qt2BC>(*lv, *this));
// reduce the number of connections needed in
// dialogs by a simple connection here.

View File

@ -27,7 +27,6 @@ libqt2_la_OBJADD = \
../xforms/FormDocument.lo \
../xforms/FormIndex.lo \
../xforms/FormInset.lo \
../xforms/FormLog.lo \
../xforms/FormMinipage.lo \
../xforms/FormPreamble.lo \
../xforms/FormPreferences.lo \
@ -35,7 +34,6 @@ libqt2_la_OBJADD = \
../xforms/FormTabular.lo \
../xforms/FormToc.lo \
../xforms/FormUrl.lo \
../xforms/FormVCLog.lo \
../xforms/MathsSymbols.lo \
../xforms/Menubar_pimpl.lo \
../xforms/RadioButtonGroup.lo \

View File

@ -13,6 +13,7 @@ DIALOGS = \
QGraphics \
QInclude \
QIndex \
QLog \
QParagraph \
QPrint \
QRef \
@ -21,7 +22,8 @@ DIALOGS = \
QTabularCreate \
QThesaurus \
QToc \
QURL
QURL \
QVCLog
DIALOGSOURCES = \
QAbout.h QAboutDialog.h \
@ -48,6 +50,8 @@ DIALOGSOURCES = \
QInclude.C QIncludeDialog.C \
QIndex.h QIndexDialog.h \
QIndex.C QIndexDialog.C \
QLog.h QLogDialog.h \
QLog.C QLogDialog.C \
QParagraph.h QParagraphDialog.h \
QParagraph.C QParagraphDialog.C \
QPrint.h QPrintDialog.h \
@ -65,7 +69,9 @@ DIALOGSOURCES = \
QToc.h QTocDialog.h \
QToc.C QTocDialog.C \
QURL.h QURLDialog.h \
QURL.C QURLDialog.C
QURL.C QURLDialog.C \
QVCLog.h QVCLogDialog.h \
QVCLog.C QVCLogDialog.C
MOCDIALOGS = \
QAboutDialog_moc.C \
@ -80,6 +86,7 @@ MOCDIALOGS = \
QGraphicsDialog_moc.C \
QIncludeDialog_moc.C \
QIndexDialog_moc.C \
QLogDialog_moc.C \
QParagraphDialog_moc.C \
QPrintDialog_moc.C \
QRefDialog_moc.C \
@ -88,7 +95,8 @@ MOCDIALOGS = \
QTabularCreateDialog_moc.C \
QThesaurusDialog_moc.C \
QTocDialog_moc.C \
QURLDialog_moc.C
QURLDialog_moc.C \
QVCLogDialog_moc.C
UIDIALOGS = \
QAboutDialogBase.h \
@ -115,6 +123,8 @@ UIDIALOGS = \
QIncludeDialogBase.C \
QIndexDialogBase.h \
QIndexDialogBase.C \
QLogDialogBase.h \
QLogDialogBase.C \
QParagraphDialogBase.h \
QParagraphDialogBase.C \
QPrintDialogBase.h \
@ -130,7 +140,9 @@ UIDIALOGS = \
QTocDialogBase.h \
QTocDialogBase.C \
QURLDialogBase.h \
QURLDialogBase.C
QURLDialogBase.C \
QVCLogDialogBase.h \
QVCLogDialogBase.C
UIMOCDIALOGS = \
QAboutDialogBase_moc.C \
@ -145,6 +157,7 @@ UIMOCDIALOGS = \
QGraphicsDialogBase_moc.C \
QIncludeDialogBase_moc.C \
QIndexDialogBase_moc.C \
QLogDialogBase_moc.C \
QParagraphDialogBase_moc.C \
QPrintDialogBase_moc.C \
QRefDialogBase_moc.C \
@ -152,4 +165,5 @@ UIMOCDIALOGS = \
QTabularCreateDialogBase_moc.C \
QThesaurusDialogBase_moc.C \
QTocDialogBase_moc.C \
QURLDialogBase_moc.C
QURLDialogBase_moc.C \
QVCLogDialogBase_moc.C

70
src/frontends/qt2/QLog.C Normal file
View File

@ -0,0 +1,70 @@
/**
* \file QLog.C
* Copyright 2001 the LyX Team
* Read the file COPYING
*
* \author John Levon <moz@compsoc.man.ac.uk>
*/
#include <config.h>
#include <fstream>
#ifdef __GNUG__
#pragma implementation
#endif
#include <qtextview.h>
#include <qpushbutton.h>
#include "QLogDialog.h"
#include "QLog.h"
#include "Qt2BC.h"
#include "gettext.h"
#include "QtLyXView.h"
#include "ControlLog.h"
typedef Qt2CB<ControlLog, Qt2DB<QLogDialog> > base_class;
QLog::QLog(ControlLog & c)
: base_class(c, _("Log"))
{
}
void QLog::build_dialog()
{
dialog_.reset(new QLogDialog(this));
bc().setCancel(dialog_->closePB);
}
void QLog::update_contents()
{
std::pair<Buffer::LogType, string> const logfile = controller().logfile();
if (logfile.first == Buffer::buildlog)
dialog_->setCaption(_("Build log"));
else
dialog_->setCaption(_("LaTeX log"));
dialog_->logTV->setText("");
ifstream ifstr(logfile.second.c_str());
if (!ifstr) {
if (logfile.first == Buffer::buildlog)
dialog_->logTV->setText(_("No build log file found"));
else
dialog_->logTV->setText(_("No LaTeX log file found"));
return;
}
string text;
string line;
while (getline(ifstr, line))
text += line + "\n";
dialog_->logTV->setText(text.c_str());
}

41
src/frontends/qt2/QLog.h Normal file
View File

@ -0,0 +1,41 @@
// -*- C++ -*-
/**
* \file QLog.h
* Copyright 2001 the LyX Team
* Read the file COPYING
*
* \author John Levon <moz@compsoc.man.ac.uk>
*/
#ifndef QLOG_H
#define QLOG_H
#ifdef __GNUG__
#pragma interface
#endif
#include "Qt2Base.h"
class ControlLog;
class QLogDialog;
///
class QLog
: public Qt2CB<ControlLog, Qt2DB<QLogDialog> >
{
public:
///
friend class QLogDialog;
///
QLog(ControlLog &);
private:
/// Apply changes
virtual void apply() {};
/// update
virtual void update_contents();
/// build the dialog
virtual void build_dialog();
};
#endif // QLOG_H

View File

@ -0,0 +1,40 @@
/**
* \file QLogDialog.C
* Copyright 2001 the LyX Team
* Read the file COPYING
*
* \author John Levon <moz@compsoc.man.ac.uk>
*/
#include <config.h>
#include <vector>
#include <qpushbutton.h>
#include <qtextview.h>
#include "QLogDialog.h"
#include "Dialogs.h"
#include "QLog.h"
#include "QtLyXView.h"
#include "ControlLog.h"
QLogDialog::QLogDialog(QLog * form)
: QLogDialogBase(0, 0, false, 0),
form_(form)
{
connect(closePB, SIGNAL(clicked()),
form, SLOT(slotClose()));
}
void QLogDialog::closeEvent(QCloseEvent * e)
{
form_->slotWMHide();
e->accept();
}
void QLogDialog::updateClicked()
{
form_->update_contents();
}

View File

@ -0,0 +1,34 @@
/**
* \file QLogDialog.h
* Copyright 2001 the LyX Team
* Read the file COPYING
*
* \author John Levon <moz@compsoc.man.ac.uk>
*/
#ifndef QLOGDIALOG_H
#define QLOGDIALOG_H
#include <config.h>
#include "ui/QLogDialogBase.h"
class QLog;
class QLogDialog : public QLogDialogBase
{ Q_OBJECT
public:
QLogDialog(QLog * form);
protected slots:
virtual void updateClicked();
protected:
virtual void closeEvent(QCloseEvent * e);
private:
QLog * form_;
};
#endif // QLOGDIALOG_H

View File

@ -0,0 +1,52 @@
/**
* \file QVCLog.C
* Copyright 2001 the LyX Team
* Read the file COPYING
*
* \author John Levon <moz@compsoc.man.ac.uk>
*/
#include <config.h>
#include "Lsstream.h"
#ifdef __GNUG__
#pragma implementation
#endif
#include <qtextview.h>
#include <qpushbutton.h>
#include "QVCLogDialog.h"
#include "QVCLog.h"
#include "Qt2BC.h"
#include "gettext.h"
#include "QtLyXView.h"
#include "ControlVCLog.h"
typedef Qt2CB<ControlVCLog, Qt2DB<QVCLogDialog> > base_class;
QVCLog::QVCLog(ControlVCLog & c)
: base_class(c, _("VCLog"))
{
}
void QVCLog::build_dialog()
{
dialog_.reset(new QVCLogDialog(this));
bc().setCancel(dialog_->closePB);
}
void QVCLog::update_contents()
{
dialog_->setCaption(string(_("Version control log for ") + controller().getBufferFileName()).c_str());
dialog_->vclogTV->setText("");
stringstream ss;
dialog_->vclogTV->setText(controller().getVCLogFile(ss).str().c_str());
}

View File

@ -0,0 +1,41 @@
// -*- C++ -*-
/**
* \file QVCLog.h
* Copyright 2001 the LyX Team
* Read the file COPYING
*
* \author John Levon <moz@compsoc.man.ac.uk>
*/
#ifndef QVCLOG_H
#define QVCLOG_H
#ifdef __GNUG__
#pragma interface
#endif
#include "Qt2Base.h"
class ControlVCLog;
class QVCLogDialog;
///
class QVCLog
: public Qt2CB<ControlVCLog, Qt2DB<QVCLogDialog> >
{
public:
///
friend class QVCLogDialog;
///
QVCLog(ControlVCLog &);
private:
/// Apply changes
virtual void apply() {};
/// update
virtual void update_contents();
/// build the dialog
virtual void build_dialog();
};
#endif // QVCLOG_H

View File

@ -0,0 +1,40 @@
/**
* \file QVCLogDialog.C
* Copyright 2001 the LyX Team
* Read the file COPYING
*
* \author John Levon <moz@compsoc.man.ac.uk>
*/
#include <config.h>
#include <vector>
#include <qpushbutton.h>
#include <qtextview.h>
#include "QVCLogDialog.h"
#include "Dialogs.h"
#include "QVCLog.h"
#include "QtLyXView.h"
#include "ControlVCLog.h"
QVCLogDialog::QVCLogDialog(QVCLog * form)
: QVCLogDialogBase(0, 0, false, 0),
form_(form)
{
connect(closePB, SIGNAL(clicked()),
form, SLOT(slotClose()));
}
void QVCLogDialog::closeEvent(QCloseEvent * e)
{
form_->slotWMHide();
e->accept();
}
void QVCLogDialog::updateClicked()
{
form_->update_contents();
}

View File

@ -0,0 +1,34 @@
/**
* \file QVCLogDialog.h
* Copyright 2001 the LyX Team
* Read the file COPYING
*
* \author John Levon <moz@compsoc.man.ac.uk>
*/
#ifndef QVCLOGDIALOG_H
#define QVCLOGDIALOG_H
#include <config.h>
#include "ui/QVCLogDialogBase.h"
class QVCLog;
class QVCLogDialog : public QVCLogDialogBase
{ Q_OBJECT
public:
QVCLogDialog(QVCLog * form);
protected slots:
virtual void updateClicked();
protected:
virtual void closeEvent(QCloseEvent * e);
private:
QVCLog * form_;
};
#endif // QVCLOGDIALOG_H

View File

@ -0,0 +1,124 @@
<!DOCTYPE UI><UI>
<class>QLogDialogBase</class>
<include location="global">config.h</include>
<include location="local">gettext.h</include>
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
<cstring>QLogDialogBase</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
<width>424</width>
<height>328</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Log</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>logTV</cstring>
</property>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout27</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>updatePB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Update</string>
</property>
<property stdset="1">
<name>default</name>
<bool>true</bool>
</property>
<property>
<name>toolTip</name>
<string>Update the display</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>updatePB</sender>
<signal>clicked()</signal>
<receiver>QLogDialogBase</receiver>
<slot>updateClicked()</slot>
</connection>
<slot access="public">updateClicked()</slot>
</connections>
<tabstops>
<tabstop>logTV</tabstop>
<tabstop>updatePB</tabstop>
<tabstop>closePB</tabstop>
</tabstops>
</UI>

View File

@ -0,0 +1,124 @@
<!DOCTYPE UI><UI>
<class>QVCLogDialogBase</class>
<include location="global">config.h</include>
<include location="local">gettext.h</include>
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
<cstring>QVCLogDialogBase</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
<width>420</width>
<height>328</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Version control log</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>vclogTV</cstring>
</property>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout27</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>updatePB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Update</string>
</property>
<property stdset="1">
<name>default</name>
<bool>true</bool>
</property>
<property>
<name>toolTip</name>
<string>Update the display</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>updatePB</sender>
<signal>clicked()</signal>
<receiver>QVCLogDialogBase</receiver>
<slot>updateClicked()</slot>
</connection>
<slot access="public">updateClicked()</slot>
</connections>
<tabstops>
<tabstop>vclogTV</tabstop>
<tabstop>updatePB</tabstop>
<tabstop>closePB</tabstop>
</tabstops>
</UI>