[Kst] branches/work/kst/portto4/kst/src/libkstapp
Barth Netterfield
netterfield at astro.utoronto.ca
Fri Apr 8 01:57:48 CEST 2011
SVN commit 1227348 by netterfield:
Add options to graphics export dialog to view just vector or just bitmap formats.
Currently, svg is the only vector format.
M +34 -8 exportgraphicsdialog.cpp
M +1 -0 exportgraphicsdialog.h
M +118 -94 exportgraphicsdialog.ui
--- branches/work/kst/portto4/kst/src/libkstapp/exportgraphicsdialog.cpp #1227347:1227348
@@ -33,15 +33,10 @@
_autoSaveTimer = new QTimer(this);
- QStringList formats;// = QPictureIO::outputFormats();
- formats.append(QString("svg"));
- foreach(QByteArray array, QImageWriter::supportedImageFormats()) {
- formats.append(QString(array));
- }
+ _listVectorFormats->setChecked(_dialogDefaults->value("export/useVectors",true).toBool());
+ _listBitmapFormats->setChecked(_dialogDefaults->value("export/useBitmaps",true).toBool());
- _comboBoxFormats->addItems(formats);
- _comboBoxFormats->setCurrentIndex(
- _comboBoxFormats->findText(_dialogDefaults->value("export/format","png").toString()));
+ updateFormats();
_xSize->setValue(_dialogDefaults->value("export/xsize","1024").toInt());
_ySize->setValue(_dialogDefaults->value("export/ysize","768").toInt());
@@ -57,13 +52,42 @@
connect(_buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject()));
connect(_buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(OKClicked()));
connect(_buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(apply()));
+ connect(_listVectorFormats, SIGNAL(clicked()), this, SLOT(updateFormats()));
+ connect(_listBitmapFormats, SIGNAL(clicked()), this, SLOT(updateFormats()));
}
ExportGraphicsDialog::~ExportGraphicsDialog() {
}
+void ExportGraphicsDialog::updateFormats() {
+ QStringList formats;// = QPictureIO::outputFormats();
+ if (_listVectorFormats->isChecked()) {
+ formats.append(QString("svg"));
+ }
+
+ if (_listBitmapFormats->isChecked()) {
+ foreach(QByteArray array, QImageWriter::supportedImageFormats()) {
+ formats.append(QString(array));
+ }
+ }
+
+ _comboBoxFormats->clear();
+ _comboBoxFormats->addItems(formats);
+
+ int index = _comboBoxFormats->findText(_dialogDefaults->value("export/format","png").toString());
+ if (index<0) {
+ if (_listBitmapFormats->isChecked()) {
+ index = _comboBoxFormats->findText("png");
+ } else {
+ index = _comboBoxFormats->findText("svg");
+ }
+ }
+ _comboBoxFormats->setCurrentIndex(index);
+
+}
+
void ExportGraphicsDialog::enableWidthHeight() {
int displayOption = _comboBoxSizeOption->currentIndex();
@@ -127,6 +151,8 @@
_dialogDefaults->setValue("export/xsize", _xSize->value());
_dialogDefaults->setValue("export/ysize", _ySize->value());
_dialogDefaults->setValue("export/sizeOption", _comboBoxSizeOption->currentIndex());
+ _dialogDefaults->setValue("export/useVectors", _listVectorFormats->isChecked());
+ _dialogDefaults->setValue("export/useBitmaps", _listBitmapFormats->isChecked());
emit exportGraphics(filename, format, _xSize->value(), _ySize->value(), _comboBoxSizeOption->currentIndex());
}
--- branches/work/kst/portto4/kst/src/libkstapp/exportgraphicsdialog.h #1227347:1227348
@@ -37,6 +37,7 @@
void apply();
void applyAutosave();
void updateButtons();
+ void updateFormats();
Q_SIGNALS:
void exportGraphics(const QString &filename, const QString &format, int w, int h, int display);
--- branches/work/kst/portto4/kst/src/libkstapp/exportgraphicsdialog.ui #1227347:1227348
@@ -36,6 +36,9 @@
</property>
</widget>
</item>
+ <item row="0" column="1" colspan="4">
+ <widget class="Kst::FileRequester" name="_saveLocation" native="true"/>
+ </item>
<item row="1" column="0">
<widget class="QLabel" name="textLabel1">
<property name="text">
@@ -52,9 +55,6 @@
</property>
</widget>
</item>
- <item row="0" column="1" colspan="4">
- <widget class="Kst::FileRequester" name="_saveLocation" native="true"/>
- </item>
<item row="1" column="1" colspan="4">
<widget class="Kst::ComboBox" name="_comboBoxFormats">
<property name="sizePolicy">
@@ -65,96 +65,7 @@
</property>
</widget>
</item>
- <item row="5" column="0" colspan="5">
- <widget class="QGroupBox" name="buttonGroup2">
- <property name="title">
- <string>Save Options</string>
- </property>
- <layout class="QHBoxLayout">
- <property name="spacing">
- <number>6</number>
- </property>
- <property name="margin">
- <number>0</number>
- </property>
- <item>
- <widget class="QRadioButton" name="_saveOnce">
- <property name="whatsThis">
- <string>Do not autosave. Instead, on OK or Apply, save once.</string>
- </property>
- <property name="text">
- <string>Sa&ve once</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="_autosave">
- <property name="toolTip">
- <string>Save image on timer</string>
- </property>
- <property name="whatsThis">
- <string>When checked, the image will be repeatedly saved using the indicated period. This is useful, for example, for live web page images.</string>
- </property>
- <property name="text">
- <string>&Autosave every</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="_period">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="toolTip">
- <string>Autosave timer</string>
- </property>
- <property name="suffix">
- <string>s</string>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>100000</number>
- </property>
- <property name="value">
- <number>15</number>
- </property>
- </widget>
- </item>
- <item>
- <spacer>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Expanding</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>21</width>
- <height>21</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </item>
- <item row="7" column="0" colspan="5">
- <widget class="QDialogButtonBox" name="_buttonBox">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- <item row="3" column="0" colspan="5">
+ <item row="4" column="0" colspan="5">
<widget class="QGroupBox" name="groupBox1">
<property name="title">
<string>Size</string>
@@ -337,7 +248,96 @@
</layout>
</widget>
</item>
- <item row="2" column="0" colspan="2">
+ <item row="6" column="0" colspan="5">
+ <widget class="QGroupBox" name="buttonGroup2">
+ <property name="title">
+ <string>Save Options</string>
+ </property>
+ <layout class="QHBoxLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QRadioButton" name="_saveOnce">
+ <property name="whatsThis">
+ <string>Do not autosave. Instead, on OK or Apply, save once.</string>
+ </property>
+ <property name="text">
+ <string>Sa&ve once</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="_autosave">
+ <property name="toolTip">
+ <string>Save image on timer</string>
+ </property>
+ <property name="whatsThis">
+ <string>When checked, the image will be repeatedly saved using the indicated period. This is useful, for example, for live web page images.</string>
+ </property>
+ <property name="text">
+ <string>&Autosave every</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="_period">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip">
+ <string>Autosave timer</string>
+ </property>
+ <property name="suffix">
+ <string>s</string>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>100000</number>
+ </property>
+ <property name="value">
+ <number>15</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>21</width>
+ <height>21</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="8" column="0" colspan="5">
+ <widget class="QDialogButtonBox" name="_buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="_autoExtension">
<property name="text">
<string>Automatic &extension</string>
@@ -347,6 +347,30 @@
</property>
</widget>
</item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Include:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QCheckBox" name="_listVectorFormats">
+ <property name="text">
+ <string>Vector formats</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QCheckBox" name="_listBitmapFormats">
+ <property name="text">
+ <string>Bitmap fomats</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
More information about the Kst
mailing list