Example #1
0
::LabrestAPI::History 
LabrestAPI::LabrestDB::getLockHistry()
{
    int s;
    
    ::LabrestAPI::History lock_history;
    
//    ::std::cout << "LabrestDB::getLockHistry() called" << ::std::endl;
    
    sqlite3_stmt * ppStmt;
    
    sqlite3_exec(db, "BEGIN", 0, 0, 0);

    sqlite3_prepare(db,"select id from using_resource;",-1,&ppStmt,0);
    
    s = sqlite3_step(ppStmt);
    
    while (s == SQLITE_ROW)
    {
        ::LabrestAPI::LockStatus temp_row = getLockStatus(sqlite3_column_int(ppStmt, 0));

        lock_history.push_back(temp_row);

        s = sqlite3_step(ppStmt);
    }
    sqlite3_finalize(ppStmt);

    sqlite3_exec(db, "COMMIT", 0, 0, 0);

    return lock_history;
}
Example #2
0
::LabrestAPI::Resource 
LabrestAPI::LabrestDB::getResource(int id)
{
    int s;
    
    ::LabrestAPI::Resource resource;
    
//    ::std::cout << "LabrestDB::getResource() called" << ::std::endl;
    
    sqlite3_stmt * ppStmt;

    sqlite3_prepare(db,"select * from resource where id = ? ;",-1,&ppStmt,0);
    
    sqlite3_bind_int(ppStmt, 1, id);

    s = sqlite3_step(ppStmt);
    
    if  (s == SQLITE_ROW)
    {
        resource.id = sqlite3_column_int(ppStmt, 0);
        
        resource.name = (reinterpret_cast<const char *>(sqlite3_column_text(ppStmt, 1)));
        
        resource.description = (reinterpret_cast<const char *>(sqlite3_column_text(ppStmt, 2)));
        
        resource.resLockStatus = getLockStatus(sqlite3_column_int(ppStmt, 3));
        
        resource.type = getResourceType(sqlite3_column_int_or_null(ppStmt, 4));
        
        resource.parentId = sqlite3_column_int_or_null(ppStmt, 5);    
  
    }
    sqlite3_finalize(ppStmt);

    return resource;
}
void LxQtKbIndicator::settingsChanged()
{
    mBit = settings()->value("bit", 0).toInt();
    mContent->setText(settings()->value("text", QString("C")).toString());
    mContent->setEnabled(getLockStatus(mBit));
}