Ejemplo n.º 1
0
TEST(GLObject, Value) {
    setFlag = false;

    auto object = std::make_unique<mbgl::gl::Value<MockGLObject>>();
    EXPECT_EQ(object->getCurrent(), false);
    EXPECT_FALSE(object->getDirty());
    EXPECT_FALSE(setFlag);

    object->setDirty();
    EXPECT_TRUE(object->getDirty());

    *object = false;
    EXPECT_EQ(object->getCurrent(), false);
    EXPECT_FALSE(object->getDirty());
    EXPECT_TRUE(setFlag);

    setFlag = false;
    *object = true;
    EXPECT_EQ(object->getCurrent(), true);
    EXPECT_FALSE(object->getDirty());
    EXPECT_TRUE(setFlag);

    object->reset();
    EXPECT_EQ(object->getCurrent(), false);
    EXPECT_FALSE(object->getDirty());
    EXPECT_TRUE(setFlag);
}
Ejemplo n.º 2
0
bool DBBrowserDB::close()
{
    if(_db)
    {
        if (getDirty())
        {
            QMessageBox::StandardButton reply = QMessageBox::question(0,
                                                                      QApplication::applicationName(),
                                                                      QObject::tr("Do you want to save the changes "
                                                                                  "made to the database file %1?").arg(curDBFilename),
                                                                      QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);

            // If the user clicked the cancel button stop here and return false
            if(reply == QMessageBox::Cancel)
                return false;

            // If he didn't it was either yes or no
            if(reply == QMessageBox::Yes)
                saveAll();
            else
                revertAll(); //not really necessary, I think... but will not hurt.
        }
        sqlite3_close(_db);
    }
    _db = 0;
    objMap.clear();
    savepointList.clear();
    emit dbChanged(getDirty());

    // Return true to tell the calling function that the closing wasn't cancelled by the user
    return true;
}
void ofxBaseShaderNode::update(){
    //if not dirty, nothing to do
    if(!getDirty())
        return;

    //cout<<"drawing node "<<name<<endl;

    //first, recursively make sure all dependencies are up to date
    for(auto node:inputs){
        node->update();
    }
    //get a buffer and draw to it
    if(!output){
        requestBuffer();
    }
    draw();
    setDirty(false);

    //now that we've drawn, dependents can start to draw, so set the counter
    dependent_count = num_dependents;

    //update inputs so they know when to free resources
    for(auto node:inputs){
        node->decrementDependents();
    }
}
Ejemplo n.º 4
0
void DBBrowserDB::close () {
    if (_db)
    {
        if (getDirty())
        {
            QString msg = "Do you want to save the changes made to the database file ";
            msg.append(curDBFilename);
            msg.append(" ?");
            if (QMessageBox::question( 0, applicationName ,msg, QMessageBox::Yes, QMessageBox::No)==QMessageBox::Yes)
            {
                save();
            } else {
                //not really necessary, I think... but will not hurt.
                revert();
            }
        }
        sqlite3_close(_db);
    }
    _db = 0;
    idxmap.clear();
    tbmap.clear();
    idmap.clear();
    browseRecs.clear();
    browseFields.clear();
    hasValidBrowseSet = false;
}
Ejemplo n.º 5
0
bool DBBrowserDB::save(const QString& pointname)
{
    if(!isOpen() || savepointList.contains(pointname) == false)
        return false;

    if(_db)
    {
        QString query = QString("RELEASE %1;").arg(pointname);
        sqlite3_exec(_db, query.toUtf8(), NULL,NULL,NULL);
        savepointList.removeAll(pointname);
        emit dbChanged(getDirty());
    }
    return true;
}
Ejemplo n.º 6
0
bool DBBrowserDB::setRestorePoint(const QString& pointname)
{
    if(!isOpen())
        return false;
    if(savepointList.contains(pointname))
        return true;

    if(_db)
    {
        QString query = QString("SAVEPOINT %1;").arg(pointname);
        sqlite3_exec(_db, query.toUtf8(), NULL, NULL, NULL);
        savepointList.append(pointname);
        emit dbChanged(getDirty());
    }
    return true;
}
Ejemplo n.º 7
0
QPixmap* SlippyMapCache::getImage(int x, int y, int Zoom)
{
    Coord C;
    C.X = x;
    C.Y = y;
    C.Zoom = Zoom;
    QMap<Coord,QByteArray>::iterator i = Memory.find(C);
    if (i == Memory.end())
    {
        addToQueue(C);
        return getDirty(x,y,Zoom);
    }
    QPixmap* img = new QPixmap;
    img->loadFromData(i.value());
    return img;
}
Ejemplo n.º 8
0
 bool Motor::isDirty()
 {
   return getDirty();
 }