mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
more dialog merging
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17977 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c570ddad12
commit
163a95106e
@ -41,21 +41,16 @@ libqt4_la_SOURCES = \
|
||||
GuiSelection.h GuiSelection.C \
|
||||
LyXKeySymFactory.C \
|
||||
QLMenubar.C QLMenubar.h \
|
||||
QBibitem.C QBibitem.h \
|
||||
QBibtex.C QBibtex.h \
|
||||
QBox.C QBox.h \
|
||||
QBranch.C QBranch.h \
|
||||
QBranches.C QBranches.h \
|
||||
QChanges.C QChanges.h \
|
||||
QCharacter.C QCharacter.h \
|
||||
QCitation.C QCitation.h \
|
||||
QDialogView.C QDialogView.h \
|
||||
QErrorList.C QErrorList.h \
|
||||
QExternal.C QExternal.h \
|
||||
QFloat.C QFloat.h \
|
||||
QGraphics.C QGraphics.h \
|
||||
QInclude.C QInclude.h \
|
||||
QIndex.C QIndex.h \
|
||||
QLImage.C QLImage.h \
|
||||
QViewSource.C QViewSource.h \
|
||||
QLPainter.C QLPainter.h \
|
||||
|
@ -87,10 +87,10 @@ MOCFILES = \
|
||||
lengthcombo.C lengthcombo.h \
|
||||
panelstack.C panelstack.h \
|
||||
QAbout.C QAbout.h \
|
||||
QBibitemDialog.C QBibitemDialog.h \
|
||||
QBibtexDialog.C QBibtexDialog.h \
|
||||
QBibitem.C QBibitem.h \
|
||||
QBibtex.C QBibtex.h \
|
||||
QBox.C QBox.h \
|
||||
QBranchDialog.C QBranchDialog.h \
|
||||
QBranch.C QBranch.h \
|
||||
QBranches.C QBranches.h \
|
||||
QChangesDialog.C QChangesDialog.h \
|
||||
QCharacterDialog.C QCharacterDialog.h \
|
||||
@ -101,11 +101,11 @@ MOCFILES = \
|
||||
QDocument.C QDocument.h \
|
||||
QErrorListDialog.C QErrorListDialog.h \
|
||||
QERT.C QERT.h \
|
||||
QExternalDialog.C QExternalDialog.h \
|
||||
QExternal.C QExternal.h \
|
||||
QFloatDialog.C QFloatDialog.h \
|
||||
QGraphicsDialog.C QGraphicsDialog.h \
|
||||
QIncludeDialog.C QIncludeDialog.h \
|
||||
QIndexDialog.C QIndexDialog.h \
|
||||
QIndex.C QIndex.h \
|
||||
QLog.C QLog.h \
|
||||
QViewSource.C QViewSource.h \
|
||||
QLMenubar.C QLMenubar.h \
|
||||
|
@ -11,24 +11,62 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "QBibitem.h"
|
||||
#include "QBibitemDialog.h"
|
||||
#include "Qt2BC.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include "controllers/ControlCommand.h"
|
||||
|
||||
#include <qlineedit.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
typedef QController<ControlCommand, QView<QBibitemDialog> > bibitem_base_class;
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QBibItemDialog
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
QBibitemDialog::QBibitemDialog(QBibitem * form)
|
||||
: form_(form)
|
||||
{
|
||||
setupUi(this);
|
||||
connect(okPB, SIGNAL(clicked()), form, SLOT(slotOK()));
|
||||
connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
|
||||
|
||||
connect(keyED, SIGNAL(textChanged(const QString &)),
|
||||
this, SLOT(change_adaptor()));
|
||||
connect(labelED, SIGNAL(textChanged(const QString &)),
|
||||
this, SLOT(change_adaptor()));
|
||||
}
|
||||
|
||||
|
||||
void QBibitemDialog::change_adaptor()
|
||||
{
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QBibitemDialog::closeEvent(QCloseEvent *e)
|
||||
{
|
||||
form_->slotWMHide();
|
||||
e->accept();
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QBibItem
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef QController<ControlCommand, QView<QBibitemDialog> > BibItemBase;
|
||||
|
||||
|
||||
QBibitem::QBibitem(Dialog & parent)
|
||||
: bibitem_base_class(parent, _("Bibliography Entry Settings"))
|
||||
: BibItemBase(parent, _("Bibliography Entry Settings"))
|
||||
{
|
||||
}
|
||||
|
||||
@ -65,3 +103,5 @@ bool QBibitem::isValid()
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "QBibitem_moc.cpp"
|
||||
|
@ -12,12 +12,33 @@
|
||||
#ifndef QBIBITEM_CONTROLLER_H
|
||||
#define QBIBITEM_CONTROLLER_H
|
||||
|
||||
#include "QBibitemDialog.h"
|
||||
#include "QDialogView.h"
|
||||
|
||||
#include "ui/BibitemUi.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QCloseEvent>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QBibitem;
|
||||
|
||||
class QBibitemDialog : public QDialog, public Ui::QBibitemUi {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
QBibitemDialog(QBibitem * form);
|
||||
protected Q_SLOTS:
|
||||
virtual void change_adaptor();
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent * e);
|
||||
private:
|
||||
QBibitem * form_;
|
||||
};
|
||||
|
||||
|
||||
class ControlCommand;
|
||||
|
||||
class QBibitem
|
||||
|
@ -1,52 +0,0 @@
|
||||
/**
|
||||
* \file QBibitemDialog.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>
|
||||
|
||||
#include "QBibitemDialog.h"
|
||||
|
||||
#include "QBibitem.h"
|
||||
|
||||
#include <qpushbutton.h>
|
||||
#include <QCloseEvent>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
QBibitemDialog::QBibitemDialog(QBibitem * form)
|
||||
: form_(form)
|
||||
{
|
||||
setupUi(this);
|
||||
connect(okPB, SIGNAL(clicked()),
|
||||
form, SLOT(slotOK()));
|
||||
connect(closePB, SIGNAL(clicked()),
|
||||
form, SLOT(slotClose()));
|
||||
|
||||
connect( keyED, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
|
||||
connect( labelED, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
|
||||
}
|
||||
|
||||
|
||||
void QBibitemDialog::change_adaptor()
|
||||
{
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QBibitemDialog::closeEvent(QCloseEvent *e)
|
||||
{
|
||||
form_->slotWMHide();
|
||||
e->accept();
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "QBibitemDialog_moc.cpp"
|
@ -1,43 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QBibitemDialog.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 QBIBITEMDIALOG_H
|
||||
#define QBIBITEMDIALOG_H
|
||||
|
||||
#include "ui/BibitemUi.h"
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include <QCloseEvent>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QBibitem;
|
||||
|
||||
class QBibitemDialog : public QDialog, public Ui::QBibitemUi {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
QBibitemDialog(QBibitem * form);
|
||||
protected Q_SLOTS:
|
||||
virtual void change_adaptor();
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent * e);
|
||||
private:
|
||||
QBibitem * form_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QBIBITEMDIALOG_H
|
@ -14,13 +14,15 @@
|
||||
|
||||
#include "QBibtex.h"
|
||||
|
||||
#include "QBibtexDialog.h"
|
||||
#include "ui/BibtexAddUi.h"
|
||||
#include "Qt2BC.h"
|
||||
#include "qt_helpers.h"
|
||||
#include "validators.h"
|
||||
|
||||
#include "lyxrc.h"
|
||||
#include "checkedwidgets.h"
|
||||
|
||||
#include "controllers/ControlBibtex.h"
|
||||
#include "controllers/ButtonPolicies.h"
|
||||
|
||||
#include "controllers/ControlBibtex.h"
|
||||
|
||||
@ -30,7 +32,8 @@
|
||||
#include <QPushButton>
|
||||
#include <QListWidget>
|
||||
#include <QCheckBox>
|
||||
|
||||
#include <QCloseEvent>
|
||||
#include <QLineEdit>
|
||||
|
||||
using lyx::support::changeExtension;
|
||||
using lyx::support::split;
|
||||
@ -39,13 +42,222 @@ using lyx::support::trim;
|
||||
using std::vector;
|
||||
using std::string;
|
||||
|
||||
#include "debug.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
typedef QController<ControlBibtex, QView<QBibtexDialog> > bibtex_base_class;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QBibtexDialog
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
QBibtexDialog::QBibtexDialog(QBibtex * form)
|
||||
: form_(form)
|
||||
{
|
||||
setupUi(this);
|
||||
QDialog::setModal(true);
|
||||
|
||||
connect(okPB, SIGNAL(clicked()),
|
||||
form, SLOT(slotOK()));
|
||||
connect(closePB, SIGNAL(clicked()),
|
||||
form, SLOT(slotClose()));
|
||||
connect(stylePB, SIGNAL(clicked()),
|
||||
this, SLOT( browsePressed()));
|
||||
connect(deletePB, SIGNAL(clicked()),
|
||||
this, SLOT( deletePressed()));
|
||||
connect(styleCB, SIGNAL(editTextChanged (const QString &)),
|
||||
this, SLOT( change_adaptor()));
|
||||
connect(databaseLW, SIGNAL(itemSelectionChanged()),
|
||||
this, SLOT( databaseChanged()));
|
||||
connect(bibtocCB, SIGNAL(clicked()),
|
||||
this, SLOT( change_adaptor()));
|
||||
connect(btPrintCO, SIGNAL(activated(int)),
|
||||
this, SLOT( change_adaptor()));
|
||||
connect(addBibPB, SIGNAL(clicked()),
|
||||
this, SLOT( addPressed()));
|
||||
|
||||
add_ = new UiDialog<Ui::QBibtexAddUi>(this, true);
|
||||
|
||||
Qt2BC * bcview = new Qt2BC(add_bc_);
|
||||
add_bc_.view(bcview);
|
||||
add_bc_.bp(new OkCancelPolicy);
|
||||
|
||||
bcview->setOK(add_->addPB);
|
||||
bcview->setCancel(add_->closePB);
|
||||
|
||||
add_->bibED->setValidator(new PathValidator(true, add_->bibED));
|
||||
addCheckedLineEdit(add_bc_.view(), add_->bibED, 0);
|
||||
|
||||
connect(add_->bibED, SIGNAL(textChanged(const QString &)),
|
||||
this, SLOT(bibEDChanged()));
|
||||
connect(add_->addPB, SIGNAL(clicked()),
|
||||
this, SLOT(addDatabase()));
|
||||
connect(add_->addPB, SIGNAL(clicked()),
|
||||
add_, SLOT(accept()));
|
||||
connect(add_->bibLW, SIGNAL(itemActivated(QListWidgetItem *)),
|
||||
this, SLOT(addDatabase()));
|
||||
connect(add_->bibLW, SIGNAL(itemActivated(QListWidgetItem *)),
|
||||
add_, SLOT(accept()));
|
||||
connect(add_->bibLW, SIGNAL(itemSelectionChanged()),
|
||||
this, SLOT(availableChanged()));
|
||||
connect(add_->browsePB, SIGNAL(clicked()),
|
||||
this, SLOT(browseBibPressed()));
|
||||
connect(add_->closePB, SIGNAL(clicked()),
|
||||
add_, SLOT(reject()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
void QBibtexDialog::bibEDChanged()
|
||||
{
|
||||
// Indicate to the button controller that the contents have
|
||||
// changed. The actual test of validity is carried out by
|
||||
// the checkedLineEdit.
|
||||
add_bc_.valid(true);
|
||||
}
|
||||
|
||||
|
||||
void QBibtexDialog::change_adaptor()
|
||||
{
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QBibtexDialog::browsePressed()
|
||||
{
|
||||
docstring const file = form_->controller().browseBst(docstring());
|
||||
|
||||
if (!file.empty()) {
|
||||
// FIXME UNICODE
|
||||
docstring const filen = from_utf8(changeExtension(to_utf8(file), ""));
|
||||
bool present = false;
|
||||
unsigned int pres = 0;
|
||||
|
||||
for (int i = 0; i != styleCB->count(); ++i) {
|
||||
if (qstring_to_ucs4(styleCB->itemText(i)) == filen) {
|
||||
present = true;
|
||||
pres = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (!present)
|
||||
styleCB->insertItem(0, toqstr(filen));
|
||||
|
||||
styleCB->setCurrentIndex(pres);
|
||||
form_->changed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QBibtexDialog::browseBibPressed()
|
||||
{
|
||||
docstring const file = trim(form_->controller().browseBib(docstring()));
|
||||
|
||||
if (!file.empty()) {
|
||||
// FIXME UNICODE
|
||||
QString const f = toqstr(changeExtension(to_utf8(file), ""));
|
||||
bool present = false;
|
||||
|
||||
for (int i = 0; i < add_->bibLW->count(); ++i) {
|
||||
if (add_->bibLW->item(i)->text() == f)
|
||||
present = true;
|
||||
}
|
||||
|
||||
if (!present) {
|
||||
add_->bibLW->addItem(f);
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
add_->bibED->setText(f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QBibtexDialog::addPressed()
|
||||
{
|
||||
add_bc_.valid(false);
|
||||
add_->exec();
|
||||
}
|
||||
|
||||
|
||||
void QBibtexDialog::addDatabase()
|
||||
{
|
||||
int const sel = add_->bibLW->currentRow();
|
||||
docstring const file = trim(qstring_to_ucs4(add_->bibED->text()));
|
||||
|
||||
if (sel < 0 && file.empty())
|
||||
return;
|
||||
|
||||
// Add the selected browser_bib keys to browser_database
|
||||
// multiple selections are possible
|
||||
for (int i = 0; i != add_->bibLW->count(); ++i) {
|
||||
QListWidgetItem * const item = add_->bibLW->item(i);
|
||||
if (add_->bibLW->isItemSelected(item)) {
|
||||
add_->bibLW->setItemSelected(item, false);
|
||||
QList<QListWidgetItem *> matches =
|
||||
databaseLW->findItems(item->text(), Qt::MatchExactly);
|
||||
if (matches.empty())
|
||||
databaseLW->addItem(item->text());
|
||||
}
|
||||
}
|
||||
|
||||
if (!file.empty()) {
|
||||
add_->bibED->clear();
|
||||
QString const f = toqstr(from_utf8(changeExtension(to_utf8(file), "")));
|
||||
QList<QListWidgetItem *> matches =
|
||||
databaseLW->findItems(f, Qt::MatchExactly);
|
||||
if (matches.empty())
|
||||
databaseLW->addItem(f);
|
||||
}
|
||||
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QBibtexDialog::deletePressed()
|
||||
{
|
||||
databaseLW->takeItem(databaseLW->currentRow());
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void QBibtexDialog::databaseChanged()
|
||||
{
|
||||
deletePB->setEnabled(!form_->readOnly() && databaseLW->currentRow() != -1);
|
||||
}
|
||||
|
||||
|
||||
void QBibtexDialog::availableChanged()
|
||||
{
|
||||
add_bc_.valid(true);
|
||||
}
|
||||
|
||||
|
||||
void QBibtexDialog::closeEvent(QCloseEvent *e)
|
||||
{
|
||||
form_->slotWMHide();
|
||||
e->accept();
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QBibTex
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
typedef QController<ControlBibtex, QView<QBibtexDialog> > BibtexBase;
|
||||
|
||||
QBibtex::QBibtex(Dialog & parent)
|
||||
: bibtex_base_class(parent, _("BibTeX Bibliography"))
|
||||
: BibtexBase(parent, _("BibTeX Bibliography"))
|
||||
{
|
||||
}
|
||||
|
||||
@ -195,3 +407,5 @@ bool QBibtex::isValid()
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "QBibtex_moc.cpp"
|
||||
|
@ -9,15 +9,65 @@
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef QBIBTEX_CONTROLLER_H
|
||||
#define QBIBTEX_CONTROLLER_H
|
||||
#ifndef QBIBTEX_H
|
||||
#define QBIBTEX_H
|
||||
|
||||
#include "QDialogView.h"
|
||||
#include "QBibtexDialog.h"
|
||||
|
||||
#include "ui/BibtexUi.h"
|
||||
#include "ui/BibtexAddUi.h"
|
||||
|
||||
#include "ButtonController.h"
|
||||
|
||||
#include <QCloseEvent>
|
||||
#include <QDialog>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QBibtex;
|
||||
|
||||
template<class UI>
|
||||
class UiDialog : public QDialog, public UI
|
||||
{
|
||||
public:
|
||||
UiDialog(QWidget * parent=0, bool modal=false, Qt::WFlags f=0)
|
||||
: QDialog(parent, f)
|
||||
{
|
||||
UI::setupUi(this);
|
||||
QDialog::setModal(modal);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class QBibtexDialog : public QDialog, public Ui::QBibtexUi {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QBibtexDialog(QBibtex * form);
|
||||
|
||||
UiDialog<Ui::QBibtexAddUi> * add_;
|
||||
|
||||
protected Q_SLOTS:
|
||||
virtual void change_adaptor();
|
||||
virtual void browsePressed();
|
||||
virtual void browseBibPressed();
|
||||
virtual void addPressed();
|
||||
virtual void addDatabase();
|
||||
virtual void deletePressed();
|
||||
virtual void databaseChanged();
|
||||
virtual void availableChanged();
|
||||
void bibEDChanged();
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent * e);
|
||||
|
||||
private:
|
||||
QBibtex * form_;
|
||||
ButtonController add_bc_;
|
||||
};
|
||||
|
||||
|
||||
class ControlBibtex;
|
||||
|
||||
class QBibtex
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "QBranch.h"
|
||||
#include "QBranchDialog.h"
|
||||
#include "Qt2BC.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
@ -22,10 +21,49 @@
|
||||
#include "insets/InsetBranch.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QCloseEvent>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QBranchDialog
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
QBranchDialog::QBranchDialog(QBranch * form)
|
||||
: form_(form)
|
||||
{
|
||||
setupUi(this);
|
||||
connect(okPB, SIGNAL(clicked()),
|
||||
form, SLOT(slotOK()));
|
||||
connect(closePB, SIGNAL(clicked()),
|
||||
form, SLOT(slotClose()));
|
||||
connect(branchCO, SIGNAL( activated(int) ),
|
||||
this, SLOT( change_adaptor() ) );
|
||||
}
|
||||
|
||||
|
||||
void QBranchDialog::closeEvent(QCloseEvent * e)
|
||||
{
|
||||
form_->slotWMHide();
|
||||
e->accept();
|
||||
}
|
||||
|
||||
|
||||
void QBranchDialog::change_adaptor()
|
||||
{
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QBranch
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef QController<ControlBranch, QView<QBranchDialog> > branch_base_class;
|
||||
|
||||
|
||||
@ -75,3 +113,5 @@ void QBranch::apply()
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "QBranch_moc.cpp"
|
||||
|
@ -12,12 +12,29 @@
|
||||
#ifndef QBRANCH_H
|
||||
#define QBRANCH_H
|
||||
|
||||
#include "QBranchDialog.h"
|
||||
#include "QDialogView.h"
|
||||
#include "ui/BranchUi.h"
|
||||
|
||||
#include <QCloseEvent>
|
||||
#include <QDialog>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QBranch;
|
||||
|
||||
class QBranchDialog : public QDialog, public Ui::QBranchUi {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QBranchDialog(QBranch * form);
|
||||
protected Q_SLOTS:
|
||||
virtual void change_adaptor();
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent * e);
|
||||
private:
|
||||
QBranch * form_;
|
||||
};
|
||||
|
||||
class ControlBranch;
|
||||
|
||||
/** This class provides a QT implementation of the Branch Dialog.
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "lyxrc.h"
|
||||
|
||||
#include "controllers/ControlExternal.h"
|
||||
#include "controllers/ButtonController.h"
|
||||
|
||||
#include "insets/ExternalTemplate.h"
|
||||
#include "insets/InsetExternal.h"
|
||||
@ -24,9 +25,9 @@
|
||||
#include "support/lstrings.h"
|
||||
#include "support/convert.h"
|
||||
#include "support/os.h"
|
||||
#include "support/lyxlib.h"
|
||||
|
||||
#include "QExternal.h"
|
||||
#include "QExternalDialog.h"
|
||||
#include "Qt2BC.h"
|
||||
|
||||
#include "checkedwidgets.h"
|
||||
@ -45,6 +46,7 @@ namespace external = lyx::external;
|
||||
using lyx::support::isStrDbl;
|
||||
using lyx::support::token;
|
||||
using lyx::support::trim;
|
||||
using lyx::support::float_equal;
|
||||
|
||||
using lyx::support::os::internal_path;
|
||||
|
||||
@ -52,9 +54,203 @@ using std::string;
|
||||
using std::vector;
|
||||
using std::find;
|
||||
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QExternalDialog
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
QExternalDialog::QExternalDialog(QExternal * form)
|
||||
: form_(form)
|
||||
{
|
||||
setupUi(this);
|
||||
connect(okPB, SIGNAL(clicked()),
|
||||
form, SLOT(slotOK()));
|
||||
connect(applyPB, SIGNAL(clicked()),
|
||||
form, SLOT(slotApply()));
|
||||
connect(closePB, SIGNAL(clicked()),
|
||||
form, SLOT(slotClose()));
|
||||
|
||||
connect( displayCB, SIGNAL( toggled(bool) ), showCO, SLOT( setEnabled(bool) ) );
|
||||
connect( displayCB, SIGNAL( toggled(bool) ), displayscaleED, SLOT( setEnabled(bool) ) );
|
||||
connect( showCO, SIGNAL( activated(const QString&) ), this, SLOT( change_adaptor() ) );
|
||||
connect( originCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
|
||||
connect( aspectratioCB, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) );
|
||||
connect( browsePB, SIGNAL( clicked() ), this, SLOT( browseClicked() ) );
|
||||
connect( editPB, SIGNAL( clicked() ), this, SLOT( editClicked() ) );
|
||||
connect( externalCO, SIGNAL( activated(const QString&) ), this, SLOT( templateChanged() ) );
|
||||
connect( extraED, SIGNAL( textChanged(const QString&) ), this, SLOT( extraChanged(const QString&) ) );
|
||||
connect( extraFormatCO, SIGNAL( activated(const QString&) ), this, SLOT( formatChanged(const QString&) ) );
|
||||
connect( widthUnitCO, SIGNAL( activated(int) ), this, SLOT( widthUnitChanged() ) );
|
||||
connect( heightUnitCO, SIGNAL( selectionChanged(lyx::LyXLength::UNIT) ), this, SLOT( change_adaptor() ) );
|
||||
connect( displayCB, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) );
|
||||
connect( displayscaleED, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
|
||||
connect( angleED, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
|
||||
connect( widthED, SIGNAL( textChanged(const QString&) ), this, SLOT( sizeChanged() ) );
|
||||
connect( heightED, SIGNAL( textChanged(const QString&) ), this, SLOT( sizeChanged() ) );
|
||||
connect( fileED, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
|
||||
connect( clipCB, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) );
|
||||
connect( getbbPB, SIGNAL( clicked() ), this, SLOT( getbbClicked() ) );
|
||||
connect( xrED, SIGNAL( textChanged(const QString&) ), this, SLOT( bbChanged() ) );
|
||||
connect( ytED, SIGNAL( textChanged(const QString&) ), this, SLOT( bbChanged() ) );
|
||||
connect( xlED, SIGNAL( textChanged(const QString&) ), this, SLOT( bbChanged() ) );
|
||||
connect( ybED, SIGNAL( textChanged(const QString&) ), this, SLOT( bbChanged() ) );
|
||||
connect( draftCB, SIGNAL( clicked() ), this, SLOT( change_adaptor() ) );
|
||||
|
||||
QIntValidator * validator = new QIntValidator(displayscaleED);
|
||||
validator->setBottom(1);
|
||||
displayscaleED->setValidator(validator);
|
||||
|
||||
angleED->setValidator(new QDoubleValidator(-360, 360, 2, angleED));
|
||||
|
||||
xlED->setValidator(new QIntValidator(xlED));
|
||||
ybED->setValidator(new QIntValidator(ybED));
|
||||
xrED->setValidator(new QIntValidator(xrED));
|
||||
ytED->setValidator(new QIntValidator(ytED));
|
||||
|
||||
widthED->setValidator(unsignedLengthValidator(widthED));
|
||||
heightED->setValidator(unsignedLengthValidator(heightED));
|
||||
|
||||
fileED->setValidator(new PathValidator(true, fileED));
|
||||
setFocusProxy(fileED);
|
||||
}
|
||||
|
||||
|
||||
void QExternalDialog::show()
|
||||
{
|
||||
QDialog::show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool QExternalDialog::activateAspectratio() const
|
||||
{
|
||||
if (widthUnitCO->currentIndex() == 0)
|
||||
return false;
|
||||
|
||||
string const wstr = fromqstr(widthED->text());
|
||||
if (wstr.empty())
|
||||
return false;
|
||||
bool const wIsDbl = isStrDbl(wstr);
|
||||
if (wIsDbl && float_equal(convert<double>(wstr), 0.0, 0.05))
|
||||
return false;
|
||||
LyXLength l;
|
||||
if (!wIsDbl && (!isValidLength(wstr, &l) || l.zero()))
|
||||
return false;
|
||||
|
||||
string const hstr = fromqstr(heightED->text());
|
||||
if (hstr.empty())
|
||||
return false;
|
||||
bool const hIsDbl = isStrDbl(hstr);
|
||||
if (hIsDbl && float_equal(convert<double>(hstr), 0.0, 0.05))
|
||||
return false;
|
||||
if (!hIsDbl && (!isValidLength(hstr, &l) || l.zero()))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void QExternalDialog::bbChanged()
|
||||
{
|
||||
form_->controller().bbChanged(true);
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QExternalDialog::browseClicked()
|
||||
{
|
||||
int const choice = externalCO->currentIndex();
|
||||
docstring const template_name =
|
||||
lyx::from_utf8(form_->controller().getTemplate(choice).lyxName);
|
||||
docstring const str =
|
||||
form_->controller().browse(qstring_to_ucs4(fileED->text()),
|
||||
template_name);
|
||||
fileED->setText(toqstr(str));
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QExternalDialog::change_adaptor()
|
||||
{
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QExternalDialog::closeEvent(QCloseEvent * e)
|
||||
{
|
||||
form_->slotWMHide();
|
||||
e->accept();
|
||||
}
|
||||
|
||||
|
||||
void QExternalDialog::editClicked()
|
||||
{
|
||||
form_->controller().editExternal();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void QExternalDialog::extraChanged(const QString& text)
|
||||
{
|
||||
std::string const format = fromqstr(extraFormatCO->currentText());
|
||||
form_->extra_[format] = text;
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QExternalDialog::formatChanged(const QString& format)
|
||||
{
|
||||
extraED->setText(form_->extra_[fromqstr(format)]);
|
||||
}
|
||||
|
||||
|
||||
void QExternalDialog::getbbClicked()
|
||||
{
|
||||
form_->getBB();
|
||||
}
|
||||
|
||||
|
||||
void QExternalDialog::sizeChanged()
|
||||
{
|
||||
aspectratioCB->setEnabled(activateAspectratio());
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QExternalDialog::templateChanged()
|
||||
{
|
||||
form_->updateTemplate();
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QExternalDialog::widthUnitChanged()
|
||||
{
|
||||
bool useHeight = (widthUnitCO->currentIndex() > 0);
|
||||
|
||||
if (useHeight)
|
||||
widthED->setValidator(unsignedLengthValidator(widthED));
|
||||
else
|
||||
widthED->setValidator(new QDoubleValidator(0, 1000, 2, widthED));
|
||||
|
||||
heightED->setEnabled(useHeight);
|
||||
heightUnitCO->setEnabled(useHeight);
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QExternal
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace {
|
||||
|
||||
LyXLength::UNIT defaultUnit()
|
||||
@ -276,10 +472,11 @@ void getExtra(external::ExtraData & data,
|
||||
} // namespace anon
|
||||
|
||||
|
||||
typedef QController<ControlExternal, QView<QExternalDialog> > external_base_class;
|
||||
typedef QController<ControlExternal, QView<QExternalDialog> >
|
||||
ExternalBase;
|
||||
|
||||
QExternal::QExternal(Dialog & parent)
|
||||
: external_base_class(parent, _("External Material"))
|
||||
: ExternalBase(parent, _("External Material"))
|
||||
{}
|
||||
|
||||
|
||||
@ -520,3 +717,5 @@ void QExternal::getBB()
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "QExternal_moc.cpp"
|
||||
|
@ -13,13 +13,45 @@
|
||||
#define QEXTERNAL_H
|
||||
|
||||
#include "QDialogView.h"
|
||||
#include "QExternalDialog.h"
|
||||
|
||||
#include "ui/ExternalUi.h"
|
||||
|
||||
#include <QCloseEvent>
|
||||
#include <QDialog>
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QExternal;
|
||||
|
||||
class QExternalDialog : public QDialog, public Ui::QExternalUi {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QExternalDialog(QExternal * form);
|
||||
|
||||
virtual void show();
|
||||
protected Q_SLOTS:
|
||||
virtual void bbChanged();
|
||||
virtual void browseClicked();
|
||||
virtual void change_adaptor();
|
||||
virtual void editClicked();
|
||||
virtual void extraChanged(const QString&);
|
||||
virtual void formatChanged(const QString&);
|
||||
virtual void getbbClicked();
|
||||
virtual void sizeChanged();
|
||||
virtual void templateChanged();
|
||||
virtual void widthUnitChanged();
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent * e);
|
||||
private:
|
||||
bool activateAspectratio() const;
|
||||
QExternal * form_;
|
||||
};
|
||||
|
||||
|
||||
class ControlExternal;
|
||||
|
||||
class QExternal
|
||||
|
@ -1,228 +0,0 @@
|
||||
/**
|
||||
* \file QExternalDialog.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
* \author Angus Leeming
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Qt defines a macro 'signals' that clashes with a boost namespace.
|
||||
// All is well if the namespace is visible first.
|
||||
#include "insets/ExternalTemplate.h"
|
||||
|
||||
#include "controllers/ButtonController.h"
|
||||
#include "controllers/ControlExternal.h"
|
||||
|
||||
#include "support/convert.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "support/lyxlib.h"
|
||||
|
||||
#include "QExternalDialog.h"
|
||||
|
||||
#include "lengthcombo.h"
|
||||
#include "validators.h"
|
||||
#include "qt_helpers.h"
|
||||
#include "QExternal.h"
|
||||
|
||||
#include <QCloseEvent>
|
||||
#include <QCheckBox>
|
||||
#include <QPushButton>
|
||||
#include <QTextBrowser>
|
||||
#include <QLineEdit>
|
||||
|
||||
|
||||
using lyx::support::float_equal;
|
||||
using lyx::support::isStrDbl;
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
QExternalDialog::QExternalDialog(QExternal * form)
|
||||
: form_(form)
|
||||
{
|
||||
setupUi(this);
|
||||
connect(okPB, SIGNAL(clicked()),
|
||||
form, SLOT(slotOK()));
|
||||
connect(applyPB, SIGNAL(clicked()),
|
||||
form, SLOT(slotApply()));
|
||||
connect(closePB, SIGNAL(clicked()),
|
||||
form, SLOT(slotClose()));
|
||||
|
||||
connect( displayCB, SIGNAL( toggled(bool) ), showCO, SLOT( setEnabled(bool) ) );
|
||||
connect( displayCB, SIGNAL( toggled(bool) ), displayscaleED, SLOT( setEnabled(bool) ) );
|
||||
connect( showCO, SIGNAL( activated(const QString&) ), this, SLOT( change_adaptor() ) );
|
||||
connect( originCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
|
||||
connect( aspectratioCB, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) );
|
||||
connect( browsePB, SIGNAL( clicked() ), this, SLOT( browseClicked() ) );
|
||||
connect( editPB, SIGNAL( clicked() ), this, SLOT( editClicked() ) );
|
||||
connect( externalCO, SIGNAL( activated(const QString&) ), this, SLOT( templateChanged() ) );
|
||||
connect( extraED, SIGNAL( textChanged(const QString&) ), this, SLOT( extraChanged(const QString&) ) );
|
||||
connect( extraFormatCO, SIGNAL( activated(const QString&) ), this, SLOT( formatChanged(const QString&) ) );
|
||||
connect( widthUnitCO, SIGNAL( activated(int) ), this, SLOT( widthUnitChanged() ) );
|
||||
connect( heightUnitCO, SIGNAL( selectionChanged(lyx::LyXLength::UNIT) ), this, SLOT( change_adaptor() ) );
|
||||
connect( displayCB, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) );
|
||||
connect( displayscaleED, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
|
||||
connect( angleED, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
|
||||
connect( widthED, SIGNAL( textChanged(const QString&) ), this, SLOT( sizeChanged() ) );
|
||||
connect( heightED, SIGNAL( textChanged(const QString&) ), this, SLOT( sizeChanged() ) );
|
||||
connect( fileED, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
|
||||
connect( clipCB, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) );
|
||||
connect( getbbPB, SIGNAL( clicked() ), this, SLOT( getbbClicked() ) );
|
||||
connect( xrED, SIGNAL( textChanged(const QString&) ), this, SLOT( bbChanged() ) );
|
||||
connect( ytED, SIGNAL( textChanged(const QString&) ), this, SLOT( bbChanged() ) );
|
||||
connect( xlED, SIGNAL( textChanged(const QString&) ), this, SLOT( bbChanged() ) );
|
||||
connect( ybED, SIGNAL( textChanged(const QString&) ), this, SLOT( bbChanged() ) );
|
||||
connect( draftCB, SIGNAL( clicked() ), this, SLOT( change_adaptor() ) );
|
||||
|
||||
QIntValidator * validator = new QIntValidator(displayscaleED);
|
||||
validator->setBottom(1);
|
||||
displayscaleED->setValidator(validator);
|
||||
|
||||
angleED->setValidator(new QDoubleValidator(-360, 360, 2, angleED));
|
||||
|
||||
xlED->setValidator(new QIntValidator(xlED));
|
||||
ybED->setValidator(new QIntValidator(ybED));
|
||||
xrED->setValidator(new QIntValidator(xrED));
|
||||
ytED->setValidator(new QIntValidator(ytED));
|
||||
|
||||
widthED->setValidator(unsignedLengthValidator(widthED));
|
||||
heightED->setValidator(unsignedLengthValidator(heightED));
|
||||
|
||||
fileED->setValidator(new PathValidator(true, fileED));
|
||||
setFocusProxy(fileED);
|
||||
}
|
||||
|
||||
|
||||
void QExternalDialog::show()
|
||||
{
|
||||
QDialog::show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool QExternalDialog::activateAspectratio() const
|
||||
{
|
||||
if (widthUnitCO->currentIndex() == 0)
|
||||
return false;
|
||||
|
||||
string const wstr = fromqstr(widthED->text());
|
||||
if (wstr.empty())
|
||||
return false;
|
||||
bool const wIsDbl = isStrDbl(wstr);
|
||||
if (wIsDbl && float_equal(convert<double>(wstr), 0.0, 0.05))
|
||||
return false;
|
||||
LyXLength l;
|
||||
if (!wIsDbl && (!isValidLength(wstr, &l) || l.zero()))
|
||||
return false;
|
||||
|
||||
string const hstr = fromqstr(heightED->text());
|
||||
if (hstr.empty())
|
||||
return false;
|
||||
bool const hIsDbl = isStrDbl(hstr);
|
||||
if (hIsDbl && float_equal(convert<double>(hstr), 0.0, 0.05))
|
||||
return false;
|
||||
if (!hIsDbl && (!isValidLength(hstr, &l) || l.zero()))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void QExternalDialog::bbChanged()
|
||||
{
|
||||
form_->controller().bbChanged(true);
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QExternalDialog::browseClicked()
|
||||
{
|
||||
int const choice = externalCO->currentIndex();
|
||||
docstring const template_name =
|
||||
lyx::from_utf8(form_->controller().getTemplate(choice).lyxName);
|
||||
docstring const str =
|
||||
form_->controller().browse(qstring_to_ucs4(fileED->text()),
|
||||
template_name);
|
||||
fileED->setText(toqstr(str));
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QExternalDialog::change_adaptor()
|
||||
{
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QExternalDialog::closeEvent(QCloseEvent * e)
|
||||
{
|
||||
form_->slotWMHide();
|
||||
e->accept();
|
||||
}
|
||||
|
||||
|
||||
void QExternalDialog::editClicked()
|
||||
{
|
||||
form_->controller().editExternal();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void QExternalDialog::extraChanged(const QString& text)
|
||||
{
|
||||
std::string const format = fromqstr(extraFormatCO->currentText());
|
||||
form_->extra_[format] = text;
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QExternalDialog::formatChanged(const QString& format)
|
||||
{
|
||||
extraED->setText(form_->extra_[fromqstr(format)]);
|
||||
}
|
||||
|
||||
|
||||
void QExternalDialog::getbbClicked()
|
||||
{
|
||||
form_->getBB();
|
||||
}
|
||||
|
||||
|
||||
void QExternalDialog::sizeChanged()
|
||||
{
|
||||
aspectratioCB->setEnabled(activateAspectratio());
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QExternalDialog::templateChanged()
|
||||
{
|
||||
form_->updateTemplate();
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QExternalDialog::widthUnitChanged()
|
||||
{
|
||||
bool useHeight = (widthUnitCO->currentIndex() > 0);
|
||||
|
||||
if (useHeight)
|
||||
widthED->setValidator(unsignedLengthValidator(widthED));
|
||||
else
|
||||
widthED->setValidator(new QDoubleValidator(0, 1000, 2, widthED));
|
||||
|
||||
heightED->setEnabled(useHeight);
|
||||
heightUnitCO->setEnabled(useHeight);
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "QExternalDialog_moc.cpp"
|
@ -1,53 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QExternalDialog.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 QEXTERNALDIALOG_H
|
||||
#define QEXTERNALDIALOG_H
|
||||
|
||||
#include "ui/ExternalUi.h"
|
||||
|
||||
#include <QCloseEvent>
|
||||
#include <QDialog>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QExternal;
|
||||
|
||||
class QExternalDialog : public QDialog, public Ui::QExternalUi {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QExternalDialog(QExternal * form);
|
||||
|
||||
virtual void show();
|
||||
protected Q_SLOTS:
|
||||
virtual void bbChanged();
|
||||
virtual void browseClicked();
|
||||
virtual void change_adaptor();
|
||||
virtual void editClicked();
|
||||
virtual void extraChanged(const QString&);
|
||||
virtual void formatChanged(const QString&);
|
||||
virtual void getbbClicked();
|
||||
virtual void sizeChanged();
|
||||
virtual void templateChanged();
|
||||
virtual void widthUnitChanged();
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent * e);
|
||||
private:
|
||||
bool activateAspectratio() const;
|
||||
QExternal * form_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QEXTERNALDIALOG_H
|
@ -14,24 +14,88 @@
|
||||
#include "ControlCommand.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include "QIndexDialog.h"
|
||||
#include "QIndex.h"
|
||||
#include "Qt2BC.h"
|
||||
#include "ButtonController.h"
|
||||
#include <qlabel.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qpushbutton.h>
|
||||
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QLineEdit>
|
||||
#include <QWhatsThis>
|
||||
#include <QCloseEvent>
|
||||
|
||||
|
||||
using std::string;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QIndexDialog
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
typedef QController<ControlCommand, QView<QIndexDialog> > index_base_class;
|
||||
QIndexDialog::QIndexDialog(QIndex * form)
|
||||
: form_(form)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
connect(okPB, SIGNAL(clicked()), form, SLOT(slotOK()));
|
||||
connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
|
||||
connect( keywordED, SIGNAL(textChanged(const QString &)),
|
||||
this, SLOT(change_adaptor()));
|
||||
|
||||
setFocusProxy(keywordED);
|
||||
|
||||
keywordED->setWhatsThis( qt_(
|
||||
"The format of the entry in the index.\n"
|
||||
"\n"
|
||||
"An entry can be specified as a sub-entry of\n"
|
||||
"another with \"!\":\n"
|
||||
"\n"
|
||||
"cars!mileage\n"
|
||||
"\n"
|
||||
"You can cross-refer to another entry like so:\n"
|
||||
"\n"
|
||||
"cars!mileage|see{economy}\n"
|
||||
"\n"
|
||||
"For further details refer to the local LaTeX\n"
|
||||
"documentation.\n")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void QIndexDialog::change_adaptor()
|
||||
{
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QIndexDialog::reject()
|
||||
{
|
||||
form_->slotClose();
|
||||
}
|
||||
|
||||
|
||||
void QIndexDialog::closeEvent(QCloseEvent * e)
|
||||
{
|
||||
form_->slotWMHide();
|
||||
e->accept();
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// QIndex
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
typedef QController<ControlCommand, QView<QIndexDialog> > IndexBase;
|
||||
|
||||
QIndex::QIndex(Dialog & parent, docstring const & title, QString const & label)
|
||||
: index_base_class(parent, title), label_(label)
|
||||
: IndexBase(parent, title), label_(label)
|
||||
{
|
||||
}
|
||||
|
||||
@ -70,3 +134,5 @@ bool QIndex::isValid()
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "QIndex_moc.cpp"
|
||||
|
@ -14,11 +14,30 @@
|
||||
#define QINDEX_H
|
||||
|
||||
#include "QDialogView.h"
|
||||
#include "QIndexDialog.h"
|
||||
#include "ui/IndexUi.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QCloseEvent>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QIndex;
|
||||
|
||||
class QIndexDialog : public QDialog, public Ui::QIndexUi {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QIndexDialog(QIndex * form);
|
||||
|
||||
protected Q_SLOTS:
|
||||
virtual void change_adaptor();
|
||||
virtual void reject();
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent * e);
|
||||
private:
|
||||
QIndex * form_;
|
||||
};
|
||||
|
||||
class ControlCommand;
|
||||
|
||||
class QIndex :
|
||||
|
@ -1,79 +0,0 @@
|
||||
/**
|
||||
* \file QIndexDialog.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>
|
||||
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include "QIndex.h"
|
||||
#include "QIndexDialog.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QLineEdit>
|
||||
#include <QWhatsThis>
|
||||
#include <QCloseEvent>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
QIndexDialog::QIndexDialog(QIndex * form)
|
||||
: form_(form)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
connect(okPB, SIGNAL(clicked()),
|
||||
form, SLOT(slotOK()));
|
||||
connect(closePB, SIGNAL(clicked()),
|
||||
form, SLOT(slotClose()));
|
||||
connect( keywordED, SIGNAL( textChanged(const QString&) ),
|
||||
this, SLOT( change_adaptor() ) );
|
||||
|
||||
setFocusProxy(keywordED);
|
||||
|
||||
keywordED->setWhatsThis( qt_(
|
||||
"The format of the entry in the index.\n"
|
||||
"\n"
|
||||
"An entry can be specified as a sub-entry of\n"
|
||||
"another with \"!\":\n"
|
||||
"\n"
|
||||
"cars!mileage\n"
|
||||
"\n"
|
||||
"You can cross-refer to another entry like so:\n"
|
||||
"\n"
|
||||
"cars!mileage|see{economy}\n"
|
||||
"\n"
|
||||
"For further details refer to the local LaTeX\n"
|
||||
"documentation.\n")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void QIndexDialog::change_adaptor()
|
||||
{
|
||||
form_->changed();
|
||||
}
|
||||
|
||||
|
||||
void QIndexDialog::reject()
|
||||
{
|
||||
form_->slotClose();
|
||||
}
|
||||
|
||||
|
||||
void QIndexDialog::closeEvent(QCloseEvent * e)
|
||||
{
|
||||
form_->slotWMHide();
|
||||
e->accept();
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "QIndexDialog_moc.cpp"
|
@ -1,42 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QIndexDialog.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 QINDEXDIALOG_H
|
||||
#define QINDEXDIALOG_H
|
||||
|
||||
#include "ui/IndexUi.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QCloseEvent>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QIndex;
|
||||
|
||||
class QIndexDialog : public QDialog, public Ui::QIndexUi {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QIndexDialog(QIndex * form);
|
||||
|
||||
protected Q_SLOTS:
|
||||
virtual void change_adaptor();
|
||||
virtual void reject();
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent * e);
|
||||
private:
|
||||
QIndex * form_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QINDEXDIALOG_H
|
@ -1,50 +0,0 @@
|
||||
/**
|
||||
* \file QLogDialog.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>
|
||||
|
||||
#include "QLogDialog.h"
|
||||
#include "QLog.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QCloseEvent>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
QLogDialog::QLogDialog(QLog * form)
|
||||
: form_(form)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
connect(closePB, SIGNAL(clicked()),
|
||||
form, SLOT(slotClose()));
|
||||
connect( updatePB, SIGNAL( clicked() ),
|
||||
this, SLOT( updateClicked() ) );
|
||||
}
|
||||
|
||||
|
||||
void QLogDialog::closeEvent(QCloseEvent * e)
|
||||
{
|
||||
form_->slotWMHide();
|
||||
e->accept();
|
||||
}
|
||||
|
||||
|
||||
void QLogDialog::updateClicked()
|
||||
{
|
||||
form_->update_contents();
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#include "QLogDialog_moc.cpp"
|
@ -1,40 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QLogDialog.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 QLOGDIALOG_H
|
||||
#define QLOGDIALOG_H
|
||||
|
||||
#include "ui/LogUi.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QCloseEvent>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class QLog;
|
||||
|
||||
class QLogDialog : public QDialog, public Ui::QLogUi {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QLogDialog(QLog * form);
|
||||
protected Q_SLOTS:
|
||||
virtual void updateClicked();
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent * e);
|
||||
private:
|
||||
QLog * form_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // QLOGDIALOG_H
|
Loading…
Reference in New Issue
Block a user