BookmarkItem * Logbook::getBookmark(const QString &url) { QVERBOSE_EXP("Logbook::getBookmark(url)", "url: " << url); BookmarkItem *result = NULL; m_query.prepare(SELECT_BOOKMARK_SQL_BY_URL); m_query.bindValue(0, url); if ( !m_query.exec() ) { QWARNING_EXP("Logbook::getBookmark(url)", "Query exec error: " << m_query.lastError().text()); } else if ( m_query.next() ) { QVERBOSE_EXP("Logbook::getBookmark(url)", "Bookmark found."); result = new BookmarkItem( m_query.value(1).toString(), // title m_query.value(0).toString(), // url isHome(m_query.value(2).toULongLong()), // isHome m_query.value(2).toInt() // id ); if ( m_query.next() ) { // Should never reach here! QWARNING_EXP("Logbook::getBookmark(url)", "More then 1 Bookmark with the same URL?"); } } else { QVERBOSE_EXP("Logbook::getBookmark(url)", "No Bookmark found."); } return result; }
BookmarkItem * Logbook::getBookmarkAt(const int &at) { QVERBOSE_EXP("Logbook::getBookmarkAt(at)", "at: " << at); BookmarkItem *result = NULL; m_query.prepare(SELECT_BOOKMARK_SQL_AT); m_query.bindValue(0, at); if ( !m_query.exec() ) { QWARNING_EXP("Logbook::getBookmarkAt()", "Query exec error: " << m_query.lastError().text()); } else if ( m_query.next() ) { result = new BookmarkItem( m_query.value(1).toString(), // title m_query.value(0).toString(), // url isHome(m_query.value(2).toULongLong()), // isHome m_query.value(2).toInt() // id ); } return result; }
Uint32 TVec::update() { printf("TVec::update!\n"); switch (this->aktion) { case eVec::Action::Idle: if(!this->doIDLE()) { if (this->aktion == eVec::Action::Idle) { this->aktion = eVec::Action::Work; return 1; } } return 0; break; case eVec::Action::Rotate: if(!this->doROTATE()) { this->aktion = eVec::Action::Move; } return 1; break; case eVec::Action::Move: if(!this->doMOVE()) { this->aktion = eVec::Action::Work; } return 1; break; case eVec::Action::Work: if(this->doWORK() == 0) { this->aktion = eVec::Action::Idle; if (!isHome()) { returnHome(); } return 0; } return this->nextWork; break; default: return 0; break; } }
bool Logbook::isHome(const QString &url) { return isHome(getBookmark(url)->id); }
bool Logbook::isHome(const BookmarkItem &item) { return isHome(item.id); }