コード例 #1
0
void Preferences::init()
{
    QDir dir(QFileInfo(fileName()).absoluteDir());

    TESTMODE = TESTMODEDEFAULT;
    UPDATECHECKTIMEOUTSECS = UPDATECHECKTIMEOUTSECSDEFAULT;
    HOSTLISTURL = HOSTLISTURLDEFAULT;
    PINGSPERHOST = PINGSPERHOSTDEFAULT;
    PINGTHREADS = PINGTHREADSDEFAULT;
    DOWNLOADTESTSECS = DOWNLOADTESTSECSDEFAULT;
    PINGTIMEOUTSECS = PINGTIMEOUTSECSDEFAULT;

    if(!dir.exists())    // If necessary, create subdir for the program's INI files
    {
        emit message(trUtf8("Creating program preferences directory") + ' ' + QDir::toNativeSeparators(dir.path()));
        dir.mkpath(dir.path());
    }

    if(_exists() || _restoreEmbeddedOk())    // First, check for a local existing preferences file. If not found, then try to restore one from the library's embedded resources. If either method succeeds, try to load the preferences file
    {
        if(!_loadOk())
        {
            emit message(trUtf8("Error parsing %1. Not a valid preferences file").arg(QDir::toNativeSeparators(fileName())));
        }

        return;
    }

    // At this point, no method gave a readable preferences file. The application should use the default global values provided by the library as starting values for preferences
}
コード例 #2
0
ファイル: gridfs.cpp プロジェクト: RyokoAkizuki/freshcity
    GridFSChunk GridFile::getChunk( int n ) {
        _exists();
        BSONObjBuilder b;
        b.appendAs( _obj["_id"] , "files_id" );
        b.append( "n" , n );

        BSONObj o = _grid->_client.findOne( _grid->_chunksNS.c_str() , b.obj() );
        uassert( 10014 ,  "chunk is empty!" , ! o.isEmpty() );
        return GridFSChunk(o);
    }
コード例 #3
0
ファイル: gridfs.cpp プロジェクト: RyokoAkizuki/freshcity
    gridfs_offset GridFile::write( ostream & out ) {
        _exists();

        const int num = getNumChunks();

        for ( int i=0; i<num; i++ ) {
            GridFSChunk c = getChunk( i );

            int len;
            const char * data = c.data( len );
            out.write( data , len );
        }

        return getContentLength();
    }
コード例 #4
0
ファイル: cachedimage.cpp プロジェクト: sevings/Taaasty
CachedImage::CachedImage(CacheManager* parent, QString url)
    : QObject(parent)
    , _man(parent)
    , _headReply(nullptr)
    , _reply(nullptr)
    , _format(UnknownFormat)
    , _url(url)
    , _kbytesReceived(0)
    , _kbytesTotal(0)
    , _available(false)
{
    Q_ASSERT(_man);

    Q_TEST(connect(&_saveWatcher, &QFutureWatcher<void>::finished, this, &CachedImage::downloadingChanged, Qt::QueuedConnection));
    Q_TEST(connect(&_saveWatcher, &QFutureWatcher<void>::finished, this, [&]()
    {
        _available = true;
        emit available();
    }, Qt::QueuedConnection));
    
    if (!_man || _url.isEmpty())
        return;

    if (_url.startsWith("//"))
        _url = "http:" + _url;

    _hash = qHash(_url);
    if (_exists())
    {
        _available = true;
        emit available();
        return;
    }

    qDebug() << "CachedImage from url: " << url;

    if (_man->autoload())
        download();
    else
        getInfo();
}
コード例 #5
0
ファイル: support.c プロジェクト: netdna/proftpd
int exists(const char *path) {
  return _exists(path, -1);
}
コード例 #6
0
ファイル: support.c プロジェクト: netdna/proftpd
int dir_exists(const char *path) {
  return _exists(path, 1);
}
コード例 #7
0
ファイル: support.c プロジェクト: netdna/proftpd
int file_exists(const char *path) {
  return _exists(path, 0);
}
コード例 #8
0
ファイル: fs.cpp プロジェクト: williame/GlestNG
bool fs_t::exists(const std::string& path) const { return _exists(canocial(path).c_str()); }
コード例 #9
0
ファイル: tuple_extras.hpp プロジェクト: mpmilano/mutils
	constexpr bool exists(const std::tuple<Args...> &t){
		return _exists(t,gens<sizeof...(Args)>::build());
	}
コード例 #10
0
ファイル: support.c プロジェクト: Nakor78/proftpd
int exists2(pool *p, const char *path) {
  return _exists(p, path, -1);
}
コード例 #11
0
ファイル: support.c プロジェクト: Nakor78/proftpd
int dir_exists2(pool *p, const char *path) {
  return _exists(p, path, 1);
}
コード例 #12
0
ファイル: support.c プロジェクト: Nakor78/proftpd
int file_exists2(pool *p, const char *path) {
  return _exists(p, path, 0);
}