summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2011-03-16 23:48:39 +0100
committerAndrea Diamantini <adjam7@gmail.com>2011-03-16 23:48:39 +0100
commit15215cf154c7d31f1520c259529b719b1fe84b48 (patch)
tree6c5d4734e5bd7ea766477c5739a8af38cbfbb2de
parentDelete url popup on resize/move (diff)
downloadrekonq-15215cf154c7d31f1520c259529b719b1fe84b48.tar.xz
Set an option to disable the disable graphics effects on the tabbar
highlight animation. CCBUG:267234 To see if this really works, please deselect the "animated tab highlights" in the Tabs Settings section
-rw-r--r--src/application.cpp2
-rw-r--r--src/rekonq.kcfg3
-rw-r--r--src/settings/settings_tabs.ui7
-rw-r--r--src/tabbar.cpp75
-rw-r--r--src/tabbar.h1
5 files changed, 67 insertions, 21 deletions
diff --git a/src/application.cpp b/src/application.cpp
index 1813d798..b1712d3e 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -443,6 +443,8 @@ void Application::updateConfiguration()
MainView *mv = w.data()->mainView();
mv->updateTabBar();
+ mv->tabBar()->setAnimatedTabHighlighting( ReKonfig::animatedTabHighlighting() );
+
if (b)
mv->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab);
else
diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg
index 8795104c..dba770b6 100644
--- a/src/rekonq.kcfg
+++ b/src/rekonq.kcfg
@@ -126,6 +126,9 @@
<entry name="useFavicon" type="Bool">
<default>false</default>
</entry>
+ <entry name="animatedTabHighlighting" type="Bool">
+ <default>true</default>
+ </entry>
</group>
diff --git a/src/settings/settings_tabs.ui b/src/settings/settings_tabs.ui
index 0edc5cae..eb775d5d 100644
--- a/src/settings/settings_tabs.ui
+++ b/src/settings/settings_tabs.ui
@@ -221,6 +221,13 @@
</property>
</widget>
</item>
+ <item>
+ <widget class="QCheckBox" name="kcfg_animatedTabHighlighting">
+ <property name="text">
+ <string>Animated tab highlighting</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
diff --git a/src/tabbar.cpp b/src/tabbar.cpp
index 118bba45..557fae96 100644
--- a/src/tabbar.cpp
+++ b/src/tabbar.cpp
@@ -70,12 +70,12 @@ static inline QByteArray highlightPropertyName(int index)
TabBar::TabBar(QWidget *parent)
- : KTabBar(parent)
- , m_actualIndex(-1)
- , m_currentTabPreviewIndex(-1)
- , m_isFirstTimeOnTab(true)
- , m_tabHighlightEffect(new TabHighlightEffect(this))
- , m_animationMapper(new QSignalMapper(this))
+ : KTabBar(parent)
+ , m_actualIndex(-1)
+ , m_currentTabPreviewIndex(-1)
+ , m_isFirstTimeOnTab(true)
+ , m_tabHighlightEffect(new TabHighlightEffect(this))
+ , m_animationMapper(new QSignalMapper(this))
{
setElideMode(Qt::ElideRight);
@@ -90,6 +90,8 @@ TabBar::TabBar(QWidget *parent)
connect(m_animationMapper, SIGNAL(mapped(int)), this, SLOT(removeAnimation(int)));
setGraphicsEffect(m_tabHighlightEffect);
+
+ setAnimatedTabHighlighting( ReKonfig::animatedTabHighlighting() );
}
@@ -361,7 +363,9 @@ void TabBar::tabRemoved(int index)
m_currentTabPreviewIndex = -1;
}
- removeAnimation(index);
+ if (ReKonfig::animatedTabHighlighting())
+ removeAnimation(index);
+
m_tabHighlightEffect->update();
}
@@ -420,19 +424,23 @@ void TabBar::setTabHighlighted(int index)
if (tabTextColor(index) != highlightColor)
{
- m_tabHighlightEffect->setProperty(propertyName, qreal(0.9));
- QPropertyAnimation *anim = new QPropertyAnimation(m_tabHighlightEffect, propertyName);
- m_highlightAnimation.insert(propertyName, anim);
-
- //setup the animation
- anim->setStartValue(0.9);
- anim->setEndValue(0.0);
- anim->setDuration(500);
- anim->setLoopCount(2);
- anim->start(QAbstractAnimation::DeleteWhenStopped);
-
- m_animationMapper->setMapping(anim, index);
- connect(anim, SIGNAL(finished()), m_animationMapper, SLOT(map()));
+ if (ReKonfig::animatedTabHighlighting)
+ {
+ m_tabHighlightEffect->setProperty(propertyName, qreal(0.9));
+ QPropertyAnimation *anim = new QPropertyAnimation(m_tabHighlightEffect, propertyName);
+ m_highlightAnimation.insert(propertyName, anim);
+
+ //setup the animation
+ anim->setStartValue(0.9);
+ anim->setEndValue(0.0);
+ anim->setDuration(500);
+ anim->setLoopCount(2);
+ anim->start(QAbstractAnimation::DeleteWhenStopped);
+
+ m_animationMapper->setMapping(anim, index);
+ connect(anim, SIGNAL(finished()), m_animationMapper, SLOT(map()));
+ }
+
setTabTextColor(index, highlightColor);
}
}
@@ -440,7 +448,9 @@ void TabBar::setTabHighlighted(int index)
void TabBar::resetTabHighlighted(int index)
{
- removeAnimation(index);
+ if (ReKonfig::animatedTabHighlighting())
+ removeAnimation(index);
+
setTabTextColor(index, palette().text().color());
}
@@ -454,3 +464,26 @@ void TabBar::removeAnimation(int index)
m_animationMapper->removeMappings(anim);
delete anim;
}
+
+
+void TabBar::setAnimatedTabHighlighting(bool enabled)
+{
+ if (enabled)
+ m_tabHighlightEffect->setEnabled(true);
+ else
+ {
+ m_tabHighlightEffect->setEnabled(false);
+
+ //cleanup
+ QHashIterator<QByteArray, QPropertyAnimation*> i(m_highlightAnimation);
+ while (i.hasNext())
+ {
+ i.next();
+ m_tabHighlightEffect->setProperty(i.key(), QVariant()); //destroy the property
+
+ QPropertyAnimation *anim = m_highlightAnimation.take(i.key());
+ m_animationMapper->removeMappings(anim);
+ delete anim;
+ }
+ }
+}
diff --git a/src/tabbar.h b/src/tabbar.h
index 58516f14..0137065d 100644
--- a/src/tabbar.h
+++ b/src/tabbar.h
@@ -61,6 +61,7 @@ public:
void setTabHighlighted(int index);
void resetTabHighlighted(int index);
QRect tabTextRect(int index);
+ void setAnimatedTabHighlighting(bool enabled);
signals:
void cloneTab(int index);