mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-24 13:48:59 +00:00
next one
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20817 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c0fb3ecae2
commit
7e30f47252
@ -21,7 +21,6 @@
|
|||||||
#include "GuiMathMatrix.h"
|
#include "GuiMathMatrix.h"
|
||||||
#include "GuiNomencl.h"
|
#include "GuiNomencl.h"
|
||||||
#include "GuiView.h"
|
#include "GuiView.h"
|
||||||
#include "GuiURL.h"
|
|
||||||
|
|
||||||
// Uncomment this if you prefer dock widget
|
// Uncomment this if you prefer dock widget
|
||||||
//#define USE_DOCK_WIDGET
|
//#define USE_DOCK_WIDGET
|
||||||
@ -202,7 +201,7 @@ Dialog * Dialogs::build(string const & name)
|
|||||||
if (name == "toc")
|
if (name == "toc")
|
||||||
return createGuiToc(lyxview_);
|
return createGuiToc(lyxview_);
|
||||||
if (name == "url")
|
if (name == "url")
|
||||||
return new GuiURLDialog(lyxview_);
|
return createGuiURL(lyxview_);
|
||||||
if (name == "vspace")
|
if (name == "vspace")
|
||||||
return createGuiVSpace(lyxview_);
|
return createGuiVSpace(lyxview_);
|
||||||
if (name == "wrap")
|
if (name == "wrap")
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
* This file is part of LyX, the document processor.
|
* This file is part of LyX, the document processor.
|
||||||
* Licence details can be found in the file COPYING.
|
* Licence details can be found in the file COPYING.
|
||||||
*
|
*
|
||||||
|
* \author Angus Leeming
|
||||||
* \author John Levon
|
* \author John Levon
|
||||||
*
|
*
|
||||||
* Full author contact details are available in file CREDITS.
|
* Full author contact details are available in file CREDITS.
|
||||||
@ -12,8 +13,10 @@
|
|||||||
|
|
||||||
#include "GuiURL.h"
|
#include "GuiURL.h"
|
||||||
|
|
||||||
#include "ControlCommand.h"
|
#include "GuiURL.h"
|
||||||
#include "qt_helpers.h"
|
#include "qt_helpers.h"
|
||||||
|
#include "FuncRequest.h"
|
||||||
|
#include "insets/InsetCommand.h"
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
@ -24,12 +27,12 @@
|
|||||||
namespace lyx {
|
namespace lyx {
|
||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
|
||||||
GuiURLDialog::GuiURLDialog(LyXView & lv)
|
GuiURL::GuiURL(LyXView & lv)
|
||||||
: GuiDialog(lv, "url")
|
: GuiDialog(lv, "url"), Controller(this), params_("url")
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
setViewTitle( _("URL"));
|
setViewTitle( _("URL"));
|
||||||
setController(new ControlCommand(*this, "url"));
|
setController(this, false);
|
||||||
|
|
||||||
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
|
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
|
||||||
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
|
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
|
||||||
@ -51,19 +54,13 @@ GuiURLDialog::GuiURLDialog(LyXView & lv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ControlCommand & GuiURLDialog::controller()
|
void GuiURL::changed_adaptor()
|
||||||
{
|
|
||||||
return static_cast<ControlCommand &>(GuiDialog::controller());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GuiURLDialog::changed_adaptor()
|
|
||||||
{
|
{
|
||||||
changed();
|
changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiURLDialog::closeEvent(QCloseEvent * e)
|
void GuiURL::closeEvent(QCloseEvent * e)
|
||||||
{
|
{
|
||||||
slotClose();
|
slotClose();
|
||||||
e->accept();
|
e->accept();
|
||||||
@ -71,33 +68,29 @@ void GuiURLDialog::closeEvent(QCloseEvent * e)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void GuiURLDialog::updateContents()
|
void GuiURL::updateContents()
|
||||||
{
|
{
|
||||||
InsetCommandParams const & params = controller().params();
|
urlED->setText(toqstr(params_["target"]));
|
||||||
|
nameED->setText(toqstr(params_["name"]));
|
||||||
urlED->setText(toqstr(params["target"]));
|
hyperlinkCB->setChecked(params_.getCmdName() != "url");
|
||||||
nameED->setText(toqstr(params["name"]));
|
|
||||||
hyperlinkCB->setChecked(params.getCmdName() != "url");
|
|
||||||
|
|
||||||
bc().setValid(isValid());
|
bc().setValid(isValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiURLDialog::applyView()
|
void GuiURL::applyView()
|
||||||
{
|
{
|
||||||
InsetCommandParams & params = controller().params();
|
params_["target"] = qstring_to_ucs4(urlED->text());
|
||||||
|
params_["name"] = qstring_to_ucs4(nameED->text());
|
||||||
params["target"] = qstring_to_ucs4(urlED->text());
|
|
||||||
params["name"] = qstring_to_ucs4(nameED->text());
|
|
||||||
|
|
||||||
if (hyperlinkCB->isChecked())
|
if (hyperlinkCB->isChecked())
|
||||||
params.setCmdName("htmlurl");
|
params_.setCmdName("htmlurl");
|
||||||
else
|
else
|
||||||
params.setCmdName("url");
|
params_.setCmdName("url");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GuiURLDialog::isValid()
|
bool GuiURL::isValid()
|
||||||
{
|
{
|
||||||
QString const u = urlED->text();
|
QString const u = urlED->text();
|
||||||
QString const n = nameED->text();
|
QString const n = nameED->text();
|
||||||
@ -105,6 +98,27 @@ bool GuiURLDialog::isValid()
|
|||||||
return !u.isEmpty() || !n.isEmpty();
|
return !u.isEmpty() || !n.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool GuiURL::initialiseParams(std::string const & data)
|
||||||
|
{
|
||||||
|
// The name passed with LFUN_INSET_APPLY is also the name
|
||||||
|
// used to identify the mailer.
|
||||||
|
InsetCommandMailer::string2params("name", data, params_);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiURL::dispatchParams()
|
||||||
|
{
|
||||||
|
std::string const lfun =
|
||||||
|
InsetCommandMailer::params2string("url", params_);
|
||||||
|
dispatch(FuncRequest(getLfun(), lfun));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Dialog * createGuiURL(LyXView & lv) { return new GuiURL(lv); }
|
||||||
|
|
||||||
|
|
||||||
} // namespace frontend
|
} // namespace frontend
|
||||||
} // namespace lyx
|
} // namespace lyx
|
||||||
|
|
||||||
|
@ -1,30 +1,32 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/**
|
/**
|
||||||
* \file GuiURLDialog.h
|
* \file GuiURL.h
|
||||||
* This file is part of LyX, the document processor.
|
* This file is part of LyX, the document processor.
|
||||||
* Licence details can be found in the file COPYING.
|
* Licence details can be found in the file COPYING.
|
||||||
*
|
*
|
||||||
* \author John Levon
|
* \author John Levon
|
||||||
|
* \author Angus Leeming
|
||||||
*
|
*
|
||||||
* Full author contact details are available in file CREDITS.
|
* Full author contact details are available in file CREDITS.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef GUIURLDIALOG_H
|
#ifndef GUIURL_H
|
||||||
#define GUIURLDIALOG_H
|
#define GUIURL_H
|
||||||
|
|
||||||
#include "GuiDialog.h"
|
#include "GuiDialog.h"
|
||||||
#include "ControlCommand.h"
|
#include "ControlCommand.h"
|
||||||
#include "ui_URLUi.h"
|
#include "ui_URLUi.h"
|
||||||
|
#include "insets/InsetCommandParams.h"
|
||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
|
||||||
class GuiURLDialog : public GuiDialog, public Ui::URLUi
|
class GuiURL : public GuiDialog, public Ui::URLUi, public Controller
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GuiURLDialog(LyXView & lv);
|
GuiURL(LyXView & lv);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void changed_adaptor();
|
void changed_adaptor();
|
||||||
@ -32,16 +34,28 @@ public Q_SLOTS:
|
|||||||
private:
|
private:
|
||||||
void closeEvent(QCloseEvent *);
|
void closeEvent(QCloseEvent *);
|
||||||
/// parent controller
|
/// parent controller
|
||||||
ControlCommand & controller();
|
Controller & controller() { return *this; }
|
||||||
///
|
///
|
||||||
bool isValid();
|
bool isValid();
|
||||||
/// apply dialog
|
/// apply dialog
|
||||||
void applyView();
|
void applyView();
|
||||||
/// update dialog
|
/// update dialog
|
||||||
void updateContents();
|
void updateContents();
|
||||||
|
///
|
||||||
|
bool initialiseParams(std::string const & data);
|
||||||
|
/// clean-up on hide.
|
||||||
|
void clearParams() { params_.clear(); }
|
||||||
|
/// clean-up on hide.
|
||||||
|
void dispatchParams();
|
||||||
|
///
|
||||||
|
bool isBufferDependent() const { return true; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
///
|
||||||
|
InsetCommandParams params_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace frontend
|
} // namespace frontend
|
||||||
} // namespace lyx
|
} // namespace lyx
|
||||||
|
|
||||||
#endif // GUIURLDIALOG_H
|
#endif // GUIURL_H
|
||||||
|
Loading…
Reference in New Issue
Block a user