Ejemplo n.º 1
0
void WaypointDialog::load(QWidget *parent){
    QString fileName = QFileDialog::getOpenFileName(parent,"Open Waypoint File",QString(),"Waypoint Files (*.txt *.wyp)");
    if(fileName.isNull())
        return;
    doLoad(parent,fileName);
    qDebug() << "Load: " << fileName;
}
Ejemplo n.º 2
0
int main() {

  uint64_t data = 0xdead;
  uint16_t addr = 1;
  printf("[INFO] Write R[%d] = %lx\n", addr, data);
  doWrite(addr, data);

  printf("[INFO] Read R[%d]\n", addr);
  uint64_t y = doRead(addr);
  printf("[INFO]   Received %lx\n", y);
  assert(y == data);

  uint64_t data_accum = -0x1fbe;
  printf("[INFO] Accum R[%d] with %lx\n", addr, data_accum);
  y = doAccum(addr, data_accum);
  printf("[INFO]   Received %lx\n", y);
  assert(y == data);

  printf("[INFO] Read R[%d]\n", addr);
  y = doRead(addr);
  printf("[INFO]   Received %lx\n", y);
  assert(y == data + data_accum);

  data = 0xbeef;
  uint64_t data_addr = doTranslate((void *) &data);
  printf("[INFO] Load %lx (0x%lx) via L1 data cache\n",
         data, data_addr);
  y = doLoad(addr, data_addr);
  printf("[INFO]   Received %lx\n", y);

  return 0;
}
Ejemplo n.º 3
0
bool XMLParseBase::LoadBaseTheme(void)
{
    bool ok = false;
    bool loadOnlyWindows = false;
    bool showWarnings = true;

    const QStringList searchpath = GetMythUI()->GetThemeSearchPath();

    QStringList::const_iterator it = searchpath.begin();
    for (; it != searchpath.end(); ++it)
    {
        QString themefile = *it + "base.xml";
        if (doLoad(QString(), GetGlobalObjectStore(), themefile,
                   loadOnlyWindows, showWarnings))
        {
            VERBOSE(VB_GUI, LOC +
                    QString("Loaded base theme from '%1'").arg(themefile));
            // Don't complain about duplicate definitions after first
            // successful load (set showWarnings to false).
            showWarnings = false;
            ok = true;
        }
        else
        {
            VERBOSE(VB_GUI|VB_FILE, LOC_WARN +
                    QString("No theme file '%1'").arg(themefile));
        }
    }

    return ok;
}
Ejemplo n.º 4
0
void NewLoader::setCache(ImageCache *_cache) {
    this->cache = _cache;
    cache->init(dm->currentDirectory(), dm->getFileList());
    worker = new LoadHelper(cache, this->thread());
    worker->moveToThread(loadThread);
    //connect(worker, SIGNAL(error(QString)), this, SLOT(errorString(QString)));
    //connect(loadThread, SIGNAL(started()), worker, SLOT(doLoad()));
    connect(this, SIGNAL(startLoad()), worker, SLOT(doLoad()));
    connect(worker, SIGNAL(finished(int)), this, SLOT(onLoadFinished(int)));
    //connect(worker, SIGNAL(finished(int)), loadThread, SLOT(quit()));
    //connect(worker, SIGNAL(finished(Image*, int)), worker, SLOT(deleteLater()));
    //connect(loadThread, SIGNAL(finished()), loadThread, SLOT(deleteLater()));

    loadTimer = new QTimer(this);
    loadTimer->setSingleShot(true);
    connect(loadTimer, SIGNAL(timeout()), this, SLOT(onLoadTimeout()));
    preloadTimer = new QTimer(this);
    preloadTimer->setSingleShot(true);
    if(globalSettings->usePreloader()) {
            connect(preloadTimer, SIGNAL(timeout()), this, SLOT(onPreloadTimeout()));
    }
    loadThread->start();
    //connect(loadTimer, SIGNAL(timeout()), loadTimer, SLOT(deleteLater()));

}
Ejemplo n.º 5
0
void Library::load()
{
	if( isLoaded() )
		return;

	doLoad();
}
Ejemplo n.º 6
0
bool XMLParseBase::LoadWindowFromXML(const QString &xmlfile,
                                     const QString &windowname,
                                     MythUIType *parent)
{
    bool onlyLoadWindows = true;
    bool showWarnings = true;

    const QStringList searchpath = GetMythUI()->GetThemeSearchPath();
    QStringList::const_iterator it = searchpath.begin();
    for (; it != searchpath.end(); ++it)
    {
        QString themefile = *it + xmlfile;
        LOG(VB_GUI, LOG_INFO, LOC + QString("Loading window %1 from %2").arg(windowname).arg(themefile));
        if (doLoad(windowname, parent, themefile,
                   onlyLoadWindows, showWarnings))
        {
            return true;
        }
        else
        {
            LOG(VB_FILE, LOG_ERR, LOC + "No theme file " + themefile);
        }
    }

    LOG(VB_GENERAL, LOG_ERR, LOC +
        QString("Unable to load window '%1' from '%2'")
            .arg(windowname).arg(xmlfile));

    return false;
}
Ejemplo n.º 7
0
bool XMLParseBase::LoadWindowFromXML(const QString &xmlfile,
                                     const QString &windowname,
                                     MythUIType *parent)
{
    bool onlyLoadWindows = true;
    bool showWarnings = true;

    const QStringList searchpath = GetMythUI()->GetThemeSearchPath();
    QStringList::const_iterator it = searchpath.begin();
    for (; it != searchpath.end(); ++it)
    {
        QString themefile = *it + xmlfile;
        VERBOSE(VB_GUI, LOC + "Loading window theme from " + themefile);
        if (doLoad(windowname, parent, themefile,
                   onlyLoadWindows, showWarnings))
        {
            return true;
        }
        else
        {
            VERBOSE(VB_FILE+VB_EXTRA, LOC_ERR + "No theme file " + themefile);
        }
    }

    VERBOSE(VB_IMPORTANT, LOC_ERR +
            QString("Unable to load window '%1' from '%2'")
            .arg(windowname).arg(xmlfile));

    return false;
}
Ejemplo n.º 8
0
void NewLoader::open(int pos) {
    //cache->unloadAll();
    dm->setCurrentPos(pos);
    emit loadStarted();
    doLoad(dm->currentFilePos());
    freeAuto();
}
Ejemplo n.º 9
0
void ImportIconsWizard::menuSelection(MythUIButtonListItem *item)
{
    if (!item)
        return;

    SearchEntry entry = item->GetData().value<SearchEntry>();

    LOG(VB_GENERAL, LOG_INFO, QString("Menu Selection: %1 %2 %3")
        .arg(entry.strID) .arg(entry.strName) .arg(entry.strLogo));

    enableControls(STATE_SEARCHING);

    CSVEntry entry2 = (*m_missingIter);
    m_strMatches += QString("%1,%2,%3,%4,%5,%6,%7,%8,%9\n")
                    .arg(escape_csv(entry.strID))
                    .arg(escape_csv(entry2.strName))
                    .arg(escape_csv(entry2.strXmlTvId))
                    .arg(escape_csv(entry2.strCallsign))
                    .arg(escape_csv(entry2.strTransportId))
                    .arg(escape_csv(entry2.strAtscMajorChan))
                    .arg(escape_csv(entry2.strAtscMinorChan))
                    .arg(escape_csv(entry2.strNetworkId))
                    .arg(escape_csv(entry2.strServiceId));

    if (checkAndDownload(entry.strLogo, entry2.strChanId))
    {
        m_statusText->SetText(tr("Icon for %1 was downloaded successfully.")
                              .arg(entry2.strName));
    }
    else
    {
        m_statusText->SetText(tr("Failed to download the icon for %1.")
                              .arg(entry2.strName));
    }

    if (m_missingMaxCount > 1)
    {
        m_missingCount++;
        m_missingIter++;
        if (!doLoad())
        {
            if (!m_strMatches.isEmpty())
                askSubmit(m_strMatches);
            else
                Close();
        }
    }
    else
    {
        enableControls(STATE_DISABLED);

        SetFocusWidget(m_iconsList);
        if (!m_strMatches.isEmpty())
            askSubmit(m_strMatches);
        else
            Close();
    }

}
Ejemplo n.º 10
0
Texture::Texture(const int width, const int height, string filename, bool allowMipmaps)
{
	DataFile file(filename);
	uint8_t *data = new uint8_t[width * height * 4];
	file.read(data, width * height * 4);
	doLoad(width, height, data, allowMipmaps);
	delete data;
};
Ejemplo n.º 11
0
bool Module::load()
{
    if(!_loaded)
    {
        _loaded = doLoad();
    }
    return _loaded;
}
Ejemplo n.º 12
0
CurveWidget::CurveWidget( QWidget* parent ) : QWidget( parent )
{
	CurveWidgetLayout = new QHBoxLayout(this);
	CurveWidgetLayout->setMargin(5);
	CurveWidgetLayout->setSpacing(5);

	layout1 = new QVBoxLayout;
	layout1->setMargin(0);
	layout1->setSpacing(5);

	invertButton = new QPushButton( this );
	invertButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
	invertButton->setIcon( IconManager::instance()->loadIcon("invert.png") );
	invertButton->setIconSize(QSize(22, 22));
	layout1->addWidget( invertButton );

	resetButton = new QPushButton( this );
	resetButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
	resetButton->setIcon( IconManager::instance()->loadIcon("reload.png") );
	resetButton->setIconSize(QSize(22, 22));
	layout1->addWidget( resetButton );
	linearButton = new QPushButton( this );
	QIcon ic;
	ic.addPixmap(IconManager::instance()->loadPixmap("curvebezier.png"), QIcon::Normal, QIcon::Off);
	ic.addPixmap(IconManager::instance()->loadPixmap("curvelinear.png"), QIcon::Normal, QIcon::On);
	linearButton->setIcon(ic);
	linearButton->setCheckable( true );
	linearButton->setChecked(false);
	linearButton->setIconSize(QSize(22, 22));
	linearButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
	layout1->addWidget( linearButton );
	spacer1 = new QSpacerItem( 2, 3, QSizePolicy::Minimum, QSizePolicy::Expanding );
	layout1->addItem( spacer1 );

	loadButton = new QPushButton( this );
	loadButton->setIcon( IconManager::instance()->loadIcon("22/document-open.png") );
	loadButton->setIconSize(QSize(22, 22));
	loadButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
	layout1->addWidget( loadButton );

	saveButton = new QPushButton( this );
	saveButton->setIcon( IconManager::instance()->loadIcon("22/document-save-as.png") );
	saveButton->setIconSize(QSize(22, 22));
	saveButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
	layout1->addWidget( saveButton );
	CurveWidgetLayout->addLayout( layout1 );

	cDisplay = new KCurve(this);
	cDisplay->setMinimumSize( QSize( 150, 150 ) );
	CurveWidgetLayout->addWidget( cDisplay );
	languageChange();

	connect(invertButton, SIGNAL(clicked()), this, SLOT(doInvert()));
	connect(resetButton, SIGNAL(clicked()), this, SLOT(doReset()));
	connect(linearButton, SIGNAL(clicked()), this, SLOT(doLinear()));
	connect(loadButton, SIGNAL(clicked()), this, SLOT(doLoad()));
	connect(saveButton, SIGNAL(clicked()), this, SLOT(doSave()));
}
Ejemplo n.º 13
0
int SoundPool::load(const char* path, int priority)
{
    ALOGV("load: path=%s, priority=%d", path, priority);
    Mutex::Autolock lock(&mLock);
    sp<Sample> sample = new Sample(++mNextSampleID, path);
    mSamples.add(sample->sampleID(), sample);
    doLoad(sample);
    return sample->sampleID();
}
Ejemplo n.º 14
0
int SoundPool::load(int fd, int64_t offset, int64_t length, int priority)
{
    ALOGV("load: fd=%d, offset=%lld, length=%lld, priority=%d",
            fd, offset, length, priority);
    Mutex::Autolock lock(&mLock);
    sp<Sample> sample = new Sample(++mNextSampleID, fd, offset, length);
    mSamples.add(sample->sampleID(), sample);
    doLoad(sample);
    return sample->sampleID();
}
Ejemplo n.º 15
0
void Asset::load(const std::string& fileName, const SurgSim::Framework::ApplicationData& data)
{
	m_fileName = fileName;
	SURGSIM_ASSERT(!m_fileName.empty()) << "File name is empty";

	std::string path = data.findFile(m_fileName);

	SURGSIM_ASSERT(!path.empty()) << "Can not locate file " << m_fileName;
	SURGSIM_ASSERT(doLoad(path)) << "Failed to load file " << m_fileName;
}
Ejemplo n.º 16
0
void NewLoader::openBlocking(QString path) {
    freeAuto();
    if(!dm->existsInCurrentDir(path)) {
        dm->setFile(path);
        reinitCache();
    } else {
        dm->setFile(path);
    }
    emit loadStarted();
    doLoad(dm->currentFilePos());
}
Ejemplo n.º 17
0
void NewLoader::loadPrev() {
    QMutexLocker locker(&mutex);
    if(dm->peekPrev(1) != dm->currentFilePos()) {
        if(setLoadTarget(dm->prevPos())) {
            emit loadStarted();
            preloadTarget = dm->peekPrev(1);
            doLoad(loadTarget);
            freeAuto();
        }
    }
}
Ejemplo n.º 18
0
int main(int argc, char **argv)
{
    if (argc < 3) {
        // ###### Note: please consider adding new tests to karchivetest (so that they can be automated)
        // rather than here (interactive)
        printf("\n"
               " Usage :\n"
               " ./kziptest list /path/to/existing_file.zip       tests listing an existing zip\n"
               " ./kziptest print-all file.zip                    prints contents of all files.\n"
               " ./kziptest print file.zip filename               prints contents of one file.\n"
               " ./kziptest update file.zip filename              update filename in file.zip.\n"
               " ./kziptest save file.zip                         save file.\n"
               " ./kziptest load file.zip                         load file.\n"
               " ./kziptest write file.bz2                        write compressed file.\n"
               " ./kziptest read file.bz2                         read uncompressed file.\n"
              );
        return 1;
    }
    QCoreApplication app(argc, argv);
    QString command = argv[1];
    if (command == QLatin1String("list")) {
        return doList(QFile::decodeName(argv[2]));
    } else if (command == QLatin1String("print-all")) {
        return doPrintAll(QFile::decodeName(argv[2]));
    } else if (command == QLatin1String("print")) {
        if (argc != 4) {
            printf("usage: kziptest print archivename filename");
            return 1;
        }
        return doPrint(QFile::decodeName(argv[2]), argv[3]);
    } else if (command == QLatin1String("save")) {
        return doSave(QFile::decodeName(argv[2]));
    } else if (command == QLatin1String("load")) {
        return doLoad(QFile::decodeName(argv[2]));
    } else if (command == QLatin1String("write")) {
        return doCompress(QFile::decodeName(argv[2]));
    } else if (command == QLatin1String("read")) {
        return doUncompress(QFile::decodeName(argv[2]));
    } else if (command == QLatin1String("update")) {
        if (argc != 4) {
            printf("usage: kziptest update archivename filename");
            return 1;
        }
        return doUpdate(QFile::decodeName(argv[2]), QFile::decodeName(argv[3]));
    } else if (command == QLatin1String("transfer")) {
        if (argc != 4) {
            printf("usage: kziptest transfer sourcefile destfile");
            return 1;
        }
        return doTransfer(QFile::decodeName(argv[2]), QFile::decodeName(argv[3]));
    } else {
        printf("Unknown command\n");
    }
}
Ejemplo n.º 19
0
void ImportIconsWizard::Init()
{
    if (m_nMaxCount > 0)
    {
        m_missingIter = m_missingEntries.begin();
        if (!doLoad())
        {
            if (!m_strMatches.isEmpty())
                askSubmit(m_strMatches);
        }
    }
}
Ejemplo n.º 20
0
void MainWindow::quickLoad()
{
    QFile file(LAST_LOAD_FILE);
    if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
        slotSetStatusBarMessage("No saved load file");
        return;
    }

    QTextStream in(&file);
    QString line = in.readLine();
    doLoad(line.toStdString());
}
Ejemplo n.º 21
0
bool CellmlFile::load()
{
    // Check whether the file is already loaded and without any issues

    if (!mLoadingNeeded)
        return mIssues.isEmpty();

    // Consider the file loaded
    // Note: even when we can't load the file, we still consider it 'loaded'
    //       since we at least tried to load it, so unless the file gets
    //       modified (and we are to reload it), we are 'fine'...

    mLoadingNeeded = false;

    // Try to load the model

    if (!doLoad(mFileName, QString(), &mModel, mIssues))
        return false;

    // Retrieve all the RDF triples associated with the model and initialise our
    // list of original RDF triples

    ObjRef<iface::cellml_api::RDFRepresentation> rdfRepresentation = mModel->getRDFRepresentation(L"http://www.cellml.org/RDF/API");

    if (rdfRepresentation) {
        mRdfApiRepresentation = QueryInterface(rdfRepresentation);

        if (mRdfApiRepresentation) {
            mRdfDataSource = mRdfApiRepresentation->source();
            ObjRef<iface::rdf_api::TripleSet> rdfTriples = mRdfDataSource->getAllTriples();
            ObjRef<iface::rdf_api::TripleEnumerator> rdfTriplesEnumerator = rdfTriples->enumerateTriples();

            for (ObjRef<iface::rdf_api::Triple> rdfTriple = rdfTriplesEnumerator->getNextTriple();
                 rdfTriple; rdfTriple = rdfTriplesEnumerator->getNextTriple()) {
                mRdfTriples << new CellmlFileRdfTriple(this, rdfTriple);
            }

            mRdfTriples.updateOriginalRdfTriples();
        }
    }

    // Determine which cmeta:ids are currently in use, be they in the various
    // CellML elements or RDF triples

    retrieveCmetaIdsFromCellmlElement(mModel);

    foreach (CellmlFileRdfTriple *rdfTriple, mRdfTriples)
        mUsedCmetaIds << rdfTriple->metadataId();

    mUsedCmetaIds.removeDuplicates();

    return true;
}
Ejemplo n.º 22
0
void ImportIconsWizard::skip()
{
    m_missingCount++;
    m_missingIter++;

    if (!doLoad())
    {
        if (!m_strMatches.isEmpty())
            askSubmit(m_strMatches);
        else
            Close();
    }
}
Ejemplo n.º 23
0
	/**
	 * @brief Load a single Object from a Result Set
	 * @param[in] Result Set
	 * @return New Domain Object
	 */
	typename D::Ptr load(cursor::row_t r)
	{
		int64_t id = r[0].as<int64_t>();
		if ((m_loaded.find(id) != m_loaded.end()) && ! m_loaded[id].expired())
			return downcast(m_loaded[id].lock());

		typename D::Ptr result = doLoad(id, r);
		m_loaded[id] = Persistent::WeakPtr(upcast(result));
		attachToSession(result);
		afterLoaded(result);
		mark_persistent_clean(result);
		return result;
	}
Ejemplo n.º 24
0
void NewLoader::open(QString path) {
    if(!dm->existsInCurrentDir(path)) {
        freeAll();
        preloadTarget = 0;
        loadTarget = 0;
        dm->setFile(path);
        reinitCache();
    } else {
        freeAuto();
        dm->setFile(path);
    }
    emit loadStarted();
    doLoad(dm->currentFilePos());
}
Ejemplo n.º 25
0
/*
 *  ======== swiLoad ========
 */
Void swiLoad(UArg arg1, UArg arg2)
{
    static ULong oldLoad = ~0;

    /* display confirmation of load changes */
    if (oldLoad != swiLoadVal) {
        oldLoad = swiLoadVal;
        Log_print1(Diags_USER1, "Swi load: new load = %d%%",
            swiLoadPercent[loadIndex]);
    }

    if (swiLoadVal) {
        doLoad(swiLoadVal);
    }
}
Ejemplo n.º 26
0
/*
 *  ======== hwiLoad ========
 */
Void hwiLoad(Void)
{
    static ULong oldLoad = ~0;

    /* display confirmation of load changes */
    if (oldLoad != hwiLoadVal) {
        oldLoad = hwiLoadVal;
        Log_print1(Diags_USER1, "Hwi load: new load = %d%%",
            hwiLoadPercent[loadIndex]);
    }

    if (hwiLoadVal) {
        doLoad(hwiLoadVal);
    }
}
Ejemplo n.º 27
0
void QcWaveform::load( const QString& filename )
{
  qcDebugMsg( 1, "QcWaveform::load( filename )" );

  SF_INFO new_info;
  memset( &new_info, 0, sizeof(SF_INFO) );

  SNDFILE *new_sf = sf_open( filename.toStdString().c_str(), SFM_READ, &new_info );

  if( !new_sf ) {
    qcErrorMsg(QString("Could not open soundfile: ") + filename);
    return;
  }

  doLoad( new_sf, new_info, 0, new_info.frames );
}
Ejemplo n.º 28
0
void BaseConfigObject::loadNow()
{
	if (m_saveTimer->isActive())
	{
		saveNow();
	}

	try
	{
		doLoad(FS::read(m_filename));
	}
	catch (Exception & e)
	{
		qWarning() << "Error loading" << m_filename << ":" << e.cause();
	}
}
Ejemplo n.º 29
0
void Floater::load(KConfig *cfg)
{
	move(firstPoint.x(), firstPoint.y());

	QPoint start(wall->startPoint() + QPoint(wall->x(), wall->y()));
	start = cfg->readPointEntry("startPoint", &start);
	QPoint end(wall->endPoint() + QPoint(wall->x(), wall->y()));
	end = cfg->readPointEntry("endPoint", &end);
	wall->setPoints(start.x(), start.y(), end.x(), end.y());
	wall->move(0, 0);

	setSpeed(cfg->readNumEntry("speed", -1));

	doLoad(cfg);
	reset();
}
Ejemplo n.º 30
0
bool XMLParseBase::LoadBaseTheme(const QString &baseTheme)
{
    LOG(VB_GUI, LOG_INFO, LOC +
        QString("Asked to load base file from '%1'").arg(baseTheme));

    if (loadedBaseFiles.contains(baseTheme))
    {
        LOG(VB_GUI, LOG_INFO, LOC +
            QString("Base file already loaded '%1'").arg(baseTheme));
        return true;
    }

    bool ok = false;
    bool loadOnlyWindows = false;
    bool showWarnings = true;

    const QStringList searchpath = GetMythUI()->GetThemeSearchPath();

    QStringList::const_iterator it = searchpath.begin();
    for (; it != searchpath.end(); ++it)
    {
        QString themefile = *it + baseTheme;
        if (doLoad(QString(), GetGlobalObjectStore(), themefile,
                   loadOnlyWindows, showWarnings))
        {
            LOG(VB_GUI, LOG_INFO, LOC +
                QString("Loaded base theme from '%1'").arg(themefile));
            // Don't complain about duplicate definitions after first
            // successful load (set showWarnings to false).
            showWarnings = false;
            ok = true;
        }
        else
        {
            LOG(VB_GUI | VB_FILE, LOG_WARNING, LOC +
                QString("No theme file '%1'").arg(themefile));
        }
    }

    if (ok)
        loadedBaseFiles.append(baseTheme);

    return ok;
}