mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 02:14:50 +00:00
GuiInfo: display and initialize the information dialog, can not apply yet
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25152 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f5101ebec8
commit
3c142cdd47
@ -24,9 +24,11 @@
|
||||
#include "insets/InsetInfo.h"
|
||||
|
||||
#include "support/debug.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
using namespace lyx::support;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
@ -37,14 +39,31 @@ namespace frontend {
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
char const * info_types[] =
|
||||
{ "unknown", "shortcut", "shortcuts", "lyxrc", "package", "textclass", "menu", "icon", "buffer", "" };
|
||||
|
||||
char const * info_types_gui[] =
|
||||
{ N_("unknown"), N_("shortcut"), N_("shortcuts"), N_("lyxrc"), N_("package"), N_("textclass"),
|
||||
N_("menu"), N_("icon"), N_("buffer"), ""};
|
||||
|
||||
|
||||
|
||||
GuiInfo::GuiInfo(GuiView & lv)
|
||||
: DialogView(lv, "info", qt_("Info"))
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
connect(okPB, SIGNAL(clicked()), this, SLOT(slotApply()));
|
||||
|
||||
connect(typeCO, SIGNAL(clicked()), this, SLOT(change_adaptor()));
|
||||
connect(nameLE, SIGNAL(textChanged(QString)), this, SLOT(change_adaptor()));
|
||||
|
||||
for (int n = 0; info_types[n][0]; ++n)
|
||||
typeCO->addItem(qt_(info_types_gui[n]));
|
||||
}
|
||||
|
||||
|
||||
void GuiInfo::on_closePB_clicked()
|
||||
void GuiInfo::on_cancelPB_clicked()
|
||||
{
|
||||
hide();
|
||||
}
|
||||
@ -61,6 +80,8 @@ void GuiInfo::applyView()
|
||||
updateLabels(bufferview()->buffer());
|
||||
bufferview()->updateMetrics();
|
||||
bufferview()->buffer().changed();
|
||||
|
||||
hide();
|
||||
}
|
||||
|
||||
|
||||
@ -68,12 +89,17 @@ void GuiInfo::updateView()
|
||||
{
|
||||
InsetInfo * ii = static_cast<InsetInfo *>(inset(INFO_CODE));
|
||||
if (!ii) {
|
||||
typeCO->setCurrentIndex(0);
|
||||
nameLE->clear();
|
||||
// FIXME: A New button to create an InsetInfo at the cursor location
|
||||
// would be nice.
|
||||
enableView(false);
|
||||
return;
|
||||
}
|
||||
//FIXME: update the controls.
|
||||
|
||||
int type = findToken(info_types, ii->infoType());
|
||||
typeCO->setCurrentIndex(type >= 0 ? type : 0);
|
||||
nameLE->setText(toqstr(ii->infoName()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
//@}
|
||||
|
||||
private Q_SLOTS:
|
||||
void on_closePB_clicked();
|
||||
void on_cancelPB_clicked();
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
|
@ -5,8 +5,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>161</width>
|
||||
<height>121</height>
|
||||
<width>320</width>
|
||||
<height>131</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
@ -15,32 +15,67 @@
|
||||
<property name="sizeGripEnabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<spacer name="spacer" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>84</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="typeLBL" >
|
||||
<property name="text" >
|
||||
<string>Information Type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QComboBox" name="typeCO" />
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="nameLBL" >
|
||||
<property name="text" >
|
||||
<string>Information Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QLineEdit" name="nameLE" />
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QPushButton" name="closePB" >
|
||||
<property name="text" >
|
||||
<string>&Close</string>
|
||||
</property>
|
||||
<property name="default" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>84</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="okPB" >
|
||||
<property name="text" >
|
||||
<string>&OK</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cancelPB" >
|
||||
<property name="text" >
|
||||
<string>&Cancel</string>
|
||||
</property>
|
||||
<property name="default" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
@ -69,6 +69,12 @@ void InsetInfo::draw(PainterInfo & pi, int x, int y) const
|
||||
}
|
||||
|
||||
|
||||
string InsetInfo::infoType() const
|
||||
{
|
||||
return nameTranslator().find(type_);
|
||||
}
|
||||
|
||||
|
||||
docstring InsetInfo::toolTip(BufferView const &, int, int) const
|
||||
{
|
||||
odocstringstream os;
|
||||
|
@ -105,6 +105,10 @@ public:
|
||||
///
|
||||
void write(std::ostream & os) const;
|
||||
///
|
||||
std::string infoType() const;
|
||||
///
|
||||
std::string infoName() const { return name_; }
|
||||
///
|
||||
bool showInsetDialog(BufferView * bv) const;
|
||||
///
|
||||
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
|
||||
|
Loading…
Reference in New Issue
Block a user