2008-02-14 18:06:47 +00:00
|
|
|
/**
|
|
|
|
* \file GuiLabel.cpp
|
|
|
|
* 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 "GuiLabel.h"
|
|
|
|
|
|
|
|
#include "qt_helpers.h"
|
|
|
|
|
2010-10-27 17:25:55 +00:00
|
|
|
#include "insets/InsetLabel.h"
|
2008-02-18 07:14:42 +00:00
|
|
|
|
2008-02-14 18:06:47 +00:00
|
|
|
#include <QLabel>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QLineEdit>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2008-04-20 09:24:14 +00:00
|
|
|
// GuiLabel
|
2008-02-14 18:06:47 +00:00
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
2010-10-27 17:25:55 +00:00
|
|
|
GuiLabel::GuiLabel(QWidget * parent) : InsetParamsWidget(parent)
|
2008-02-14 18:06:47 +00:00
|
|
|
{
|
|
|
|
setupUi(this);
|
|
|
|
|
|
|
|
connect(keywordED, SIGNAL(textChanged(const QString &)),
|
2010-10-27 17:25:55 +00:00
|
|
|
this, SIGNAL(changed()));
|
2008-02-14 18:06:47 +00:00
|
|
|
|
|
|
|
setFocusProxy(keywordED);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-10-27 17:25:55 +00:00
|
|
|
void GuiLabel::paramsToDialog(Inset const * inset)
|
2008-02-14 18:06:47 +00:00
|
|
|
{
|
2010-10-27 17:25:55 +00:00
|
|
|
InsetLabel const * label = static_cast<InsetLabel const *>(inset);
|
|
|
|
InsetCommandParams const & params = label->params();
|
|
|
|
keywordED->setText(toqstr(params["name"]));
|
2008-02-14 18:06:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-10-27 17:25:55 +00:00
|
|
|
docstring GuiLabel::dialogToParams() const
|
2008-02-14 18:06:47 +00:00
|
|
|
{
|
2010-10-27 17:25:55 +00:00
|
|
|
InsetCommandParams params(insetCode());
|
|
|
|
params["name"] = qstring_to_ucs4(keywordED->text());
|
2010-11-07 17:38:39 +00:00
|
|
|
return from_utf8(InsetLabel::params2string(params));
|
2008-02-14 18:06:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-10-31 18:56:32 +00:00
|
|
|
bool GuiLabel::initialiseParams(std::string const & data)
|
|
|
|
{
|
|
|
|
InsetCommandParams p(insetCode());
|
|
|
|
if (!InsetCommand::string2params(data, p))
|
|
|
|
return false;
|
|
|
|
keywordED->setText(toqstr(p["name"]));
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-10-27 17:25:55 +00:00
|
|
|
bool GuiLabel::checkWidgets() const
|
2008-02-14 18:06:47 +00:00
|
|
|
{
|
2010-10-27 17:25:55 +00:00
|
|
|
if (!InsetParamsWidget::checkWidgets())
|
|
|
|
return false;
|
2008-02-14 18:06:47 +00:00
|
|
|
return !keywordED->text().isEmpty();
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
|
|
|
|
2008-11-14 14:28:50 +00:00
|
|
|
#include "moc_GuiLabel.cpp"
|