mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
support to set the examples folder in the preferences
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21776 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
49051b32ea
commit
58135f8b27
@ -785,6 +785,10 @@ bool LyX::init()
|
||||
lyxrc.tempdir_path = package().temp_dir().absFilename();
|
||||
lyxrc.document_path = package().document_dir().absFilename();
|
||||
|
||||
if (lyxrc.example_path.empty()) {
|
||||
lyxrc.example_path = addPath(package().system_support().absFilename(),
|
||||
"examples");
|
||||
}
|
||||
if (lyxrc.template_path.empty()) {
|
||||
lyxrc.template_path = addPath(package().system_support().absFilename(),
|
||||
"templates");
|
||||
|
@ -92,6 +92,7 @@ keyword_item lyxrcTags[] = {
|
||||
{ "\\display_graphics", LyXRC::RC_DISPLAY_GRAPHICS },
|
||||
{ "\\document_path", LyXRC::RC_DOCUMENTPATH },
|
||||
{ "\\escape_chars", LyXRC::RC_ESC_CHARS },
|
||||
{ "\\example_path", LyXRC::RC_EXAMPLEPATH },
|
||||
{ "\\font_encoding", LyXRC::RC_FONT_ENCODING },
|
||||
{ "\\format", LyXRC::RC_FORMAT },
|
||||
{ "\\index_command", LyXRC::RC_INDEX_COMMAND },
|
||||
@ -705,6 +706,13 @@ int LyXRC::read(Lexer & lexrc)
|
||||
}
|
||||
break;
|
||||
|
||||
case RC_EXAMPLEPATH:
|
||||
if (lexrc.next()) {
|
||||
example_path = os::internal_path(lexrc.getString());
|
||||
example_path = expandPath(example_path);
|
||||
}
|
||||
break;
|
||||
|
||||
case RC_TEMPLATEPATH:
|
||||
if (lexrc.next()) {
|
||||
template_path = os::internal_path(lexrc.getString());
|
||||
@ -1932,6 +1940,14 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
|
||||
}
|
||||
if (tag != RC_LAST)
|
||||
break;
|
||||
case RC_EXAMPLEPATH:
|
||||
if (ignore_system_lyxrc ||
|
||||
example_path != system_lyxrc.example_path) {
|
||||
string const path = os::external_path(example_path);
|
||||
os << "\\example_path \"" << path << "\"\n";
|
||||
}
|
||||
if (tag != RC_LAST)
|
||||
break;
|
||||
case RC_TEMPLATEPATH:
|
||||
if (ignore_system_lyxrc ||
|
||||
template_path != system_lyxrc.template_path) {
|
||||
@ -2411,6 +2427,10 @@ string const LyXRC::getDescription(LyXRCTags tag)
|
||||
str = _("Specify additional chars that can be part of a word.");
|
||||
break;
|
||||
|
||||
case RC_EXAMPLEPATH:
|
||||
str = _("The path that LyX will set when offering to choose an example. An empty value selects the directory LyX was started from.");
|
||||
break;
|
||||
|
||||
case RC_FONT_ENCODING:
|
||||
str = _("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
|
||||
break;
|
||||
|
@ -63,6 +63,7 @@ public:
|
||||
RC_DISPLAY_GRAPHICS,
|
||||
RC_DOCUMENTPATH,
|
||||
RC_ESC_CHARS,
|
||||
RC_EXAMPLEPATH,
|
||||
RC_FONT_ENCODING,
|
||||
RC_FORMAT,
|
||||
RC_INDEX_COMMAND,
|
||||
@ -226,6 +227,8 @@ public:
|
||||
///
|
||||
std::string document_path;
|
||||
///
|
||||
std::string example_path;
|
||||
///
|
||||
std::string template_path;
|
||||
///
|
||||
std::string tempdir_path;
|
||||
|
@ -740,6 +740,7 @@ PrefPaths::PrefPaths(GuiPreferences * form, QWidget * parent)
|
||||
: PrefModule(_("Paths"), form, parent)
|
||||
{
|
||||
setupUi(this);
|
||||
connect(exampleDirPB, SIGNAL(clicked()), this, SLOT(select_exampledir()));
|
||||
connect(templateDirPB, SIGNAL(clicked()), this, SLOT(select_templatedir()));
|
||||
connect(tempDirPB, SIGNAL(clicked()), this, SLOT(select_tempdir()));
|
||||
connect(backupDirPB, SIGNAL(clicked()), this, SLOT(select_backupdir()));
|
||||
@ -747,6 +748,8 @@ PrefPaths::PrefPaths(GuiPreferences * form, QWidget * parent)
|
||||
connect(lyxserverDirPB, SIGNAL(clicked()), this, SLOT(select_lyxpipe()));
|
||||
connect(workingDirED, SIGNAL(textChanged(QString)),
|
||||
this, SIGNAL(changed()));
|
||||
connect(exampleDirPB, SIGNAL(textChanged(QString)),
|
||||
this, SIGNAL(changed()));
|
||||
connect(templateDirED, SIGNAL(textChanged(QString)),
|
||||
this, SIGNAL(changed()));
|
||||
connect(backupDirED, SIGNAL(textChanged(QString)),
|
||||
@ -763,6 +766,7 @@ PrefPaths::PrefPaths(GuiPreferences * form, QWidget * parent)
|
||||
void PrefPaths::apply(LyXRC & rc) const
|
||||
{
|
||||
rc.document_path = internal_path(fromqstr(workingDirED->text()));
|
||||
rc.example_path = internal_path(fromqstr(exampleDirED->text()));
|
||||
rc.template_path = internal_path(fromqstr(templateDirED->text()));
|
||||
rc.backupdir_path = internal_path(fromqstr(backupDirED->text()));
|
||||
rc.tempdir_path = internal_path(fromqstr(tempDirED->text()));
|
||||
@ -775,6 +779,7 @@ void PrefPaths::apply(LyXRC & rc) const
|
||||
void PrefPaths::update(LyXRC const & rc)
|
||||
{
|
||||
workingDirED->setText(toqstr(external_path(rc.document_path)));
|
||||
exampleDirED->setText(toqstr(external_path(rc.example_path)));
|
||||
templateDirED->setText(toqstr(external_path(rc.template_path)));
|
||||
backupDirED->setText(toqstr(external_path(rc.backupdir_path)));
|
||||
tempDirED->setText(toqstr(external_path(rc.tempdir_path)));
|
||||
@ -784,6 +789,16 @@ void PrefPaths::update(LyXRC const & rc)
|
||||
}
|
||||
|
||||
|
||||
void PrefPaths::select_exampledir()
|
||||
{
|
||||
docstring file(form_->browsedir(
|
||||
from_utf8(internal_path(fromqstr(exampleDirED->text()))),
|
||||
_("Select a document templates directory")));
|
||||
if (!file.empty())
|
||||
exampleDirED->setText(toqstr(file));
|
||||
}
|
||||
|
||||
|
||||
void PrefPaths::select_templatedir()
|
||||
{
|
||||
docstring file(form_->browsedir(
|
||||
|
@ -197,6 +197,7 @@ public:
|
||||
void update(LyXRC const & rc);
|
||||
|
||||
private Q_SLOTS:
|
||||
void select_exampledir();
|
||||
void select_templatedir();
|
||||
void select_tempdir();
|
||||
void select_backupdir();
|
||||
|
@ -6,67 +6,25 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>347</width>
|
||||
<height>227</height>
|
||||
<height>259</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QLabel" name="lyxserverDirLA" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="workingDirLA" >
|
||||
<property name="text" >
|
||||
<string>Ly&XServer pipe:</string>
|
||||
<string>&Working directory:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>lyxserverDirED</cstring>
|
||||
<cstring>workingDirED</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" >
|
||||
<widget class="QPushButton" name="templateDirPB" >
|
||||
<property name="text" >
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
<property name="autoDefault" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="2" >
|
||||
<widget class="QLineEdit" name="pathPrefixED" />
|
||||
</item>
|
||||
<item row="2" column="2" >
|
||||
<widget class="QPushButton" name="backupDirPB" >
|
||||
<property name="text" >
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
<property name="autoDefault" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2" >
|
||||
<widget class="QPushButton" name="tempDirPB" >
|
||||
<property name="text" >
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
<property name="autoDefault" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" >
|
||||
<widget class="QLineEdit" name="lyxserverDirED" />
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QLineEdit" name="templateDirED" />
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLineEdit" name="workingDirED" />
|
||||
</item>
|
||||
<item row="0" column="2" >
|
||||
<widget class="QPushButton" name="workingDirPB" >
|
||||
@ -78,62 +36,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" >
|
||||
<widget class="QLabel" name="pathPrefixLA" >
|
||||
<property name="text" >
|
||||
<string>&PATH prefix:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>pathPrefixED</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" >
|
||||
<widget class="QLabel" name="tempDirLA" >
|
||||
<property name="text" >
|
||||
<string>&Temporary directory:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>tempDirED</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="backupDirLA" >
|
||||
<property name="text" >
|
||||
<string>&Backup directory:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>backupDirED</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QLineEdit" name="backupDirED" />
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLineEdit" name="workingDirED" />
|
||||
</item>
|
||||
<item row="3" column="2" >
|
||||
<widget class="QPushButton" name="lyxserverDirPB" >
|
||||
<property name="text" >
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
<property name="autoDefault" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="workingDirLA" >
|
||||
<property name="text" >
|
||||
<string>&Working directory:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>workingDirED</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="templateDirLA" >
|
||||
<property name="text" >
|
||||
@ -144,10 +46,125 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QLineEdit" name="templateDirED" />
|
||||
</item>
|
||||
<item row="1" column="2" >
|
||||
<widget class="QPushButton" name="templateDirPB" >
|
||||
<property name="text" >
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
<property name="autoDefault" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="exampleDirLA" >
|
||||
<property name="text" >
|
||||
<string>&Example files:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>templateDirED</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QLineEdit" name="exampleDirED" />
|
||||
</item>
|
||||
<item row="2" column="2" >
|
||||
<widget class="QPushButton" name="exampleDirPB" >
|
||||
<property name="text" >
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
<property name="autoDefault" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QLabel" name="backupDirLA" >
|
||||
<property name="text" >
|
||||
<string>&Backup directory:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>backupDirED</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" >
|
||||
<widget class="QLineEdit" name="backupDirED" />
|
||||
</item>
|
||||
<item row="3" column="2" >
|
||||
<widget class="QPushButton" name="backupDirPB" >
|
||||
<property name="text" >
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
<property name="autoDefault" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" >
|
||||
<widget class="QLabel" name="lyxserverDirLA" >
|
||||
<property name="text" >
|
||||
<string>Ly&XServer pipe:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>lyxserverDirED</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" >
|
||||
<widget class="QLineEdit" name="lyxserverDirED" />
|
||||
</item>
|
||||
<item row="4" column="2" >
|
||||
<widget class="QPushButton" name="lyxserverDirPB" >
|
||||
<property name="text" >
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
<property name="autoDefault" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" >
|
||||
<widget class="QLabel" name="tempDirLA" >
|
||||
<property name="text" >
|
||||
<string>&Temporary directory:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>tempDirED</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" >
|
||||
<widget class="QLineEdit" name="tempDirED" />
|
||||
</item>
|
||||
<item row="6" column="0" colspan="3" >
|
||||
<item row="5" column="2" >
|
||||
<widget class="QPushButton" name="tempDirPB" >
|
||||
<property name="text" >
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
<property name="autoDefault" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" >
|
||||
<widget class="QLabel" name="pathPrefixLA" >
|
||||
<property name="text" >
|
||||
<string>&PATH prefix:</string>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>pathPrefixED</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1" colspan="2" >
|
||||
<widget class="QLineEdit" name="pathPrefixED" />
|
||||
</item>
|
||||
<item row="7" column="0" colspan="3" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
@ -165,10 +182,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<pixmapfunction></pixmapfunction>
|
||||
<includes>
|
||||
<include location="local" >qt_helpers.h</include>
|
||||
</includes>
|
||||
<tabstops>
|
||||
<tabstop>workingDirED</tabstop>
|
||||
<tabstop>workingDirPB</tabstop>
|
||||
@ -181,6 +194,9 @@
|
||||
<tabstop>tempDirED</tabstop>
|
||||
<tabstop>tempDirPB</tabstop>
|
||||
</tabstops>
|
||||
<includes>
|
||||
<include location="local" >qt_helpers.h</include>
|
||||
</includes>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
Loading…
Reference in New Issue
Block a user