more dialog merging

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17981 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2007-04-25 10:57:54 +00:00
parent 5971c1a9f1
commit a77a19e497
35 changed files with 634 additions and 3684 deletions

View File

@ -43,21 +43,15 @@ libqt4_la_SOURCES = \
QLMenubar.C QLMenubar.h \ QLMenubar.C QLMenubar.h \
QBox.C QBox.h \ QBox.C QBox.h \
QBranches.C QBranches.h \ QBranches.C QBranches.h \
QCharacter.C QCharacter.h \
QCitation.C QCitation.h \ QCitation.C QCitation.h \
QDialogView.C QDialogView.h \ QDialogView.C QDialogView.h \
QFloat.C QFloat.h \ QFloat.C QFloat.h \
QGraphics.C QGraphics.h \ QGraphics.C QGraphics.h \
QInclude.C QInclude.h \
QLImage.C QLImage.h \ QLImage.C QLImage.h \
QViewSource.C QViewSource.h \ QViewSource.C QViewSource.h \
QLPainter.C QLPainter.h \ QLPainter.C QLPainter.h \
QLyXKeySym.C QLyXKeySym.h \ QLyXKeySym.C QLyXKeySym.h \
QNomencl.C QNomencl.h \
QNote.C QNote.h \
QPrint.C QPrint.h \ QPrint.C QPrint.h \
QRef.C QRef.h \
QSendto.C QSendto.h \
Qt2BC.C Qt2BC.h \ Qt2BC.C Qt2BC.h \
checkedwidgets.C checkedwidgets.h \ checkedwidgets.C checkedwidgets.h \
panelstack.h panelstack.C \ panelstack.h panelstack.C \

View File

@ -93,7 +93,7 @@ MOCFILES = \
QBranch.C QBranch.h \ QBranch.C QBranch.h \
QBranches.C QBranches.h \ QBranches.C QBranches.h \
QChanges.C QChanges.h \ QChanges.C QChanges.h \
QCharacterDialog.C QCharacterDialog.h \ QCharacter.C QCharacter.h \
QCitationDialog.C QCitationDialog.h \ QCitationDialog.C QCitationDialog.h \
QCommandBuffer.C QCommandBuffer.h \ QCommandBuffer.C QCommandBuffer.h \
QCommandEdit.C QCommandEdit.h \ QCommandEdit.C QCommandEdit.h \
@ -104,7 +104,7 @@ MOCFILES = \
QExternal.C QExternal.h \ QExternal.C QExternal.h \
QFloatDialog.C QFloatDialog.h \ QFloatDialog.C QFloatDialog.h \
QGraphicsDialog.C QGraphicsDialog.h \ QGraphicsDialog.C QGraphicsDialog.h \
QIncludeDialog.C QIncludeDialog.h \ QInclude.C QInclude.h \
QIndex.C QIndex.h \ QIndex.C QIndex.h \
QLog.C QLog.h \ QLog.C QLog.h \
QViewSource.C QViewSource.h \ QViewSource.C QViewSource.h \
@ -112,13 +112,13 @@ MOCFILES = \
QLPopupMenu.C QLPopupMenu.h \ QLPopupMenu.C QLPopupMenu.h \
QLPrintDialog.C QLPrintDialog.h \ QLPrintDialog.C QLPrintDialog.h \
QMathMatrixDialog.C QMathMatrixDialog.h \ QMathMatrixDialog.C QMathMatrixDialog.h \
QNomenclDialog.C QNomenclDialog.h \ QNomencl.C QNomencl.h \
QNoteDialog.C QNoteDialog.h \ QNote.C QNote.h \
QParagraph.C QParagraph.h \ QParagraph.C QParagraph.h \
QPrefs.C QPrefs.h \ QPrefs.C QPrefs.h \
QRefDialog.C QRefDialog.h \ QRef.C QRef.h \
QSearch.C QSearch.h \ QSearch.C QSearch.h \
QSendtoDialog.C QSendtoDialog.h \ QSendto.C QSendto.h \
qsetborder.C qsetborder.h \ qsetborder.C qsetborder.h \
QShowFile.C QShowFile.h \ QShowFile.C QShowFile.h \
QSpellchecker.C QSpellchecker.h \ QSpellchecker.C QSpellchecker.h \

View File

@ -1,240 +0,0 @@
/**
* \file QBibtexDialog.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 "QBibtexDialog.h"
#include "QBibtex.h"
#include <QCloseEvent>
#include "checkedwidgets.h"
#include "Qt2BC.h"
#include "qt_helpers.h"
#include "validators.h"
#include "controllers/ControlBibtex.h"
#include "controllers/ButtonPolicies.h"
#include "debug.h"
#include "support/filetools.h"
#include "support/lstrings.h"
#include <QPushButton>
#include <QListWidget>
#include <QLineEdit>
using lyx::support::changeExtension;
using lyx::support::trim;
using std::string;
namespace lyx {
namespace frontend {
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() ) );
}
QBibtexDialog::~QBibtexDialog()
{}
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();
}
} // namespace frontend
} // namespace lyx
#include "QBibtexDialog_moc.cpp"

View File

@ -1,71 +0,0 @@
// -*- C++ -*-
/**
* \file QBibtexDialog.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 QBIBTEXDIALOG_H
#define 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);
~QBibtexDialog();
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_;
};
} // namespace frontend
} // namespace lyx
#endif // QBIBTEXDIALOG_H

View File

@ -1,50 +0,0 @@
/**
* \file QBranchDialog.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Jürgen Spitzmüller
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "QBranchDialog.h"
#include "QBranch.h"
#include <QPushButton>
#include <QCloseEvent>
namespace lyx {
namespace frontend {
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();
}
} // namespace frontend
} // namespace lyx
#include "QBranchDialog_moc.cpp"

View File

@ -1,40 +0,0 @@
// -*- C++ -*-
/**
* \file QBranchDialog.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Jürgen Spitzmüller
*
* Full author contact details are available in file CREDITS.
*/
#ifndef QBRANCHDIALOG_H
#define QBRANCHDIALOG_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_;
};
} // namespace frontend
} // namespace lyx
#endif // QBRANCHDIALOG_H

View File

@ -13,25 +13,83 @@
#include "QCharacter.h" #include "QCharacter.h"
#include "ControlCharacter.h" #include "ControlCharacter.h"
#include "QCharacterDialog.h"
#include "Qt2BC.h" #include "Qt2BC.h"
#include "qt_helpers.h" #include "qt_helpers.h"
#include "LColor.h" #include "LColor.h"
#include <qpushbutton.h>
#include <qcheckbox.h> #include <QCloseEvent>
using std::vector; using std::vector;
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
typedef QController<ControlCharacter, QView<QCharacterDialog> > character_base_class; /////////////////////////////////////////////////////////////////////
//
// QCharacterDialog
//
/////////////////////////////////////////////////////////////////////
QCharacterDialog::QCharacterDialog(QCharacter * 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(miscCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(sizeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(familyCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(seriesCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(shapeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(colorCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(langCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(toggleallCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
}
void QCharacterDialog::change_adaptor()
{
form_->changed();
if (!autoapplyCB->isChecked())
return;
// to be really good here, we should set the combos to the values of
// the current text, and make it appear as "no change" if the values
// stay the same between applys. Might be difficult though wrt to a
// moved cursor - jbl
form_->slotApply();
familyCO->setCurrentIndex(0);
seriesCO->setCurrentIndex(0);
sizeCO->setCurrentIndex(0);
shapeCO->setCurrentIndex(0);
miscCO->setCurrentIndex(0);
langCO->setCurrentIndex(0);
colorCO->setCurrentIndex(0);
}
void QCharacterDialog::closeEvent(QCloseEvent * e)
{
form_->slotWMHide();
e->accept();
}
/////////////////////////////////////////////////////////////////////
//
// QCharacter
//
/////////////////////////////////////////////////////////////////////
typedef QController<ControlCharacter, QView<QCharacterDialog> > CharacterBase;
QCharacter::QCharacter(Dialog & parent) QCharacter::QCharacter(Dialog & parent)
: character_base_class(parent, _("Text Style")) : CharacterBase(parent, _("Text Style"))
{ {
} }
@ -155,3 +213,5 @@ void QCharacter::apply()
} // namespace frontend } // namespace frontend
} // namespace lyx } // namespace lyx
#include "QCharacter_moc.cpp"

View File

@ -13,8 +13,9 @@
#ifndef QCHARACTER_H_CONTROLLER #ifndef QCHARACTER_H_CONTROLLER
#define QCHARACTER_H_CONTROLLER #define QCHARACTER_H_CONTROLLER
#include "QCharacterDialog.h"
#include "QDialogView.h" #include "QDialogView.h"
#include "ui/CharacterUi.h"
#include <QDialog>
#include "controllers/character.h" #include "controllers/character.h"
#include "controllers/frnt_lang.h" #include "controllers/frnt_lang.h"
@ -22,8 +23,26 @@
#include <vector> #include <vector>
namespace lyx { namespace lyx {
class LyXFont;
namespace frontend { namespace frontend {
class QCharacter;
class QCharacterDialog : public QDialog, public Ui::QCharacterUi {
Q_OBJECT
public:
QCharacterDialog(QCharacter * form);
protected:
void closeEvent(QCloseEvent * e);
private:
QCharacter * form_;
protected Q_SLOTS:
void change_adaptor();
};
class ControlCharacter; class ControlCharacter;
class QCharacter class QCharacter

View File

@ -1,77 +0,0 @@
/**
* \file QCharacterDialog.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Edwin Leuven
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "QCharacterDialog.h"
#include "QCharacter.h"
#include <qcheckbox.h>
#include <qpushbutton.h>
#include <QCloseEvent>
namespace lyx {
namespace frontend {
QCharacterDialog::QCharacterDialog(QCharacter * 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( miscCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
connect( sizeCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
connect( familyCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
connect( seriesCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
connect( shapeCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
connect( colorCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
connect( langCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
connect( toggleallCB, SIGNAL( clicked() ), this, SLOT( change_adaptor() ) );
}
void QCharacterDialog::change_adaptor()
{
form_->changed();
if (!autoapplyCB->isChecked())
return;
// to be really good here, we should set the combos to the values of
// the current text, and make it appear as "no change" if the values
// stay the same between applys. Might be difficult though wrt to a
// moved cursor - jbl
form_->slotApply();
familyCO->setCurrentIndex(0);
seriesCO->setCurrentIndex(0);
sizeCO->setCurrentIndex(0);
shapeCO->setCurrentIndex(0);
miscCO->setCurrentIndex(0);
langCO->setCurrentIndex(0);
colorCO->setCurrentIndex(0);
}
void QCharacterDialog::closeEvent(QCloseEvent * e)
{
form_->slotWMHide();
e->accept();
}
} // namespace frontend
} // namespace lyx
#include "QCharacterDialog_moc.cpp"

View File

@ -1,43 +0,0 @@
// -*- C++ -*-
/**
* \file QCharacterDialog.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Edwin Leuven
* \author John Levon
*
* Full author contact details are available in file CREDITS.
*/
#ifndef QCHARACTERDIALOG_H
#define QCHARACTERDIALOG_H
#include "ui/CharacterUi.h"
#include <QCloseEvent>
#include <QDialog>
namespace lyx {
class LyXFont;
namespace frontend {
class QCharacter;
class QCharacterDialog : public QDialog, public Ui::QCharacterUi {
Q_OBJECT
public:
QCharacterDialog(QCharacter * form);
protected:
void closeEvent(QCloseEvent * e);
private:
QCharacter * form_;
protected Q_SLOTS:
void change_adaptor();
};
} // namespace frontend
} // namespace lyx
#endif // QCHARACTERDIALOG_H

View File

@ -1,64 +0,0 @@
/**
* \file QErrorListDialog.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Alfredo Braunstein
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "QErrorListDialog.h"
#include "QErrorList.h"
#include <QListWidget>
#include <QPushButton>
#include <QCloseEvent>
namespace lyx {
namespace frontend {
QErrorListDialog::QErrorListDialog(QErrorList * form)
: form_(form)
{
setupUi(this);
connect(closePB, SIGNAL(clicked()),
form, SLOT(slotClose()));
connect(errorsLW, SIGNAL( itemActivated(QListWidgetItem *)),
form, SLOT(slotClose()));
connect( errorsLW, SIGNAL( itemClicked(QListWidgetItem *) ),
this, SLOT( select_adaptor(QListWidgetItem *) ) );
}
QErrorListDialog::~QErrorListDialog()
{}
void QErrorListDialog::select_adaptor(QListWidgetItem * item)
{
form_->select(item);
}
void QErrorListDialog::closeEvent(QCloseEvent * e)
{
form_->slotWMHide();
e->accept();
}
void QErrorListDialog::showEvent(QShowEvent *e)
{
errorsLW->setCurrentRow(0);
form_->select(errorsLW->item(0));
e->accept();
}
} // namespace frontend
} // namespace lyx
#include "QErrorListDialog_moc.cpp"

View File

@ -1,45 +0,0 @@
// -*- C++ -*-
/**
* \file QErrorListDialog.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Alfredo Braunstein
*
* Full author contact details are available in file CREDITS.
*/
#ifndef QERRORLISTDIALOG_H
#define QERRORLISTDIALOG_H
#include "ui/ErrorListUi.h"
#include <QDialog>
#include <QCloseEvent>
class QListWidgetItem;
namespace lyx {
namespace frontend {
class QErrorList;
class QErrorListDialog : public QDialog, public Ui::QErrorListUi {
Q_OBJECT
public:
QErrorListDialog(QErrorList * form);
~QErrorListDialog();
public Q_SLOTS:
void select_adaptor(QListWidgetItem *);
protected:
void closeEvent(QCloseEvent *);
void showEvent(QShowEvent *);
private:
QErrorList * form_;
};
} // namespace frontend
} // namespace lyx
#endif // QTOCERRORLIST_H

View File

@ -12,7 +12,6 @@
#include "support/os.h" #include "support/os.h"
#include "QIncludeDialog.h"
#include "QInclude.h" #include "QInclude.h"
#include "checkedwidgets.h" #include "checkedwidgets.h"
@ -24,22 +23,115 @@
#include "controllers/ControlInclude.h" #include "controllers/ControlInclude.h"
#include <qlineedit.h> #include <QPushButton>
#include <qpushbutton.h> #include <QCheckBox>
#include <qcheckbox.h> #include <QCloseEvent>
#include <QLineEdit>
using std::string; using std::string;
using lyx::support::os::internal_path; using lyx::support::os::internal_path;
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
typedef QController<ControlInclude, QView<QIncludeDialog> > include_base_class; /////////////////////////////////////////////////////////////////////
//
// QIncludeDialog
//
/////////////////////////////////////////////////////////////////////
QIncludeDialog::QIncludeDialog(QInclude * form)
: form_(form)
{
setupUi(this);
connect(okPB, SIGNAL(clicked()), form, SLOT(slotOK()));
connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
connect(visiblespaceCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
connect(filenameED, SIGNAL(textChanged(const QString &)),
this, SLOT(change_adaptor()));
connect(loadPB, SIGNAL(clicked()), this, SLOT(loadClicked()));
connect(browsePB, SIGNAL(clicked()), this, SLOT(browseClicked()));
connect(typeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(typeCO, SIGNAL(activated(int)), this, SLOT(typeChanged(int)));
connect(previewCB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
filenameED->setValidator(new PathValidator(true, filenameED));
setFocusProxy(filenameED);
}
void QIncludeDialog::show()
{
QDialog::show();
}
void QIncludeDialog::change_adaptor()
{
form_->changed();
}
void QIncludeDialog::closeEvent(QCloseEvent * e)
{
form_->slotWMHide();
e->accept();
}
void QIncludeDialog::typeChanged(int v)
{
switch (v) {
//case Include
case 0:
visiblespaceCB->setEnabled(false);
visiblespaceCB->setChecked(false);
previewCB->setEnabled(false);
previewCB->setChecked(false);
break;
//case Input
case 1:
visiblespaceCB->setEnabled(false);
visiblespaceCB->setChecked(false);
previewCB->setEnabled(true);
break;
//case Verbatim
default:
visiblespaceCB->setEnabled(true);
previewCB->setEnabled(false);
previewCB->setChecked(false);
break;
}
}
void QIncludeDialog::loadClicked()
{
form_->load();
}
void QIncludeDialog::browseClicked()
{
form_->browse();
}
/////////////////////////////////////////////////////////////////////
//
// QInclude
//
/////////////////////////////////////////////////////////////////////
typedef QController<ControlInclude, QView<QIncludeDialog> > IncludeBase;
QInclude::QInclude(Dialog & parent) QInclude::QInclude(Dialog & parent)
: include_base_class(parent, _("Child Document")) : IncludeBase(parent, _("Child Document"))
{} {}
@ -143,7 +235,7 @@ void QInclude::browse()
void QInclude::load() void QInclude::load()
{ {
if (isValid()) { if (isValid()) {
string const file(fromqstr(dialog_->filenameED->text())); string const file = fromqstr(dialog_->filenameED->text());
slotOK(); slotOK();
controller().load(file); controller().load(file);
} }
@ -157,3 +249,5 @@ bool QInclude::isValid()
} // namespace frontend } // namespace frontend
} // namespace lyx } // namespace lyx
#include "QInclude_moc.cpp"

View File

@ -13,11 +13,36 @@
#define QINCLUDE_H #define QINCLUDE_H
#include "QDialogView.h" #include "QDialogView.h"
#include "QIncludeDialog.h"
#include "ui/IncludeUi.h"
#include <QDialog>
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
class QInclude;
class QIncludeDialog : public QDialog, public Ui::QIncludeUi {
Q_OBJECT
public:
QIncludeDialog(QInclude * form);
void updateLists();
virtual void show();
protected Q_SLOTS:
virtual void change_adaptor();
virtual void loadClicked();
virtual void browseClicked();
virtual void typeChanged(int v);
protected:
virtual void closeEvent(QCloseEvent * e);
private:
QInclude * form_;
};
class ControlInclude; class ControlInclude;
/// ///

View File

@ -1,108 +0,0 @@
/**
* \file QIncludeDialog.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 "QIncludeDialog.h"
#include "QInclude.h"
//Added by qt3to4:
#include <QCloseEvent>
#include "validators.h"
#include <qpushbutton.h>
#include <qcheckbox.h>
#include <qlineedit.h>
namespace lyx {
namespace frontend {
QIncludeDialog::QIncludeDialog(QInclude * form)
: form_(form)
{
setupUi(this);
connect(okPB, SIGNAL(clicked()),
form, SLOT(slotOK()));
connect(closePB, SIGNAL(clicked()),
form, SLOT(slotClose()));
connect( visiblespaceCB, SIGNAL( clicked() ), this, SLOT( change_adaptor() ) );
connect( filenameED, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
connect( loadPB, SIGNAL( clicked() ), this, SLOT( loadClicked() ) );
connect( browsePB, SIGNAL( clicked() ), this, SLOT( browseClicked() ) );
connect( typeCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
connect( typeCO, SIGNAL( activated(int) ), this, SLOT( typeChanged(int) ) );
connect( previewCB, SIGNAL( clicked() ), this, SLOT( change_adaptor() ) );
filenameED->setValidator(new PathValidator(true, filenameED));
setFocusProxy(filenameED);
}
void QIncludeDialog::show()
{
QDialog::show();
}
void QIncludeDialog::change_adaptor()
{
form_->changed();
}
void QIncludeDialog::closeEvent(QCloseEvent * e)
{
form_->slotWMHide();
e->accept();
}
void QIncludeDialog::typeChanged(int v)
{
switch (v) {
//case Include
case 0:
visiblespaceCB->setEnabled(false);
visiblespaceCB->setChecked(false);
previewCB->setEnabled(false);
previewCB->setChecked(false);
break;
//case Input
case 1:
visiblespaceCB->setEnabled(false);
visiblespaceCB->setChecked(false);
previewCB->setEnabled(true);
break;
//case Verbatim
default:
visiblespaceCB->setEnabled(true);
previewCB->setEnabled(false);
previewCB->setChecked(false);
break;
}
}
void QIncludeDialog::loadClicked()
{
form_->load();
}
void QIncludeDialog::browseClicked()
{
form_->browse();
}
} // namespace frontend
} // namespace lyx
#include "QIncludeDialog_moc.cpp"

View File

@ -1,47 +0,0 @@
// -*- C++ -*-
/**
* \file QIncludeDialog.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 QINCLUDEDIALOG_H
#define QINCLUDEDIALOG_H
#include "ui/IncludeUi.h"
#include <QDialog>
#include <QCloseEvent>
namespace lyx {
namespace frontend {
class QInclude;
class QIncludeDialog : public QDialog, public Ui::QIncludeUi {
Q_OBJECT
public:
QIncludeDialog(QInclude * form);
void updateLists();
virtual void show();
protected Q_SLOTS:
virtual void change_adaptor();
virtual void loadClicked();
virtual void browseClicked();
virtual void typeChanged(int v);
protected:
virtual void closeEvent(QCloseEvent * e);
private:
QInclude * form_;
};
} // namespace frontend
} // namespace lyx
#endif // QINCLUDEDIALOG_H

View File

@ -15,7 +15,6 @@
#include "ControlCommand.h" #include "ControlCommand.h"
#include "qt_helpers.h" #include "qt_helpers.h"
#include "QNomenclDialog.h"
#include "QNomencl.h" #include "QNomencl.h"
#include "Qt2BC.h" #include "Qt2BC.h"
#include "ButtonController.h" #include "ButtonController.h"
@ -23,17 +22,73 @@
#include <QLineEdit> #include <QLineEdit>
#include <QPushButton> #include <QPushButton>
#include <QTextEdit> #include <QTextEdit>
#include <QWhatsThis>
#include <QCloseEvent>
using std::string; using std::string;
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
typedef QController<ControlCommand, QView<QNomenclDialog> > nomencl_base_class; /////////////////////////////////////////////////////////////////////
//
// QNomenclDialog
//
/////////////////////////////////////////////////////////////////////
QNomenclDialog::QNomenclDialog(QNomencl * form)
: form_(form)
{
setupUi(this);
connect(okPB, SIGNAL(clicked()), form, SLOT(slotOK()));
connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
connect(symbolED, SIGNAL(textChanged(const QString&)),
this, SLOT(change_adaptor()));
connect(descriptionTE, SIGNAL(textChanged()),
this, SLOT(change_adaptor()));
setFocusProxy(descriptionTE);
}
void QNomenclDialog::show()
{
QDialog::show();
}
void QNomenclDialog::change_adaptor()
{
form_->changed();
}
void QNomenclDialog::reject()
{
form_->slotClose();
}
void QNomenclDialog::closeEvent(QCloseEvent * e)
{
form_->slotWMHide();
e->accept();
}
/////////////////////////////////////////////////////////////////////
//
// QNomencl
//
/////////////////////////////////////////////////////////////////////
typedef QController<ControlCommand, QView<QNomenclDialog> > NomenBase;
QNomencl::QNomencl(Dialog & parent, docstring const & title) QNomencl::QNomencl(Dialog & parent, docstring const & title)
: nomencl_base_class(parent, title) : NomenBase(parent, title)
{ {
} }
@ -80,3 +135,5 @@ bool QNomencl::isValid()
} // namespace frontend } // namespace frontend
} // namespace lyx } // namespace lyx
#include "QNomencl_moc.cpp"

View File

@ -15,11 +15,33 @@
#define QNOMENCL_H #define QNOMENCL_H
#include "QDialogView.h" #include "QDialogView.h"
#include "QNomenclDialog.h" #include "ui/NomenclUi.h"
#include <QDialog>
class QCloseEvent;
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
class QNomencl;
class QNomenclDialog : public QDialog, public Ui::QNomenclUi {
Q_OBJECT
public:
QNomenclDialog(QNomencl * form);
virtual void show();
protected Q_SLOTS:
virtual void change_adaptor();
virtual void reject();
protected:
virtual void closeEvent(QCloseEvent * e);
private:
QNomencl * form_;
};
class ControlCommand; class ControlCommand;
class QNomencl : class QNomencl :

View File

@ -1,71 +0,0 @@
/**
* \file QNomenclDialog.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
* \author O. U. Baran
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "qt_helpers.h"
#include "QNomencl.h"
#include "QNomenclDialog.h"
#include <QPushButton>
#include <QLineEdit>
#include <QWhatsThis>
#include <QCloseEvent>
#include <QTextEdit>
namespace lyx {
namespace frontend {
QNomenclDialog::QNomenclDialog(QNomencl * form)
: form_(form)
{
setupUi(this);
connect(okPB, SIGNAL(clicked()), form, SLOT(slotOK()));
connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
connect(symbolED, SIGNAL(textChanged(const QString&)),
this, SLOT(change_adaptor()));
connect(descriptionTE, SIGNAL(textChanged()),
this, SLOT(change_adaptor()));
setFocusProxy(descriptionTE);
}
void QNomenclDialog::show()
{
QDialog::show();
}
void QNomenclDialog::change_adaptor()
{
form_->changed();
}
void QNomenclDialog::reject()
{
form_->slotClose();
}
void QNomenclDialog::closeEvent(QCloseEvent * e)
{
form_->slotWMHide();
e->accept();
}
} // namespace frontend
} // namespace lyx
#include "QNomenclDialog_moc.cpp"

View File

@ -1,43 +0,0 @@
// -*- C++ -*-
/**
* \file QNomenclDialog.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
* \author O. U. Baran
*
* Full author contact details are available in file CREDITS.
*/
#ifndef QNOMENCLDIALOG_H
#define QNOMENCLDIALOG_H
#include "ui/NomenclUi.h"
#include <QDialog>
#include <QCloseEvent>
namespace lyx {
namespace frontend {
class QNomencl;
class QNomenclDialog : public QDialog, public Ui::QNomenclUi {
Q_OBJECT
public:
QNomenclDialog(QNomencl * form);
virtual void show();
protected Q_SLOTS:
virtual void change_adaptor();
virtual void reject();
protected:
virtual void closeEvent(QCloseEvent * e);
private:
QNomencl * form_;
};
} // namespace frontend
} // namespace lyx
#endif // QNOMENCLDIALOG_H

View File

@ -11,27 +11,63 @@
#include <config.h> #include <config.h>
#include "QNote.h" #include "QNote.h"
#include "QNoteDialog.h"
#include "Qt2BC.h" #include "Qt2BC.h"
#include "controllers/ControlNote.h" #include "controllers/ControlNote.h"
#include "insets/InsetNote.h" #include "insets/InsetNote.h"
#include <qradiobutton.h> #include <QCloseEvent>
#include <qpushbutton.h>
using std::string;
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
typedef QController<ControlNote, QView<QNoteDialog> > note_base_class; /////////////////////////////////////////////////////////////////////
//
// QNoteDialog
//
/////////////////////////////////////////////////////////////////////
QNoteDialog::QNoteDialog(QNote * form)
: form_(form)
{
setupUi(this);
connect(okPB, SIGNAL(clicked()), form, SLOT(slotOK()));
connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
connect(noteRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
connect(greyedoutRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
connect(commentRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
connect(framedRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
connect(shadedRB, SIGNAL(clicked()), this, SLOT(change_adaptor()));
}
void QNoteDialog::closeEvent(QCloseEvent * e)
{
form_->slotWMHide();
e->accept();
}
void QNoteDialog::change_adaptor()
{
form_->changed();
}
/////////////////////////////////////////////////////////////////////
//
// QNote
//
/////////////////////////////////////////////////////////////////////
typedef QController<ControlNote, QView<QNoteDialog> > NoteBase;
QNote::QNote(Dialog & parent) QNote::QNote(Dialog & parent)
: note_base_class(parent, _("Note Settings")) : NoteBase(parent, _("Note Settings"))
{} {}
@ -90,3 +126,5 @@ void QNote::apply()
} // namespace frontend } // namespace frontend
} // namespace lyx } // namespace lyx
#include "QNote_moc.cpp"

View File

@ -13,11 +13,29 @@
#define QNOTE_H #define QNOTE_H
#include "QDialogView.h" #include "QDialogView.h"
#include "QNoteDialog.h" #include "ui/NoteUi.h"
#include <QDialog>
class QCloseEvent;
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
class QNote;
class QNoteDialog : public QDialog, public Ui::QNoteUi {
Q_OBJECT
public:
QNoteDialog(QNote * form);
protected Q_SLOTS:
virtual void change_adaptor();
protected:
virtual void closeEvent(QCloseEvent * e);
private:
QNote * form_;
};
class ControlNote; class ControlNote;
/** This class provides a QT implementation of the Note Dialog. /** This class provides a QT implementation of the Note Dialog.

View File

@ -1,56 +0,0 @@
/**
* \file QNoteDialog.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Jürgen Spitzmüller
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "QNoteDialog.h"
#include "QNote.h"
#include <qpushbutton.h>
//Added by qt3to4:
#include <QCloseEvent>
namespace lyx {
namespace frontend {
QNoteDialog::QNoteDialog(QNote * form)
: form_(form)
{
setupUi(this);
connect(okPB, SIGNAL(clicked()),
form, SLOT(slotOK()));
connect(closePB, SIGNAL(clicked()),
form, SLOT(slotClose()));
connect( noteRB, SIGNAL( clicked() ), this, SLOT( change_adaptor() ) );
connect( greyedoutRB, SIGNAL( clicked() ), this, SLOT( change_adaptor() ) );
connect( commentRB, SIGNAL( clicked() ), this, SLOT( change_adaptor() ) );
connect( framedRB, SIGNAL( clicked() ), this, SLOT( change_adaptor() ) );
connect( shadedRB, SIGNAL( clicked() ), this, SLOT( change_adaptor() ) );
}
void QNoteDialog::closeEvent(QCloseEvent * e)
{
form_->slotWMHide();
e->accept();
}
void QNoteDialog::change_adaptor()
{
form_->changed();
}
} // namespace frontend
} // namespace lyx
#include "QNoteDialog_moc.cpp"

View File

@ -1,40 +0,0 @@
// -*- C++ -*-
/**
* \file QNoteDialog.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Jürgen Spitzmüller
*
* Full author contact details are available in file CREDITS.
*/
#ifndef QNOTEDIALOG_H
#define QNOTEDIALOG_H
#include "ui/NoteUi.h"
#include <QDialog>
#include <QCloseEvent>
namespace lyx {
namespace frontend {
class QNote;
class QNoteDialog : public QDialog, public Ui::QNoteUi {
Q_OBJECT
public:
QNoteDialog(QNote * form);
protected Q_SLOTS:
virtual void change_adaptor();
protected:
virtual void closeEvent(QCloseEvent * e);
private:
QNote * form_;
};
} // namespace frontend
} // namespace lyx
#endif // QNOTEDIALOG_H

View File

@ -56,25 +56,20 @@ class PrefModule : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
PrefModule(lyx::docstring const & cat, lyx::docstring const & t, QPrefs * form = 0, QWidget * parent = 0) PrefModule(docstring const & cat, docstring const & t,
QPrefs * form = 0, QWidget * parent = 0)
: QWidget(parent), category_(cat), title_(t), form_(form) : QWidget(parent), category_(cat), title_(t), form_(form)
{ {}
}
virtual void apply(LyXRC & rc) const = 0; virtual void apply(LyXRC & rc) const = 0;
virtual void update(LyXRC const & rc) = 0; virtual void update(LyXRC const & rc) = 0;
lyx::docstring const & category() { docstring const & category() const { return category_; }
return category_; docstring const & title() const { return title_; }
}
lyx::docstring const & title() {
return title_;
}
protected: protected:
lyx::docstring category_; docstring category_;
lyx::docstring title_; docstring title_;
QPrefs * form_; QPrefs * form_;
Q_SIGNALS: Q_SIGNALS:

File diff suppressed because it is too large Load Diff

View File

@ -1,397 +0,0 @@
// -*- C++ -*-
/**
* \file QPrefsDialog.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
* \author Abdelrazak Younes
*
* Full author contact details are available in file CREDITS.
*/
#ifndef QPREFSDIALOG_H
#define QPREFSDIALOG_H
#include "LColor.h"
#include "lyxrc.h"
#include "ui/PrefsUi.h"
#include <vector>
#include <QDialog>
#include <QCloseEvent>
#include "ui/PrefPlaintextUi.h"
#include "ui/PrefDateUi.h"
#include "ui/PrefKeyboardUi.h"
#include "ui/PrefLatexUi.h"
#include "ui/PrefScreenFontsUi.h"
#include "ui/PrefColorsUi.h"
#include "ui/PrefCygwinPathUi.h"
#include "ui/PrefDisplayUi.h"
#include "ui/PrefPathsUi.h"
#include "ui/PrefSpellcheckerUi.h"
#include "ui/PrefConvertersUi.h"
#include "ui/PrefCopiersUi.h"
#include "ui/PrefFileformatsUi.h"
#include "ui/PrefLanguageUi.h"
#include "ui/PrefPrinterUi.h"
#include "ui/PrefUi.h"
#include "ui/PrefIdentityUi.h"
namespace lyx {
namespace frontend {
class QPrefs;
class PrefModule : public QWidget
{
Q_OBJECT
public:
PrefModule(lyx::docstring const & cat, lyx::docstring const & t, QPrefs * form = 0, QWidget * parent = 0)
: QWidget(parent), category_(cat), title_(t), form_(form)
{
}
virtual ~PrefModule() {}
virtual void apply(LyXRC & rc) const = 0;
virtual void update(LyXRC const & rc) = 0;
lyx::docstring const & category() {
return category_;
}
lyx::docstring const & title() {
return title_;
}
protected:
lyx::docstring category_;
lyx::docstring title_;
QPrefs * form_;
Q_SIGNALS:
void changed();
};
class PrefPlaintext : public PrefModule, public Ui::QPrefPlaintextUi
{
Q_OBJECT
public:
PrefPlaintext(QWidget * parent = 0);
~PrefPlaintext() {}
virtual void apply(LyXRC & rc) const;
virtual void update(LyXRC const & rc);
};
class PrefDate : public PrefModule, public Ui::QPrefDateUi
{
Q_OBJECT
public:
PrefDate(QWidget * parent = 0);
~PrefDate() {}
virtual void apply(LyXRC & rc) const;
virtual void update(LyXRC const & rc);
};
class PrefKeyboard : public PrefModule, public Ui::QPrefKeyboardUi
{
Q_OBJECT
public:
PrefKeyboard(QPrefs * form, QWidget * parent = 0);
~PrefKeyboard() {}
virtual void apply(LyXRC & rc) const;
virtual void update(LyXRC const & rc);
private Q_SLOTS:
void on_firstKeymapPB_clicked(bool);
void on_secondKeymapPB_clicked(bool);
void on_keymapCB_toggled(bool);
private:
QString testKeymap(QString keymap);
};
class PrefLatex : public PrefModule, public Ui::QPrefLatexUi
{
Q_OBJECT
public:
PrefLatex(QPrefs * form, QWidget * parent = 0);
~PrefLatex() {}
virtual void apply(LyXRC & rc) const;
virtual void update(LyXRC const & rc);
};
class PrefScreenFonts : public PrefModule, public Ui::QPrefScreenFontsUi
{
Q_OBJECT
public:
PrefScreenFonts(QPrefs * form, QWidget * parent = 0);
~PrefScreenFonts() {}
virtual void apply(LyXRC & rc) const;
virtual void update(LyXRC const & rc);
private Q_SLOTS:
void select_roman(const QString&);
void select_sans(const QString&);
void select_typewriter(const QString&);
};
class PrefColors : public PrefModule, public Ui::QPrefColorsUi
{
Q_OBJECT
public:
PrefColors(QPrefs * form, QWidget * parent = 0);
~PrefColors() {}
void apply(LyXRC & rc) const;
void update(LyXRC const & rc);
private Q_SLOTS:
void change_color();
private:
std::vector<LColor_color> lcolors_;
// FIXME the use of mutable here is required due to the
// fact that initialization is not done in the controller
// but in the constructor.
mutable std::vector<QString> curcolors_;
std::vector<QString> newcolors_;
};
class PrefCygwinPath : public PrefModule, public Ui::QPrefCygwinPathUi
{
Q_OBJECT
public:
PrefCygwinPath(QWidget * parent = 0);
~PrefCygwinPath() {}
void apply(LyXRC & rc) const;
void update(LyXRC const & rc);
};
class PrefDisplay : public PrefModule, public Ui::QPrefDisplayUi
{
Q_OBJECT
public:
PrefDisplay(QWidget * parent = 0);
~PrefDisplay() {}
void apply(LyXRC & rc) const;
void update(LyXRC const & rc);
};
class PrefPaths : public PrefModule, public Ui::QPrefPathsUi
{
Q_OBJECT
public:
PrefPaths(QPrefs * form, QWidget * parent = 0);
~PrefPaths() {}
void apply(LyXRC & rc) const;
void update(LyXRC const & rc);
private Q_SLOTS:
void select_templatedir();
void select_tempdir();
void select_backupdir();
void select_workingdir();
void select_lyxpipe();
};
class PrefSpellchecker : public PrefModule, public Ui::QPrefSpellcheckerUi
{
Q_OBJECT
public:
PrefSpellchecker(QPrefs * form, QWidget * parent = 0);
~PrefSpellchecker() {}
void apply(LyXRC & rc) const;
void update(LyXRC const & rc);
private Q_SLOTS:
void select_dict();
};
class PrefConverters : public PrefModule, public Ui::QPrefConvertersUi
{
Q_OBJECT
public:
PrefConverters(QPrefs * form, QWidget * parent = 0);
~PrefConverters() {}
void apply(LyXRC & rc) const;
void update(LyXRC const & rc);
public Q_SLOTS:
void updateGui();
private Q_SLOTS:
void update_converter();
void switch_converter();
void converter_changed();
void remove_converter();
void on_cacheCB_stateChanged(int state);
private:
void updateButtons();
};
class PrefCopiers : public PrefModule, public Ui::QPrefCopiersUi
{
Q_OBJECT
public:
PrefCopiers(QPrefs * form, QWidget * parent = 0);
~PrefCopiers() {}
void apply(LyXRC & rc) const;
void update(LyXRC const & rc);
void update();
private Q_SLOTS:
void switch_copierLB(int nr);
void switch_copierCO(int nr);
void copiers_changed();
void new_copier();
void modify_copier();
void remove_copier();
private:
void updateButtons();
};
class PrefFileformats : public PrefModule, public Ui::QPrefFileformatsUi
{
Q_OBJECT
public:
PrefFileformats(QPrefs * form, QWidget * parent = 0);
~PrefFileformats() {}
void apply(LyXRC & rc) const;
void update(LyXRC const & rc);
void update();
Q_SIGNALS:
void formatsChanged();
private:
void updateButtons();
private Q_SLOTS:
void switch_format(int);
void fileformat_changed();
void new_format();
void modify_format();
void remove_format();
};
class PrefLanguage : public PrefModule, public Ui::QPrefLanguageUi
{
Q_OBJECT
public:
PrefLanguage(QWidget * parent = 0);
~PrefLanguage() {}
void apply(LyXRC & rc) const;
void update(LyXRC const & rc);
private:
std::vector<std::string> lang_;
};
class PrefPrinter : public PrefModule, public Ui::QPrefPrinterUi
{
Q_OBJECT
public:
PrefPrinter(QWidget * parent = 0);
~PrefPrinter() {}
void apply(LyXRC & rc) const;
void update(LyXRC const & rc);
};
class PrefUserInterface : public PrefModule, public Ui::QPrefUi
{
Q_OBJECT
public:
PrefUserInterface(QPrefs * form, QWidget * parent = 0);
~PrefUserInterface() {}
void apply(LyXRC & rc) const;
void update(LyXRC const & rc);
public Q_SLOTS:
void select_ui();
void select_bind();
void on_loadWindowSizeCB_toggled(bool);
};
class PrefIdentity : public PrefModule, public Ui::QPrefIdentityUi
{
Q_OBJECT
public:
PrefIdentity(QWidget * parent = 0);
~PrefIdentity() {}
void apply(LyXRC & rc) const;
void update(LyXRC const & rc);
};
///
class QPrefsDialog : public QDialog, public Ui::QPrefsUi
{
Q_OBJECT
public:
QPrefsDialog(QPrefs *);
~QPrefsDialog();
void apply(LyXRC & rc) const;
void updateRc(LyXRC const & rc);
public Q_SLOTS:
void change_adaptor();
protected:
void closeEvent(QCloseEvent * e);
private:
void add(PrefModule * module);
private:
QPrefs * form_;
std::vector<PrefModule *> modules_;
};
} // namespace frontend
} // namespace lyx
#endif // PREFSDIALOG_H

View File

@ -12,7 +12,6 @@
#include <config.h> #include <config.h>
#include "QRef.h" #include "QRef.h"
#include "QRefDialog.h"
#include "Qt2BC.h" #include "Qt2BC.h"
#include "qt_helpers.h" #include "qt_helpers.h"
@ -27,22 +26,166 @@
#include <QListWidgetItem> #include <QListWidgetItem>
#include <QPushButton> #include <QPushButton>
#include <QToolTip> #include <QToolTip>
#include <QCloseEvent>
using lyx::docstring;
using std::vector; using std::vector;
using std::string; using std::string;
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
/////////////////////////////////////////////////////////////////////
//
// QRefDialog
//
/////////////////////////////////////////////////////////////////////
QRefDialog::QRefDialog(QRef * 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(closePB, SIGNAL(clicked()), this, SLOT(reset_dialog()));
connect(typeCO, SIGNAL(activated(int)),
this, SLOT(changed_adaptor()));
connect(referenceED, SIGNAL(textChanged(const QString &)),
this, SLOT(changed_adaptor()));
connect(nameED, SIGNAL(textChanged(const QString &)),
this, SLOT(changed_adaptor()));
connect(refsLW, SIGNAL(itemClicked(QListWidgetItem *)),
this, SLOT(refHighlighted(QListWidgetItem *)));
connect(refsLW, SIGNAL(itemSelectionChanged()),
this, SLOT(selectionChanged()));
connect(refsLW, SIGNAL(itemActivated(QListWidgetItem *)),
this, SLOT(refSelected(QListWidgetItem *)));
connect(sortCB, SIGNAL(clicked(bool)),
this, SLOT(sortToggled(bool)));
connect(gotoPB, SIGNAL(clicked()),
this, SLOT(gotoClicked()));
connect(updatePB, SIGNAL(clicked()),
this, SLOT(updateClicked()));
connect(bufferCO, SIGNAL(activated(int)),
this, SLOT(updateClicked()));
setFocusProxy(refsLW);
}
void QRefDialog::show()
{
QDialog::show();
}
void QRefDialog::changed_adaptor()
{
form_->changed();
}
void QRefDialog::gotoClicked()
{
form_->gotoRef();
}
void QRefDialog::selectionChanged()
{
if (form_->readOnly())
return;
QList<QListWidgetItem *> selections = refsLW->selectedItems();
if (selections.isEmpty())
return;
QListWidgetItem * sel = selections.first();
refHighlighted(sel);
return;
}
void QRefDialog::refHighlighted(QListWidgetItem * sel)
{
if (form_->readOnly())
return;
/* int const cur_item = refsLW->currentRow();
bool const cur_item_selected = cur_item >= 0 ?
refsLB->isSelected(cur_item) : false;*/
bool const cur_item_selected = refsLW->isItemSelected(sel);
if (cur_item_selected)
referenceED->setText(sel->text());
if (form_->at_ref_)
form_->gotoRef();
gotoPB->setEnabled(true);
if (form_->typeAllowed())
typeCO->setEnabled(true);
if (form_->nameAllowed())
nameED->setEnabled(true);
}
void QRefDialog::refSelected(QListWidgetItem * sel)
{
if (form_->readOnly())
return;
/* int const cur_item = refsLW->currentRow();
bool const cur_item_selected = cur_item >= 0 ?
refsLB->isSelected(cur_item) : false;*/
bool const cur_item_selected = refsLW->isItemSelected(sel);
if (cur_item_selected)
referenceED->setText(sel->text());
// <enter> or double click, inserts ref and closes dialog
form_->slotOK();
}
void QRefDialog::sortToggled(bool on)
{
form_->sort_ = on;
form_->redoRefs();
}
void QRefDialog::updateClicked()
{
form_->updateRefs();
}
void QRefDialog::reset_dialog() {
form_->at_ref_ = false;
form_->setGotoRef();
}
void QRefDialog::closeEvent(QCloseEvent * e)
{
form_->slotWMHide();
reset_dialog();
e->accept();
}
/////////////////////////////////////////////////////////////////////
//
// QRef
//
/////////////////////////////////////////////////////////////////////
// full qualification because qt4 has also a ControlRef type // full qualification because qt4 has also a ControlRef type
typedef QController<lyx::frontend::ControlRef, QView<QRefDialog> > ref_base_class; typedef QController<lyx::frontend::ControlRef, QView<QRefDialog> > RefBase;
QRef::QRef(Dialog & parent) QRef::QRef(Dialog & parent)
: ref_base_class(parent, _("Cross-reference")), : RefBase(parent, _("Cross-reference")),
sort_(false), at_ref_(false) sort_(false), at_ref_(false)
{ {
} }
@ -240,3 +383,5 @@ bool QRef::isValid()
} // namespace frontend } // namespace frontend
} // namespace lyx } // namespace lyx
#include "QRef_moc.cpp"

View File

@ -13,13 +13,46 @@
#define QREF_H #define QREF_H
#include "QDialogView.h" #include "QDialogView.h"
#include "QRefDialog.h"
#include "ui/RefUi.h"
#include <QDialog>
#include <vector> #include <vector>
class QListWidgetItem;
class QCloseEvent;
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
class QRef;
class QRefDialog : public QDialog, public Ui::QRefUi {
Q_OBJECT
public:
QRefDialog(QRef * form);
virtual void show();
public Q_SLOTS:
void changed_adaptor();
void gotoClicked();
void refHighlighted(QListWidgetItem *);
void selectionChanged();
void refSelected(QListWidgetItem *);
void sortToggled(bool);
void updateClicked();
protected Q_SLOTS:
void reset_dialog();
protected:
void closeEvent(QCloseEvent * e);
private:
QRef * form_;
};
class ControlRef; class ControlRef;
// full qualification because qt4 has also a ControlRef type // full qualification because qt4 has also a ControlRef type

View File

@ -1,162 +0,0 @@
/**
* \file QRefDialog.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Kalle Dalheimer
* \author John Levon
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "QRefDialog.h"
#include "QRef.h"
#include <QLineEdit>
#include <QListWidget>
#include <QPushButton>
#include <QCloseEvent>
namespace lyx {
namespace frontend {
QRefDialog::QRefDialog(QRef * 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(closePB, SIGNAL(clicked()),
this, SLOT( reset_dialog() ) );
connect( typeCO, SIGNAL( activated(int) ),
this, SLOT( changed_adaptor() ) );
connect( referenceED, SIGNAL( textChanged(const QString&) ),
this, SLOT( changed_adaptor() ) );
connect( nameED, SIGNAL( textChanged(const QString&) ),
this, SLOT( changed_adaptor() ) );
connect( refsLW, SIGNAL( itemClicked(QListWidgetItem *) ),
this, SLOT( refHighlighted(QListWidgetItem *) ) );
connect( refsLW, SIGNAL( itemSelectionChanged() ),
this, SLOT( selectionChanged() ) );
connect( refsLW, SIGNAL( itemActivated(QListWidgetItem *) ),
this, SLOT( refSelected(QListWidgetItem *) ) );
connect( sortCB, SIGNAL( clicked(bool) ),
this, SLOT( sortToggled(bool) ) );
connect( gotoPB, SIGNAL( clicked() ),
this, SLOT( gotoClicked() ) );
connect( updatePB, SIGNAL( clicked() ),
this, SLOT( updateClicked() ) );
connect( bufferCO, SIGNAL( activated(int) ),
this, SLOT( updateClicked() ) );
setFocusProxy(refsLW);
}
void QRefDialog::show()
{
QDialog::show();
}
void QRefDialog::changed_adaptor()
{
form_->changed();
}
void QRefDialog::gotoClicked()
{
form_->gotoRef();
}
void QRefDialog::selectionChanged()
{
if (form_->readOnly())
return;
QList<QListWidgetItem *> selections = refsLW->selectedItems();
if (selections.isEmpty())
return;
QListWidgetItem * sel = selections.first();
refHighlighted(sel);
return;
}
void QRefDialog::refHighlighted(QListWidgetItem * sel)
{
if (form_->readOnly())
return;
/* int const cur_item = refsLW->currentRow();
bool const cur_item_selected = cur_item >= 0 ?
refsLB->isSelected(cur_item) : false;*/
bool const cur_item_selected = refsLW->isItemSelected(sel);
if (cur_item_selected)
referenceED->setText(sel->text());
if (form_->at_ref_)
form_->gotoRef();
gotoPB->setEnabled(true);
if (form_->typeAllowed())
typeCO->setEnabled(true);
if (form_->nameAllowed())
nameED->setEnabled(true);
}
void QRefDialog::refSelected(QListWidgetItem * sel)
{
if (form_->readOnly())
return;
/* int const cur_item = refsLW->currentRow();
bool const cur_item_selected = cur_item >= 0 ?
refsLB->isSelected(cur_item) : false;*/
bool const cur_item_selected = refsLW->isItemSelected(sel);
if (cur_item_selected)
referenceED->setText(sel->text());
// <enter> or double click, inserts ref and closes dialog
form_->slotOK();
}
void QRefDialog::sortToggled(bool on)
{
form_->sort_ = on;
form_->redoRefs();
}
void QRefDialog::updateClicked()
{
form_->updateRefs();
}
void QRefDialog::reset_dialog() {
form_->at_ref_ = false;
form_->setGotoRef();
}
void QRefDialog::closeEvent(QCloseEvent * e)
{
form_->slotWMHide();
reset_dialog();
e->accept();
}
} // namespace frontend
} // namespace lyx
#include "QRefDialog_moc.cpp"

View File

@ -1,55 +0,0 @@
// -*- C++ -*-
/**
* \file QRefDialog.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Kalle Dalheimer
* \author John Levon
*
* Full author contact details are available in file CREDITS.
*/
#ifndef QREFDIALOG_H
#define QREFDIALOG_H
#include "ui/RefUi.h"
#include <QDialog>
#include <QCloseEvent>
class QListWidgetItem;
namespace lyx {
namespace frontend {
class QRef;
class QRefDialog : public QDialog, public Ui::QRefUi {
Q_OBJECT
public:
QRefDialog(QRef * form);
virtual void show();
public Q_SLOTS:
void changed_adaptor();
void gotoClicked();
void refHighlighted(QListWidgetItem *);
void selectionChanged();
void refSelected(QListWidgetItem *);
void sortToggled(bool);
void updateClicked();
protected Q_SLOTS:
void reset_dialog();
protected:
void closeEvent(QCloseEvent * e);
private:
QRef * form_;
};
} // namespace frontend
} // namespace lyx
#endif // QREFDIALOG_H

View File

@ -11,7 +11,6 @@
#include <config.h> #include <config.h>
#include "QSendto.h" #include "QSendto.h"
#include "QSendtoDialog.h"
#include "Qt2BC.h" #include "Qt2BC.h"
#include "qt_helpers.h" #include "qt_helpers.h"
@ -21,18 +20,68 @@
#include <QListWidget> #include <QListWidget>
#include <QPushButton> #include <QPushButton>
#include <QCloseEvent>
using std::vector; using std::vector;
using std::string; using std::string;
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
typedef QController<ControlSendto, QView<QSendtoDialog> > sendto_base_class; /////////////////////////////////////////////////////////////////////
//
// QSendtoDialog
//
/////////////////////////////////////////////////////////////////////
QSendtoDialog::QSendtoDialog(QSendto * 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( formatLW, SIGNAL( itemClicked(QListWidgetItem *) ),
this, SLOT( slotFormatHighlighted(QListWidgetItem *) ) );
connect( formatLW, SIGNAL( itemActivated(QListWidgetItem *) ),
this, SLOT( slotFormatSelected(QListWidgetItem *) ) );
connect( formatLW, SIGNAL( itemClicked(QListWidgetItem *) ),
this, SLOT( changed_adaptor() ) );
connect( commandCO, SIGNAL( textChanged(const QString&) ),
this, SLOT( changed_adaptor() ) );
}
void QSendtoDialog::changed_adaptor()
{
form_->changed();
}
void QSendtoDialog::closeEvent(QCloseEvent * e)
{
form_->slotWMHide();
e->accept();
}
/////////////////////////////////////////////////////////////////////
//
// QSendto
//
/////////////////////////////////////////////////////////////////////
typedef QController<ControlSendto, QView<QSendtoDialog> > SendtoBase;
QSendto::QSendto(Dialog & parent) QSendto::QSendto(Dialog & parent)
: sendto_base_class(parent, _("Send Document to Command")) : SendtoBase(parent, _("Send Document to Command"))
{ {
} }
@ -103,3 +152,5 @@ bool QSendto::isValid()
} // namespace frontend } // namespace frontend
} // namespace lyx } // namespace lyx
#include "QSendto_moc.cpp"

View File

@ -13,16 +13,38 @@
#define QSENDTO_H #define QSENDTO_H
#include "QDialogView.h" #include "QDialogView.h"
#include "QSendtoDialog.h" #include "ui/SendtoUi.h"
#include <QDialog>
#include <vector> #include <vector>
class QCloseEvent;
class QListWidgetItem;
namespace lyx { namespace lyx {
class Format; class Format;
namespace frontend { namespace frontend {
class QSendto;
class QSendtoDialog : public QDialog, public Ui::QSendtoUi {
Q_OBJECT
public:
QSendtoDialog(QSendto * form);
protected Q_SLOTS:
virtual void changed_adaptor();
virtual void slotFormatHighlighted(QListWidgetItem *) {}
virtual void slotFormatSelected(QListWidgetItem *) {}
protected:
virtual void closeEvent(QCloseEvent * e);
private:
QSendto * form_;
};
class ControlSendto; class ControlSendto;
/** This class provides a Qt implementation of the Custom Export Dialog. /** This class provides a Qt implementation of the Custom Export Dialog.

View File

@ -1,61 +0,0 @@
/**
* \file QSendtoDialog.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Jürgen Spitzmüller
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "QSendtoDialog.h"
#include "QSendto.h"
#include <QPushButton>
#include <QCloseEvent>
namespace lyx {
namespace frontend {
QSendtoDialog::QSendtoDialog(QSendto * 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( formatLW, SIGNAL( itemClicked(QListWidgetItem *) ),
this, SLOT( slotFormatHighlighted(QListWidgetItem *) ) );
connect( formatLW, SIGNAL( itemActivated(QListWidgetItem *) ),
this, SLOT( slotFormatSelected(QListWidgetItem *) ) );
connect( formatLW, SIGNAL( itemClicked(QListWidgetItem *) ),
this, SLOT( changed_adaptor() ) );
connect( commandCO, SIGNAL( textChanged(const QString&) ),
this, SLOT( changed_adaptor() ) );
}
void QSendtoDialog::changed_adaptor()
{
form_->changed();
}
void QSendtoDialog::closeEvent(QCloseEvent * e)
{
form_->slotWMHide();
e->accept();
}
} // namespace frontend
} // namespace lyx
#include "QSendtoDialog_moc.cpp"

View File

@ -1,44 +0,0 @@
// -*- C++ -*-
/**
* \file QSendtoDialog.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Jürgen Spitzmüller
*
* Full author contact details are available in file CREDITS.
*/
#ifndef QSENDTODIALOG_H
#define QSENDTODIALOG_H
#include "ui/SendtoUi.h"
#include <QDialog>
#include <QCloseEvent>
class QListWidgetItem;
namespace lyx {
namespace frontend {
class QSendto;
class QSendtoDialog : public QDialog, public Ui::QSendtoUi {
Q_OBJECT
public:
QSendtoDialog(QSendto * form);
protected Q_SLOTS:
virtual void changed_adaptor();
virtual void slotFormatHighlighted(QListWidgetItem *) {}
virtual void slotFormatSelected(QListWidgetItem *) {}
protected:
virtual void closeEvent(QCloseEvent * e);
private:
QSendto * form_;
};
} // namespace frontend
} // namespace lyx
#endif // QSENDTODIALOG_H