mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-06 00:10:59 +00:00
various fixes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2585 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
a63c7ca207
commit
3796da5d05
@ -1,3 +1,29 @@
|
|||||||
|
2001-08-25 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
|
* Dialogs.C: add URL
|
||||||
|
|
||||||
|
* QAbout.h:
|
||||||
|
* QCitation.h:
|
||||||
|
* QDocument.h:
|
||||||
|
* QIndex.C:
|
||||||
|
* Qt2Base.h:
|
||||||
|
* Qt2Base.C: add an updating_ variable to prevent
|
||||||
|
bc() breakage.
|
||||||
|
|
||||||
|
* QURL.h:
|
||||||
|
* QURL.C:
|
||||||
|
* QURLDialog.h:
|
||||||
|
* QURLDialog.C:
|
||||||
|
* ui/QURLDialog.ui: make alive again
|
||||||
|
|
||||||
|
* Qt2BC.C: make lineedits ReadOnly not disabled
|
||||||
|
|
||||||
|
* README: update
|
||||||
|
|
||||||
|
* ui/QCitationDialog.ui: small cleanups
|
||||||
|
|
||||||
|
* ui/QIndexDialog.ui: add a what's this
|
||||||
|
|
||||||
2001-08-24 John Levon <moz@compsoc.man.ac.uk>
|
2001-08-24 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
* Dialogs.C: include the right files
|
* Dialogs.C: include the right files
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "QAboutDialog.h"
|
#include "QAboutDialog.h"
|
||||||
#include "QCitationDialog.h"
|
#include "QCitationDialog.h"
|
||||||
#include "QIndexDialog.h"
|
#include "QIndexDialog.h"
|
||||||
|
#include "QURLDialog.h"
|
||||||
|
|
||||||
// the controller interface
|
// the controller interface
|
||||||
#include "QAbout.h"
|
#include "QAbout.h"
|
||||||
@ -26,6 +27,7 @@
|
|||||||
#include "QSearch.h"
|
#include "QSearch.h"
|
||||||
#include "QSplash.h"
|
#include "QSplash.h"
|
||||||
#include "QTabularCreate.h"
|
#include "QTabularCreate.h"
|
||||||
|
#include "QURL.h"
|
||||||
|
|
||||||
#include "QtLyXView.h"
|
#include "QtLyXView.h"
|
||||||
#include "Dialogs.h"
|
#include "Dialogs.h"
|
||||||
@ -44,6 +46,7 @@
|
|||||||
#include "controllers/ControlCitation.h"
|
#include "controllers/ControlCitation.h"
|
||||||
#include "controllers/ControlIndex.h"
|
#include "controllers/ControlIndex.h"
|
||||||
#include "controllers/ControlSplash.h"
|
#include "controllers/ControlSplash.h"
|
||||||
|
#include "controllers/ControlUrl.h"
|
||||||
#if 0
|
#if 0
|
||||||
#include "controllers/ControlCopyright.h"
|
#include "controllers/ControlCopyright.h"
|
||||||
#include "controllers/ControlCredits.h"
|
#include "controllers/ControlCredits.h"
|
||||||
@ -70,7 +73,6 @@
|
|||||||
#include "controllers/ControlTabularCreate.h"
|
#include "controllers/ControlTabularCreate.h"
|
||||||
#include "controllers/ControlThesaurus.h"
|
#include "controllers/ControlThesaurus.h"
|
||||||
#include "controllers/ControlToc.h"
|
#include "controllers/ControlToc.h"
|
||||||
#include "controllers/ControlUrl.h"
|
|
||||||
#include "controllers/ControlVCLog.h"
|
#include "controllers/ControlVCLog.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -88,6 +90,7 @@ Dialogs::Dialogs(LyXView * lv)
|
|||||||
add(new GUICitation<QCitation, Qt2BC>(*lv, *this));
|
add(new GUICitation<QCitation, Qt2BC>(*lv, *this));
|
||||||
add(new GUIAboutlyx<QAbout, Qt2BC>(*lv, *this));
|
add(new GUIAboutlyx<QAbout, Qt2BC>(*lv, *this));
|
||||||
add(new GUIIndex<QIndex, Qt2BC>(*lv, *this));
|
add(new GUIIndex<QIndex, Qt2BC>(*lv, *this));
|
||||||
|
add(new GUIUrl<QURL, Qt2BC>(*lv, *this));
|
||||||
|
|
||||||
// reduce the number of connections needed in
|
// reduce the number of connections needed in
|
||||||
// dialogs by a simple connection here.
|
// dialogs by a simple connection here.
|
||||||
|
@ -28,7 +28,7 @@ private:
|
|||||||
/// not needed
|
/// not needed
|
||||||
virtual void apply() {}
|
virtual void apply() {}
|
||||||
/// not needed
|
/// not needed
|
||||||
virtual void update() {}
|
virtual void update_contents() {}
|
||||||
// build the dialog
|
// build the dialog
|
||||||
virtual void build();
|
virtual void build();
|
||||||
};
|
};
|
||||||
|
@ -89,7 +89,7 @@ void QCitation::build()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QCitation::update()
|
void QCitation::update_contents()
|
||||||
{
|
{
|
||||||
// Make the list of all available bibliography keys
|
// Make the list of all available bibliography keys
|
||||||
bibkeys = biblio::getKeys(controller().bibkeysInfo());
|
bibkeys = biblio::getKeys(controller().bibkeysInfo());
|
||||||
@ -105,8 +105,6 @@ void QCitation::update()
|
|||||||
setCiteButtons(OFF);
|
setCiteButtons(OFF);
|
||||||
|
|
||||||
dialog_->textAfterED->setText(controller().params().getOptions().c_str());
|
dialog_->textAfterED->setText(controller().params().getOptions().c_str());
|
||||||
|
|
||||||
reset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ private:
|
|||||||
/// Hide the dialog.
|
/// Hide the dialog.
|
||||||
virtual void hide();
|
virtual void hide();
|
||||||
/// Update dialog before/whilst showing it.
|
/// Update dialog before/whilst showing it.
|
||||||
virtual void update();
|
virtual void update_contents();
|
||||||
|
|
||||||
void updateBrowser(QListBox *, std::vector<string> const &) const;
|
void updateBrowser(QListBox *, std::vector<string> const &) const;
|
||||||
///
|
///
|
||||||
|
@ -265,12 +265,23 @@ void QCitationDialog::doFind(biblio::Direction const dir)
|
|||||||
|
|
||||||
bool const caseSensitive = searchCaseCB->isChecked();
|
bool const caseSensitive = searchCaseCB->isChecked();
|
||||||
|
|
||||||
vector<string>::const_iterator const cit =
|
vector<string>::const_iterator cit =
|
||||||
biblio::searchKeys(theMap, form_->bibkeys, str,
|
biblio::searchKeys(theMap, form_->bibkeys, str,
|
||||||
start, type, dir, caseSensitive);
|
start, type, dir, caseSensitive);
|
||||||
|
|
||||||
|
// FIXME: should work ...
|
||||||
if (cit == form_->bibkeys.end()) {
|
if (cit == form_->bibkeys.end()) {
|
||||||
return;
|
// not found. let's loop round
|
||||||
|
if (dir == biblio::FORWARD)
|
||||||
|
start = form_->bibkeys.begin();
|
||||||
|
else
|
||||||
|
start = form_->bibkeys.end();
|
||||||
|
|
||||||
|
cit = biblio::searchKeys(theMap, form_->bibkeys, str,
|
||||||
|
start, type, dir, caseSensitive);
|
||||||
|
|
||||||
|
if (cit == form_->bibkeys.end())
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int const found = int(cit - form_->bibkeys.begin());
|
int const found = int(cit - form_->bibkeys.begin());
|
||||||
|
@ -245,7 +245,7 @@ void QDocument::cancel()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QDocument::update()
|
void QDocument::update_contents()
|
||||||
{
|
{
|
||||||
if (!dialog_.get())
|
if (!dialog_.get())
|
||||||
return;
|
return;
|
||||||
|
@ -75,7 +75,7 @@ private:
|
|||||||
// /// Filter the inputs
|
// /// Filter the inputs
|
||||||
// virtual bool input( FL_OBJECT *, long );
|
// virtual bool input( FL_OBJECT *, long );
|
||||||
/// Update the dialog.
|
/// Update the dialog.
|
||||||
virtual void update();
|
virtual void update_contents();
|
||||||
/// Apply from dialog
|
/// Apply from dialog
|
||||||
virtual void apply();
|
virtual void apply();
|
||||||
/// Cancel from dialog
|
/// Cancel from dialog
|
||||||
|
@ -41,10 +41,9 @@ void QIndex::build()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QIndex::update()
|
void QIndex::update_contents()
|
||||||
{
|
{
|
||||||
dialog_->keywordED->setText(controller().params().getContents().c_str());
|
dialog_->keywordED->setText(controller().params().getContents().c_str());
|
||||||
reset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -52,3 +51,9 @@ void QIndex::apply()
|
|||||||
{
|
{
|
||||||
controller().params().setContents(dialog_->keywordED->text().latin1());
|
controller().params().setContents(dialog_->keywordED->text().latin1());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool QIndex::isValid()
|
||||||
|
{
|
||||||
|
return !string(dialog_->keywordED->text()).empty();
|
||||||
|
}
|
||||||
|
@ -24,11 +24,14 @@ class QIndex :
|
|||||||
public:
|
public:
|
||||||
QIndex(ControlIndex &);
|
QIndex(ControlIndex &);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual bool isValid();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Apply changes
|
/// Apply changes
|
||||||
virtual void apply();
|
virtual void apply();
|
||||||
/// update
|
/// update
|
||||||
virtual void update();
|
virtual void update_contents();
|
||||||
/// build the dialog
|
/// build the dialog
|
||||||
virtual void build();
|
virtual void build();
|
||||||
};
|
};
|
||||||
|
@ -9,142 +9,62 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "QURLDialog.h"
|
#include "QURLDialog.h"
|
||||||
#include "QtLyXView.h"
|
|
||||||
#include "BufferView.h"
|
|
||||||
|
|
||||||
#include "Dialogs.h"
|
|
||||||
#include "QURL.h"
|
|
||||||
#include "gettext.h"
|
|
||||||
#include "buffer.h"
|
|
||||||
#include "lyxfunc.h"
|
|
||||||
|
|
||||||
#include <qlineedit.h>
|
|
||||||
#include <qcheckbox.h>
|
#include <qcheckbox.h>
|
||||||
#include <qpushbutton.h>
|
#include <qpushbutton.h>
|
||||||
|
#include <qlineedit.h>
|
||||||
QURL::QURL(LyXView *v, Dialogs *d)
|
|
||||||
: dialog_(0), lv_(v), d_(d), inset_(0), h_(0), u_(0), ih_(0)
|
|
||||||
{
|
|
||||||
// let the dialog be shown
|
|
||||||
// This is a permanent connection so we won't bother
|
|
||||||
// storing a copy because we won't be disconnecting.
|
|
||||||
d->showUrl.connect(slot(this, &QURL::showUrl));
|
|
||||||
d->createUrl.connect(slot(this, &QURL::createUrl));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QURL::~QURL()
|
#include "ControlUrl.h"
|
||||||
|
#include "Qt2BC.h"
|
||||||
|
#include "QURL.h"
|
||||||
|
#include "debug.h"
|
||||||
|
#include "gettext.h"
|
||||||
|
|
||||||
|
typedef Qt2CB<ControlUrl, Qt2DB<QURLDialog> > base_class;
|
||||||
|
|
||||||
|
QURL::QURL(ControlUrl & c)
|
||||||
|
: base_class(c, _("URL"))
|
||||||
{
|
{
|
||||||
delete dialog_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QURL::showUrl(InsetCommand * const inset)
|
void QURL::build()
|
||||||
{
|
{
|
||||||
// FIXME: when could inset be 0 here ?
|
dialog_.reset(new QURLDialog(this));
|
||||||
if (inset==0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
inset_ = inset;
|
bc().setOK(dialog_->okPB);
|
||||||
readonly = lv_->buffer()->isReadonly();
|
bc().setCancel(dialog_->closePB);
|
||||||
//ih_ = inset_->hide.connect(slot(this,&QURL::hide));
|
bc().addReadOnly(dialog_->urlED);
|
||||||
params = inset->params();
|
bc().addReadOnly(dialog_->nameED);
|
||||||
|
bc().addReadOnly(dialog_->hyperlinkCB);
|
||||||
show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QURL::createUrl(string const & arg)
|
void QURL::update_contents()
|
||||||
{
|
{
|
||||||
// we could already be showing a URL, clear it out
|
lyxerr << "update_contents URL" << std::endl;
|
||||||
if (inset_)
|
lyxerr << dialog_->okPB << std::endl;
|
||||||
close();
|
dialog_->urlED->setText(controller().params().getContents().c_str());
|
||||||
|
dialog_->nameED->setText(controller().params().getOptions().c_str());
|
||||||
readonly = lv_->buffer()->isReadonly();
|
dialog_->hyperlinkCB->setChecked(controller().params().getCmdName() != "url");
|
||||||
params.setFromString(arg);
|
|
||||||
show();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void QURL::update()
|
|
||||||
{
|
|
||||||
dialog_->urlED->setText(params.getContents().c_str());
|
|
||||||
dialog_->nameED->setText(params.getOptions().c_str());
|
|
||||||
|
|
||||||
if (params.getCmdName()=="url")
|
|
||||||
dialog_->hyperlinkCB->setChecked(false);
|
|
||||||
else
|
|
||||||
dialog_->hyperlinkCB->setChecked(true);
|
|
||||||
|
|
||||||
if (readonly) {
|
|
||||||
dialog_->nameED->setFocusPolicy(QWidget::NoFocus);
|
|
||||||
dialog_->urlED->setFocusPolicy(QWidget::NoFocus);
|
|
||||||
dialog_->okPB->setEnabled(false);
|
|
||||||
dialog_->cancelPB->setText(_("Close"));
|
|
||||||
dialog_->hyperlinkCB->setEnabled(false);
|
|
||||||
} else {
|
|
||||||
dialog_->nameED->setFocusPolicy(QWidget::StrongFocus);
|
|
||||||
dialog_->urlED->setFocusPolicy(QWidget::StrongFocus);
|
|
||||||
dialog_->urlED->setFocus();
|
|
||||||
dialog_->okPB->setEnabled(true);
|
|
||||||
dialog_->cancelPB->setText(_("Cancel"));
|
|
||||||
dialog_->hyperlinkCB->setEnabled(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QURL::apply()
|
void QURL::apply()
|
||||||
{
|
{
|
||||||
if (readonly)
|
controller().params().setContents(dialog_->urlED->text().latin1());
|
||||||
return;
|
controller().params().setOptions(dialog_->nameED->text().latin1());
|
||||||
|
|
||||||
params.setContents(dialog_->urlED->text().latin1());
|
|
||||||
params.setOptions(dialog_->nameED->text().latin1());
|
|
||||||
|
|
||||||
if (dialog_->hyperlinkCB->isChecked())
|
if (dialog_->hyperlinkCB->isChecked())
|
||||||
params.setCmdName("htmlurl");
|
controller().params().setCmdName("htmlurl");
|
||||||
else
|
else
|
||||||
params.setCmdName("url");
|
controller().params().setCmdName("url");
|
||||||
|
|
||||||
if (inset_ != 0) {
|
|
||||||
if (params != inset_->params()) {
|
|
||||||
inset_->setParams(params);
|
|
||||||
lv_->view()->updateInset(inset_, true);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
lv_->getLyXFunc()->dispatch(LFUN_INSERT_URL, params.getAsString().c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QURL::show()
|
|
||||||
|
bool QURL::isValid()
|
||||||
{
|
{
|
||||||
if (!dialog_)
|
string const u(dialog_->urlED->text().latin1());
|
||||||
dialog_ = new QURLDialog(this, 0, _("LyX: Url"), false);
|
string const n(dialog_->nameED->text().latin1());
|
||||||
|
|
||||||
if (!dialog_->isVisible()) {
|
|
||||||
h_ = d_->hideBufferDependent.connect(slot(this, &QURL::hide));
|
|
||||||
//u_ = d_->updateBufferDependent.connect(slot(this, &QURL::update));
|
|
||||||
}
|
|
||||||
|
|
||||||
dialog_->raise();
|
return !u.empty() && !n.empty();
|
||||||
dialog_->setActiveWindow();
|
}
|
||||||
|
|
||||||
update();
|
|
||||||
dialog_->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void QURL::close()
|
|
||||||
{
|
|
||||||
h_.disconnect();
|
|
||||||
u_.disconnect();
|
|
||||||
ih_.disconnect();
|
|
||||||
inset_ = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void QURL::hide()
|
|
||||||
{
|
|
||||||
dialog_->hide();
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
|
@ -1,71 +1,36 @@
|
|||||||
// -*- C++ -*-
|
|
||||||
/**
|
/**
|
||||||
* \file QURL.h
|
* \file QURL.h
|
||||||
* Copyright 2001 the LyX Team
|
* Copyright 2001 the LyX Team
|
||||||
* Read the file COPYING
|
* Read the file COPYING
|
||||||
*
|
*
|
||||||
* \author John Levon <moz@compsoc.man.ac.uk>
|
* \author John Levon
|
||||||
* \author Kalle Dalheimer <kalle@klaralvdalens-datakonsult.se>
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef QURL_H
|
#ifndef QURL_H
|
||||||
#define QURL_H
|
#define QURL_H
|
||||||
|
|
||||||
#include "DialogBase.h"
|
#include "Qt2Base.h"
|
||||||
#include "LString.h"
|
|
||||||
#include "boost/utility.hpp"
|
class ControlUrl;
|
||||||
#include "insets/inseturl.h"
|
|
||||||
|
|
||||||
class Dialogs;
|
|
||||||
class LyXView;
|
|
||||||
class QURLDialog;
|
class QURLDialog;
|
||||||
|
|
||||||
class QURL : public DialogBase {
|
class QURL :
|
||||||
|
public Qt2CB<ControlUrl, Qt2DB<QURLDialog> >
|
||||||
|
{
|
||||||
|
friend class QURLDialog;
|
||||||
public:
|
public:
|
||||||
QURL(LyXView *, Dialogs *);
|
QURL(ControlUrl & c);
|
||||||
~QURL();
|
|
||||||
|
|
||||||
/// Apply changes
|
protected:
|
||||||
void apply();
|
virtual bool isValid();
|
||||||
/// close the connections
|
|
||||||
void close();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Create the dialog if necessary, update it and display it.
|
/// apply dialog
|
||||||
void show();
|
virtual void apply();
|
||||||
/// Hide the dialog.
|
/// build dialog
|
||||||
void hide();
|
virtual void build();
|
||||||
/// Update the dialog.
|
/// update dialog
|
||||||
void update();
|
virtual void update_contents();
|
||||||
|
|
||||||
/// create a URL inset
|
|
||||||
void createUrl(string const &);
|
|
||||||
/// edit a URL inset
|
|
||||||
void showUrl(InsetCommand * const);
|
|
||||||
|
|
||||||
/// Real GUI implementation.
|
|
||||||
QURLDialog * dialog_;
|
|
||||||
|
|
||||||
/// the LyXView we belong to
|
|
||||||
LyXView * lv_;
|
|
||||||
|
|
||||||
/** Which Dialogs do we belong to?
|
|
||||||
Used so we can get at the signals we have to connect to.
|
|
||||||
*/
|
|
||||||
Dialogs * d_;
|
|
||||||
/// pointer to the inset if any
|
|
||||||
InsetCommand * inset_;
|
|
||||||
/// insets params
|
|
||||||
InsetCommandParams params;
|
|
||||||
/// is the inset we are reading from a readonly buffer
|
|
||||||
bool readonly;
|
|
||||||
|
|
||||||
/// Hide connection.
|
|
||||||
SigC::Connection h_;
|
|
||||||
/// Update connection.
|
|
||||||
SigC::Connection u_;
|
|
||||||
/// Inset hide connection.
|
|
||||||
SigC::Connection ih_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QURL_H
|
#endif // QURL_H
|
||||||
|
@ -8,14 +8,20 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
|
#include <qpushbutton.h>
|
||||||
|
|
||||||
#include "QURLDialog.h"
|
#include "QURLDialog.h"
|
||||||
#include "Dialogs.h"
|
#include "Dialogs.h"
|
||||||
#include "QURL.h"
|
#include "QURL.h"
|
||||||
|
|
||||||
QURLDialog::QURLDialog(QURL * form, QWidget * parent, const char * name, bool modal, WFlags fl)
|
QURLDialog::QURLDialog(QURL * form)
|
||||||
: QURLDialogBase(parent, name, modal, fl),
|
: QURLDialogBase(0, 0, false, 0),
|
||||||
form_(form)
|
form_(form)
|
||||||
{
|
{
|
||||||
|
connect(okPB, SIGNAL(clicked()),
|
||||||
|
form_, SLOT(slotOK()));
|
||||||
|
connect(closePB, SIGNAL(clicked()),
|
||||||
|
form_, SLOT(slotClose()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -24,23 +30,14 @@ QURLDialog::~QURLDialog()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QURLDialog::apply_adaptor()
|
void QURLDialog::changed_adaptor()
|
||||||
{
|
{
|
||||||
form_->apply();
|
form_->changed();
|
||||||
form_->close();
|
|
||||||
hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QURLDialog::close_adaptor()
|
|
||||||
{
|
|
||||||
form_->close();
|
|
||||||
hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void QURLDialog::closeEvent(QCloseEvent * e)
|
void QURLDialog::closeEvent(QCloseEvent * e)
|
||||||
{
|
{
|
||||||
form_->close();
|
form_->slotWMHide();
|
||||||
e->accept();
|
e->accept();
|
||||||
}
|
}
|
||||||
|
@ -17,12 +17,11 @@ class QURLDialog : public QURLDialogBase
|
|||||||
{ Q_OBJECT
|
{ Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QURLDialog(QURL * form, QWidget * parent = 0, const char * name = 0, bool modal = FALSE, WFlags fl = 0);
|
QURLDialog(QURL * form);
|
||||||
~QURLDialog();
|
~QURLDialog();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void apply_adaptor();
|
void changed_adaptor();
|
||||||
void close_adaptor();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *);
|
void closeEvent(QCloseEvent *);
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
#include <qbutton.h>
|
#include <qbutton.h>
|
||||||
|
#include <qlineedit.h>
|
||||||
|
|
||||||
Qt2BC::Qt2BC(string const & cancel, string const & close)
|
Qt2BC::Qt2BC(string const & cancel, string const & close)
|
||||||
: GuiBC<QButton, QWidget>(cancel, close)
|
: GuiBC<QButton, QWidget>(cancel, close)
|
||||||
@ -25,13 +26,26 @@ Qt2BC::Qt2BC(string const & cancel, string const & close)
|
|||||||
|
|
||||||
void Qt2BC::setButtonEnabled(QButton * obj, bool enabled)
|
void Qt2BC::setButtonEnabled(QButton * obj, bool enabled)
|
||||||
{
|
{
|
||||||
|
lyxerr << "Qt2BC: setting button "
|
||||||
|
<< obj << " to " << enabled << std::endl;
|
||||||
|
|
||||||
obj->setEnabled(enabled);
|
obj->setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Qt2BC::setWidgetEnabled(QWidget * obj, bool enabled)
|
void Qt2BC::setWidgetEnabled(QWidget * obj, bool enabled)
|
||||||
{
|
{
|
||||||
obj->setEnabled(enabled);
|
lyxerr << "Qt2BC: setting "
|
||||||
|
<< obj << " to " << enabled << std::endl;
|
||||||
|
|
||||||
|
// yuck, rtti, but the user comes first
|
||||||
|
if (obj->inherits("QLineEdit")) {
|
||||||
|
QLineEdit * le(static_cast<QLineEdit*>(obj));
|
||||||
|
le->setReadOnly(enabled);
|
||||||
|
} else {
|
||||||
|
obj->setEnabled(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
QWidget::FocusPolicy const p =
|
QWidget::FocusPolicy const p =
|
||||||
(enabled) ? QWidget::StrongFocus : QWidget::NoFocus;
|
(enabled) ? QWidget::StrongFocus : QWidget::NoFocus;
|
||||||
obj->setFocusPolicy(p);
|
obj->setFocusPolicy(p);
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "support/LAssert.h"
|
#include "support/LAssert.h"
|
||||||
|
|
||||||
Qt2Base::Qt2Base(ControlButtons & c, QString const & t)
|
Qt2Base::Qt2Base(ControlButtons & c, QString const & t)
|
||||||
: ViewBC<Qt2BC>(c), title_(t)
|
: ViewBC<Qt2BC>(c), updating_(false), title_(t)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -50,12 +50,6 @@ void Qt2Base::show()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Qt2Base::reset()
|
|
||||||
{
|
|
||||||
qApp->processEvents();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Qt2Base::hide()
|
void Qt2Base::hide()
|
||||||
{
|
{
|
||||||
if (form() && form()->isVisible())
|
if (form() && form()->isVisible())
|
||||||
@ -71,6 +65,11 @@ bool Qt2Base::isValid()
|
|||||||
|
|
||||||
void Qt2Base::changed()
|
void Qt2Base::changed()
|
||||||
{
|
{
|
||||||
|
lyxerr << "got changed() during updating:" << updating_ << std::endl;
|
||||||
|
|
||||||
|
if (updating_)
|
||||||
|
return;
|
||||||
|
|
||||||
if (isValid())
|
if (isValid())
|
||||||
bc().valid();
|
bc().valid();
|
||||||
else
|
else
|
||||||
|
@ -14,12 +14,12 @@
|
|||||||
#ifndef QT2BASE_H
|
#ifndef QT2BASE_H
|
||||||
#define QT2BASE_H
|
#define QT2BASE_H
|
||||||
|
|
||||||
class QDialog;
|
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <qfont.h>
|
#include <qfont.h>
|
||||||
|
#include <qdialog.h>
|
||||||
#include <qobject.h>
|
#include <qobject.h>
|
||||||
|
#include <qapplication.h>
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
@ -52,8 +52,8 @@ protected:
|
|||||||
virtual void hide();
|
virtual void hide();
|
||||||
/// Create the dialog if necessary, update it and display it.
|
/// Create the dialog if necessary, update it and display it.
|
||||||
virtual void show();
|
virtual void show();
|
||||||
/// reset after an update
|
/// update the dialog's contents
|
||||||
virtual void reset();
|
virtual void update_contents() = 0;
|
||||||
|
|
||||||
/// the dialog has changed contents
|
/// the dialog has changed contents
|
||||||
virtual void changed();
|
virtual void changed();
|
||||||
@ -61,6 +61,9 @@ protected:
|
|||||||
/// is the dialog currently valid ?
|
/// is the dialog currently valid ?
|
||||||
virtual bool isValid();
|
virtual bool isValid();
|
||||||
|
|
||||||
|
/// are we updating ?
|
||||||
|
bool updating_;
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
// dialog closed from WM
|
// dialog closed from WM
|
||||||
void slotWMHide();
|
void slotWMHide();
|
||||||
@ -91,10 +94,13 @@ template <class Dialog>
|
|||||||
class Qt2DB: public Qt2Base
|
class Qt2DB: public Qt2Base
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
Qt2DB(ControlButtons &, const QString&);
|
Qt2DB(ControlButtons &, const QString &);
|
||||||
|
|
||||||
|
/// update the dialog
|
||||||
|
virtual void update();
|
||||||
|
|
||||||
/// Pointer to the actual instantiation of the Qt dialog
|
/// Pointer to the actual instantiation of the Qt dialog
|
||||||
virtual QDialog* form() const;
|
virtual QDialog * form() const;
|
||||||
/// Real GUI implementation.
|
/// Real GUI implementation.
|
||||||
boost::scoped_ptr<Dialog> dialog_;
|
boost::scoped_ptr<Dialog> dialog_;
|
||||||
|
|
||||||
@ -102,18 +108,39 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
template <class Dialog>
|
template <class Dialog>
|
||||||
Qt2DB<Dialog>::Qt2DB(ControlButtons & c, const QString& t)
|
Qt2DB<Dialog>::Qt2DB(ControlButtons & c, const QString & t)
|
||||||
: Qt2Base(c, t)
|
: Qt2Base(c, t)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
template <class Dialog>
|
template <class Dialog>
|
||||||
QDialog* Qt2DB<Dialog>::form() const
|
QDialog * Qt2DB<Dialog>::form() const
|
||||||
{
|
{
|
||||||
return dialog_.get();
|
return dialog_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <class Dialog>
|
||||||
|
void Qt2DB<Dialog>::update()
|
||||||
|
{
|
||||||
|
form()->setUpdatesEnabled(false);
|
||||||
|
|
||||||
|
// this is tricky. First we process pending events
|
||||||
|
// as a result of the bc() state change (if any).
|
||||||
|
// then we lock out any bc() changes as a result of
|
||||||
|
// "innocent" updates during update_contents()
|
||||||
|
// then we enable normal behaviour again.
|
||||||
|
qApp->processEvents();
|
||||||
|
updating_ = true;
|
||||||
|
update_contents();
|
||||||
|
qApp->processEvents();
|
||||||
|
updating_ = false;
|
||||||
|
|
||||||
|
form()->setUpdatesEnabled(true);
|
||||||
|
form()->update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class Controller, class Base>
|
template <class Controller, class Base>
|
||||||
class Qt2CB: public Base
|
class Qt2CB: public Base
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,8 @@ form_->changed(). If you are using a more complicated thing anyway,
|
|||||||
then remember to call form_->changed() at the end (if it has changed !)
|
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
|
Every non-trivial widget should have a tooltip. If you don't know
|
||||||
what to write, write "FIXME", and it can fixed later.
|
what to write, write "FIXME", and it can fixed later. Don't be afraid
|
||||||
|
to use QWhatsThis too (e.g. the index dialog)
|
||||||
|
|
||||||
If necessary, you should override Qt2Base::isValid() for determining the validity
|
If necessary, you should override Qt2Base::isValid() for determining the validity
|
||||||
of the current dialog's contents.
|
of the current dialog's contents.
|
||||||
@ -18,9 +19,12 @@ of the current dialog's contents.
|
|||||||
OK/Apply/Restore/Close should be connected in the derived class's constructor
|
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.
|
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
|
Override update_contents() to update the dialog, not update()
|
||||||
is correct !
|
|
||||||
|
Never call buttoncontroller functions directly from dialogs. In general, you
|
||||||
|
should use Qt2Base::changed() in all circumstances. However, if you must call
|
||||||
|
the buttoncontroller, make sure to respect Qt2Base::updating_
|
||||||
|
|
||||||
Don't #undef emit - #include "QtLyXView.h" instead
|
Don't #undef emit - #include "QtLyXView.h" instead
|
||||||
|
|
||||||
Naming conventions
|
Naming conventions
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>439</width>
|
<width>427</width>
|
||||||
<height>585</height>
|
<height>585</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -79,6 +79,10 @@
|
|||||||
<name>pixmap</name>
|
<name>pixmap</name>
|
||||||
<pixmap>image0</pixmap>
|
<pixmap>image0</pixmap>
|
||||||
</property>
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>toolTip</name>
|
||||||
|
<string>Add the selected citation</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget>
|
<widget>
|
||||||
<class>QPushButton</class>
|
<class>QPushButton</class>
|
||||||
@ -101,6 +105,10 @@
|
|||||||
<name>pixmap</name>
|
<name>pixmap</name>
|
||||||
<pixmap>image1</pixmap>
|
<pixmap>image1</pixmap>
|
||||||
</property>
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>toolTip</name>
|
||||||
|
<string>Remove the selected citation</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget>
|
<widget>
|
||||||
<class>QPushButton</class>
|
<class>QPushButton</class>
|
||||||
@ -123,6 +131,10 @@
|
|||||||
<name>pixmap</name>
|
<name>pixmap</name>
|
||||||
<pixmap>image2</pixmap>
|
<pixmap>image2</pixmap>
|
||||||
</property>
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>toolTip</name>
|
||||||
|
<string>Move the selected citation up</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget>
|
<widget>
|
||||||
<class>QPushButton</class>
|
<class>QPushButton</class>
|
||||||
@ -145,6 +157,10 @@
|
|||||||
<name>pixmap</name>
|
<name>pixmap</name>
|
||||||
<pixmap>image3</pixmap>
|
<pixmap>image3</pixmap>
|
||||||
</property>
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>toolTip</name>
|
||||||
|
<string>Move the selected citation down</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</vbox>
|
</vbox>
|
||||||
</widget>
|
</widget>
|
||||||
@ -184,7 +200,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property>
|
<property>
|
||||||
<name>toolTip</name>
|
<name>toolTip</name>
|
||||||
<string>Reference keys available</string>
|
<string>Available citation keys</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget row="1" column="0" >
|
<widget row="1" column="0" >
|
||||||
@ -205,7 +221,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property>
|
<property>
|
||||||
<name>toolTip</name>
|
<name>toolTip</name>
|
||||||
<string>Keys currently selected</string>
|
<string>Citations currently selected</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</grid>
|
</grid>
|
||||||
@ -262,7 +278,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property>
|
<property>
|
||||||
<name>toolTip</name>
|
<name>toolTip</name>
|
||||||
<string>Reference entry text</string>
|
<string>Citation entry</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<spacer>
|
<spacer>
|
||||||
@ -311,6 +327,10 @@
|
|||||||
<name>name</name>
|
<name>name</name>
|
||||||
<cstring>searchED</cstring>
|
<cstring>searchED</cstring>
|
||||||
</property>
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>toolTip</name>
|
||||||
|
<string>Search the available citations</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget>
|
<widget>
|
||||||
<class>QLayoutWidget</class>
|
<class>QLayoutWidget</class>
|
||||||
@ -337,6 +357,10 @@
|
|||||||
<name>text</name>
|
<name>text</name>
|
||||||
<string>Regular E&xpression</string>
|
<string>Regular E&xpression</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>toolTip</name>
|
||||||
|
<string>Interpret search entry as a regular expression</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<spacer>
|
<spacer>
|
||||||
<property>
|
<property>
|
||||||
@ -397,6 +421,10 @@
|
|||||||
<name>text</name>
|
<name>text</name>
|
||||||
<string>&Case sensitive</string>
|
<string>&Case sensitive</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>toolTip</name>
|
||||||
|
<string>Make the search case-sensitive</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<spacer>
|
<spacer>
|
||||||
<property>
|
<property>
|
||||||
@ -487,6 +515,10 @@
|
|||||||
<name>name</name>
|
<name>name</name>
|
||||||
<cstring>citationStyleCO</cstring>
|
<cstring>citationStyleCO</cstring>
|
||||||
</property>
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>toolTip</name>
|
||||||
|
<string>FIXME</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<spacer>
|
<spacer>
|
||||||
<property>
|
<property>
|
||||||
@ -773,4 +805,24 @@
|
|||||||
<slot access="protected">slotSearchTypeSelected(bool)</slot>
|
<slot access="protected">slotSearchTypeSelected(bool)</slot>
|
||||||
<slot access="protected">slotUpClicked()</slot>
|
<slot access="protected">slotUpClicked()</slot>
|
||||||
</connections>
|
</connections>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>addPB</tabstop>
|
||||||
|
<tabstop>delPB</tabstop>
|
||||||
|
<tabstop>upPB</tabstop>
|
||||||
|
<tabstop>downPB</tabstop>
|
||||||
|
<tabstop>citeLB</tabstop>
|
||||||
|
<tabstop>bibLB</tabstop>
|
||||||
|
<tabstop>searchED</tabstop>
|
||||||
|
<tabstop>searchTypeCB</tabstop>
|
||||||
|
<tabstop>searchCaseCB</tabstop>
|
||||||
|
<tabstop>previousPB</tabstop>
|
||||||
|
<tabstop>nextPB</tabstop>
|
||||||
|
<tabstop>citationStyleCO</tabstop>
|
||||||
|
<tabstop>textBeforeED</tabstop>
|
||||||
|
<tabstop>textAfterED</tabstop>
|
||||||
|
<tabstop>restorePB</tabstop>
|
||||||
|
<tabstop>okPB</tabstop>
|
||||||
|
<tabstop>applyPB</tabstop>
|
||||||
|
<tabstop>closePB</tabstop>
|
||||||
|
</tabstops>
|
||||||
</UI>
|
</UI>
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>204</width>
|
<width>197</width>
|
||||||
<height>82</height>
|
<height>82</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -72,6 +72,22 @@
|
|||||||
<name>toolTip</name>
|
<name>toolTip</name>
|
||||||
<string>Index entry</string>
|
<string>Index entry</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>whatsThis</name>
|
||||||
|
<string>The format of the entry in the index.
|
||||||
|
|
||||||
|
An entry can be specified as a sub-entry of
|
||||||
|
another with "!" :
|
||||||
|
|
||||||
|
cars!mileage
|
||||||
|
|
||||||
|
You can cross-refer to another entry like so :
|
||||||
|
|
||||||
|
cars!mileage|see{economy}
|
||||||
|
|
||||||
|
For further details refer to the local LaTeX
|
||||||
|
documentation.</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</hbox>
|
</hbox>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -171,11 +171,11 @@
|
|||||||
<class>QPushButton</class>
|
<class>QPushButton</class>
|
||||||
<property stdset="1">
|
<property stdset="1">
|
||||||
<name>name</name>
|
<name>name</name>
|
||||||
<cstring>cancelPB</cstring>
|
<cstring>closePB</cstring>
|
||||||
</property>
|
</property>
|
||||||
<property stdset="1">
|
<property stdset="1">
|
||||||
<name>text</name>
|
<name>text</name>
|
||||||
<string>&Cancel</string>
|
<string>&Close</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</hbox>
|
</hbox>
|
||||||
@ -184,18 +184,23 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
<sender>okPB</sender>
|
<sender>urlED</sender>
|
||||||
<signal>clicked()</signal>
|
<signal>textChanged(const QString&)</signal>
|
||||||
<receiver>QURLDialogBase</receiver>
|
<receiver>QURLDialogBase</receiver>
|
||||||
<slot>apply_adaptor()</slot>
|
<slot>changed_adaptor()</slot>
|
||||||
</connection>
|
</connection>
|
||||||
<connection>
|
<connection>
|
||||||
<sender>cancelPB</sender>
|
<sender>hyperlinkCB</sender>
|
||||||
<signal>clicked()</signal>
|
<signal>clicked()</signal>
|
||||||
<receiver>QURLDialogBase</receiver>
|
<receiver>QURLDialogBase</receiver>
|
||||||
<slot>close_adaptor()</slot>
|
<slot>changed_adaptor()</slot>
|
||||||
</connection>
|
</connection>
|
||||||
<slot access="public">apply_adaptor()</slot>
|
<connection>
|
||||||
<slot access="public">close_adaptor()</slot>
|
<sender>nameED</sender>
|
||||||
|
<signal>textChanged(const QString&)</signal>
|
||||||
|
<receiver>QURLDialogBase</receiver>
|
||||||
|
<slot>changed_adaptor()</slot>
|
||||||
|
</connection>
|
||||||
|
<slot access="public">changed_adaptor()</slot>
|
||||||
</connections>
|
</connections>
|
||||||
</UI>
|
</UI>
|
||||||
|
Loading…
Reference in New Issue
Block a user