connect(updatePB, SIGNAL(clicked()),
this, SLOT(updateView()));
connect(outputFormatCO, SIGNAL(activated(int)),
- this, SLOT(updateView()));
+ this, SLOT(setViewFormat()));
// setting a document at this point trigger an assertion in Qt
// so we disable the signals here:
}
+void ViewSourceWidget::setViewFormat()
+{
+ view_format_ = outputFormatCO->itemData(
+ outputFormatCO->currentIndex()).toString();
+ updateView();
+}
+
void ViewSourceWidget::updateView()
{
if (!bv_) {
setEnabled(true);
- string const format = fromqstr(outputFormatCO->itemData(
- outputFormatCO->currentIndex()).toString());
+ string const format = fromqstr(view_format_);
QString content;
Buffer::OutputWhat output = Buffer::CurrentParagraph;
outputFormatCO->clear();
outputFormatCO->addItem(qt_("Default"),
QVariant(QString("default")));
+
+ int index = 0;
typedef vector<Format const *> Formats;
Formats formats = bv_->buffer().params().exportableFormats(true);
Formats::const_iterator cit = formats.begin();
Formats::const_iterator end = formats.end();
- for (; cit != end; ++cit)
+ for (; cit != end; ++cit) {
+ QString const fname = toqstr((*cit)->name());
outputFormatCO->addItem(qt_((*cit)->prettyname()),
- QVariant(toqstr((*cit)->name())));
+ QVariant(fname));
+ if (fname == view_format_)
+ index = outputFormatCO->count() -1;
+ }
+ outputFormatCO->setCurrentIndex(index);
outputFormatCO->blockSignals(false);
}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ViewSourceUi</class>
+ <widget class="QWidget" name="ViewSourceUi">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>528</width>
+ <height>205</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string/>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0" rowspan="5">
+ <widget class="QTextEdit" name="viewSourceTV">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="Ignored">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="whatsThis">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLabel" name="outputFormatLA">
+ <property name="text">
+ <string>F&ormat:</string>
+ </property>
+ <property name="buddy">
+ <cstring>outputFormatCO</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QComboBox" name="outputFormatCO">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="toolTip">
+ <string>Select the output format</string>
+ </property>
+ <property name="sizeAdjustPolicy">
+ <enum>QComboBox::AdjustToContents</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" colspan="2">
+ <widget class="QComboBox" name="contentsCO">
+ <item>
+ <property name="text">
+ <string>Current Paragraph</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Complete Source</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Preamble Only</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Body Only</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="2" column="1" colspan="2">
+ <widget class="QCheckBox" name="autoUpdateCB">
+ <property name="text">
+ <string>Automatic update</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1" colspan="2">
+ <widget class="QPushButton" name="updatePB">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>&Update</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1" colspan="2">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>85</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <tabstops>
+ <tabstop>viewSourceTV</tabstop>
+ <tabstop>autoUpdateCB</tabstop>
+ <tabstop>updatePB</tabstop>
+ </tabstops>
+ <includes>
+ <include location="local">qt_i18n.h</include>
+ </includes>
+ <resources/>
+ <connections/>
+</ui>