mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
merge QVSpace and QVSpaceDialog
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17944 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e9b92c06a3
commit
888ba9e94b
@ -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 \
|
||||
|
@ -16,12 +16,12 @@
|
||||
#include <config.h>
|
||||
|
||||
#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 <QLineEdit>
|
||||
#include <QCheckBox>
|
||||
#include <QCloseEvent>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QValidator>
|
||||
|
||||
|
||||
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<ControlVSpace, QView<QVSpaceDialog> > vspace_base_class;
|
||||
typedef QController<ControlVSpace, QView<QVSpaceDialog> > 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"
|
||||
|
@ -15,17 +15,40 @@
|
||||
#define QVSPACE_H
|
||||
|
||||
#include "QDialogView.h"
|
||||
#include "QVSpaceDialog.h"
|
||||
|
||||
#include <vector>
|
||||
#include "ui/VSpaceUi.h"
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
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<ControlVSpace, QView<QVSpaceDialog> >
|
||||
{
|
||||
|
@ -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 <config.h>
|
||||
|
||||
#include "QVSpaceDialog.h"
|
||||
#include "QVSpace.h"
|
||||
//Added by qt3to4:
|
||||
#include <QCloseEvent>
|
||||
|
||||
#include "lengthcombo.h"
|
||||
#include "validators.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QValidator>
|
||||
|
||||
|
||||
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"
|
@ -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 <QDialog>
|
||||
#include <QCloseEvent>
|
||||
|
||||
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
|
Loading…
Reference in New Issue
Block a user