1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Use palette colors for indicating not yet loaded tabs.

Also fixed compile issue from previous commit.
This commit is contained in:
nowrep 2013-06-18 11:03:52 +02:00
parent fb6114eb5b
commit 99b35a19b5
4 changed files with 27 additions and 5 deletions

View File

@ -480,6 +480,20 @@ QTabBar::ButtonPosition TabBar::closeButtonPosition()
return (QTabBar::ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, this);
}
void TabBar::overrideTabTextColor(int index, QColor color)
{
if (!m_originalTabTextColor.isValid()) {
m_originalTabTextColor = tabTextColor(index);
}
setTabTextColor(index, color);
}
void TabBar::restoreTabTextColor(int index)
{
setTabTextColor(index, m_originalTabTextColor);
}
void TabBar::showTabPreview()
{
WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(m_tabPreview->previewIndex()));

View File

@ -45,6 +45,9 @@ public:
QTabBar::ButtonPosition iconButtonPosition();
QTabBar::ButtonPosition closeButtonPosition();
void overrideTabTextColor(int index, QColor color);
void restoreTabTextColor(int index);
void updatePinnedTabCloseButton(int index);
void disconnectObjects();
@ -119,6 +122,7 @@ private:
mutable int m_normalTabWidth;
mutable int m_activeTabWidth;
QColor m_originalTabTextColor;
QRect m_originalGeometry;
QPoint m_dragStartPosition;
};

View File

@ -55,7 +55,7 @@ class QT_QUPZILLA_EXPORT MenuTabs : public QMenu
{
Q_OBJECT
public:
explicit MenuTabs(QWidget *parent = 0) : QMenu(parent) {}
explicit MenuTabs(QWidget* parent = 0) : QMenu(parent) {}
signals:
void closeTab(int);

View File

@ -261,6 +261,7 @@ bool WebTab::isRestored() const
return m_savedTab.isEmpty();
}
#include <QDebug>
void WebTab::restoreTab(const WebTab::SavedTab &tab)
{
if (qzSettings->loadTabsOnActivation) {
@ -269,11 +270,13 @@ void WebTab::restoreTab(const WebTab::SavedTab &tab)
m_view->tabWidget()->setTabIcon(index, tab.icon);
m_view->tabWidget()->setTabText(index, tab.title);
if (! tab.url.isEmpty()) {
m_view->tabWidget()->tabBar()->setTabTextColor(index, QColor(100, 100, 100));
}
m_view->tabWidget()->setTabToolTip(index, tab.title);
m_locationBar.data()->showUrl(tab.url);
if (!tab.url.isEmpty()) {
QColor col = m_view->tabWidget()->getTabBar()->palette().text().color();
m_view->tabWidget()->getTabBar()->overrideTabTextColor(index, col.lighter(250));
}
}
else {
p_restoreTab(tab);
@ -346,8 +349,9 @@ void WebTab::showNotification(QWidget* notif)
void WebTab::slotRestore()
{
p_restoreTab(m_savedTab);
m_view->tabWidget()->tabBar()->setTabTextColor(tabIndex(), QColor(0, 0, 0));
m_savedTab.clear();
m_view->tabWidget()->getTabBar()->restoreTabTextColor(tabIndex());
}
int WebTab::tabIndex() const