--- a/ginebra2/ContentToolbarChromeItem.cpp Fri May 14 15:40:36 2010 +0300
+++ b/ginebra2/ContentToolbarChromeItem.cpp Tue Jun 29 00:46:29 2010 -0400
@@ -1,35 +1,47 @@
/*
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, version 2.1 of the License.
*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
*
-* Contributors:
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program. If not,
+* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
*
-* Description:
+* Description:
+* This class extends ToolbarChromeItem. It paints the toolbar background
+* and controls toolbar visibility in the content view.
*
*/
-
#include "ContentToolbarChromeItem.h"
+#include "ChromeItem.h"
+#include "WebChromeContainerSnippet.h"
+#include "ContentToolbarSnippet.h"
#include "GWebContentView.h"
#include "mostvisitedsnippet.h"
+#include "webpagecontroller.h"
+#include "ViewController.h"
+#include "ChromeEffect.h"
+
#include <QTimeLine>
#include <QDebug>
#define TOOLBAR_MARGIN 4
-#define TOOBAR_ANIMATION_DURATION 200
-#define TOOBAR_INACTIVITY_DURATION 5000
+#define TOOLBAR_ANIMATION_DURATION 200
+#define TOOLBAR_INACTIVITY_DURATION 5000
namespace GVA {
- ToolbarFadeAnimator::ToolbarFadeAnimator(): m_timeLine(NULL)
+ ToolbarFadeAnimator::ToolbarFadeAnimator(): m_timeLine(NULL)
{
}
@@ -43,7 +55,7 @@
void ToolbarFadeAnimator::start(bool visible) {
//qDebug() << __PRETTY_FUNCTION__ << visible;
if (!m_timeLine) {
- m_timeLine = new QTimeLine(TOOBAR_ANIMATION_DURATION);
+ m_timeLine = new QTimeLine(TOOLBAR_ANIMATION_DURATION);
connect(m_timeLine, SIGNAL(valueChanged(qreal)), this, SLOT(valueChange(qreal)));
connect(m_timeLine, SIGNAL(finished()), this, SIGNAL(finished()));
}
@@ -69,18 +81,15 @@
}
void ToolbarFadeAnimator::valueChange(qreal step) {
- qreal value = step - 0.25;
- value = (value > 0)? value: 0.0;
- emit updateVisibility(value);
+ emit updateVisibility(step);
}
- ContentToolbarChromeItem::ContentToolbarChromeItem(QGraphicsItem* parent)
- : ToolbarChromeItem(parent),
+ ContentToolbarChromeItem::ContentToolbarChromeItem(ChromeSnippet* snippet, QGraphicsItem* parent)
+ : ToolbarChromeItem(snippet, parent),
m_background(NULL),
- m_middleSnippet(NULL),
- m_bgopacity(0.75),
m_state(CONTENT_TOOLBAR_STATE_FULL),
- m_inactiveTimerState(CONTENT_TOOLBAR_INACTIVITY_TIMER_NONE)
+ m_autoHideToolbar(true),
+ m_timerState(CONTENT_TOOLBAR_TIMER_STATE_ALLOW)
{
m_inactivityTimer = new QTimer(this);
@@ -89,16 +98,22 @@
m_animator = new ToolbarFadeAnimator();
connect(m_animator, SIGNAL(updateVisibility(qreal)), this, SLOT(onUpdateVisibility(qreal)));
connect(m_animator, SIGNAL(finished()), this, SLOT(onAnimFinished()));
-
+
+ m_maxOpacity = m_bgopacity = opacity();
+ if (m_autoHideToolbar ) {
+ connect(m_snippet->chrome(), SIGNAL(chromeComplete()), this, SLOT(onChromeComplete()));
+ }
+
setFlags(QGraphicsItem::ItemDoesntPropagateOpacityToChildren);
-
+
}
ContentToolbarChromeItem::~ContentToolbarChromeItem()
{
- if (m_background )
+ if (m_background )
delete m_background;
delete m_inactivityTimer;
+
delete m_animator;
}
@@ -108,7 +123,30 @@
//qDebug() << __PRETTY_FUNCTION__ << boundingRect();
ToolbarChromeItem::resizeEvent(ev);
addFullBackground();
-
+
+ }
+
+ void ContentToolbarChromeItem::mousePressEvent(QGraphicsSceneMouseEvent * ev)
+ {
+ // If we are not in full state, ignore the event. Once igonre, none of the
+ // other mouse events are received until the next mouse press
+ if (m_state == CONTENT_TOOLBAR_STATE_PARTIAL ) {
+ ev->ignore();
+ }
+ else {
+ ChromeSnippet * mv = m_snippet->chrome()->getSnippet("MostVisitedViewId");
+ // Let mostvisited snippet handle the key press if it is visible
+ if (mv && mv->isVisible() ){
+ ev->ignore();
+ }
+ }
+ }
+
+ void ContentToolbarChromeItem::mouseReleaseEvent(QGraphicsSceneMouseEvent * ev)
+ {
+ Q_UNUSED(ev);
+ // Do nothing - prevent the event from trickling down
+
}
void ContentToolbarChromeItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* opt, QWidget* widget)
@@ -118,12 +156,12 @@
// qDebug() << __PRETTY_FUNCTION__ << m_state;
painter->save();
-
+
painter->setRenderHint(QPainter::Antialiasing);
-
+
painter->setPen(pen());
painter->setOpacity(m_bgopacity);
-
+
switch (m_state) {
case CONTENT_TOOLBAR_STATE_PARTIAL:
ToolbarChromeItem::paint(painter, opt, widget);
@@ -135,57 +173,114 @@
// fill path with color
painter->fillPath(*m_background,QBrush(grad()));
painter->drawPath(*m_background);
+ if(m_state == CONTENT_TOOLBAR_STATE_FULL && !isEnabled()) {
+ // Disabled, apply whitewash.
+ ChromeEffect::paintDisabledRect(painter, opt->exposedRect);
+ }
break;
default:
qDebug() << "ContentToolbarChromeItem::paint invalid state" ;
break;
}
// restore painter
- painter->restore();
-
+ painter->restore();
+
+ }
+
+
+ void ContentToolbarChromeItem::setSnippet(ChromeSnippet* snippet) {
+ ToolbarChromeItem::setSnippet(snippet);
+ m_maxOpacity = m_bgopacity = opacity();
+
+ if (m_autoHideToolbar ) {
+ connect(snippet->chrome(), SIGNAL(chromeComplete()), this, SLOT(onChromeComplete()));
+ }
+
+ }
+
+ void ContentToolbarChromeItem::onChromeComplete() {
+
+ GWebContentView* webView = static_cast<GWebContentView*> (m_snippet->chrome()->getView("WebView"));
+ //qDebug() << __PRETTY_FUNCTION__ << webView;
+ if (webView ) {
+ connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool)));
+ connect(webView, SIGNAL(loadStarted()), this, SLOT(onLoadStarted()));
+#ifdef BEDROCK_TILED_BACKING_STORE
+ connect(webView, SIGNAL(contextEvent(::WebViewEventContext *)), this, SLOT(resetTimer()));
+#else
+ connect(webView->widget(), SIGNAL(contextEvent(::WebViewEventContext *)), this, SLOT(resetTimer()));
+#endif
+ }
+
+ }
+
+ void ContentToolbarChromeItem::onLoadStarted() {
+
+ m_timerState = CONTENT_TOOLBAR_TIMER_STATE_ALLOW;
+ stopInactivityTimer();
}
- void ContentToolbarChromeItem::setSnippet(WebChromeContainerSnippet* snippet) {
+ void ContentToolbarChromeItem::onLoadFinished(bool ok) {
+
+ Q_UNUSED(ok);
+ //qDebug() << __PRETTY_FUNCTION__ << m_state << "Timer Allowed" << m_timerState;
+
+ if (m_autoHideToolbar && m_timerState == CONTENT_TOOLBAR_TIMER_STATE_ALLOW) {
+ ControllableViewBase* curView = m_snippet->chrome()->viewController()->currentView();
+ if (curView && curView->type() == "webView") {
+ GWebContentView * gView = qobject_cast<GWebContentView*> (curView);
+ bool isSuperPage = gView ? gView->currentPageIsSuperPage() : false;
- //qDebug() << __func__ << snippet;
- ToolbarChromeItem::setSnippet(snippet);
+ // Start inactivity timer if full toolbar is visible
+ if (!isSuperPage && m_state == CONTENT_TOOLBAR_STATE_FULL )
+ m_inactivityTimer->start(TOOLBAR_INACTIVITY_DURATION);
+ }
+ }
- connect(snippet->chrome(), SIGNAL(chromeComplete()), this, SLOT(onChromeComplete()));
- connect(snippet, SIGNAL(snippetMouseEvent(QEvent::Type)), this, SLOT(onSnippetMouseEvent(QEvent::Type)));
-
+ }
+ void ContentToolbarChromeItem::resetTimer() {
+
+ m_timerState = CONTENT_TOOLBAR_TIMER_STATE_NONE;
+ stopInactivityTimer();
}
- void ContentToolbarChromeItem::onWebViewMouseEvents(QEvent::Type type) {
+ void ContentToolbarChromeItem::stopInactivityTimer() {
+
+ //qDebug() << __PRETTY_FUNCTION__<< m_state << " Timer Active: " << m_inactivityTimer->isActive();
+ // Stop inactivity timer
+ if (m_inactivityTimer->isActive() )
+ m_inactivityTimer->stop();
+
+ }
-// qDebug() << __PRETTY_FUNCTION__ << type;
- switch (type ) {
- case QEvent::GraphicsSceneMousePress:
- case QEvent::GraphicsSceneMouseDoubleClick:
- handleMousePress();
- break;
- case QEvent::GraphicsSceneMouseRelease:
- handleMouseRelease();
- break;
- default:
- break;
+ void ContentToolbarChromeItem::onInactivityTimer() {
+
+ //qDebug() << __PRETTY_FUNCTION__ << m_state;
- }
-
+ //We are here because inactivity timer timed out. So we have to be in full toolbar state with no
+ // popups. So change fade to Partial state after stopping inactivity timer
+ m_inactivityTimer->stop();
+ changeState(CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL, true);
}
void ContentToolbarChromeItem::onSnippetMouseEvent( QEvent::Type type) {
-
-// qDebug() << __PRETTY_FUNCTION__ << type;
- // Handle the snippet mouse events when we are in webview
- if ( getSnippet()->chrome()->currentView() == "webView") {
+ //qDebug() << __PRETTY_FUNCTION__ << type ;
+
+ if (type == QEvent::MouseButtonPress || type == QEvent::GraphicsSceneMousePress) {
+ resetTimer();
+ }
+ }
- if (type == QEvent::MouseButtonPress || type == QEvent::GraphicsSceneMousePress) {
-
- m_inactiveTimerState = CONTENT_TOOLBAR_INACTIVITY_TIMER_NONE;
- switch (m_state) {
- case CONTENT_TOOLBAR_STATE_PARTIAL:
+ void ContentToolbarChromeItem::addLinkedChild(ChromeSnippet * s) {
+ m_linkedChildren.append(s);
+ }
+
+ void ContentToolbarChromeItem::toggleMiddleSnippet() {
+ //qDebug() << "TOGGLE MIDDLE : " << m_state;
+ switch (m_state) {
+ case CONTENT_TOOLBAR_STATE_PARTIAL:
changeState(CONTENT_TOOLBAR_STATE_ANIM_TO_FULL);
break;
case CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL:
@@ -198,151 +293,69 @@
// animation completes
break;
case CONTENT_TOOLBAR_STATE_FULL:
- resetInactivityTimer();
+ // if MV is active then wait for it to hide before changing the toolbar state
+ if (mvSnippetVisible()) {
+ changeState(CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL, false);
+ }
+ else {
+ changeState(CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL, true);
+ }
break;
default:
break;
-
}
- }
- else if ( type == QEvent::MouseButtonRelease || type == QEvent::GraphicsSceneMouseRelease){
- m_inactiveTimerState = CONTENT_TOOLBAR_INACTIVITY_TIMER_ALLOWED;
- if (m_state == CONTENT_TOOLBAR_STATE_FULL ){
- resetInactivityTimer();
- }
- }
- }
- }
-
- void ContentToolbarChromeItem::onChromeComplete() {
-
- GWebContentView* webView = static_cast<GWebContentView*> (getSnippet()->chrome()->getView("WebView"));
- //qDebug() << __PRETTY_FUNCTION__ << webView;
- if(webView){
- connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool)));
- connect(webView, SIGNAL(loadStarted()), this, SLOT(onLoadStarted()));
- connect(webView, SIGNAL(contentViewMouseEvent(QEvent::Type)) , this, SLOT(onWebViewMouseEvents(QEvent::Type)) );
- }
- // Get the middle snippet here for now
- m_middleSnippet = getSnippet()->chrome()->getSnippet("ButtonContainer");
- connect(m_middleSnippet, SIGNAL(snippetMouseEvent(QEvent::Type)), this, SLOT(onSnippetMouseEvent(QEvent::Type)));
- QList <ChromeSnippet *> links = getSnippet()->links();
- for (int i=0; i < links.count() ; i++) {
-
- connect(links.at(i), SIGNAL(snippetMouseEvent(QEvent::Type)), this, SLOT(onSnippetMouseEvent(QEvent::Type)));
-
- }
-
- // Connect to shown and hidden signals to reset the inactivity timer
- connect(getSnippet() , SIGNAL(shown()), this, SLOT(onSnippetHide()));
- connect(getSnippet() , SIGNAL(hidden()), this, SLOT(onSnippetShow()));
- }
-
- void ContentToolbarChromeItem::onSnippetShow() {
-
- // This is signal is received when the snippet is about to be hidden. So stop the timer
- //qDebug() << __PRETTY_FUNCTION__;
- if (m_inactivityTimer->isActive() )
- m_inactivityTimer->stop();
- }
-
- void ContentToolbarChromeItem::onSnippetHide() {
-
- //qDebug() << __PRETTY_FUNCTION__;
- changeState(CONTENT_TOOLBAR_STATE_FULL, false);
}
void ContentToolbarChromeItem::onMVCloseComplete() {
-// qDebug() << __PRETTY_FUNCTION__;
- ChromeSnippet * mv = getSnippet()->chrome()->getSnippet("MostVisitedViewId");
+// qDebug() << __PRETTY_FUNCTION__;
+ ChromeSnippet * mv = m_snippet->chrome()->getSnippet("MostVisitedViewId");
disconnect(mv, SIGNAL(mostVisitedSnippetCloseComplete()) , this, SLOT(onMVCloseComplete()));
// MostVisitedSnippet animation complete, so let's do toolbar animation
- if (m_state == CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL)
+ if (m_state == CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL)
changeState(CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL, true);
-
- }
-
- void ContentToolbarChromeItem::onLoadFinished(bool ok) {
-
- Q_UNUSED(ok);
- //qDebug() << __PRETTY_FUNCTION__ << m_state;
-
- // We should be in STATE_FULL when load completes as we would have
- // changed to that state on starting a load
- //assert(m_state == CONTENT_TOOLBAR_STATE_FULL)
- m_inactiveTimerState = CONTENT_TOOLBAR_INACTIVITY_TIMER_ALLOWED;
- resetInactivityTimer();
-
- }
-
- void ContentToolbarChromeItem::onLoadStarted() {
-
- //qDebug() << __PRETTY_FUNCTION__<< m_state; ;
- m_inactiveTimerState = CONTENT_TOOLBAR_INACTIVITY_TIMER_NONE;
- switch (m_state) {
- case CONTENT_TOOLBAR_STATE_PARTIAL:
- changeState(CONTENT_TOOLBAR_STATE_FULL, false);
- break;
- case CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL:
- case CONTENT_TOOLBAR_STATE_ANIM_TO_FULL:
- // Stop animation and change to full immediately
- m_animator->stop();
- changeState(CONTENT_TOOLBAR_STATE_FULL, false);
- break;
- case CONTENT_TOOLBAR_STATE_FULL:
- resetInactivityTimer();
- break;
- default:
- break;
-
- }
- //qDebug() << __PRETTY_FUNCTION__<< m_state; ;
-
- }
-
- void ContentToolbarChromeItem::onInactivityTimer() {
-
- //assert(m_state == CONTENT_TOOLBAR_STATE_PARTIAL);
- //qDebug() << __PRETTY_FUNCTION__ << m_state;
- if (mvSnippetVisible()) {
- changeState(CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL);
-
- }
- else {
- changeState(CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL, true);
- }
}
void ContentToolbarChromeItem::onUpdateVisibility(qreal step) {
- qreal value = 0.76 - step;
- //qDebug() << __PRETTY_FUNCTION__ << step << value << m_bgopacity << opacity();
- if (m_bgopacity != step ) {
- m_bgopacity = step;
- getSnippet()->setOpacity(value);
- m_middleSnippet->widget()->setOpacity(step);
+ //qDebug() << __PRETTY_FUNCTION__ << step << m_bgopacity << opacity();
+ // Value we get is 1.0 based, adjust it based on our max opacity
+ qreal value = step - (1.0 - m_maxOpacity);
+ value = (value > 0)? value: 0.0;
+
+ if (m_bgopacity != value ) {
+ m_bgopacity = value;
+ setOpacity(m_maxOpacity - value);
+ ContentToolbarSnippet * s = static_cast<ContentToolbarSnippet*>(m_snippet);
+ s->middleSnippet()->widget()->setOpacity(value);
update();
}
}
void ContentToolbarChromeItem::onAnimFinished() {
- //qDebug() << __PRETTY_FUNCTION__ << m_state;
+ ContentToolbarState state = CONTENT_TOOLBAR_STATE_INVALID;
+ bool animate = false;
+ //qDebug() << __PRETTY_FUNCTION__ << m_state;
switch (m_state) {
case CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL:
- changeState(CONTENT_TOOLBAR_STATE_PARTIAL);
+ state = CONTENT_TOOLBAR_STATE_PARTIAL;
break;
case CONTENT_TOOLBAR_STATE_ANIM_TO_FULL:
- changeState(CONTENT_TOOLBAR_STATE_FULL, true);
+ state = CONTENT_TOOLBAR_STATE_FULL;
+ animate = true;
break;
default:
break;
-
+
}
- //qDebug() << __PRETTY_FUNCTION__ << m_state;
-
+
+ ContentToolbarSnippet * s = static_cast<ContentToolbarSnippet*>(m_snippet);
+ s->handleToolbarStateChange(state);
+ changeState(state, animate);
+ //qDebug() << __PRETTY_FUNCTION__ << m_state;
+
}
void ContentToolbarChromeItem::addFullBackground() {
@@ -358,29 +371,19 @@
m_background->addRoundedRect(r, roundness, roundness);
}
- void ContentToolbarChromeItem::resetInactivityTimer() {
+ void ContentToolbarChromeItem::stateEnterFull(bool animate) {
-// qDebug() << __PRETTY_FUNCTION__ << m_inactiveTimerState;
- if (m_inactivityTimer->isActive() )
- m_inactivityTimer->stop();
- if (m_inactiveTimerState == CONTENT_TOOLBAR_INACTIVITY_TIMER_ALLOWED ) {
- m_inactivityTimer->start(TOOBAR_INACTIVITY_DURATION);
- }
- }
+ //qDebug() <<__PRETTY_FUNCTION__ ;
+ ContentToolbarSnippet * s = static_cast<ContentToolbarSnippet*>(m_snippet);
- void ContentToolbarChromeItem::stateEnterFull(bool animate) {
-
- //qDebug() <<__PRETTY_FUNCTION__ ;
-
- resetInactivityTimer();
// Show the middle snippet and reset the opacity if we are here directly with no aniamtion
if (!animate) {
- m_bgopacity = 0.75;
- m_middleSnippet->show();
+ m_bgopacity = 0.75;
+ s->middleSnippet()->show();
}
m_state = CONTENT_TOOLBAR_STATE_FULL;
- m_middleSnippet->widget()->setOpacity(1.0);
+ s->middleSnippet()->widget()->setOpacity(1.0);
// TODO: specify the rect to be updated to avoid full repaint
update();
}
@@ -389,47 +392,42 @@
//qDebug() <<__PRETTY_FUNCTION__ ;
Q_UNUSED(animate);
+ ContentToolbarSnippet * s = static_cast<ContentToolbarSnippet*>(m_snippet);
// Explicity hide the linked snippets so that toggle button javascript gets the right
// signals that it is expecting
- QList <ChromeSnippet *> links = getSnippet()->links();
- for (int i=0; i < links.count() ; i++) {
- //qDebug() << __PRETTY_FUNCTION__ << links.at(i)->elementId();
- links.at(i)->hide();
- }
+ hideLinkedChildren();
- m_middleSnippet->hide();
+ s->middleSnippet()->hide();
m_state = CONTENT_TOOLBAR_STATE_PARTIAL;
-
+
}
void ContentToolbarChromeItem::stateEnterAnimToFull(bool animate) {
//qDebug() <<__PRETTY_FUNCTION__ ;
Q_UNUSED(animate);
+ ContentToolbarSnippet * s = static_cast<ContentToolbarSnippet*>(m_snippet);
+
m_state = CONTENT_TOOLBAR_STATE_ANIM_TO_FULL;
- m_inactivityTimer->stop();
- m_middleSnippet->show();
+ s->middleSnippet()->show();
m_animator->start(false);
-
+
}
void ContentToolbarChromeItem::stateEnterAnimToPartial(bool animate) {
+ m_state = CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL;
- //qDebug() <<__PRETTY_FUNCTION__ << animate ;
- m_inactivityTimer->stop();
- m_state = CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL;
-
if (animate ) {
m_animator->start(true);
}
else {
- MostVisitedSnippet * mv = static_cast<MostVisitedSnippet *>(getSnippet()->chrome()->getSnippet("MostVisitedViewId"));
+ MostVisitedSnippet * mv = static_cast<MostVisitedSnippet *>(m_snippet->chrome()->getSnippet("MostVisitedViewId"));
connect(mv, SIGNAL(mostVisitedSnippetCloseComplete()) , this, SLOT(onMVCloseComplete()));
mv->close();
}
-
+
}
void ContentToolbarChromeItem::changeState( ContentToolbarState state, bool animate){
@@ -459,109 +457,24 @@
}
}
- void ContentToolbarChromeItem::onStateExit(ContentToolbarState state){
-
- //qDebug() << __PRETTY_FUNCTION__ ;
- switch (state) {
- case CONTENT_TOOLBAR_STATE_PARTIAL:
- break;
- case CONTENT_TOOLBAR_STATE_ANIM_TO_FULL:
- break;
- case CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL:
- break;
- case CONTENT_TOOLBAR_STATE_FULL:
- break;
- default:
- qDebug() << "ContentToolbarChromeItem::onStateExit - invalid state" ;
- break;
- }
- }
-
- void ContentToolbarChromeItem::handleMousePress() {
-
-// qDebug() << __PRETTY_FUNCTION__ << m_state;
- m_inactiveTimerState = CONTENT_TOOLBAR_INACTIVITY_TIMER_NONE;
- switch (m_state) {
- case CONTENT_TOOLBAR_STATE_PARTIAL:
- changeState(CONTENT_TOOLBAR_STATE_ANIM_TO_FULL);
- break;
- case CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL:
- // Stop animation and change to full immediately
- m_animator->stop();
- changeState(CONTENT_TOOLBAR_STATE_FULL, false);
- break;
- case CONTENT_TOOLBAR_STATE_ANIM_TO_FULL:
- // Do nothing here - will reset inactivity timer when
- // animation completes based on timer state then
- break;
- case CONTENT_TOOLBAR_STATE_FULL:
- resetInactivityTimer();
- break;
- default:
- qDebug() << "ContentToolbarChromeItem::handleMousePress invalid state" ;
- break;
-
- }
-
-
- }
-
- void ContentToolbarChromeItem::handleMouseRelease() {
-
-// qDebug() << __PRETTY_FUNCTION__ << m_state;
- /* If in STATE_FULL, restart inactivity timer. In other states:
- * STATE_PARTIAL, STATE_ANIM_TO_PARTIAL - not possible
- * STATE_ANIM_TO_FULL - timer will be restarted on animation completion
- */
-
- m_inactiveTimerState = CONTENT_TOOLBAR_INACTIVITY_TIMER_ALLOWED;
- if (m_state == CONTENT_TOOLBAR_STATE_FULL ){
- resetInactivityTimer();
- }
- }
-
bool ContentToolbarChromeItem::mvSnippetVisible() {
- ChromeSnippet * mv = getSnippet()->chrome()->getSnippet("MostVisitedViewId");
+ ChromeSnippet * mv = m_snippet->chrome()->getSnippet("MostVisitedViewId");
bool result = false;
-
+
if (mv && mv->isVisible() ) {
result = true;
}
return result;
}
-/*
- //Not using this method now - potential performance hit
- void ContentToolbarChromeItem::changeState( ContentToolbarState state, bool animate){
+ void ContentToolbarChromeItem::hideLinkedChildren() {
- if ( m_states[m_state].exitFunc ) {
-
- (*this.*(m_states[m_state].exitFunc))();
+ for (int i=0; i < m_linkedChildren.count() ; i++) {
+
+ m_linkedChildren.at(i)->hide();
}
- if ( m_states[state].enterFunc ) {
- (*this.*(m_states[state].enterFunc))(animate);
-
- }
-
}
-
- void ContentToolbarChromeItem::initStates() {
-
-
- m_states[CONTENT_TOOLBAR_STATE_FULL].enterFunc = &ContentToolbarChromeItem::stateEnterFull;
- m_states[CONTENT_TOOLBAR_STATE_FULL].exitFunc = NULL;
-
- m_states[CONTENT_TOOLBAR_STATE_PARTIAL].enterFunc = &ContentToolbarChromeItem::stateEnterpartial;
- m_states[CONTENT_TOOLBAR_STATE_PARTIAL].exitFunc = NULL;
-
- m_states[CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL].enterFunc = &ContentToolbarChromeItem::stateEnterAnimToPartial;
- m_states[CONTENT_TOOLBAR_STATE_ANIM_TO_PARTIAL].exitFunc = NULL;
-
- m_states[CONTENT_TOOLBAR_STATE_ANIM_TO_FULL].enterFunc = &ContentToolbarChromeItem::stateEnterAnimToFull;
- m_states[CONTENT_TOOLBAR_STATE_ANIM_TO_FULL].exitFunc = NULL;
- }
-*/
} // end of namespace GVA