Add lyxrc.use_lastfilepos and load_session to the preference dialog. Bo Peng (ben.bob@gmail.com)

* src/frontends/qt3/QPrefs.C, QPrefsDialog.C, ui/QPrefUIModule.ui: add two checkboxes
	*	src/lyxrc.C: turn off load_session by default (since we now can turn it on)


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13741 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Bo Peng 2006-04-25 22:22:11 +00:00
parent 13cd255a30
commit 1d1df1a5f1
4 changed files with 243 additions and 223 deletions

View File

@ -178,6 +178,8 @@ void QPrefs::apply()
rc.ui_file = internal_path(uimod->uiFileED->text()); rc.ui_file = internal_path(uimod->uiFileED->text());
rc.bind_file = internal_path(uimod->bindFileED->text()); rc.bind_file = internal_path(uimod->bindFileED->text());
rc.use_lastfilepos = uimod->restoreCursorCB->isChecked();
rc.load_session = uimod->loadSessionCB->isChecked();
rc.cursor_follows_scrollbar = uimod->cursorFollowsCB->isChecked(); rc.cursor_follows_scrollbar = uimod->cursorFollowsCB->isChecked();
rc.autosave = uimod->autoSaveSB->value() * 60; rc.autosave = uimod->autoSaveSB->value() * 60;
rc.make_backup = uimod->autoSaveCB->isChecked(); rc.make_backup = uimod->autoSaveCB->isChecked();
@ -504,6 +506,8 @@ void QPrefs::update_contents()
uimod->uiFileED->setText(external_path(rc.ui_file)); uimod->uiFileED->setText(external_path(rc.ui_file));
uimod->bindFileED->setText(external_path(rc.bind_file)); uimod->bindFileED->setText(external_path(rc.bind_file));
uimod->restoreCursorCB->setChecked(rc.use_lastfilepos);
uimod->loadSessionCB->setChecked(rc.load_session);
uimod->cursorFollowsCB->setChecked(rc.cursor_follows_scrollbar); uimod->cursorFollowsCB->setChecked(rc.cursor_follows_scrollbar);
// convert to minutes // convert to minutes
int mins(rc.autosave / 60); int mins(rc.autosave / 60);

View File

@ -230,6 +230,8 @@ QPrefsDialog::QPrefsDialog(QPrefs * form)
connect(languageModule->defaultLanguageCO, SIGNAL(activated(int)), this, SLOT(change_adaptor())); connect(languageModule->defaultLanguageCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
connect(uiModule->uiFileED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor())); connect(uiModule->uiFileED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
connect(uiModule->bindFileED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor())); connect(uiModule->bindFileED, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
connect(uiModule->restoreCursorCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
connect(uiModule->loadSessionCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
connect(uiModule->cursorFollowsCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor())); connect(uiModule->cursorFollowsCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
connect(uiModule->autoSaveSB, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor())); connect(uiModule->autoSaveSB, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
connect(uiModule->autoSaveCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor())); connect(uiModule->autoSaveCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));

View File

@ -1,15 +1,10 @@
<!DOCTYPE UI><UI> <!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>QPrefUIModule</class> <class>QPrefUIModule</class>
<include location="global">config.h</include> <widget class="QWidget">
<include location="local">qt_helpers.h</include> <property name="name">
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>QPrefUIModule</cstring> <cstring>QPrefUIModule</cstring>
</property> </property>
<property stdset="1"> <property name="geometry">
<name>geometry</name>
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
@ -17,94 +12,131 @@
<height>441</height> <height>441</height>
</rect> </rect>
</property> </property>
<property stdset="1"> <property name="sizePolicy">
<name>sizePolicy</name>
<sizepolicy> <sizepolicy>
<hsizetype>1</hsizetype> <hsizetype>1</hsizetype>
<vsizetype>1</vsizetype> <vsizetype>1</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property stdset="1"> <property name="caption">
<name>caption</name>
<string>QPrefUIModule</string> <string>QPrefUIModule</string>
</property> </property>
<grid> <vbox>
<property stdset="1"> <property name="name">
<name>margin</name> <cstring>unnamed</cstring>
</property>
<property name="margin">
<number>11</number> <number>11</number>
</property> </property>
<property stdset="1"> <property name="spacing">
<name>spacing</name>
<number>6</number> <number>6</number>
</property> </property>
<widget row="1" column="0" > <widget class="QLayoutWidget">
<class>QLayoutWidget</class> <property name="name">
<property stdset="1"> <cstring>Layout2</cstring>
<name>name</name> </property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<widget class="QPushButton" row="1" column="2">
<property name="name">
<cstring>bindFilePB</cstring>
</property>
<property name="text">
<string>B&amp;rowse...</string>
</property>
</widget>
<widget class="QLabel" row="0" column="0">
<property name="name">
<cstring>uiFileLA</cstring>
</property>
<property name="text">
<string>&amp;User interface file:</string>
</property>
<property name="buddy" stdset="0">
<cstring>uiFileED</cstring>
</property>
</widget>
<widget class="QLabel" row="1" column="0">
<property name="name">
<cstring>bindFileLA</cstring>
</property>
<property name="text">
<string>&amp;Bind file:</string>
</property>
<property name="buddy" stdset="0">
<cstring>bindFileED</cstring>
</property>
</widget>
<widget class="QLineEdit" row="0" column="1">
<property name="name">
<cstring>uiFileED</cstring>
</property>
</widget>
<widget class="QPushButton" row="0" column="2">
<property name="name">
<cstring>uiFilePB</cstring>
</property>
<property name="text">
<string>Bro&amp;wse...</string>
</property>
</widget>
<widget class="QLineEdit" row="1" column="1">
<property name="name">
<cstring>bindFileED</cstring>
</property>
</widget>
</grid>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>Layout7</cstring> <cstring>Layout7</cstring>
</property> </property>
<hbox> <hbox>
<property stdset="1"> <property name="name">
<name>margin</name> <cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number> <number>0</number>
</property> </property>
<property stdset="1"> <property name="spacing">
<name>spacing</name>
<number>6</number> <number>6</number>
</property> </property>
<widget> <widget class="QLayoutWidget">
<class>QLayoutWidget</class> <property name="name">
<property stdset="1">
<name>name</name>
<cstring>Layout6</cstring> <cstring>Layout6</cstring>
</property> </property>
<vbox> <vbox>
<property stdset="1"> <property name="name">
<name>margin</name> <cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number> <number>0</number>
</property> </property>
<property stdset="1"> <property name="spacing">
<name>spacing</name>
<number>6</number> <number>6</number>
</property> </property>
<widget> <widget class="QGroupBox">
<class>QGroupBox</class> <property name="name">
<property stdset="1">
<name>name</name>
<cstring>documentsGB</cstring> <cstring>documentsGB</cstring>
</property> </property>
<property stdset="1"> <property name="title">
<name>title</name>
<string>Documents</string> <string>Documents</string>
</property> </property>
<widget> <widget class="QLayoutWidget">
<class>QCheckBox</class> <property name="name">
<property stdset="1">
<name>name</name>
<cstring>autoSaveCB</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>11</x>
<y>17</y>
<width>275</width>
<height>17</height>
</rect>
</property>
<property stdset="1">
<name>text</name>
<string>B&amp;ackup documents </string>
</property>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout11</cstring> <cstring>Layout11</cstring>
</property> </property>
<property stdset="1"> <property name="geometry">
<name>geometry</name>
<rect> <rect>
<x>60</x> <x>60</x>
<y>40</y> <y>40</y>
@ -113,86 +145,69 @@
</rect> </rect>
</property> </property>
<hbox> <hbox>
<property stdset="1"> <property name="name">
<name>margin</name> <cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number> <number>0</number>
</property> </property>
<property stdset="1"> <property name="spacing">
<name>spacing</name>
<number>6</number> <number>6</number>
</property> </property>
<spacer> <spacer>
<property> <property name="name">
<name>name</name>
<cstring>Spacer6</cstring> <cstring>Spacer6</cstring>
</property> </property>
<property stdset="1"> <property name="orientation">
<name>orientation</name>
<enum>Horizontal</enum> <enum>Horizontal</enum>
</property> </property>
<property stdset="1"> <property name="sizeType">
<name>sizeType</name>
<enum>Fixed</enum> <enum>Fixed</enum>
</property> </property>
<property> <property name="sizeHint">
<name>sizeHint</name>
<size> <size>
<width>21</width> <width>21</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
</spacer> </spacer>
<widget> <widget class="QLabel">
<class>QLabel</class> <property name="name">
<property stdset="1">
<name>name</name>
<cstring>autoSaveLA</cstring> <cstring>autoSaveLA</cstring>
</property> </property>
<property stdset="1"> <property name="text">
<name>text</name>
<string> every</string> <string> every</string>
</property> </property>
<property> <property name="buddy" stdset="0">
<name>buddy</name>
<cstring>autoSaveSB</cstring> <cstring>autoSaveSB</cstring>
</property> </property>
</widget> </widget>
<widget> <widget class="QSpinBox">
<class>QSpinBox</class> <property name="name">
<property stdset="1">
<name>name</name>
<cstring>autoSaveSB</cstring> <cstring>autoSaveSB</cstring>
</property> </property>
<property stdset="1"> <property name="maxValue">
<name>maxValue</name>
<number>300</number> <number>300</number>
</property> </property>
<property stdset="1"> <property name="minValue">
<name>minValue</name>
<number>1</number> <number>1</number>
</property> </property>
</widget> </widget>
<widget> <widget class="QLabel">
<class>QLabel</class> <property name="name">
<property stdset="1">
<name>name</name>
<cstring>TextLabel1</cstring> <cstring>TextLabel1</cstring>
</property> </property>
<property stdset="1"> <property name="text">
<name>text</name>
<string>minutes</string> <string>minutes</string>
</property> </property>
</widget> </widget>
</hbox> </hbox>
</widget> </widget>
<widget> <widget class="QLayoutWidget">
<class>QLayoutWidget</class> <property name="name">
<property stdset="1">
<name>name</name>
<cstring>Layout12</cstring> <cstring>Layout12</cstring>
</property> </property>
<property stdset="1"> <property name="geometry">
<name>geometry</name>
<rect> <rect>
<x>11</x> <x>11</x>
<y>69</y> <y>69</y>
@ -201,60 +216,69 @@
</rect> </rect>
</property> </property>
<hbox> <hbox>
<property stdset="1"> <property name="name">
<name>margin</name> <cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number> <number>0</number>
</property> </property>
<property stdset="1"> <property name="spacing">
<name>spacing</name>
<number>6</number> <number>6</number>
</property> </property>
<widget> <widget class="QLabel">
<class>QLabel</class> <property name="name">
<property stdset="1">
<name>name</name>
<cstring>lastfilesLA</cstring> <cstring>lastfilesLA</cstring>
</property> </property>
<property stdset="1"> <property name="text">
<name>text</name>
<string>&amp;Maximum last files:</string> <string>&amp;Maximum last files:</string>
</property> </property>
<property> <property name="buddy" stdset="0">
<name>buddy</name>
<cstring>lastfilesSB</cstring> <cstring>lastfilesSB</cstring>
</property> </property>
</widget> </widget>
<widget> <widget class="QSpinBox">
<class>QSpinBox</class> <property name="name">
<property stdset="1">
<name>name</name>
<cstring>lastfilesSB</cstring> <cstring>lastfilesSB</cstring>
</property> </property>
<property stdset="1"> <property name="maxValue">
<name>maxValue</name>
<number>9</number> <number>9</number>
</property> </property>
</widget> </widget>
</hbox> </hbox>
</widget> </widget>
<widget class="QCheckBox">
<property name="name">
<cstring>autoSaveCB</cstring>
</property>
<property name="geometry">
<rect>
<x>11</x>
<y>17</y>
<width>275</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>B&amp;ackup documents </string>
</property>
<property name="accel">
<string>Alt+A</string>
</property>
</widget>
</widget> </widget>
</vbox> </vbox>
</widget> </widget>
<spacer> <spacer>
<property> <property name="name">
<name>name</name>
<cstring>Spacer8</cstring> <cstring>Spacer8</cstring>
</property> </property>
<property stdset="1"> <property name="orientation">
<name>orientation</name>
<enum>Horizontal</enum> <enum>Horizontal</enum>
</property> </property>
<property stdset="1"> <property name="sizeType">
<name>sizeType</name>
<enum>Expanding</enum> <enum>Expanding</enum>
</property> </property>
<property> <property name="sizeHint">
<name>sizeHint</name>
<size> <size>
<width>20</width> <width>20</width>
<height>20</height> <height>20</height>
@ -263,122 +287,107 @@
</spacer> </spacer>
</hbox> </hbox>
</widget> </widget>
<widget row="0" column="0" > <widget class="QLayoutWidget">
<class>QLayoutWidget</class> <property name="name">
<property stdset="1"> <cstring>layout6</cstring>
<name>name</name>
<cstring>Layout2</cstring>
</property> </property>
<grid> <hbox>
<property stdset="1"> <property name="name">
<name>margin</name> <cstring>unnamed</cstring>
<number>0</number>
</property> </property>
<property stdset="1"> <widget class="QGroupBox">
<name>spacing</name> <property name="name">
<number>6</number> <cstring>sessionGB</cstring>
</property> </property>
<widget row="1" column="2" > <property name="title">
<class>QPushButton</class> <string>Session</string>
<property stdset="1">
<name>name</name>
<cstring>bindFilePB</cstring>
</property> </property>
<property stdset="1"> <hbox>
<name>text</name> <property name="name">
<string>B&amp;rowse...</string> <cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout7</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QCheckBox">
<property name="name">
<cstring>restoreCursorCB</cstring>
</property>
<property name="text">
<string>Restore cursor positions</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="toolTip" stdset="0">
<string>Restore to cursor position when the file was last closed</string>
</property> </property>
</widget> </widget>
<widget row="0" column="0" > <widget class="QCheckBox">
<class>QLabel</class> <property name="name">
<property stdset="1"> <cstring>loadSessionCB</cstring>
<name>name</name>
<cstring>uiFileLA</cstring>
</property> </property>
<property stdset="1"> <property name="text">
<name>text</name> <string>Load opened files from last session</string>
<string>&amp;User interface file:</string>
</property>
<property>
<name>buddy</name>
<cstring>uiFileED</cstring>
</property> </property>
</widget> </widget>
<widget row="1" column="0" > </vbox>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>bindFileLA</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Bind file:</string>
</property>
<property>
<name>buddy</name>
<cstring>bindFileED</cstring>
</property>
</widget> </widget>
<widget row="0" column="1" > </hbox>
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>uiFileED</cstring>
</property>
</widget> </widget>
<widget row="0" column="2" > <spacer>
<class>QPushButton</class> <property name="name">
<property stdset="1"> <cstring>spacer4</cstring>
<name>name</name>
<cstring>uiFilePB</cstring>
</property> </property>
<property stdset="1"> <property name="orientation">
<name>text</name> <enum>Horizontal</enum>
<string>Bro&amp;wse...</string>
</property> </property>
</widget> <property name="sizeType">
<widget row="1" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>bindFileED</cstring>
</property>
</widget>
</grid>
</widget>
<widget row="2" column="0" >
<class>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>cursorFollowsCB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Cursor follows &amp;scrollbar</string>
</property>
</widget>
<spacer row="3" column="0" >
<property>
<name>name</name>
<cstring>Spacer7</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Vertical</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum> <enum>Expanding</enum>
</property> </property>
<property> <property name="sizeHint">
<name>sizeHint</name>
<size> <size>
<width>20</width> <width>81</width>
<height>20</height> <height>31</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</grid> </hbox>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>cursorFollowsCB</cstring>
</property>
<property name="text">
<string>Cursor follows &amp;scrollbar</string>
</property>
<property name="accel">
<string>Alt+S</string>
</property>
</widget>
<spacer>
<property name="name">
<cstring>Spacer7</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>90</height>
</size>
</property>
</spacer>
</vbox>
</widget> </widget>
<connections> <connections>
<connection> <connection>
@ -410,4 +419,9 @@
<tabstop>autoSaveSB</tabstop> <tabstop>autoSaveSB</tabstop>
<tabstop>lastfilesSB</tabstop> <tabstop>lastfilesSB</tabstop>
</tabstops> </tabstops>
<includes>
<include location="global" impldecl="in implementation">config.h</include>
<include location="local" impldecl="in implementation">qt_helpers.h</include>
</includes>
<layoutdefaults spacing="6" margin="11"/>
</UI> </UI>

View File

@ -254,7 +254,7 @@ void LyXRC::setDefaults() {
num_lastfiles = maxlastfiles; num_lastfiles = maxlastfiles;
check_lastfiles = true; check_lastfiles = true;
use_lastfilepos = true; use_lastfilepos = true;
load_session = true; load_session = false;
make_backup = true; make_backup = true;
backupdir_path.erase(); backupdir_path.erase();
display_graphics = lyx::graphics::ColorDisplay; display_graphics = lyx::graphics::ColorDisplay;