本文整理汇总了C++中KstDataSourcePtr::fieldList方法的典型用法代码示例。如果您正苦于以下问题:C++ KstDataSourcePtr::fieldList方法的具体用法?C++ KstDataSourcePtr::fieldList怎么用?C++ KstDataSourcePtr::fieldList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KstDataSourcePtr
的用法示例。
在下文中一共展示了KstDataSourcePtr::fieldList方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
KstObject::UpdateType IndirectSource::update(int u) {
if (KstObject::checkUpdateCounter(u)) {
return lastUpdateResult();
}
// recheck the indirect file for a changed filename
QFile f(_filename);
if (f.open(QIODevice::ReadOnly)) {
char* data;
if (0 < f.readLine(data,1000)) {
QString ifn(data);
KUrl url(ifn);
if (url.isLocalFile() || url.protocol().isEmpty()) {
if (QFileInfo(ifn).isRelative()) {
ifn = QFileInfo(_filename).absolutePath() + QDir::separator() + ifn;
}
}
if (!_child || ifn.trimmed() != _child->fileName()) {
_child = 0L; // release
KstDataSourcePtr p = KstDataSource::loadSource(ifn.trimmed());
if (p) {
_child = p;
_fieldList = p->fieldList();
_valid = true;
} else {
_valid = false;
}
}
}
}
return setLastUpdateResult(_child ? _child->update(u) : KstObject::NO_CHANGE);
}
示例2: sourceChanged
void KstChangeFileDialog::sourceChanged(const QString& text)
{
delete _configWidget;
_configWidget = 0L;
_configureSource->setEnabled(false);
_file = QString::null;
if (!text.isEmpty() && text != "stdin" && text != "-") {
KUrl url;
QString txt = _dataFile->completionObject()->replacedPath(text);
if (QFile::exists(txt) && QFileInfo(txt).isRelative()) {
url.setPath(txt);
} else {
url = KUrl::fromPathOrURL(txt);
}
if (!url.isLocalFile() && url.protocol() != "file" && !url.protocol().isEmpty()) {
_fileType->setText(QString::null);
return;
}
if (!url.isValid()) {
_fileType->setText(QString::null);
return;
}
QString file = txt;
KstDataSourcePtr ds = *KST::dataSourceList.findReusableFileName(file);
QStringList fl;
QString fileType;
if (ds) {
ds->readLock();
fl = ds->fieldList();
fileType = ds->fileType();
ds->unlock();
ds = 0L;
} else {
bool complete = false;
fl = KstDataSource::fieldListForSource(file, QString::null, &fileType, &complete);
}
if (!fl.isEmpty() && !fileType.isEmpty()) {
if (ds) {
ds->writeLock();
_configWidget = ds->configWidget();
ds->unlock();
} else {
_configWidget = KstDataSource::configWidgetForSource(file, fileType);
}
}
_configureSource->setEnabled(_configWidget);
_file = file;
_fileType->setText(fileType.isEmpty() ? QString::null : tr("Data source of type: %1").arg(fileType));
} else {
_fileType->setText(QString::null);
}
}
示例3: KstDataSource
IndirectSource::IndirectSource(QSettings *cfg, const QString& filename, KstDataSourcePtr child)
: KstDataSource(cfg, filename, QString::null), _child(child) {
if (child) {
_valid = true;
_fieldList = child->fieldList();
} else {
_valid = false;
}
}
示例4: fieldList
KJS::Value KstBindDataSource::fieldList(KJS::ExecState *exec, const KJS::List& args) {
Q_UNUSED(args)
KJS::List rc;
KstDataSourcePtr s = makeSource(_d);
if (!s) {
KJS::Object eobj = KJS::Error::create(exec, KJS::GeneralError);
exec->setException(eobj);
return KJS::Object(exec->interpreter()->builtinArray().construct(exec, rc));
}
s->readLock();
QStringList l = s->fieldList();
s->unlock();
for (QStringList::ConstIterator i = l.begin(); i != l.end(); ++i) {
rc.append(KJS::String(*i));
}
return KJS::Object(exec->interpreter()->builtinArray().construct(exec, rc));
}
示例5: updateCompletion
void KstVectorDialogI::updateCompletion() {
QString current_text = Field->currentText();
Field->clear();
/* update filename list and ll axes combo boxes */
KST::dataSourceList.lock().readLock();
KstDataSourcePtr ds = *KST::dataSourceList.findFileName(FileName->url());
KST::dataSourceList.lock().readUnlock();
delete _configWidget; // FIXME: very inefficient!!!!
_configWidget = 0L;
QStringList list;
if (ds) {
ds->readLock();
list = ds->fieldList();
Field->setEditable(!ds->fieldListIsComplete());
_configWidget = ds->configWidget();
ds->readUnlock();
} else {
QString type;
bool complete = false;
list = KstDataSource::fieldListForSource(FileName->url(), QString::null, &type, &complete);
Field->setEditable(!complete);
if (!list.isEmpty() && !type.isEmpty()) {
_configWidget = KstDataSource::configWidgetForSource(FileName->url(), type);
}
}
_configure->setEnabled(_configWidget);
_fieldCompletion = Field->completionObject();
Field->insertStringList(list);
if (_fieldCompletion) {
_fieldCompletion->clear();
_fieldCompletion->insertItems(list);
}
if (!current_text.isEmpty() && (list.contains(current_text) || Field->editable())) {
Field->setCurrentText(current_text);
}
_kstDataRange->setAllowTime(ds && ds->supportsTimeConversions());
}
示例6: fillFieldsForRVEdit
void KstVectorDialogI::fillFieldsForRVEdit() {
KstRVectorPtr rvp = kst_cast<KstRVector>(_dp);
rvp->readLock();
_w->_readFromSource->setChecked(true);
_w->_rvectorGroup->show();
_w->_kstDataRange->show();
_w->_kstDataRange->setEnabled(true);
_w->_svectorGroup->hide();
_w->_svectorGroup->setEnabled(false);
_w->sourceGroup->hide();
_tagName->setText(rvp->tagName());
_w->Field->clear();
if (_fieldCompletion) {
_fieldCompletion->clear();
}
{
KstDataSourcePtr tf;
KST::dataSourceList.lock().readLock();
KstDataSourceList::Iterator it = KST::dataSourceList.findReusableFileName(rvp->filename());
if (it != KST::dataSourceList.end()) {
tf = *it;
tf->readLock();
_w->Field->insertStringList(tf->fieldList());
if (_fieldCompletion) {
_fieldCompletion->insertItems(tf->fieldList());
}
tf->unlock();
} else {
QStringList list = KstDataSource::fieldListForSource(_w->FileName->url());
_w->Field->insertStringList(list);
if (_fieldCompletion) {
_fieldCompletion->insertItems(list);
}
}
KST::dataSourceList.lock().unlock();
}
_w->Field->setEnabled(_w->Field->count() > 0);
_ok->setEnabled(_w->Field->isEnabled());
_w->Field->setCurrentText(rvp->field());
// select the proper file
_w->FileName->setURL(rvp->filename());
// fill the vector range entries
_w->_kstDataRange->CountFromEnd->setChecked(rvp->countFromEOF());
_w->_kstDataRange->setF0Value(rvp->reqStartFrame());
// fill number of frames entries
_w->_kstDataRange->ReadToEnd->setChecked(rvp->readToEOF());
_w->_kstDataRange->setNValue(rvp->reqNumFrames());
// fill in frames to skip box
_w->_kstDataRange->Skip->setValue(rvp->skip());
_w->_kstDataRange->DoSkip->setChecked(rvp->doSkip());
_w->_kstDataRange->DoFilter->setChecked(rvp->doAve());
_w->_kstDataRange->updateEnables();
rvp->unlock();
}
示例7: updateCompletion
void KstVectorDialogI::updateCompletion() {
QString current_text = _w->Field->currentText();
_w->Field->clear();
// update filename list and ll axes combo boxes
KST::dataSourceList.lock().readLock();
KstDataSourcePtr ds = *KST::dataSourceList.findReusableFileName(_w->FileName->url());
KST::dataSourceList.lock().unlock();
delete _configWidget;
_configWidget = 0L;
QStringList list;
if (ds) {
ds->readLock();
list = ds->fieldList();
_w->Field->setEditable(!ds->fieldListIsComplete());
_configWidget = ds->configWidget();
ds->unlock();
_w->Field->setEnabled(true);
_w->_connect->hide();
_w->_kstDataRange->setAllowTime(ds->supportsTimeConversions());
} else {
QString type;
bool complete = false;
QString u = _w->FileName->url();
KURL url;
if (QFile::exists(u) && QFileInfo(u).isRelative()) {
url.setPath(u);
} else {
url = KURL::fromPathOrURL(u);
}
if (!_inTest && !url.isLocalFile() && url.protocol() != "file" && !url.protocol().isEmpty()) {
_w->_connect->show();
} else if (url.isValid()) {
list = KstDataSource::fieldListForSource(u, QString::null, &type, &complete);
if (!_inTest || (_inTest && !list.isEmpty())) {
_w->_connect->hide();
}
}
_w->Field->setEditable(!complete);
_w->Field->setEnabled(!list.isEmpty());
if (!list.isEmpty() && !type.isEmpty()) {
_configWidget = KstDataSource::configWidgetForSource(u, type);
}
_w->_kstDataRange->setAllowTime(KstDataSource::supportsTime(u, type));
}
_w->_configure->setEnabled(_configWidget);
_fieldCompletion = _w->Field->completionObject();
_w->Field->insertStringList(list);
if (_fieldCompletion) {
_fieldCompletion->clear();
_fieldCompletion->insertItems(list);
}
if (!current_text.isEmpty() && (list.contains(current_text) || _w->Field->editable())) {
_w->Field->setCurrentText(current_text);
}
_ok->setEnabled(_w->Field->isEnabled() || _editMultipleMode);
}
示例8: _fillFieldsForEdit
void KstVectorDialogI::_fillFieldsForEdit() {
if (DP == 0L) {
return; // shouldn't be needed
}
DP->readLock();
_tagName->setText(DP->tagName());
/* fill the fields */
Field->clear();
if (_fieldCompletion) {
_fieldCompletion->clear();
}
{
KstDataSourcePtr tf;
KST::dataSourceList.lock().readLock();
KstDataSourceList::Iterator it = KST::dataSourceList.findFileName(DP->filename());
if (it != KST::dataSourceList.end()) {
tf = *it;
tf->readLock();
Field->insertStringList(tf->fieldList());
if (_fieldCompletion) {
_fieldCompletion->insertItems(tf->fieldList());
}
tf->readUnlock();
} else {
QStringList list = KstDataSource::fieldListForSource(FileName->url());
Field->insertStringList(list);
if (_fieldCompletion) {
_fieldCompletion->insertItems(list);
}
}
KST::dataSourceList.lock().readUnlock();
}
Field->setCurrentText(DP->field());
/* select the proper file */
FileName->setURL(DP->filename());
/* fill the vector range entries */
if (DP->countFromEOF()) {
_kstDataRange->CountFromEnd->setChecked(true);
} else {
_kstDataRange->CountFromEnd->setChecked(false);
}
_kstDataRange->setF0Value(DP->reqStartFrame());
/* fill number of frames entries */
if (DP->readToEOF()) {
_kstDataRange->ReadToEnd->setChecked(true);
} else {
_kstDataRange->ReadToEnd->setChecked(false);
}
_kstDataRange->setNValue(DP->reqNumFrames());
/* fill in frames to skip box */
_kstDataRange->Skip->setValue(DP->skip());
_kstDataRange->DoSkip->setChecked(DP->doSkip());
_kstDataRange->DoFilter->setChecked(DP->doAve());
_kstDataRange->updateEnables();
DP->readUnlock();
}