KstVectorDialogI::KstVectorDialogI(QWidget* parent, Qt::WindowFlags fl) : KstDataDialog(parent, fl) { _w = new Ui::KstVectorDialog; _w->setupUi(_contents); setMultiple(true); _inTest = false; _w->FileName->completionObject()->setDir(QDir::currentPath()); _w->FileName->setMode(KFile::File | KFile::Directory | KFile::ExistingOnly); connect(_w->FileName, SIGNAL(textChanged(const QString&)), this, SLOT(updateCompletion())); connect(_w->_configure, SIGNAL(clicked()), this, SLOT(configureSource())); connect(_w->_readFromSource, SIGNAL(clicked()), this, SLOT(enableSource())); connect(_w->_generateX, SIGNAL(clicked()), this, SLOT(enableGenerate())); connect(_w->_connect, SIGNAL(clicked()), this, SLOT(testUrl())); // connections for multiple edit mode connect(_w->_kstDataRange->CountFromEnd, SIGNAL(clicked()), this, SLOT(setCountFromEndDirty())); connect(_w->_kstDataRange->ReadToEnd, SIGNAL(clicked()), this, SLOT(setReadToEndDirty())); connect(_w->_kstDataRange->DoFilter, SIGNAL(clicked()), this, SLOT(setDoFilterDirty())); connect(_w->_kstDataRange->DoSkip, SIGNAL(clicked()), this, SLOT(setDoSkipDirty())); _w->_configure->setEnabled(false); _fieldCompletion = _w->Field->completionObject(); _w->Field->setAutoDeleteCompletionObject(true); setFixedHeight(height()); _configWidget = 0L; _w->Field->setEnabled(false); _ok->setEnabled(_w->Field->isEnabled()); _legendLabel->hide(); _legendText->hide(); }
int main() { setLog(); testThreadPool(); testSHA1(); testUtf8(); testFile(); testUrl(); return 0; }
DataServer::DataServer(QObject *parent) : QObject(parent) { Dataquay::BasicStore store; store.setBaseUri(Dataquay::Uri("http://www.w3.org/ns/hydra/core#")); // Simple test. FIXME: remove QUrl testUrl("https://raw.githubusercontent.com/semiotproject/semiot-platform/master/api-gateway/src/main/resources/ru/semiot/platform/apigateway/ApiDocumentation.ttl"); FileDownloader fd(testUrl); QString path = fd.download(); store.import(path,Dataquay::BasicStore::ImportPermitDuplicates); Dataquay::Triple triple(Dataquay::Node(Dataquay::Uri(QUrl("http://semiot.ru/doc#EntryPoint-Sensors"))),Dataquay::Node(Dataquay::Uri(QUrl("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"))),Dataquay::Node(Dataquay::Uri(QUrl("http://www.w3.org/ns/hydra/core#Link")))); store.save(QString("superstore.ttl")); qDebug()<<store.contains(triple); }
void DataTest::_RunTest(BString url, const char* expected, size_t expectedLength) { NextSubTest(); BUrl testUrl(url); BDataRequest t(testUrl); fReceivedData.clear(); t.SetListener(this); t.Run(); while(t.IsRunning()) snooze(1000); CPPUNIT_ASSERT_EQUAL(expectedLength, fReceivedData.size()); CPPUNIT_ASSERT(memcmp(&fReceivedData.front(), expected, expectedLength) == 0); }
bool CRecieveTask_zakazrf_ru::run() { qDebug(); // m_signaller->onRecieveFinished(this); // return true; connect(m_signaller, SIGNAL(dataParsed(QUrl)), this, SLOT(removeData(QUrl))); #ifndef RUN_ALL_TASKS QUrl testUrl("http://zakazrf.ru/ViewReduction.aspx?id=4781"); CDataStructure* tmpdata = new CDataStructure(testUrl); tmpdata->setType(getUrlDataType(testUrl)); tmpdata->setRoot(); m_dataStructures.insert(testUrl, tmpdata); m_activeDataStructures.push_back(tmpdata); QUrl testUrl2("http://zakazrf.ru/ViewReduction.aspx?id=2943"); CDataStructure* tmpdata2 = new CDataStructure(testUrl2); tmpdata2->setType(getUrlDataType(testUrl2)); tmpdata2->setRoot(); m_dataStructures.insert(testUrl2, tmpdata2); m_activeDataStructures.push_back(tmpdata2); QUrl testUrl3("http://zakazrf.ru/ViewReduction.aspx?id=5319"); CDataStructure* tmpdata3 = new CDataStructure(testUrl3); tmpdata3->setType(getUrlDataType(testUrl3)); tmpdata3->setRoot(); m_dataStructures.insert(testUrl3, tmpdata3); m_activeDataStructures.push_back(tmpdata3); #else CDownloadManager_zakazrf_ru downloadManager; downloadManager.init(); QUrlList urls=downloadManager.getUrls(); if(urls.isEmpty()) { int min = getConfigurationValue("zakazrf/min_id",1).toUInt(); int max = getConfigurationValue("zakazrf/max_id",10000).toUInt(); if (max < min) { int tmp = max; max = min; min = tmp; } for(int i = min; i < max; i++) { QUrl testUrl(QString("http://zakazrf.ru/ViewReduction.aspx?id=%1").arg(i)); CDataStructure* tmpdata = new CDataStructure(testUrl); tmpdata->setType(getUrlDataType(testUrl)); tmpdata->setRoot(); m_dataStructures.insert(testUrl, tmpdata); m_activeDataStructures.push_back(tmpdata); } } else { for(int i=0; i<urls.count();i++) { CDataStructure* tmpdata = new CDataStructure(urls.at(i)); tmpdata->setType(getUrlDataType(urls.at(i))); tmpdata->setRoot(); m_dataStructures.insert(urls.at(i), tmpdata); m_activeDataStructures.push_back(tmpdata); } } #endif CDataStructure* data=NULL; QList<CDataStructure*>::iterator activeDataStructuresIter; for(activeDataStructuresIter = m_activeDataStructures.begin(); activeDataStructuresIter != m_activeDataStructures.end();) { if(m_threads.count()<(m_maxThreads+1)) { data=(*activeDataStructuresIter); CReciveThread *thread=new CReciveThread(data->url(), m_threadCounter++); thread->setDataStructure(data); m_threads.push_back(thread); connect(thread, SIGNAL(dataReady(int/*,QByteArray*/)), this, SLOT(onDataReady(int/*,QByteArray*/))); connect(thread, SIGNAL(finished()), this, SLOT(onThreadFinished())); thread->start(); activeDataStructuresIter=m_activeDataStructures.erase(activeDataStructuresIter); break; } break; }