merge QWrapDialog and QWrap

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17951 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2007-04-24 14:59:51 +00:00
parent 998a68b13e
commit 1ed0c6be12
6 changed files with 71 additions and 114 deletions

View File

@ -41,7 +41,6 @@ libqt4_la_SOURCES = \
GuiSelection.h GuiSelection.C \
LyXKeySymFactory.C \
QLMenubar.C QLMenubar.h \
QAbout.C QAbout.h \
QBibitem.C QBibitem.h \
QBibtex.C QBibtex.h \
QBox.C QBox.h \
@ -53,7 +52,6 @@ libqt4_la_SOURCES = \
QDocument.C QDocument.h \
QDialogView.C QDialogView.h \
QErrorList.C QErrorList.h \
QERT.C QERT.h \
QExternal.C QExternal.h \
QFloat.C QFloat.h \
QGraphics.C QGraphics.h \
@ -70,16 +68,12 @@ libqt4_la_SOURCES = \
QPrefs.C QPrefs.h \
QPrint.C QPrint.h \
QRef.C QRef.h \
QSearch.C QSearch.h \
QSendto.C QSendto.h \
QShowFile.C QShowFile.h \
QSpellchecker.C QSpellchecker.h \
QTabular.C QTabular.h \
QTabularCreate.C QTabularCreate.h \
QTexinfo.C QTexinfo.h \
QThesaurus.C QThesaurus.h \
QVSpace.C QVSpace.h \
QWrap.C QWrap.h \
Qt2BC.C Qt2BC.h \
checkedwidgets.C checkedwidgets.h \
panelstack.h panelstack.C \

View File

@ -133,7 +133,7 @@ MOCFILES = \
QToc.C QToc.h \
QURLDialog.C QURLDialog.h \
QVSpace.C QVSpace.h \
QWrapDialog.C QWrapDialog.h \
QWrap.C QWrap.h \
QLToolbar.C QLToolbar.h \
socket_callback.C socket_callback.h \
validators.C validators.h

View File

@ -11,7 +11,6 @@
#include <config.h>
#include "QWrap.h"
#include "QWrapDialog.h"
#include "Qt2BC.h"
#include "lengthcombo.h"
@ -25,6 +24,7 @@
#include "support/lstrings.h"
#include <QLineEdit>
#include <QCloseEvent>
#include <QPushButton>
@ -33,6 +33,50 @@ using std::string;
namespace lyx {
namespace frontend {
/////////////////////////////////////////////////////////////////////
//
// QWrapDialog
//
/////////////////////////////////////////////////////////////////////
QWrapDialog::QWrapDialog(QWrap * form)
: form_(form)
{
setupUi(this);
connect(restorePB, SIGNAL(clicked()), form, SLOT(slotRestore()));
connect(okPB, SIGNAL(clicked()), form, SLOT(slotOK()));
connect(applyPB, SIGNAL(clicked()), form, SLOT(slotApply()));
connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
connect(widthED, SIGNAL(textChanged(const QString &)),
this, SLOT(change_adaptor()));
connect(unitsLC, SIGNAL(selectionChanged(LyXLength::UNIT)),
this, SLOT(change_adaptor()));
connect(valignCO, SIGNAL(highlighted(const QString &)),
this, SLOT(change_adaptor()));
}
void QWrapDialog::closeEvent(QCloseEvent * e)
{
form_->slotWMHide();
e->accept();
}
void QWrapDialog::change_adaptor()
{
form_->changed();
}
/////////////////////////////////////////////////////////////////////
//
// QWrap
//
/////////////////////////////////////////////////////////////////////
typedef QController<ControlWrap, QView<QWrapDialog> > wrap_base_class;
QWrap::QWrap(Dialog & parent)
@ -84,10 +128,9 @@ void QWrap::apply()
}
namespace {
string const numtostr(double val) {
string a(convert<string>(val));
static string const numtostr(double val)
{
string a = convert<string>(val);
#ifdef WITH_WARNINGS
#warning Will this test ever trigger? (Lgb)
#endif
@ -96,8 +139,6 @@ string const numtostr(double val) {
return a;
}
} // namespace anon
void QWrap::update_contents()
{
@ -120,3 +161,6 @@ void QWrap::update_contents()
} // namespace frontend
} // namespace lyx
#include "QWrap_moc.cpp"

View File

@ -13,11 +13,29 @@
#define QWRAP_H
#include "QDialogView.h"
#include "QWrapDialog.h"
#include "ui/WrapUi.h"
#include <QDialog>
#include <QCloseEvent>
namespace lyx {
namespace frontend {
class QWrap;
class QWrapDialog : public QDialog, public Ui::QWrapUi {
Q_OBJECT
public:
QWrapDialog(QWrap * form);
protected Q_SLOTS:
virtual void change_adaptor();
protected:
virtual void closeEvent(QCloseEvent * e);
private:
QWrap * form_;
};
class ControlWrap;
class QWrap : public QController<ControlWrap, QView<QWrapDialog> > {

View File

@ -1,59 +0,0 @@
/**
* \file QWrapDialog.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 "QWrapDialog.h"
#include "QWrap.h"
#include <qpushbutton.h>
//Added by qt3to4:
#include <QCloseEvent>
namespace lyx {
namespace frontend {
QWrapDialog::QWrapDialog(QWrap * form)
: form_(form)
{
setupUi(this);
connect(restorePB, SIGNAL(clicked()),
form, SLOT(slotRestore()));
connect(okPB, SIGNAL(clicked()),
form, SLOT(slotOK()));
connect(applyPB, SIGNAL(clicked()),
form, SLOT(slotApply()));
connect(closePB, SIGNAL(clicked()),
form, SLOT(slotClose()));
connect( widthED, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
connect( unitsLC, SIGNAL( selectionChanged(LyXLength::UNIT) ), this, SLOT( change_adaptor() ) );
connect( valignCO, SIGNAL( highlighted(const QString&) ), this, SLOT( change_adaptor() ) );
}
void QWrapDialog::closeEvent(QCloseEvent * e)
{
form_->slotWMHide();
e->accept();
}
void QWrapDialog::change_adaptor()
{
form_->changed();
}
} // namespace frontend
} // namespace lyx
#include "QWrapDialog_moc.cpp"

View File

@ -1,40 +0,0 @@
// -*- C++ -*-
/**
* \file QWrapDialog.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 QWRAPDIALOG_H
#define QWRAPDIALOG_H
#include "ui/WrapUi.h"
#include <QDialog>
#include <QCloseEvent>
namespace lyx {
namespace frontend {
class QWrap;
class QWrapDialog : public QDialog, public Ui::QWrapUi {
Q_OBJECT
public:
QWrapDialog(QWrap * form);
protected Q_SLOTS:
virtual void change_adaptor();
protected:
virtual void closeEvent(QCloseEvent * e);
private:
QWrap * form_;
};
} // namespace frontend
} // namespace lyx
#endif // QWRAPDIALOG_H