mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 02:14:50 +00:00
some more random changes, added Timeout (make clean if LyX crashes !!)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2584 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
99915ba16a
commit
a63c7ca207
@ -1,3 +1,28 @@
|
||||
2001-08-24 John Levon <moz@compsoc.man.ac.uk>
|
||||
|
||||
* Dialogs.C: include the right files
|
||||
|
||||
* QCitation.C: closePB not cancelPB
|
||||
|
||||
* QCitationDialog.C:
|
||||
* QCitationDialog.h:
|
||||
* ui/QCitationDialog.ui: small fixes
|
||||
|
||||
* QIndex.h:
|
||||
* QIndex.C:
|
||||
* QIndexDialog.C:
|
||||
* QIndexDialog.h:
|
||||
* ui/QIndexDialog.ui: more fixes
|
||||
|
||||
* Qt2Base.h:
|
||||
* Qt2Base.C: add reset() to workaround problem.
|
||||
|
||||
* README: update
|
||||
|
||||
* Makefile.am:
|
||||
* Timeout_pimpl.h:
|
||||
* Timeout_pimpl.C: add the timer
|
||||
|
||||
2001-08-23 John Levon <moz@compsoc.man.ac.uk>
|
||||
|
||||
* Dialogs.C:
|
||||
|
@ -12,8 +12,9 @@
|
||||
#endif
|
||||
|
||||
// the dialog definitions
|
||||
#include "QCitationDialog.h"
|
||||
#include "QAboutDialog.h"
|
||||
#include "QCitationDialog.h"
|
||||
#include "QIndexDialog.h"
|
||||
|
||||
// the controller interface
|
||||
#include "QAbout.h"
|
||||
|
@ -46,7 +46,6 @@ libqt2_la_OBJADD = \
|
||||
../xforms/MathsSymbols.lo \
|
||||
../xforms/Menubar_pimpl.lo \
|
||||
../xforms/RadioButtonGroup.lo \
|
||||
../xforms/Timeout_pimpl.lo \
|
||||
../xforms/Toolbar_pimpl.lo \
|
||||
../xforms/bmtable.lo \
|
||||
../xforms/form_bibitem.lo \
|
||||
@ -80,6 +79,8 @@ libqt2_la_SOURCES = \
|
||||
GUIRunTime.C \
|
||||
FileDialog.C \
|
||||
FileDialog_private.C \
|
||||
Timeout_pimpl.h \
|
||||
Timeout_pimpl.C \
|
||||
Qt2Base.C \
|
||||
Qt2Base.h \
|
||||
Qt2BC.C \
|
||||
|
@ -36,7 +36,7 @@ void QAbout::build()
|
||||
{
|
||||
dialog_.reset(new QAboutDialog());
|
||||
connect(dialog_.get()->closePB, SIGNAL(clicked()),
|
||||
this, SLOT(slotCancel()));
|
||||
this, SLOT(slotClose()));
|
||||
|
||||
dialog_->copyrightLA->setText(controller().getCopyright().c_str());
|
||||
dialog_->licenseLA->setText(controller().getLicense().c_str());
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include "QCitationDialog.h"
|
||||
#include "QCitation.h"
|
||||
|
||||
|
||||
#include <qcheckbox.h>
|
||||
#include <qcombobox.h>
|
||||
#include <qlineedit.h>
|
||||
@ -26,6 +26,7 @@
|
||||
#include "QtLyXView.h"
|
||||
#include "Qt2BC.h"
|
||||
#include "ControlCitation.h"
|
||||
#include "debug.h"
|
||||
#include "gettext.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "helper_funcs.h"
|
||||
@ -74,7 +75,7 @@ void QCitation::build()
|
||||
// Manage the ok, apply, restore and cancel/close buttons
|
||||
bc().setOK(dialog_->okPB);
|
||||
bc().setApply(dialog_->applyPB);
|
||||
bc().setCancel(dialog_->cancelPB);
|
||||
bc().setCancel(dialog_->closePB);
|
||||
bc().setRestore(dialog_->restorePB);
|
||||
|
||||
bc().addReadOnly(dialog_->addPB);
|
||||
@ -82,7 +83,8 @@ void QCitation::build()
|
||||
bc().addReadOnly(dialog_->upPB);
|
||||
bc().addReadOnly(dialog_->downPB);
|
||||
bc().addReadOnly(dialog_->citationStyleCO);
|
||||
bc().addReadOnly(dialog_->textBeforeED);
|
||||
// add when enabled !
|
||||
//bc().addReadOnly(dialog_->textBeforeED);
|
||||
bc().addReadOnly(dialog_->textAfterED);
|
||||
}
|
||||
|
||||
@ -102,7 +104,9 @@ void QCitation::update()
|
||||
setBibButtons(OFF);
|
||||
setCiteButtons(OFF);
|
||||
|
||||
dialog_->textAfterED->setText( controller().params().getOptions().c_str());
|
||||
dialog_->textAfterED->setText(controller().params().getOptions().c_str());
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
|
||||
|
@ -22,7 +22,8 @@ class QListBox;
|
||||
class ControlCitation;
|
||||
class QCitationDialog;
|
||||
|
||||
class QCitation : public Qt2CB<ControlCitation, Qt2DB<QCitationDialog> > {
|
||||
class QCitation : public Qt2CB<ControlCitation, Qt2DB<QCitationDialog> >
|
||||
{
|
||||
friend class QCitationDialog;
|
||||
|
||||
public:
|
||||
@ -47,7 +48,7 @@ private:
|
||||
/// Update dialog before/whilst showing it.
|
||||
virtual void update();
|
||||
|
||||
void updateBrowser(QListBox*, std::vector<string> const &) const;
|
||||
void updateBrowser(QListBox *, std::vector<string> const &) const;
|
||||
///
|
||||
void setBibButtons(State) const;
|
||||
///
|
||||
|
@ -7,18 +7,20 @@
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
||||
#include "gettext.h"
|
||||
|
||||
#include "QCitationDialog.h"
|
||||
#include "Dialogs.h"
|
||||
#include "QCitation.h"
|
||||
#include "controllers/ControlCitation.h"
|
||||
|
||||
#include <qcheckbox.h>
|
||||
#include <qcombobox.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qlistbox.h>
|
||||
#include <qmultilineedit.h>
|
||||
#include <qpushbutton.h>
|
||||
|
||||
|
||||
#include "QtLyXView.h"
|
||||
|
||||
#include <algorithm>
|
||||
@ -28,29 +30,46 @@ using std::vector;
|
||||
using std::find;
|
||||
using std::max;
|
||||
|
||||
QCitationDialog::QCitationDialog(QCitation * form, QWidget * parent, const char * name, bool modal, WFlags fl)
|
||||
: QCitationDialogBase(parent, name, modal, fl),
|
||||
QCitationDialog::QCitationDialog(QCitation * form)
|
||||
: QCitationDialogBase(0, 0, false, 0),
|
||||
form_(form)
|
||||
{
|
||||
connect(okPB, SIGNAL(clicked()),
|
||||
form, SLOT(slotOK()));
|
||||
connect(cancelPB, SIGNAL(clicked()),
|
||||
form, SLOT(slotCancel()));
|
||||
connect(restorePB, SIGNAL(clicked()),
|
||||
form, SLOT(slotRestore()));
|
||||
connect(okPB, SIGNAL(clicked()),
|
||||
form, SLOT(slotOK()));
|
||||
connect(applyPB, SIGNAL(clicked()),
|
||||
form, SLOT(slotApply()));
|
||||
connect(closePB, SIGNAL(clicked()),
|
||||
form, SLOT(slotClose()));
|
||||
connect(searchED, SIGNAL(returnPressed()),
|
||||
form, SLOT(slotNextClicked()));
|
||||
this, SLOT(slotNextClicked()));
|
||||
|
||||
textBeforeED->setText(_("Not yet supported"));
|
||||
textBeforeED->setReadOnly(true);
|
||||
textBeforeED->setFocusPolicy(QWidget::NoFocus);
|
||||
citationStyleCO->setEnabled(false);
|
||||
citationStyleCO->setFocusPolicy(QWidget::NoFocus);
|
||||
}
|
||||
|
||||
|
||||
|
||||
QCitationDialog::~QCitationDialog()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void QCitationDialog::slotBibSelected( int sel )
|
||||
void QCitationDialog::slotBibSelected(int sel)
|
||||
{
|
||||
slotBibHighlighted(sel);
|
||||
|
||||
if (form_->controller().isReadonly())
|
||||
return;
|
||||
|
||||
slotAddClicked();
|
||||
}
|
||||
|
||||
|
||||
void QCitationDialog::slotBibHighlighted(int sel)
|
||||
{
|
||||
biblio::InfoMap const & theMap = form_->controller().bibkeysInfo();
|
||||
|
||||
@ -91,7 +110,7 @@ void QCitationDialog::slotBibSelected( int sel )
|
||||
}
|
||||
|
||||
|
||||
void QCitationDialog::slotCiteSelected(int sel)
|
||||
void QCitationDialog::slotCiteHighlighted(int sel)
|
||||
{
|
||||
biblio::InfoMap const & theMap = form_->controller().bibkeysInfo();
|
||||
|
||||
@ -107,7 +126,7 @@ void QCitationDialog::slotCiteSelected(int sel)
|
||||
|
||||
// Highlight the selected browser_cite key in browser_bib
|
||||
vector<string>::const_iterator cit =
|
||||
std::find(form_->bibkeys.begin(),
|
||||
std::find(form_->bibkeys.begin(),
|
||||
form_->bibkeys.end(), form_->citekeys[sel]);
|
||||
|
||||
if (cit != form_->bibkeys.end()) {
|
||||
@ -149,7 +168,7 @@ void QCitationDialog::slotDelClicked()
|
||||
{
|
||||
int const sel = citeLB->currentItem();
|
||||
|
||||
// FIXME: why ?
|
||||
// FIXME: why ?
|
||||
if (sel < 0 || sel >= (int)form_->citekeys.size()) {
|
||||
return;
|
||||
}
|
||||
@ -192,7 +211,7 @@ void QCitationDialog::slotDownClicked()
|
||||
{
|
||||
int const sel = citeLB->currentItem();
|
||||
|
||||
// FIXME: ?
|
||||
// FIXME: ?
|
||||
if (sel < 0 || sel >= (int)form_->citekeys.size() - 1) {
|
||||
return;
|
||||
}
|
||||
@ -263,23 +282,5 @@ void QCitationDialog::doFind(biblio::Direction const dir)
|
||||
int const top = max(found - 5, 1);
|
||||
bibLB->setTopItem(top);
|
||||
bibLB->setSelected(found, true);
|
||||
slotBibSelected(0);
|
||||
}
|
||||
|
||||
|
||||
void QCitationDialog::slotCitationStyleSelected( int )
|
||||
{
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QCitationDialog::slotTextBeforeReturn()
|
||||
{
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QCitationDialog::slotTextAfterReturn()
|
||||
{
|
||||
form_->changed();
|
||||
slotBibHighlighted(0);
|
||||
}
|
||||
|
@ -9,34 +9,35 @@
|
||||
#ifndef QCITATIONDIALOG_H
|
||||
#define QCITATIONDIALOG_H
|
||||
|
||||
class QCitation;
|
||||
|
||||
#include <config.h>
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include "ui/QCitationDialogBase.h"
|
||||
#include "QCitation.h"
|
||||
#include "controllers/biblio.h"
|
||||
|
||||
class QCitationDialog : public QCitationDialogBase
|
||||
{ Q_OBJECT
|
||||
|
||||
public:
|
||||
QCitationDialog(QCitation * form, QWidget * parent = 0, const char * name = 0, bool modal = FALSE, WFlags fl = 0);
|
||||
QCitationDialog(QCitation * form);
|
||||
~QCitationDialog();
|
||||
|
||||
protected slots:
|
||||
virtual void slotBibHighlighted(int sel);
|
||||
virtual void slotBibSelected(int sel);
|
||||
virtual void slotCiteSelected(int sel);
|
||||
virtual void slotCiteHighlighted(int sel);
|
||||
virtual void slotAddClicked();
|
||||
virtual void slotDelClicked();
|
||||
virtual void slotUpClicked();
|
||||
virtual void slotDownClicked();
|
||||
virtual void slotPreviousClicked();
|
||||
virtual void slotNextClicked();
|
||||
virtual void slotCitationStyleSelected(int);
|
||||
virtual void slotTextBeforeReturn();
|
||||
virtual void slotTextAfterReturn();
|
||||
|
||||
virtual void changed_adaptor() {
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
private:
|
||||
void doFind(biblio::Direction dir);
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "QIndexDialog.h"
|
||||
#include "ControlIndex.h"
|
||||
#include "QtLyXView.h"
|
||||
#include "BufferView.h"
|
||||
|
||||
@ -30,17 +31,12 @@ QIndex::QIndex(ControlIndex & c)
|
||||
}
|
||||
|
||||
|
||||
QIndex::~QIndex()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void QIndex::build()
|
||||
{
|
||||
dialog_.reset(new QIndexDialog(this));
|
||||
|
||||
bc().setOK(dialog_->okPB);
|
||||
bc().setCancel(dialog_->cancelPB);
|
||||
bc().setCancel(dialog_->closePB);
|
||||
bc().addReadOnly(dialog_->keywordED);
|
||||
}
|
||||
|
||||
@ -48,6 +44,7 @@ void QIndex::build()
|
||||
void QIndex::update()
|
||||
{
|
||||
dialog_->keywordED->setText(controller().params().getContents().c_str());
|
||||
reset();
|
||||
}
|
||||
|
||||
|
||||
|
@ -12,22 +12,18 @@
|
||||
#define QINDEX_H
|
||||
|
||||
#include "Qt2Base.h"
|
||||
#include "ControlIndex.h"
|
||||
#include "LString.h"
|
||||
#include "boost/utility.hpp"
|
||||
|
||||
class Dialogs;
|
||||
class LyXView;
|
||||
class ControlIndex;
|
||||
class QIndexDialog;
|
||||
|
||||
class QIndex :
|
||||
public Qt2CB<ControlIndex, Qt2DB<QIndexDialog> > {
|
||||
|
||||
public Qt2CB<ControlIndex, Qt2DB<QIndexDialog> >
|
||||
{
|
||||
friend class QIndexDialog;
|
||||
|
||||
public:
|
||||
QIndex(ControlIndex &);
|
||||
~QIndex();
|
||||
|
||||
private:
|
||||
/// Apply changes
|
||||
virtual void apply();
|
||||
@ -35,11 +31,6 @@ private:
|
||||
virtual void update();
|
||||
/// build the dialog
|
||||
virtual void build();
|
||||
|
||||
/// create an Index inset
|
||||
void createIndex(string const &);
|
||||
/// edit an Index inset
|
||||
void showIndex(InsetCommand * const);
|
||||
};
|
||||
|
||||
#endif // QINDEX_H
|
||||
|
@ -10,10 +10,17 @@
|
||||
#include "Dialogs.h"
|
||||
#include "QIndex.h"
|
||||
|
||||
#include <qwidget.h>
|
||||
#include <qpushbutton.h>
|
||||
|
||||
QIndexDialog::QIndexDialog(QIndex * form)
|
||||
: QIndexDialogBase(0, 0, false, 0),
|
||||
form_(form)
|
||||
{
|
||||
connect(okPB, SIGNAL(clicked()),
|
||||
form, SLOT(slotOK()));
|
||||
connect(closePB, SIGNAL(clicked()),
|
||||
form, SLOT(slotClose()));
|
||||
}
|
||||
|
||||
|
||||
@ -22,20 +29,6 @@ QIndexDialog::~QIndexDialog()
|
||||
}
|
||||
|
||||
|
||||
void QIndexDialog::ok_adaptor()
|
||||
{
|
||||
form_->slotOK();
|
||||
hide();
|
||||
}
|
||||
|
||||
|
||||
void QIndexDialog::close_adaptor()
|
||||
{
|
||||
form_->slotCancel();
|
||||
hide();
|
||||
}
|
||||
|
||||
|
||||
void QIndexDialog::change_adaptor()
|
||||
{
|
||||
form_->changed();
|
||||
|
@ -22,11 +22,9 @@ public:
|
||||
QIndexDialog(QIndex * form);
|
||||
~QIndexDialog();
|
||||
|
||||
public slots:
|
||||
virtual void ok_adaptor();
|
||||
virtual void close_adaptor();
|
||||
protected slots:
|
||||
virtual void change_adaptor();
|
||||
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent * e);
|
||||
|
||||
|
@ -167,6 +167,8 @@ void QRef::do_ref_update()
|
||||
|
||||
void QRef::update()
|
||||
{
|
||||
// FIXME: needs updating
|
||||
|
||||
dialog_->referenceED->setText(params.getContents().c_str());
|
||||
dialog_->nameED->setText(params.getOptions().c_str());
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#endif
|
||||
|
||||
#include "Qt2BC.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include <qbutton.h>
|
||||
|
||||
|
@ -17,16 +17,15 @@
|
||||
#endif
|
||||
|
||||
#include <qdialog.h>
|
||||
#include <qapplication.h>
|
||||
|
||||
#include "debug.h"
|
||||
#include "QtLyXView.h"
|
||||
#include "Dialogs.h"
|
||||
#include "Qt2Base.h"
|
||||
#include "Qt2BC.h"
|
||||
#include "support/LAssert.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
Qt2Base::Qt2Base(ControlButtons & c, QString const & t)
|
||||
: ViewBC<Qt2BC>(c), title_(t)
|
||||
{}
|
||||
@ -51,6 +50,12 @@ void Qt2Base::show()
|
||||
}
|
||||
|
||||
|
||||
void Qt2Base::reset()
|
||||
{
|
||||
qApp->processEvents();
|
||||
}
|
||||
|
||||
|
||||
void Qt2Base::hide()
|
||||
{
|
||||
if (form() && form()->isVisible())
|
||||
@ -79,7 +84,6 @@ void Qt2Base::slotWMHide()
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Qt2Base::slotApply()
|
||||
{
|
||||
ApplyButton();
|
||||
@ -92,7 +96,7 @@ void Qt2Base::slotOK()
|
||||
}
|
||||
|
||||
|
||||
void Qt2Base::slotCancel()
|
||||
void Qt2Base::slotClose()
|
||||
{
|
||||
CancelButton();
|
||||
}
|
||||
@ -102,10 +106,3 @@ void Qt2Base::slotRestore()
|
||||
{
|
||||
RestoreButton();
|
||||
}
|
||||
|
||||
|
||||
// PENDING(kalle) How to handle this?
|
||||
// extern "C" void C_Qt2BaseInputCB(FL_OBJECT * ob, long d)
|
||||
// {
|
||||
// GetForm(ob)->InputCB(ob, d);
|
||||
// }
|
||||
|
@ -49,31 +49,33 @@ protected:
|
||||
/// Build the dialog
|
||||
virtual void build() = 0;
|
||||
/// Hide the dialog.
|
||||
void hide();
|
||||
virtual void hide();
|
||||
/// Create the dialog if necessary, update it and display it.
|
||||
void show();
|
||||
virtual void show();
|
||||
/// reset after an update
|
||||
virtual void reset();
|
||||
|
||||
/// the dialog has changed contents
|
||||
virtual void changed();
|
||||
|
||||
/// is the dialog currently valid ?
|
||||
virtual bool isValid();
|
||||
|
||||
|
||||
protected slots:
|
||||
// dialog closed from WM
|
||||
void slotWMHide();
|
||||
|
||||
// Apply button clicked
|
||||
void slotApply();
|
||||
|
||||
// Restore button clicked
|
||||
void slotRestore();
|
||||
|
||||
// OK button clicked
|
||||
void slotOK();
|
||||
|
||||
// Cancel button clicked
|
||||
void slotCancel();
|
||||
// Apply button clicked
|
||||
void slotApply();
|
||||
|
||||
// Restore button clicked
|
||||
void slotRestore();
|
||||
// Close button clicked
|
||||
void slotClose();
|
||||
|
||||
private:
|
||||
/// Pointer to the actual instantiation of xform's form
|
||||
@ -89,12 +91,13 @@ template <class Dialog>
|
||||
class Qt2DB: public Qt2Base
|
||||
{
|
||||
protected:
|
||||
///
|
||||
Qt2DB(ControlButtons &, const QString&);
|
||||
|
||||
/// Pointer to the actual instantiation of the Qt dialog
|
||||
virtual QDialog* form() const;
|
||||
/// Real GUI implementation.
|
||||
boost::scoped_ptr<Dialog> dialog_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,5 +1,26 @@
|
||||
This file contains some do's and dont's for the Qt2 frontend.
|
||||
|
||||
General rules
|
||||
-------------
|
||||
|
||||
Every editable field that affects the state of the dialog contents
|
||||
from LyX's point of view should connect its xxxChanged() signal to
|
||||
a the dialog's changed_adaptor() slot, which in turn should call
|
||||
form_->changed(). If you are using a more complicated thing anyway,
|
||||
then remember to call form_->changed() at the end (if it has changed !)
|
||||
|
||||
Every non-trivial widget should have a tooltip. If you don't know
|
||||
what to write, write "FIXME", and it can fixed later.
|
||||
|
||||
If necessary, you should override Qt2Base::isValid() for determining the validity
|
||||
of the current dialog's contents.
|
||||
|
||||
OK/Apply/Restore/Close should be connected in the derived class's constructor
|
||||
to call form_->slotOK() etc. Refer to close/cancel as close in the source.
|
||||
|
||||
Every overridden update() must call reset() to ensure the beginning state of the dialog
|
||||
is correct !
|
||||
|
||||
Don't #undef emit - #include "QtLyXView.h" instead
|
||||
|
||||
Naming conventions
|
||||
@ -17,7 +38,7 @@ Widgets should be named like "fooXX", where XX is one of the following
|
||||
widget types :
|
||||
|
||||
CB - check box
|
||||
CO -
|
||||
CO - combo box
|
||||
ED - line edit
|
||||
LA - label
|
||||
ML -
|
||||
@ -28,15 +49,15 @@ PB - push button
|
||||
Dialog Maintainer MVC conversion
|
||||
----------------------------------------------
|
||||
Character Edwin
|
||||
Citation Kalle Done ?
|
||||
Document Kalle In progress (Not yet prepared)
|
||||
Citation Kalle Done
|
||||
Document Kalle Waiting for MVC
|
||||
Index Kalle Done
|
||||
Paragraph Edwin Not yet prepared
|
||||
Paragraph Edwin Waiting for MVC
|
||||
Print Edwin
|
||||
Ref Kalle
|
||||
Search Edwin
|
||||
Splash Edwin
|
||||
Tabular Not yet prepared
|
||||
Tabular Waiting for MVC
|
||||
TabularCreate Edwin
|
||||
Toc Kalle
|
||||
Url Kalle
|
||||
|
51
src/frontends/qt2/Timeout_pimpl.C
Normal file
51
src/frontends/qt2/Timeout_pimpl.C
Normal file
@ -0,0 +1,51 @@
|
||||
/**
|
||||
* \file Timeout_pimpl.C
|
||||
* Copyright 2001 LyX Team
|
||||
* Read COPYING
|
||||
*
|
||||
* \author John Levon
|
||||
*/
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "Timeout_pimpl.h"
|
||||
#include "debug.h"
|
||||
|
||||
using std::endl;
|
||||
|
||||
Timeout::Pimpl::Pimpl(Timeout * owner)
|
||||
: owner_(owner), timeout_id(-1)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void Timeout::Pimpl::timerEvent(QTimerEvent *)
|
||||
{
|
||||
owner_->emit();
|
||||
}
|
||||
|
||||
|
||||
void Timeout::Pimpl::reset()
|
||||
{
|
||||
killTimers();
|
||||
timeout_id = -1;
|
||||
}
|
||||
|
||||
|
||||
void Timeout::Pimpl::start()
|
||||
{
|
||||
if (timeout_id != -1)
|
||||
lyxerr << "Timeout::start: already running!" << endl;
|
||||
timeout_id = startTimer(owner_->timeout_ms);
|
||||
}
|
||||
|
||||
|
||||
void Timeout::Pimpl::stop()
|
||||
{
|
||||
if (timeout_id != -1)
|
||||
reset();
|
||||
}
|
50
src/frontends/qt2/Timeout_pimpl.h
Normal file
50
src/frontends/qt2/Timeout_pimpl.h
Normal file
@ -0,0 +1,50 @@
|
||||
/**
|
||||
* \file Timeout_pimpl.h
|
||||
* Copyright 2001 LyX Team
|
||||
* Read COPYING
|
||||
*
|
||||
* \author John Levon
|
||||
*/
|
||||
#ifndef TIMEOUTPIMPL_H
|
||||
#define TIMEOUTPIMPL_H
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "frontends/Timeout.h"
|
||||
|
||||
#include <sigc++/signal_system.h>
|
||||
|
||||
#include <qobject.h>
|
||||
// stupid Qt
|
||||
#undef emit
|
||||
|
||||
/**
|
||||
* This class executes the callback when the timeout expires
|
||||
* using Qt mechanisms
|
||||
*/
|
||||
struct Timeout::Pimpl : QObject {
|
||||
public:
|
||||
///
|
||||
Pimpl(Timeout * owner_);
|
||||
/// start the timer
|
||||
void start();
|
||||
/// stop the timer
|
||||
void stop();
|
||||
/// reset
|
||||
void reset();
|
||||
|
||||
protected:
|
||||
/// slot
|
||||
virtual void timerEvent(QTimerEvent *);
|
||||
private:
|
||||
/// the owning timer
|
||||
Timeout * owner_;
|
||||
/// xforms id
|
||||
int timeout_id;
|
||||
};
|
||||
|
||||
#endif
|
@ -15,7 +15,6 @@ libqt2moc_la_SOURCES := FileDialog_private_moc.C \
|
||||
emptytable_moc.C \
|
||||
Qt2Base_moc.C \
|
||||
$(MOCDIALOGS)
|
||||
#$(patsubst, %, %Dialog_moc.C, $(DIALOGS))
|
||||
|
||||
DISTCLEANFILES = $(libqt2moc_la_SOURCES) *.orig *.rej *~ *.bak core
|
||||
|
||||
@ -23,4 +22,3 @@ ETAGS_ARGS = --lang=c++
|
||||
|
||||
%_moc.C: ../%.h
|
||||
$(MOC) -o $@ $<
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>483</width>
|
||||
<width>439</width>
|
||||
<height>585</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -631,6 +631,10 @@
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>default</name>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>autoDefault</name>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
@ -649,7 +653,7 @@
|
||||
<class>QPushButton</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>cancelPB</cstring>
|
||||
<cstring>closePB</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
@ -697,12 +701,6 @@
|
||||
<receiver>QCitationDialogBase</receiver>
|
||||
<slot>slotDownClicked()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>restorePB</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>QCitationDialogBase</receiver>
|
||||
<slot>slotRestoreClicked()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>previousPB</sender>
|
||||
<signal>clicked()</signal>
|
||||
@ -715,54 +713,64 @@
|
||||
<receiver>QCitationDialogBase</receiver>
|
||||
<slot>slotNextClicked()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>citationStyleCO</sender>
|
||||
<signal>activated(int)</signal>
|
||||
<receiver>QCitationDialogBase</receiver>
|
||||
<slot>slotCitationStyleSelected(int)</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>textBeforeED</sender>
|
||||
<signal>returnPressed()</signal>
|
||||
<receiver>QCitationDialogBase</receiver>
|
||||
<slot>slotTextBeforeReturn()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>textAfterED</sender>
|
||||
<signal>returnPressed()</signal>
|
||||
<receiver>QCitationDialogBase</receiver>
|
||||
<slot>slotTextAfterReturn()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>bibLB</sender>
|
||||
<signal>highlighted(int)</signal>
|
||||
<receiver>QCitationDialogBase</receiver>
|
||||
<slot>slotBibSelected(int)</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>citeLB</sender>
|
||||
<signal>highlighted(int)</signal>
|
||||
<receiver>QCitationDialogBase</receiver>
|
||||
<slot>slotCiteSelected(int)</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>upPB</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>QCitationDialogBase</receiver>
|
||||
<slot>slotUpClicked()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>textBeforeED</sender>
|
||||
<signal>textChanged(const QString&)</signal>
|
||||
<receiver>QCitationDialogBase</receiver>
|
||||
<slot>changed_adaptor()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>textAfterED</sender>
|
||||
<signal>textChanged(const QString&)</signal>
|
||||
<receiver>QCitationDialogBase</receiver>
|
||||
<slot>changed_adaptor()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>citationStyleCO</sender>
|
||||
<signal>textChanged(const QString&)</signal>
|
||||
<receiver>QCitationDialogBase</receiver>
|
||||
<slot>changed_adaptor()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>citeLB</sender>
|
||||
<signal>highlighted(int)</signal>
|
||||
<receiver>QCitationDialogBase</receiver>
|
||||
<slot>slotCiteHighlighted(int)</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>citeLB</sender>
|
||||
<signal>selected(int)</signal>
|
||||
<receiver>QCitationDialogBase</receiver>
|
||||
<slot>slotBibHighlighted(int)</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>bibLB</sender>
|
||||
<signal>highlighted(int)</signal>
|
||||
<receiver>QCitationDialogBase</receiver>
|
||||
<slot>slotBibHighlighted(int)</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>bibLB</sender>
|
||||
<signal>selected(int)</signal>
|
||||
<receiver>QCitationDialogBase</receiver>
|
||||
<slot>slotBibSelected(int)</slot>
|
||||
</connection>
|
||||
<slot access="public">changed_adaptor()</slot>
|
||||
<slot access="public">slotBibSelected(int)</slot>
|
||||
<slot access="protected">slotAddClicked()</slot>
|
||||
<slot access="protected">slotBibSelected(int)</slot>
|
||||
<slot access="protected">slotCitationStyleSelected(int)</slot>
|
||||
<slot access="protected">slotCiteSelected(int)</slot>
|
||||
<slot access="public">slotBibHighlighted(int)</slot>
|
||||
<slot access="public">slotCiteHighlighted(int)</slot>
|
||||
<slot access="protected">slotDelClicked()</slot>
|
||||
<slot access="protected">slotDownClicked()</slot>
|
||||
<slot access="protected">slotUpClicked()</slot>
|
||||
<slot access="protected">slotNextClicked()</slot>
|
||||
<slot access="protected">slotPreviousClicked()</slot>
|
||||
<slot access="protected">slotRestoreClicked()</slot>
|
||||
<slot access="protected">slotSearchTypeSelected(bool)</slot>
|
||||
<slot access="protected">slotTextAfterReturn()</slot>
|
||||
<slot access="protected">slotTextBeforeReturn()</slot>
|
||||
<slot access="protected">slotUpClicked()</slot>
|
||||
</connections>
|
||||
</UI>
|
||||
|
@ -11,7 +11,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>208</width>
|
||||
<width>204</width>
|
||||
<height>82</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -130,7 +130,7 @@
|
||||
<class>QPushButton</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>cancelPB</cstring>
|
||||
<cstring>closePB</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
@ -142,26 +142,12 @@
|
||||
</vbox>
|
||||
</widget>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>okPB</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>QIndexDialogBase</receiver>
|
||||
<slot>ok_adaptor()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>cancelPB</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>QIndexDialogBase</receiver>
|
||||
<slot>close_adaptor()</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>keywordED</sender>
|
||||
<signal>textChanged(const QString&)</signal>
|
||||
<receiver>QIndexDialogBase</receiver>
|
||||
<slot>change_adaptor()</slot>
|
||||
</connection>
|
||||
<slot access="public">close_adaptor()</slot>
|
||||
<slot access="public">change_adaptor()</slot>
|
||||
<slot access="public">ok_adaptor()</slot>
|
||||
</connections>
|
||||
</UI>
|
||||
|
Loading…
Reference in New Issue
Block a user