Пример #1
0
inline
size_t DeviceInfo::totalMemory() const
{
    size_t _totalMemory = 0, _freeMemory = 0;
    queryMemory(_totalMemory, _freeMemory);
    return _totalMemory;
}
Пример #2
0
void CIRexxApp::doAbout()
{
   char info[40];
   CForm frmAbout(AboutForm);
   CLabel(frmAbout, AboutVersionLabel).CopyLabel(Interpreter::getYaxxVersion());
 	StrPrintF(info, getRexxAppMessage(msgRexxInfo), (unsigned long)queryMemory());
   CLabel(frmAbout, AboutInfoLabel).CopyLabel(info);
   frmAbout.DoDialog();
   return;
}
Пример #3
0
/**
* @brief 
*
* @return 
*/
int MemoryInputV1::run()
{
    SharedData sharedData;
    memset( &sharedData, 0, sizeof(sharedData) );

    while( !mStop )
    {
        Info( "Querying memory" );
        if ( queryMemory( &sharedData ) && sharedData.valid )
            break;
        Info( "Can't query shared memory" );
        usleep( 500000 );
    }
    //Info( "SHV: %d", sharedData.valid );
    //mImageCount = 40;
    //mPixelFormat = sharedData.imageFormat;
    //mPixelFormat = PIX_FMT_UYVY422;
    //mPixelFormat = PIX_FMT_YUYV422;
    //mPixelFormat = PIX_FMT_RGB24;
    //mFrameRate = 15;
    ////mImageWidth = sharedData.imageWidth;
    //mImageWidth = 720;
    ////mImageHeight = sharedData.imageHeight;
    //mImageHeight = 576;

    attachMemory( mImageCount, mPixelFormat, mImageWidth, mImageHeight );
    int lastWriteIndex = 0;
    while( !mStop )
    {
        if ( !mSharedData || !mSharedData->valid )
        {
            stop();
            break;
        }
        if ( mSharedData->last_write_index != lastWriteIndex )
        {
            const FeedFrame *frame = loadFrame();
            //Info( "Sending frame %d", frame->id() );
            lastWriteIndex = mSharedData->last_write_index;
            distributeFrame( FramePtr( frame ) );
            //delete frame;
            mFrameCount++;
        }
        usleep( INTERFRAME_TIMEOUT );
    }
    cleanup();
    return( !ended() );
}
Пример #4
0
bool DatabaseService::setupTables() {
    QSqlDatabase dbDisk = QSqlDatabase::database("disk");
    QSqlQuery queryDisk(dbDisk);

    queryDisk.exec("CREATE TABLE IF NOT EXISTS appData ("
                   "name VARCHAR(255) PRIMARY KEY, "
                   "value VARCHAR(255))");
    int version = getAppData("database_version").toInt();
    int oldVersion = version;
    qDebug() << __func__ << " - 'database_version': " << version;

    QSqlDatabase dbMemory = QSqlDatabase::database("memory");
    QSqlQuery queryMemory(dbMemory);
    queryMemory.exec("CREATE TABLE IF NOT EXISTS note ("
                     "id INTEGER PRIMARY KEY,"
                     "name VARCHAR(255),"
                     "file_name VARCHAR(255),"
                     "note_sub_folder_id int,"
                     "note_text TEXT,"
                     "decrypted_note_text TEXT,"
                     "has_dirty_data INTEGER DEFAULT 0,"
                     "file_last_modified DATETIME,"
                     "file_created DATETIME,"
                     "crypto_key INT64 DEFAULT 0,"
                     "crypto_password VARCHAR(255),"
                     "created DATETIME default current_timestamp,"
                     "modified DATETIME default current_timestamp)");
    queryMemory.exec("CREATE TABLE IF NOT EXISTS noteSubFolder ("
                     "id INTEGER PRIMARY KEY,"
                     "name VARCHAR(255),"
                     "parent_id int,"
                     "file_last_modified DATETIME,"
                     "created DATETIME default current_timestamp,"
                     "modified DATETIME default current_timestamp)");

    if (version < 1) {
        queryDisk.exec("CREATE TABLE IF NOT EXISTS calendarItem ("
                       "id INTEGER PRIMARY KEY,"
                       "summary VARCHAR(255),"
                       "url VARCHAR(255),"
                       "description TEXT,"
                       "has_dirty_data INTEGER DEFAULT 0,"
                       "completed INTEGER DEFAULT 0,"
                       "priority INTEGER,"
                       "calendar VARCHAR(255),"
                       "uid VARCHAR(255),"
                       "ics_data TEXT,"
                       "alarm_date DATETIME,"
                       "etag VARCHAR(255),"
                       "last_modified_string VARCHAR(255),"
                       "created DATETIME DEFAULT current_timestamp,"
                       "modified DATETIME DEFAULT current_timestamp)");

        queryDisk.exec("CREATE UNIQUE INDEX IF NOT EXISTS idxUrl "
                       "ON calendarItem( url )");
        queryDisk.exec("ALTER TABLE calendarItem ADD completed_date DATETIME");
        queryDisk.exec("ALTER TABLE calendarItem "
                       "ADD sort_priority INTEGER DEFAULT 0");
        version = 1;
    }

    if (version < 2) {
        CalendarItem::updateAllSortPriorities();
        version = 2;
    }

    if (version < 3) {
        queryDisk.exec("CREATE TABLE IF NOT EXISTS noteFolder ("
                       "id INTEGER PRIMARY KEY,"
                       "name VARCHAR(255),"
                       "local_path VARCHAR(255),"
                       "remote_path VARCHAR(255),"
                       "owncloud_server_id INTEGER DEFAULT 0,"
                       "priority INTEGER DEFAULT 0 )");
        version = 3;
    }

    // we need to remove the main splitter sizes for version 4 and 5
    if (version < 5) {
        QSettings settings;
        // remove the main splitter sizes for the tags pane
        settings.remove("mainSplitterSizes");

        version = 5;
    }

    if (version < 6) {
        QSettings settings;
        // remove the obsolete activeTagId setting
        settings.remove("activeTagId");

        version = 6;
    }

    if (version < 7) {
        queryDisk.exec("ALTER TABLE noteFolder ADD active_tag_id INTEGER");
        version = 7;
    }

    if (version < 8) {
        queryDisk.exec("CREATE TABLE IF NOT EXISTS script ("
                       "id INTEGER PRIMARY KEY,"
                       "name VARCHAR(255),"
                       "script_path TEXT,"
                       "enabled BOOLEAN DEFAULT 1,"
                       "priority INTEGER DEFAULT 0 )");
        version = 8;
    }

    if (version < 9) {
        queryDisk.exec("ALTER TABLE noteFolder ADD show_subfolders BOOLEAN "
                       "DEFAULT 0");
        version = 9;
    }

    if (version < 10) {
        queryDisk.exec("ALTER TABLE noteFolder "
                       "ADD active_note_sub_folder_data TEXT");
        version = 10;
    }

    if (version != oldVersion) {
        setAppData("database_version", QString::number(version));
    }

    return true;
}
Пример #5
0
bool DatabaseService::setupTables() {
    QSqlDatabase dbDisk = QSqlDatabase::database("disk");
    QSqlQuery queryDisk(dbDisk);

    queryDisk.exec("CREATE TABLE appData ("
                           "name VARCHAR(255) PRIMARY KEY, "
                           "value VARCHAR(255));");
    int version = getAppData("database_version").toInt();
    qDebug() << __func__ << " - 'database_version': " << version;

    QSqlDatabase dbMemory = QSqlDatabase::database("memory");
    QSqlQuery queryMemory(dbMemory);
    queryMemory.exec("CREATE TABLE note ("
                             "id INTEGER PRIMARY KEY,"
                             "name VARCHAR(255),"
                             "file_name VARCHAR(255),"
                             "note_text TEXT,"
                             "decrypted_note_text TEXT,"
                             "has_dirty_data INTEGER DEFAULT 0,"
                             "file_last_modified DATETIME,"
                             "file_created DATETIME,"
                             "crypto_key INT64 DEFAULT 0,"
                             "crypto_password VARCHAR(255),"
                             "created DATETIME default current_timestamp,"
                             "modified DATETIME default current_timestamp)");

    if (version < 1) {
        queryDisk.exec("CREATE TABLE calendarItem ("
                               "id INTEGER PRIMARY KEY,"
                               "summary VARCHAR(255),"
                               "url VARCHAR(255),"
                               "description TEXT,"
                               "has_dirty_data INTEGER DEFAULT 0,"
                               "completed INTEGER DEFAULT 0,"
                               "priority INTEGER,"
                               "calendar VARCHAR(255),"
                               "uid VARCHAR(255),"
                               "ics_data TEXT,"
                               "alarm_date DATETIME,"
                               "etag VARCHAR(255),"
                               "last_modified_string VARCHAR(255),"
                               "created DATETIME DEFAULT current_timestamp,"
                               "modified DATETIME DEFAULT current_timestamp)");

        queryDisk.exec("CREATE UNIQUE INDEX idxUrl ON calendarItem( url );");
        queryDisk.exec("ALTER TABLE calendarItem ADD completed_date DATETIME;");
        queryDisk.exec("ALTER TABLE calendarItem "
                               "ADD sort_priority INTEGER DEFAULT 0;");

        version = 1;
    }

    if (version < 2) {
        CalendarItem::updateAllSortPriorities();
        version = 2;
    }

    setAppData("database_version", QString::number(version));

    return true;
}