From 888ba9e94b0e21ade6ab3af21f0fadda3b706fcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Tue, 24 Apr 2007 12:02:27 +0000 Subject: [PATCH] merge QVSpace and QVSpaceDialog git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17944 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/Makefile.dialogs | 2 +- src/frontends/qt4/QVSpace.C | 81 ++++++++++++++++++++++++++---- src/frontends/qt4/QVSpace.h | 31 ++++++++++-- src/frontends/qt4/QVSpaceDialog.C | 78 ---------------------------- src/frontends/qt4/QVSpaceDialog.h | 46 ----------------- 5 files changed, 98 insertions(+), 140 deletions(-) delete mode 100644 src/frontends/qt4/QVSpaceDialog.C delete mode 100644 src/frontends/qt4/QVSpaceDialog.h diff --git a/src/frontends/qt4/Makefile.dialogs b/src/frontends/qt4/Makefile.dialogs index c9788d093e..33f32d3228 100644 --- a/src/frontends/qt4/Makefile.dialogs +++ b/src/frontends/qt4/Makefile.dialogs @@ -133,7 +133,7 @@ MOCFILES = \ TocWidget.C TocWidget.h \ QToc.C QToc.h \ QURLDialog.C QURLDialog.h \ - QVSpaceDialog.C QVSpaceDialog.h \ + QVSpace.C QVSpace.h \ QWrapDialog.C QWrapDialog.h \ QLToolbar.C QLToolbar.h \ socket_callback.C socket_callback.h \ diff --git a/src/frontends/qt4/QVSpace.C b/src/frontends/qt4/QVSpace.C index 2bdded75f8..e991aefe58 100644 --- a/src/frontends/qt4/QVSpace.C +++ b/src/frontends/qt4/QVSpace.C @@ -16,12 +16,12 @@ #include #include "QVSpace.h" -#include "QVSpaceDialog.h" #include "Qt2BC.h" #include "checkedwidgets.h" #include "lengthcombo.h" #include "qt_helpers.h" +#include "validators.h" #include "lyxrc.h" // to set the default length values #include "Spacing.h" @@ -32,9 +32,11 @@ #include "support/lstrings.h" -#include #include +#include +#include #include +#include using std::string; @@ -42,9 +44,66 @@ using std::string; namespace lyx { namespace frontend { -namespace { -void setWidgetsFromVSpace(VSpace const & space, +///////////////////////////////////////////////////////////////////// +// +// QVSpaceDialog +// +///////////////////////////////////////////////////////////////////// + + +QVSpaceDialog::QVSpaceDialog(QVSpace * 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(spacingCO, SIGNAL(highlighted(const QString &)), + this, SLOT(change_adaptor())); + connect(valueLE, SIGNAL(textChanged(const QString &)), + this, SLOT(change_adaptor())); + connect(spacingCO, SIGNAL(activated(int)), + this, SLOT(enableCustom(int))); + connect(keepCB, SIGNAL(clicked()), + this, SLOT(change_adaptor())); + connect(unitCO, SIGNAL(selectionChanged(lyx::LyXLength::UNIT)), + this, SLOT(change_adaptor())); + + valueLE->setValidator(unsignedLengthValidator(valueLE)); +} + + +void QVSpaceDialog::closeEvent(QCloseEvent * e) +{ + form_->slotWMHide(); + e->accept(); +} + + +void QVSpaceDialog::change_adaptor() +{ + form_->changed(); +} + + +void QVSpaceDialog::enableCustom(int selection) +{ + bool const enable = selection == 5; + valueLE->setEnabled(enable); + unitCO->setEnabled(enable); +} + + +///////////////////////////////////////////////////////////////////// +// +// QVSpace +// +///////////////////////////////////////////////////////////////////// + +static void setWidgetsFromVSpace(VSpace const & space, QComboBox * spacing, QLineEdit * value, LengthCombo * unit, @@ -90,7 +149,7 @@ void setWidgetsFromVSpace(VSpace const & space, } -VSpace setVSpaceFromWidgets(int spacing, +static VSpace setVSpaceFromWidgets(int spacing, QLineEdit * value, LengthCombo * unit, bool keep) @@ -114,8 +173,7 @@ VSpace setVSpaceFromWidgets(int spacing, space = VSpace(VSpace::VFILL); break; case 5: - space = VSpace(LyXGlueLength( - widgetsToLength(value, unit))); + space = VSpace(LyXGlueLength(widgetsToLength(value, unit))); break; } @@ -123,13 +181,11 @@ VSpace setVSpaceFromWidgets(int spacing, return space; } -} // namespace anon - -typedef QController > vspace_base_class; +typedef QController > VSpaceBase; QVSpace::QVSpace(Dialog & parent) - : vspace_base_class(parent, _("Vertical Space Settings")) + : VSpaceBase(parent, _("Vertical Space Settings")) {} @@ -187,3 +243,6 @@ void QVSpace::update_contents() } // namespace frontend } // namespace lyx + + +#include "QVSpace_moc.cpp" diff --git a/src/frontends/qt4/QVSpace.h b/src/frontends/qt4/QVSpace.h index af7aa73029..862c8d16fb 100644 --- a/src/frontends/qt4/QVSpace.h +++ b/src/frontends/qt4/QVSpace.h @@ -15,17 +15,40 @@ #define QVSPACE_H #include "QDialogView.h" -#include "QVSpaceDialog.h" -#include +#include "ui/VSpaceUi.h" + +#include + +class QCloseEvent; namespace lyx { namespace frontend { class ControlVSpace; -/** This class provides an Qt implementation of the VSpace dialog. - */ +class QVSpace; + + +class QVSpaceDialog : public QDialog, public Ui::QVSpaceUi { + Q_OBJECT + +public: + QVSpaceDialog(QVSpace * form); + +public Q_SLOTS: + void change_adaptor(); + +protected Q_SLOTS: + void closeEvent(QCloseEvent *); + void enableCustom(int); + +private: + QVSpace * form_; +}; + + + class QVSpace : public QController > { diff --git a/src/frontends/qt4/QVSpaceDialog.C b/src/frontends/qt4/QVSpaceDialog.C deleted file mode 100644 index 77cd26dffa..0000000000 --- a/src/frontends/qt4/QVSpaceDialog.C +++ /dev/null @@ -1,78 +0,0 @@ -/** - * \file QVSpaceDialog.C - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * \author John Levon - * \author Edwin Leuven - * \author Jürgen Spitzmüller - * - * Full author contact details are available in file CREDITS. - */ - -#include - -#include "QVSpaceDialog.h" -#include "QVSpace.h" -//Added by qt3to4: -#include - -#include "lengthcombo.h" -#include "validators.h" -#include "qt_helpers.h" - -#include -#include -#include - - -namespace lyx { -namespace frontend { - - -QVSpaceDialog::QVSpaceDialog(QVSpace * 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( spacingCO, SIGNAL( highlighted(const QString&) ), this, SLOT( change_adaptor() ) ); - connect( valueLE, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) ); - connect( spacingCO, SIGNAL( activated(int) ), this, SLOT( enableCustom(int) ) ); - connect( keepCB, SIGNAL( clicked() ), this, SLOT( change_adaptor() ) ); - connect( unitCO, SIGNAL( selectionChanged(lyx::LyXLength::UNIT) ), this, SLOT( change_adaptor() ) ); - - valueLE->setValidator(unsignedLengthValidator(valueLE)); -} - - -void QVSpaceDialog::closeEvent(QCloseEvent * e) -{ - form_->slotWMHide(); - e->accept(); -} - - -void QVSpaceDialog::change_adaptor() -{ - form_->changed(); -} - - -void QVSpaceDialog::enableCustom(int selection) -{ - bool const enable = selection == 5; - valueLE->setEnabled(enable); - unitCO->setEnabled(enable); -} - -} // namespace frontend -} // namespace lyx - -#include "QVSpaceDialog_moc.cpp" diff --git a/src/frontends/qt4/QVSpaceDialog.h b/src/frontends/qt4/QVSpaceDialog.h deleted file mode 100644 index 81b779f5a5..0000000000 --- a/src/frontends/qt4/QVSpaceDialog.h +++ /dev/null @@ -1,46 +0,0 @@ -// -*- C++ -*- -/** - * \file QVSpaceDialog.h - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * \author John Levon - * \author Jürgen Spitzmüller - * - * Full author contact details are available in file CREDITS. - */ - -#ifndef QVSPACEDIALOG_H -#define QVSPACEDIALOG_H - -#include "ui/VSpaceUi.h" - -#include -#include - -namespace lyx { -namespace frontend { - -class QVSpace; - -class QVSpaceDialog : public QDialog, public Ui::QVSpaceUi { - Q_OBJECT - -public: - QVSpaceDialog(QVSpace * form); - -public Q_SLOTS: - void change_adaptor(); - -protected Q_SLOTS: - void closeEvent(QCloseEvent *); - void enableCustom(int); - -private: - QVSpace * form_; -}; - -} // namespace frontend -} // namespace lyx - -#endif // QVSPACEDIALOG_H