[Kst] branches/work/kst/portto4/kst/src/datasources
Barth Netterfield
netterfield at astro.utoronto.ca
Tue Nov 11 23:57:23 CET 2008
SVN commit 883044 by netterfield:
for qimage and fitsimage source
fix typeString
get rid of magic strings
M +17 -8 fitsimage/fitsimage.cpp
M +2 -0 fitsimage/fitsimage.h
M +17 -8 qimagesource/qimagesource.cpp
M +2 -0 qimagesource/qimagesource.h
--- branches/work/kst/portto4/kst/src/datasources/fitsimage/fitsimage.cpp #883043:883044
@@ -15,6 +15,10 @@
#include <fitsio.h>
#include <math.h>
+#include "kst_i18n.h"
+
+static const QString fitsTypeString = I18N_NOOP("Fits image");
+
class FitsImageSource::Config {
public:
Config() {
@@ -22,7 +26,7 @@
void read(QSettings *cfg, const QString& fileName = QString::null) {
Q_UNUSED(fileName);
- cfg->beginGroup("FITS Image Source");
+ cfg->beginGroup(fitsTypeString);
cfg->endGroup();
}
@@ -41,7 +45,7 @@
_fptr = 0L;
_valid = false;
- if (!type.isEmpty() && type != "FITS Image Source") {
+ if (!type.isEmpty() && type != fitsTypeString) {
return;
}
@@ -68,7 +72,12 @@
}
}
+const QString& FitsImageSource::typeString() const {
+ return fitsTypeString;
+}
+
+
bool FitsImageSource::reset() {
init();
return true;
@@ -294,7 +303,7 @@
QString FitsImageSource::fileType() const {
- return "FITS Image";
+ return fitsTypeString;
}
@@ -349,7 +358,7 @@
}
if (typeSuggestion) {
- *typeSuggestion = "FITS Image";
+ *typeSuggestion = fitsTypeString;
}
if ( understands(cfg, filename) ) {
matrixList.append( "1" );
@@ -375,7 +384,7 @@
}
if (typeSuggestion) {
- *typeSuggestion = "FITS Image";
+ *typeSuggestion = fitsTypeString;
}
scalarList.append("FRAMES");
@@ -400,7 +409,7 @@
}
if (typeSuggestion) {
- *typeSuggestion = "FITS Image";
+ *typeSuggestion = fitsTypeString;
}
stringList.append("FILENAME");
@@ -421,7 +430,7 @@
}
if (typeSuggestion) {
- *typeSuggestion = "FITS Image";
+ *typeSuggestion = fitsTypeString;
}
if (understands(cfg, filename)) {
fieldList.append("INDEX");
@@ -465,7 +474,7 @@
QStringList FitsImagePlugin::provides() const {
QStringList rc;
- rc += "FITS Image Source";
+ rc += fitsTypeString;
return rc;
}
--- branches/work/kst/portto4/kst/src/datasources/fitsimage/fitsimage.h #883043:883044
@@ -44,6 +44,8 @@
void save(QXmlStreamWriter &streamWriter);
+ virtual const QString& typeString() const;
+
class Config;
int readScalar(double &S, const QString& scalar);
--- branches/work/kst/portto4/kst/src/datasources/qimagesource/qimagesource.cpp #883043:883044
@@ -15,6 +15,10 @@
#include <QImageReader>
#include <qcolor.h>
+#include "kst_i18n.h"
+
+static const QString qimageTypeString = I18N_NOOP("QImage image");
+
class QImageSource::Config {
public:
Config() {
@@ -22,7 +26,7 @@
void read(QSettings *cfg, const QString& fileName = QString::null) {
Q_UNUSED(fileName);
- cfg->beginGroup("QImage Source");
+ cfg->beginGroup(qimageTypeString);
cfg->endGroup();
}
@@ -39,7 +43,7 @@
QImageSource::QImageSource(Kst::ObjectStore *store, QSettings *cfg, const QString& filename, const QString& type, const QDomElement& e)
: Kst::DataSource(store, cfg, filename, type, None), _config(0L) {
_valid = false;
- if (!type.isEmpty() && type != "QImage Source") {
+ if (!type.isEmpty() && type != qimageTypeString) {
return;
}
@@ -63,6 +67,11 @@
}
+const QString& QImageSource::typeString() const {
+ return qimageTypeString;
+}
+
+
bool QImageSource::reset() {
init();
return true;
@@ -242,7 +251,7 @@
QString QImageSource::fileType() const {
- return "QImage compatible Image";
+ return qimageTypeString;
}
@@ -292,7 +301,7 @@
if (typeSuggestion) {
- *typeSuggestion = "QImage compatible Image";
+ *typeSuggestion = qimageTypeString;
}
if ((!type.isEmpty() && !provides().contains(type)) ||
0 == understands(cfg, filename)) {
@@ -334,7 +343,7 @@
}
if (typeSuggestion) {
- *typeSuggestion = "QImage compatible Image";
+ *typeSuggestion = qimageTypeString;
}
scalarList.append("FRAMES");
@@ -359,7 +368,7 @@
}
if (typeSuggestion) {
- *typeSuggestion = "QImage compatible Image";
+ *typeSuggestion = qimageTypeString;
}
stringList.append("FILENAME");
@@ -381,7 +390,7 @@
}
if (typeSuggestion) {
- *typeSuggestion = "QImage compatible Image";
+ *typeSuggestion = qimageTypeString;
}
if ( !QImageReader::imageFormat( filename ).isEmpty() ) {
fieldList.append("INDEX");
@@ -420,7 +429,7 @@
QStringList QImageSourcePlugin::provides() const {
QStringList rc;
- rc += "QImage Source";
+ rc += qimageTypeString;
return rc;
}
--- branches/work/kst/portto4/kst/src/datasources/qimagesource/qimagesource.h #883043:883044
@@ -43,6 +43,8 @@
void save(QXmlStreamWriter &streamWriter);
+ virtual const QString& typeString() const;
+
class Config;
int readScalar(double &S, const QString& scalar);
More information about the Kst
mailing list