summaryrefslogtreecommitdiff
path: root/src/tabbar.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2011-07-17 16:46:24 +0200
committerAndrea Diamantini <adjam7@gmail.com>2011-07-17 16:46:24 +0200
commit82167d2422a4b6e3071dca68cf65a66e1da41ab4 (patch)
tree03c1f95a2aa60c48822a463cc3812b5c3415991e /src/tabbar.cpp
parentImproving tab previews (diff)
downloadrekonq-82167d2422a4b6e3071dca68cf65a66e1da41ab4.tar.xz
A round of the "new" astyle 2.01...
Diffstat (limited to 'src/tabbar.cpp')
-rw-r--r--src/tabbar.cpp80
1 files changed, 40 insertions, 40 deletions
diff --git a/src/tabbar.cpp b/src/tabbar.cpp
index 1b2dcb2b..edcb3a9c 100644
--- a/src/tabbar.cpp
+++ b/src/tabbar.cpp
@@ -83,12 +83,12 @@ TabBar::TabBar(QWidget *parent)
connect(this, SIGNAL(contextMenu(int, const QPoint &)), this, SLOT(contextMenu(int, const QPoint &)));
connect(this, SIGNAL(emptyAreaContextMenu(const QPoint &)), this, SLOT(emptyAreaContextMenu(const QPoint &)));
- connect(this, SIGNAL(tabMoved(int,int)), this, SLOT(tabMoved(int,int)));
+ connect(this, SIGNAL(tabMoved(int, int)), this, SLOT(tabMoved(int, int)));
connect(m_animationMapper, SIGNAL(mapped(int)), this, SLOT(removeAnimation(int)));
setGraphicsEffect(m_tabHighlightEffect);
- setAnimatedTabHighlighting( ReKonfig::animatedTabHighlighting() );
+ setAnimatedTabHighlighting(ReKonfig::animatedTabHighlighting());
}
@@ -102,13 +102,13 @@ QSize TabBar::tabSizeHint(int index) const
int minWidth = view->sizeHint().width() / minWidthDivisor;
int w;
- if (baseWidth*count() < tabBarWidth)
+ if(baseWidth * count() < tabBarWidth)
{
w = baseWidth;
}
else
{
- if (count() > 0 && tabBarWidth / count() > minWidth)
+ if(count() > 0 && tabBarWidth / count() > minWidth)
{
w = tabBarWidth / count();
}
@@ -162,7 +162,7 @@ void TabBar::detachTab()
void TabBar::showTabPreview()
{
- if (m_isFirstTimeOnTab)
+ if(m_isFirstTimeOnTab)
m_isFirstTimeOnTab = false;
//delete previous tab preview
@@ -175,25 +175,25 @@ void TabBar::showTabPreview()
WebTab *currentTab = mv->webTab(currentIndex());
// check if view && currentView exist before using them :)
- if (!currentTab || !indexedTab)
+ if(!currentTab || !indexedTab)
return;
// no previews during load
- if (indexedTab->isPageLoading())
+ if(indexedTab->isPageLoading())
return;
int w = (mv->sizeHint().width() / baseWidthDivisor);
- m_previewPopup = new TabPreviewPopup(indexedTab ,this);
+ m_previewPopup = new TabPreviewPopup(indexedTab , this);
int tabBarWidth = mv->size().width();
- int leftIndex = tabRect(m_currentTabPreviewIndex).x() + (tabRect(m_currentTabPreviewIndex).width() - w)/2;
+ int leftIndex = tabRect(m_currentTabPreviewIndex).x() + (tabRect(m_currentTabPreviewIndex).width() - w) / 2;
- if (leftIndex < 0)
+ if(leftIndex < 0)
{
leftIndex = 0;
}
- else if (leftIndex + w > tabBarWidth)
+ else if(leftIndex + w > tabBarWidth)
{
leftIndex = tabBarWidth - w;
}
@@ -205,7 +205,7 @@ void TabBar::showTabPreview()
void TabBar::hideEvent(QHideEvent *event)
{
- if (!event->spontaneous())
+ if(!event->spontaneous())
{
qobject_cast<MainView *>(parent())->addTabButton()->hide();
}
@@ -216,7 +216,7 @@ void TabBar::hideEvent(QHideEvent *event)
void TabBar::showEvent(QShowEvent *event)
{
KTabBar::showEvent(event);
- if (!event->spontaneous())
+ if(!event->spontaneous())
{
qobject_cast<MainView *>(parent())->addTabButton()->show();
}
@@ -225,24 +225,24 @@ void TabBar::showEvent(QShowEvent *event)
void TabBar::mouseMoveEvent(QMouseEvent *event)
{
- if (count() == 1)
+ if(count() == 1)
{
return;
}
KTabBar::mouseMoveEvent(event);
- if (ReKonfig::hoveringTabOption() == 0)
+ if(ReKonfig::hoveringTabOption() == 0)
{
//Find the tab under the mouse
const int tabIndex = tabAt(event->pos());
// if found and not the current tab then show tab preview
- if (tabIndex != -1
+ if(tabIndex != -1
&& tabIndex != currentIndex()
&& m_currentTabPreviewIndex != tabIndex
&& event->buttons() == Qt::NoButton
- )
+ )
{
m_currentTabPreviewIndex = tabIndex;
@@ -253,9 +253,9 @@ void TabBar::mouseMoveEvent(QMouseEvent *event)
}
// if current tab or not found then hide previous tab preview
- if (tabIndex == currentIndex() || tabIndex == -1)
+ if(tabIndex == currentIndex() || tabIndex == -1)
{
- if (!m_previewPopup.isNull())
+ if(!m_previewPopup.isNull())
{
m_previewPopup.data()->hide();
}
@@ -267,10 +267,10 @@ void TabBar::mouseMoveEvent(QMouseEvent *event)
void TabBar::leaveEvent(QEvent *event)
{
- if (ReKonfig::hoveringTabOption() == 0)
+ if(ReKonfig::hoveringTabOption() == 0)
{
//if leave tabwidget then hide previous tab preview
- if (!m_previewPopup.isNull())
+ if(!m_previewPopup.isNull())
{
m_previewPopup.data()->hide();
}
@@ -284,9 +284,9 @@ void TabBar::leaveEvent(QEvent *event)
void TabBar::mousePressEvent(QMouseEvent *event)
{
- if (ReKonfig::hoveringTabOption() == 0)
+ if(ReKonfig::hoveringTabOption() == 0)
{
- if (!m_previewPopup.isNull())
+ if(!m_previewPopup.isNull())
{
m_previewPopup.data()->hide();
}
@@ -294,7 +294,7 @@ void TabBar::mousePressEvent(QMouseEvent *event)
}
// just close tab on middle mouse click
- if (event->button() == Qt::MidButton)
+ if(event->button() == Qt::MidButton)
return;
KTabBar::mousePressEvent(event);
@@ -319,7 +319,7 @@ void TabBar::contextMenu(int tab, const QPoint &pos)
menu.addAction(mainWindow->actionByName(QL1S("new_tab")));
menu.addAction(mainWindow->actionByName(QL1S("clone_tab")));
- if (count() > 1)
+ if(count() > 1)
menu.addAction(mainWindow->actionByName(QL1S("detach_tab")));
menu.addAction(mainWindow->actionByName(QL1S("open_last_closed_tab")));
menu.addAction(mainWindow->actionByName(QL1S("closed_tab_menu")));
@@ -348,7 +348,7 @@ void TabBar::emptyAreaContextMenu(const QPoint &pos)
menu.addAction(mainWindow->actionByName(QL1S("reload_all_tabs")));
KToolBar *mainBar = mainWindow->toolBar("mainToolBar");
- if (!mainBar->isVisible())
+ if(!mainBar->isVisible())
{
menu.addAction(mainBar->toggleViewAction());
}
@@ -359,16 +359,16 @@ void TabBar::emptyAreaContextMenu(const QPoint &pos)
void TabBar::tabRemoved(int index)
{
- if (ReKonfig::hoveringTabOption() == 0)
+ if(ReKonfig::hoveringTabOption() == 0)
{
- if (!m_previewPopup.isNull())
+ if(!m_previewPopup.isNull())
{
m_previewPopup.data()->hide();
}
m_currentTabPreviewIndex = -1;
}
- if (ReKonfig::animatedTabHighlighting())
+ if(ReKonfig::animatedTabHighlighting())
removeAnimation(index);
}
@@ -383,19 +383,19 @@ void TabBar::setupHistoryActions()
// update closed tabs menu
KActionMenu *am = qobject_cast<KActionMenu *>(w->actionByName(QL1S("closed_tab_menu")));
- if (!am)
+ if(!am)
return;
bool isEnabled = (mv->recentlyClosedTabs().size() > 0);
am->setEnabled(isEnabled);
- if (am->menu())
+ if(am->menu())
am->menu()->clear();
- if (!isEnabled)
+ if(!isEnabled)
return;
- Q_FOREACH(const HistoryItem &item, mv->recentlyClosedTabs())
+ Q_FOREACH(const HistoryItem & item, mv->recentlyClosedTabs())
{
KAction *a = new KAction(rApp->iconManager()->iconForUrl(item.url), item.title, this);
a->setData(item.url);
@@ -418,9 +418,9 @@ void TabBar::setTabHighlighted(int index)
const QByteArray propertyName = highlightPropertyName(index);
const QColor highlightColor = KColorScheme(QPalette::Active, KColorScheme::Window).foreground(KColorScheme::PositiveText).color();
- if (tabTextColor(index) != highlightColor)
+ if(tabTextColor(index) != highlightColor)
{
- if (ReKonfig::animatedTabHighlighting())
+ if(ReKonfig::animatedTabHighlighting())
{
m_tabHighlightEffect->setEnabled(true);
m_tabHighlightEffect->setProperty(propertyName, qreal(0.9));
@@ -437,7 +437,7 @@ void TabBar::setTabHighlighted(int index)
m_animationMapper->setMapping(anim, index);
connect(anim, SIGNAL(finished()), m_animationMapper, SLOT(map()));
}
-
+
setTabTextColor(index, highlightColor);
}
}
@@ -445,7 +445,7 @@ void TabBar::setTabHighlighted(int index)
void TabBar::resetTabHighlighted(int index)
{
- if (ReKonfig::animatedTabHighlighting())
+ if(ReKonfig::animatedTabHighlighting())
removeAnimation(index);
setTabTextColor(index, palette().text().color());
@@ -461,14 +461,14 @@ void TabBar::removeAnimation(int index)
m_animationMapper->removeMappings(anim);
delete anim;
- if (m_highlightAnimation.isEmpty())
+ if(m_highlightAnimation.isEmpty())
m_tabHighlightEffect->setEnabled(false);
}
void TabBar::setAnimatedTabHighlighting(bool enabled)
{
- if (enabled)
+ if(enabled)
m_tabHighlightEffect->setEnabled(true);
else
{
@@ -476,7 +476,7 @@ void TabBar::setAnimatedTabHighlighting(bool enabled)
//cleanup
QHashIterator<QByteArray, QPropertyAnimation*> i(m_highlightAnimation);
- while (i.hasNext())
+ while(i.hasNext())
{
i.next();
m_tabHighlightEffect->setProperty(i.key(), QVariant()); //destroy the property