当前位置: 首页>>代码示例>>C++>>正文


C++ Tab::tabId方法代码示例

本文整理汇总了C++中Tab::tabId方法的典型用法代码示例。如果您正苦于以下问题:C++ Tab::tabId方法的具体用法?C++ Tab::tabId怎么用?C++ Tab::tabId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tab的用法示例。


在下文中一共展示了Tab::tabId方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: createTab

void DBWorker::createTab(const Tab &tab)
{
#if DEBUG_LOGS
    qDebug() << "new tab id: " << tab.tabId();
#endif
    QSqlQuery query = prepare("INSERT INTO tab (tab_id, tab_history_id) VALUES (?,?);");
    query.bindValue(0, tab.tabId());
    query.bindValue(1, 0);
    execute(query);

    if (tab.url().isEmpty()) {
        return;
    }

    int linkId = createLink(tab.url(), tab.title(), tab.thumbnailPath());

    if (addToBrowserHistory(tab.url(), tab.title()) == Error) {
        qWarning() << Q_FUNC_INFO << "failed to add url to history" << tab.url();
    }

    int historyId = addToTabHistory(tab.tabId(), linkId);
    if (historyId > 0) {
        updateTab(tab.tabId(), historyId);
    } else {
        qWarning() << Q_FUNC_INFO << "failed to add url to tab history" << tab.url();
    }

#if DEBUG_LOGS
    qDebug() << "created link:" << linkId << "with history id:" << historyId << "for tab:" << tab.tabId() << tab.url();
#endif
}
开发者ID:sailfishos,项目名称:sailfish-browser,代码行数:31,代码来源:dbworker.cpp

示例2: tabChanged

void DeclarativeTabModel::tabChanged(Tab tab)
{
    // When a tab was closed do not update anything from database as
    // loading might be on going.
    if (m_activeTabClosed && this->sender() == DBManager::instance()) {
        m_activeTabClosed = false;
        return;
    }
#ifdef DEBUG_LOGS
    qDebug() << "tab: " << tab.tabId() << m_activeTab.tabId() << tab.currentLink().thumbPath() << tab.currentLink().url() << tab.currentLink().title() << m_tabs.indexOf(tab);
#endif
    if (tab.tabId() == m_activeTab.tabId()) {
        updateActiveTab(tab);
    } else {
        int i = m_tabs.indexOf(tab); // match based on tab_id
        if (i > -1) {
            QVector<int> roles;
            Tab oldTab = m_tabs[i];
            if (oldTab.currentLink().url() != tab.currentLink().url()) {
                roles << UrlRole;
            }
            if (oldTab.currentLink().title() != tab.currentLink().title()) {
                roles << TitleRole;
            }
            if (oldTab.currentLink().thumbPath() != tab.currentLink().thumbPath()) {
                roles << ThumbPathRole;
            }
            m_tabs[i] = tab;
            QModelIndex start = index(i, 0);
            QModelIndex end = index(i, 0);
            emit dataChanged(start, end, roles);
        }
    }
}
开发者ID:siteshwar,项目名称:sailfish-browser,代码行数:34,代码来源:declarativetabmodel.cpp

示例3: tabSort

bool DeclarativeTabModel::tabSort(const Tab &t1, const Tab &t2)
{
    int i1 = s_tabOrder.indexOf(t1.tabId());
    int i2 = s_tabOrder.indexOf(t2.tabId());
    if (i2 == -1) {
        return true;
    } else {
        return i1 < i2;
    }
}
开发者ID:Amit-Tomar,项目名称:sailfish-browser,代码行数:10,代码来源:declarativetabmodel.cpp

示例4: tabChanged

void DeclarativeTabModel::tabChanged(const Tab &tab)
{
#ifdef DEBUG_LOGS
    qDebug() << &m_activeTab;
    qDebug() << "new tab data:" << &tab;
#endif
    if (m_activeTab.tabId() == tab.tabId()) {
        updateActiveTab(tab);
    } else {
        int i = m_tabs.indexOf(tab); // match based on tab_id
        if (i > -1) {
            QVector<int> roles;
            Tab oldTab = m_tabs[i];
            if (oldTab.url() != tab.url()) {
                roles << UrlRole;
            }
            if (oldTab.title() != tab.title()) {
                roles << TitleRole;
            }
            if (oldTab.thumbnailPath() != tab.thumbnailPath()) {
                roles << ThumbPathRole;
            }
            m_tabs[i] = tab;
            QModelIndex start = index(i, 0);
            QModelIndex end = index(i, 0);
            emit dataChanged(start, end, roles);
        }
    }
}
开发者ID:Amit-Tomar,项目名称:sailfish-browser,代码行数:29,代码来源:declarativetabmodel.cpp

示例5: updateActiveTab

void DeclarativeTabModel::updateActiveTab(const Tab &activeTab, bool loadActiveTab)
{
#if DEBUG_LOGS
    qDebug() << "new active tab:" << &activeTab << "old active tab:" << &m_activeTab << "count:" << m_tabs.count();
#endif
    if (m_tabs.isEmpty()) {
        return;
    }

    if (m_activeTab != activeTab) {
        int oldTabId = m_activeTab.tabId();
        m_activeTab = activeTab;

        // If tab has changed, update active tab role.
        int tabIndex = activeTabIndex();
        if (oldTabId != m_activeTab.tabId() && tabIndex >= 0) {
            emit activeTabIndexChanged();
        }
        // To avoid blinking we don't expose "activeTabIndex" as a model role because
        // it should be updated over here and this is too early.
        // Instead, we pass current contentItem and activeTabIndex
        // when pushing the TabPage to the PageStack. This is the signal changes the
        // contentItem of WebView.
        emit activeTabChanged(oldTabId, activeTab.tabId(), loadActiveTab);
    }
}
开发者ID:alinelena,项目名称:sailfish-browser,代码行数:26,代码来源:declarativetabmodel.cpp

示例6: return

bool Tab::operator==(const Tab &other) const
{
    return (m_tabId == other.tabId() &&
            m_previousLinkId == other.m_previousLinkId &&
            m_nextLinkId == other.m_nextLinkId &&
            m_currentLink == other.m_currentLink);
}
开发者ID:Amit-Tomar,项目名称:sailfish-browser,代码行数:7,代码来源:tab.cpp

示例7: updateActiveTab

void DeclarativeTabModel::updateActiveTab(const Tab &activeTab)
{
#ifdef DEBUG_LOGS
    qDebug() << "old active tab: " << &m_activeTab << m_tabs.count();
    qDebug() << "new active tab: " << &activeTab;
#endif
    if (m_activeTab != activeTab) {
        int oldTabId = m_activeTab.tabId();
        m_activeTab = activeTab;
        emit activeTabChanged(oldTabId, activeTab.tabId());
        saveTabOrder();
    }
}
开发者ID:Amit-Tomar,项目名称:sailfish-browser,代码行数:13,代码来源:declarativetabmodel.cpp

示例8: updateActiveTab

void DeclarativeTabModel::updateActiveTab(const Tab &newActiveTab, bool updateCurrentTab)
{
#ifdef DEBUG_LOGS
    qDebug() << "change tab: " << updateCurrentTab << m_currentTab;
    qDebug() << "old active tab: " << m_activeTab.tabId() << m_activeTab.isValid() << m_activeTab.currentLink().url() << m_tabs.count();
    qDebug() << "new active tab: " << newActiveTab.tabId() << newActiveTab.isValid() << newActiveTab.currentLink().url();
#endif
    m_activeTab = newActiveTab;
    emit currentTabIdChanged();

    saveTabOrder();
    if (updateCurrentTab && m_currentTab) {
        m_currentTab->tabChanged(m_activeTab);
    }
}
开发者ID:siteshwar,项目名称:sailfish-browser,代码行数:15,代码来源:declarativetabmodel.cpp

示例9: removeTab

void DeclarativeTabModel::removeTab(const Tab &tab, int index)
{
#ifdef DEBUG_LOGS
    qDebug() << "index:" << index << tab.currentLink().url();
#endif
    int tabId = tab.tabId();
    DBManager::instance()->removeTab(tabId);

    QFile f(tab.currentLink().thumbPath());
    if (f.exists()) {
        f.remove();
    }

    if (index >= 0) {
        m_tabs.removeAt(index);
    }
}
开发者ID:siteshwar,项目名称:sailfish-browser,代码行数:17,代码来源:declarativetabmodel.cpp


注:本文中的Tab::tabId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。