Join PrefDateUi and PrefPlaintextUi into PrefOutputUi

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34140 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Pavel Sanda 2010-04-15 14:25:25 +00:00
parent 5862c1e414
commit 52756f5dc7
6 changed files with 137 additions and 209 deletions

View File

@ -324,34 +324,6 @@ static void setComboxFont(QComboBox * cb, string const & family,
} }
/////////////////////////////////////////////////////////////////////
//
// PrefPlaintext
//
/////////////////////////////////////////////////////////////////////
PrefPlaintext::PrefPlaintext(GuiPreferences * form)
: PrefModule(qt_(catOutput), qt_("Plain text"), form)
{
setupUi(this);
connect(plaintextLinelengthSB, SIGNAL(valueChanged(int)),
this, SIGNAL(changed()));
}
void PrefPlaintext::apply(LyXRC & rc) const
{
rc.plaintext_linelen = plaintextLinelengthSB->value();
}
void PrefPlaintext::update(LyXRC const & rc)
{
plaintextLinelengthSB->setValue(rc.plaintext_linelen);
}
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
// //
// StrftimeValidator // StrftimeValidator
@ -383,21 +355,23 @@ QValidator::State StrftimeValidator::validate(QString & input, int & /*pos*/) co
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
// //
// PrefDate // PrefOutput
// //
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
PrefDate::PrefDate(GuiPreferences * form) PrefOutput::PrefOutput(GuiPreferences * form)
: PrefModule(qt_(catOutput), qt_("Date format"), form) : PrefModule(qt_(catOutput), qt_("General"), form)
{ {
setupUi(this); setupUi(this);
DateED->setValidator(new StrftimeValidator(DateED)); DateED->setValidator(new StrftimeValidator(DateED));
connect(DateED, SIGNAL(textChanged(QString)), connect(DateED, SIGNAL(textChanged(QString)),
this, SIGNAL(changed())); this, SIGNAL(changed()));
connect(plaintextLinelengthSB, SIGNAL(valueChanged(int)),
this, SIGNAL(changed()));
} }
void PrefDate::on_DateED_textChanged(const QString &) void PrefOutput::on_DateED_textChanged(const QString &)
{ {
QString t = DateED->text(); QString t = DateED->text();
int p = 0; int p = 0;
@ -407,15 +381,17 @@ void PrefDate::on_DateED_textChanged(const QString &)
} }
void PrefDate::apply(LyXRC & rc) const void PrefOutput::apply(LyXRC & rc) const
{ {
rc.date_insert_format = fromqstr(DateED->text()); rc.date_insert_format = fromqstr(DateED->text());
rc.plaintext_linelen = plaintextLinelengthSB->value();
} }
void PrefDate::update(LyXRC const & rc) void PrefOutput::update(LyXRC const & rc)
{ {
DateED->setText(toqstr(rc.date_insert_format)); DateED->setText(toqstr(rc.date_insert_format));
plaintextLinelengthSB->setValue(rc.plaintext_linelen);
} }
@ -2927,10 +2903,10 @@ GuiPreferences::GuiPreferences(GuiView & lv)
addModule(new PrefLanguage(this)); addModule(new PrefLanguage(this));
addModule(new PrefSpellchecker(this)); addModule(new PrefSpellchecker(this));
//for strftime validator
PrefOutput * output = new PrefOutput(this);
addModule(output);
addModule(new PrefPrinter(this)); addModule(new PrefPrinter(this));
PrefDate * dateFormat = new PrefDate(this);
addModule(dateFormat);
addModule(new PrefPlaintext(this));
addModule(new PrefLatex(this)); addModule(new PrefLatex(this));
PrefConverters * converters = new PrefConverters(this); PrefConverters * converters = new PrefConverters(this);
@ -2954,7 +2930,7 @@ GuiPreferences::GuiPreferences(GuiView & lv)
bc().setRestore(restorePB); bc().setRestore(restorePB);
// initialize the strftime validator // initialize the strftime validator
bc().addCheckedLineEdit(dateFormat->DateED); bc().addCheckedLineEdit(output->DateED);
} }

View File

@ -26,8 +26,7 @@
#include "ui_PrefsUi.h" #include "ui_PrefsUi.h"
#include "ui_PrefPlaintextUi.h" #include "ui_PrefOutputUi.h"
#include "ui_PrefDateUi.h"
#include "ui_PrefInputUi.h" #include "ui_PrefInputUi.h"
#include "ui_PrefLatexUi.h" #include "ui_PrefLatexUi.h"
#include "ui_PrefScreenFontsUi.h" #include "ui_PrefScreenFontsUi.h"
@ -157,22 +156,11 @@ Q_SIGNALS:
}; };
class PrefPlaintext : public PrefModule, public Ui::PrefPlaintextUi class PrefOutput : public PrefModule, public Ui::PrefOutputUi
{ {
Q_OBJECT Q_OBJECT
public: public:
PrefPlaintext(GuiPreferences * form); PrefOutput(GuiPreferences * form);
virtual void apply(LyXRC & rc) const;
virtual void update(LyXRC const & rc);
};
class PrefDate : public PrefModule, public Ui::PrefDateUi
{
Q_OBJECT
public:
PrefDate(GuiPreferences * form);
virtual void apply(LyXRC & rc) const; virtual void apply(LyXRC & rc) const;
virtual void update(LyXRC const & rc); virtual void update(LyXRC const & rc);

View File

@ -300,7 +300,7 @@ UIFILES = \
PrefColorsUi.ui \ PrefColorsUi.ui \
PrefCompletionUi.ui \ PrefCompletionUi.ui \
PrefConvertersUi.ui \ PrefConvertersUi.ui \
PrefDateUi.ui \ PrefOutputUi.ui \
PrefDisplayUi.ui \ PrefDisplayUi.ui \
PrefEditUi.ui \ PrefEditUi.ui \
PrefFileformatsUi.ui \ PrefFileformatsUi.ui \
@ -309,7 +309,6 @@ UIFILES = \
PrefLanguageUi.ui \ PrefLanguageUi.ui \
PrefLatexUi.ui \ PrefLatexUi.ui \
PrefPathsUi.ui \ PrefPathsUi.ui \
PrefPlaintextUi.ui \
PrefPrinterUi.ui \ PrefPrinterUi.ui \
PrefScreenFontsUi.ui \ PrefScreenFontsUi.ui \
PrefShortcutsUi.ui \ PrefShortcutsUi.ui \

View File

@ -1,73 +0,0 @@
<ui version="4.0" >
<class>PrefDateUi</class>
<widget class="QWidget" name="PrefDateUi" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>279</width>
<height>91</height>
</rect>
</property>
<property name="windowTitle" >
<string/>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>11</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="DateLA" >
<property name="text" >
<string>&amp;Date format:</string>
</property>
<property name="buddy" >
<cstring>DateED</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="DateED" >
<property name="toolTip" >
<string>Date format for strftime output</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<pixmapfunction></pixmapfunction>
<includes>
<include location="local" >qt_i18n.h</include>
</includes>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,119 @@
<ui version="4.0" >
<class>PrefOutputUi</class>
<widget class="QWidget" name="PrefOutputUi" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>270</width>
<height>128</height>
</rect>
</property>
<property name="windowTitle" >
<string/>
</property>
<layout class="QVBoxLayout" name="verticalLayout" >
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2" >
<item>
<widget class="QLabel" name="plaintextLinelengthLA" >
<property name="text" >
<string>Output &amp;line length:</string>
</property>
<property name="buddy" >
<cstring>plaintextLinelengthSB</cstring>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="plaintextLinelengthSB" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>The maximum line length of exported plain text/LaTeX/SGML files. If set to 0, paragraphs are output in a single line; if the line length is > 0, paragraphs are separated by a blank line.</string>
</property>
<property name="maximum" >
<number>120</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout" >
<item>
<widget class="QLabel" name="DateLA" >
<property name="text" >
<string>&amp;Date format:</string>
</property>
<property name="buddy" >
<cstring>DateED</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="DateED" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<string>Date format for strftime output</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<includes>
<include location="local" >qt_i18n.h</include>
</includes>
<resources/>
<connections/>
</ui>

View File

@ -1,81 +0,0 @@
<ui version="4.0">
<class>PrefPlaintextUi</class>
<widget class="QWidget" name="PrefPlaintextUi">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>340</width>
<height>99</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="1" column="0" colspan="3">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="plaintextLinelengthSB">
<property name="toolTip">
<string>The maximum line length of exported plain text/LaTeX/SGML files. If set to 0, paragraphs are output in a single line; if the line length is &gt; 0, paragraphs are separated by a blank line.</string>
</property>
<property name="maximum">
<number>120</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="plaintextLinelengthLA">
<property name="text">
<string>Output &amp;line length:</string>
</property>
<property name="buddy">
<cstring>plaintextLinelengthSB</cstring>
</property>
</widget>
</item>
</layout>
</widget>
<includes>
<include location="local">qt_i18n.h</include>
</includes>
<resources/>
<connections/>
</ui>