[Kst] branches/work/kst/portto4/kst
Barth Netterfield
netterfield at astro.utoronto.ca
Thu Jun 7 16:06:41 UTC 2012
SVN commit 1298835 by netterfield:
BUG: 298777
If, when loading a kst file, a datasource can't be found, prompt the
user for an alternate.
This required moving datasourcepluginfactory to libkstapp. So a
complete recompile will be required, as the libraries will change.
Also,
Add a option to interpret a vector as EXCEL time.
M +2 -0 cmake/src/libkst/CMakeLists.txt
D src/libkst/builtindatasources.cpp
D src/libkst/builtindatasources.h
M +8 -0 src/libkst/datasource.cpp
M +12 -3 src/libkst/datasource.h
D src/libkst/datasourcepluginfactory.cpp
D src/libkst/datasourcepluginfactory.h
M +1 -1 src/libkst/datasourcepluginmanager.cpp
M +1 -0 src/libkst/libkst.pro
M +1 -0 src/libkstapp/aboutdialog.cpp
A src/libkstapp/baddatasourcedialog.cpp [License: GPL (v2+)]
A src/libkstapp/baddatasourcedialog.h [License: GPL (v2+)]
AM src/libkstapp/baddatasourcedialog.ui
A src/libkstapp/builtindatasources.cpp src/libkst/builtindatasources.cpp#1296680 [License: GPL (v2+)]
A src/libkstapp/builtindatasources.h src/libkst/builtindatasources.h#1296680 [License: GPL (v2+)]
A src/libkstapp/datasourcepluginfactory.cpp src/libkst/datasourcepluginfactory.cpp#1296680 [License: GPL (v2+)]
A src/libkstapp/datasourcepluginfactory.h src/libkst/datasourcepluginfactory.h#1296680 [License: GPL (v2+)]
M +1 -1 src/libkstapp/mainwindow.cpp
M +4 -0 src/libkstapp/plotaxis.cpp
M +4 -2 src/libkstmath/plotdefines.h
--- branches/work/kst/portto4/kst/cmake/src/libkst/CMakeLists.txt #1298834:1298835
@@ -1,5 +1,7 @@
kst_init(${kst_binary_name} core)
+kst_include_directories(widgets)
+
kst_files_ignore(stdinsource timezones)
if(WIN32 OR APPLE OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
--- branches/work/kst/portto4/kst/src/libkst/datasource.cpp #1298834:1298835
@@ -135,6 +135,7 @@
DataSource::DataSource(ObjectStore *store, QSettings *cfg, const QString& filename, const QString& type) :
Object(),
_filename(filename),
+ _alternateFilename(QString()),
_cfg(cfg),
interf_scalar(new NotSupportedImp<DataScalar>),
interf_string(new NotSupportedImp<DataString>),
@@ -267,7 +268,14 @@
return _filename;
}
+QString DataSource::alternateFilename() const {
+ return _alternateFilename;
+}
+void DataSource::setAlternateFilename(const QString &file) {
+ _alternateFilename = file;
+}
+
QString DataSource::fileType() const {
return QString();
}
--- branches/work/kst/portto4/kst/src/libkst/datasource.h #1298834:1298835
@@ -40,7 +40,7 @@
namespace Kst {
class DataSourceConfigWidget;
-class DataSourcePlugin;
+//class DataSourcePlugin;
class KSTCORE_EXPORT DataSource : public Object
@@ -163,6 +163,8 @@
virtual bool isValid() const; // generally you don't need to change this
virtual QString fileName() const;
+ QString alternateFilename() const;
+ void setAlternateFilename(const QString &file);
QMap<QString, QString> fileMetas() const;
@@ -221,8 +223,11 @@
/** The filename. Populated by the base class constructor. */
QString _filename;
- friend class DataSourcePlugin;
+ /** an alias for the file: for example if the file were replaced at load time */
+ QString _alternateFilename;
+ //friend class DataSourcePlugin;
+
/** The source type name. */
QString _source;
@@ -284,10 +289,14 @@
// @since 1.1.0
DataSourcePtr findReusableFileName(const QString& x) {
for (DataSourceList::Iterator it = begin(); it != end(); ++it) {
- if ((*it)->reusable() && (*it)->fileName() == x) {
+ if ((*it)->reusable()) {
+ if ((*it)->fileName() == x) {
return *it;
+ } else if ((*it)->alternateFilename() == x) {
+ return *it;
}
}
+ }
return 0;
}
--- branches/work/kst/portto4/kst/src/libkst/datasourcepluginmanager.cpp #1298834:1298835
@@ -324,7 +324,7 @@
}
if (!QFileInfo(fn).exists()) {
- Debug::self()->log(QObject::tr("File '%1' does not exists.").arg(fn), Debug::Warning);
+ Debug::self()->log(QObject::tr("File '%1' does not exist.").arg(fn), Debug::Warning);
return 0;
}
--- branches/work/kst/portto4/kst/src/libkst/libkst.pro #1298834:1298835
@@ -15,6 +15,7 @@
}
INCLUDEPATH += tmp \
+ $$TOPLEVELDIR/src/widgets \
$$OUTPUT_DIR/src/libkst/tmp
SOURCES += builtindatasources.cpp \
--- branches/work/kst/portto4/kst/src/libkstapp/aboutdialog.cpp #1298834:1298835
@@ -42,6 +42,7 @@
// qmake support
QStringList authors = QStringList()
<< "Barth Netterfield"
+ << "Joshua Netterfield"
<< "Matthew Truch"
<< "Nicolas Brisset"
<< "Staikos Computing Services Inc."
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.cpp #1298834:1298835
@@ -437,7 +437,7 @@
if (!ok) {
QMessageBox::critical(this, tr("Kst"),
tr("Error opening document '%1':\n%2\n"
- "Maybe it is a Kst 1 file which could not be read by Kst 2.").arg(file, _doc->lastError()));
+ ).arg(file, _doc->lastError()));
}
setWindowTitle("Kst - " + file);
--- branches/work/kst/portto4/kst/src/libkstapp/plotaxis.cpp #1298834:1298835
@@ -21,6 +21,7 @@
static int FULL_PRECISION = 15;
static qreal JD1900 = 2415020.5;
+static qreal JD1899_12_30 = 2415018.5;
static qreal JD1970 = 2440587.5;
static qreal JD_RJD = 2400000.0;
static qreal JD_MJD = 2400000.5;
@@ -119,6 +120,9 @@
case AXIS_INTERP_RJD:
value += JD_RJD;
break;
+ case AXIS_INTERP_EXCEL:
+ value += JD1899_12_30;
+ break;
case AXIS_INTERP_AIT:
value -= 86400.0 * (365.0 * 12.0 + 3.0);
// current difference (seconds) between UTC and AIT
--- branches/work/kst/portto4/kst/src/libkstmath/plotdefines.h #1298834:1298835
@@ -25,7 +25,8 @@
AXIS_INTERP_JD,
AXIS_INTERP_MJD,
AXIS_INTERP_RJD,
- AXIS_INTERP_AIT };
+ AXIS_INTERP_AIT,
+ AXIS_INTERP_EXCEL};
enum AxisDisplayType {
AXIS_DISPLAY_YEAR,
@@ -53,7 +54,8 @@
{ I18N_NOOP2("Julian Date", "JD"), AXIS_INTERP_JD },
{ I18N_NOOP2("Modified Julian Date", "MJD"), AXIS_INTERP_MJD },
{ I18N_NOOP2("Reduced Julian Date", "RJD"), AXIS_INTERP_RJD },
- { I18N_NOOP2("Temps Atomique International", "TAI"), AXIS_INTERP_AIT }
+ { I18N_NOOP2("Temps Atomique International", "TAI"), AXIS_INTERP_AIT },
+ { I18N_NOOP("Excel time (Windows)"), AXIS_INTERP_EXCEL }
};
const AxisDisplay AxisDisplays[] = {
More information about the Kst
mailing list