#include <QDebug>
#include <QDir>
#include <QCoreApplication>
#include <QHash>
#include <QObject>
#include <QDialog>
#include <QAbstractItemModel>
#include <QVBoxLayout>
#include <QListView>
#include <QDialogButtonBox>
#include <QItemSelection>
#include <QPushButton>
Go to the source code of this file.
Classes | |
class | TablePrefs |
Namespace for global constants. More... | |
class | Tables |
Group of TablePrefs. More... | |
class | SimpleViewSelectionDialog |
A simple selection dialog based on a QListView. More... | |
Namespaces | |
namespace | GlobalConst |
Namespace for global constants. | |
namespace | GlobalEnum |
Namespace for global enumerations. | |
Enumerations | |
enum | GlobalEnum::BuilderHeaderDataRole { GlobalEnum::BuilderHeaderDataUnitSymbolRole = 1200 + Qt::UserRole } |
Functions | |
bool | copyFile (char *dest, char *src) |
QString | generateKey (const QDateTime ×tamp, const QString &component) |
int | seekRow (QSqlQuery query, const QSqlRecord &record) |
quint64 | cantor (const int &x, const int &y) |
QVariant | formulaRead (const QVariant &data) |
QVariant | formulaWrite (const QVariant &data) |
Variables | |
const QString | GlobalConst::SMARTLET_SCHEMA = "smartlet" |
const QString | GlobalConst::TEMPLATES_SCHEMA = "templates01" |
const QDir | GlobalConst::TEMP_DIR = "temp" |
const QDir | GlobalConst::EXPORT_DIR = "export" |
const QDir | GlobalConst::LOG_DIR = "log" |
const QString | GlobalConst::CALI_FORMULA_HELP = "A valid formula for example is: '($1)^2*5'. It will take data, raise it to the second power, and multiply it by five.</body>" |
const QString | GlobalConst::DB_TABLE_CHANGE_NOTIFY = "NOTIFICATION_TABLE_CHANGE_%1" |
const QString | GlobalConst::DB_BASE_DATA_QUERY = ") AS \"%2\" \n" |
const QString | GlobalConst::URL_DOCS = "http://pleco10.ugent.be:10000/projects/docs/smartlet/html/current/" |
quint64 cantor | ( | const int & | x, | |
const int & | y | |||
) |
{
return ((x+y)*(x+y)+x-y)/2;
}
bool copyFile | ( | char * | dest, | |
char * | src | |||
) |
{ FILE *dp,*sp; int c; sp = fopen(src,"rb"); if (!sp) { qWarning() << "Can't open " << src; return FALSE; } dp = fopen(dest,"wb"); if (!dp) { qWarning() << "Can't open " << dest; return FALSE; } while (1) { c = getc(sp); if (feof(sp)) break; fputc(c,dp); } fclose(sp); fclose(dp); return TRUE; }
Referenced by CalibrationsModel::data().
{ return data.toString().replace("$1", "RAW"); }
{ int p = 0; // Our key is the left part of the ISODate, cut off on the component. // So for month, we take the first 7 characters of YYYY-MM-DDTHH:MM:SS (i.e. // ISO date format) if (component == QString()) return QString(); else if (component == "Week") { int year; int week = timestamp.date().weekNumber(&year); return QString::number(year).append("-w").append(QString::number(week)); } else if (component == "Year") p = 4; else if (component == "Month") p = 7; else if (component == "Day") p = 10; else if (component == "Hour") p = 13; else if (component == "Minute") p = 16; else if (component == "Second") p = 19; Q_ASSERT(p); return timestamp.toString(Qt::ISODate).left(p); }
int seekRow | ( | QSqlQuery | query, | |
const QSqlRecord & | record | |||
) |
Referenced by MappedBaseEditor::onQueryChange(), MappedBaseEditor::onSubmitButtonPress(), and MappedBaseEditor::setCurrent().
{ // note that query is passed by value: this might be a performance bottleneck for large queries. if (!query.isActive() || record.isEmpty()) return -1; // check whether query is empty Q_ASSERT(query.isSelect()); query.first(); if (!query.isValid()) return -1; // check equal fields exist and their data types are the same, and in mean time, // set up the FieldMap. struct FieldMap { FieldMap() : query(0), record(0) {} int query; int record; } map[record.count()]; for(int i = 0; i < record.count(); i++){ map[i].record = i; map[i].query = query.record().indexOf(record.fieldName(i)); if (map[i].query == -1 || query.record().field(map[i].query).type() != record.field(map[i].record).type()) return -1; } // seek row int i = 0; //field number int count = record.count(); int max = record.count() - 1; do { for (i = 0; i < count; i++) { //qDebug() << /*j*/ << "of" << query.size() << i << query.value(map[i].query) << record.value(map[i].record); if (query.value(map[i].query) != record.value(map[i].record)) break; if (i == max) return query.at(); } } while (query.next()); return -1; }