Example #1
0
static cbnode_t* bufferGetLine(CBuffer* cb, uint idx)
{
    cbnode_t* node = NULL;
    assert(cb);
    if(!(cb->numLines == 0 || idx >= cb->numLines))
    {
        rebuildIndex(cb);
        node = cb->index[idx];
    }
    return node;
}
Example #2
0
/** ***************************************************************************/
Terminal::Extension::Extension() : IExtension("Terminal"), dirtyFlag_(false) {
    qDebug("[%s] Initialize extension", name_);

    QString iconPath = XdgIconLookup::instance()->themeIconPath("terminal", QIcon::themeName());
    iconPath_ = iconPath.isNull() ? ":calc" : iconPath;

    connect(&watcher_, &QFileSystemWatcher::directoryChanged, [this](){ dirtyFlag_ = true; });

    rebuildIndex();

    qDebug("[%s] Extension initialized", name_);
}
Example #3
0
bool OsmAnd::TileDB::openIndex()
{
    QMutexLocker scopeLock(&_indexMutex);

    bool ok;
    bool shouldRebuild = indexFilename.isEmpty() || !QFile(indexFilename).exists();

    _indexDb.setDatabaseName(indexFilename.isEmpty() ? ":memory:" : indexFilename);
    ok = _indexDb.open();
    if(!ok)
    {
        LogPrintf(LogSeverityLevel::Error, "Failed to open TileDB index from '%s': %s", qPrintable(indexFilename), qPrintable(_indexDb.lastError().text()));
        return false;
    }

    if(shouldRebuild)
        rebuildIndex();

    return true;
}
Example #4
0
/** ***************************************************************************/
void Terminal::Extension::teardownSession() {
    if ( dirtyFlag_ )
        // Build rebuild the chache
        rebuildIndex();
}