BrowsingLibrary: Use new icons for bookmarks and history tabs

Also fix HighDPI rendering
remotes/origin/falkon
David Rosca 9 years ago
parent 5c435fe638
commit a69e0d7a43
  1. 40
      src/lib/3rdparty/fancytabwidget.cpp
  2. 2
      src/lib/3rdparty/fancytabwidget.h
  3. 22
      src/lib/3rdparty/stylehelper.cpp
  4. 1
      src/lib/bookmarks/bookmarkswidget.cpp
  5. 14
      src/lib/bookmarks/bookmarkswidget.ui
  6. 6
      src/lib/data/icons.qrc
  7. 22
      src/lib/data/icons/other/bighistory-selected.svg
  8. BIN
      src/lib/data/icons/other/bighistory.png
  9. 22
      src/lib/data/icons/other/bighistory.svg
  10. 14
      src/lib/data/icons/other/bigstar-selected.svg
  11. BIN
      src/lib/data/icons/other/bigstar.png
  12. 14
      src/lib/data/icons/other/bigstar.svg
  13. 12
      src/lib/other/browsinglibrary.cpp

@ -121,7 +121,6 @@ void FancyTabProxyStyle::drawControl(
int textFlags = Qt::AlignHCenter | Qt::AlignVCenter;
p->drawText(text_rect, textFlags, text);
p->setPen(selected ? QColor(60, 60, 60) : Utils::StyleHelper::panelTextColor());
#if 0
if (widget) {
const QString fader_key = "tab_" + text + "_fader";
const QString animation_key = "tab_" + text + "_animation";
@ -158,20 +157,15 @@ void FancyTabProxyStyle::drawControl(
if (!selected) {
p->save();
QLinearGradient grad(draw_rect.topLeft(), vertical_tabs ? draw_rect.bottomLeft() : draw_rect.topRight());
grad.setColorAt(0, Qt::transparent);
grad.setColorAt(0.5, QColor(255, 255, 255, fader));
grad.setColorAt(1, Qt::transparent);
p->fillRect(draw_rect, grad);
p->setPen(QPen(grad, 1.0));
p->fillRect(draw_rect, QColor(255, 255, 255, fader));
p->setPen(QPen(QColor(255, 255, 255, fader), 1.0));
p->drawLine(draw_rect.topLeft(), vertical_tabs ? draw_rect.bottomLeft() : draw_rect.topRight());
p->drawLine(draw_rect.bottomRight(), vertical_tabs ? draw_rect.topRight() : draw_rect.bottomLeft());
p->restore();
}
}
#endif
Utils::StyleHelper::drawIconWithShadow(v_opt->icon, icon_rect, p, QIcon::Normal);
Utils::StyleHelper::drawIconWithShadow(v_opt->icon, icon_rect, p, selected ? QIcon::Selected : QIcon::Normal);
p->drawText(text_rect.translated(0, -1), textFlags, text);
@ -217,25 +211,25 @@ bool FancyTabProxyStyle::eventFilter(QObject* o, QEvent* e)
FancyTab::FancyTab(QWidget* tabbar)
: QWidget(tabbar), tabbar(tabbar), m_fader(0)
{
// animator.setPropertyName("fader");
// animator.setTargetObject(this);
animator.setPropertyName("fader");
animator.setTargetObject(this);
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
}
void FancyTab::fadeIn()
{
// animator.stop();
// animator.setDuration(80);
// animator.setEndValue(40);
// animator.start();
animator.stop();
animator.setDuration(80);
animator.setEndValue(40);
animator.start();
}
void FancyTab::fadeOut()
{
// animator.stop();
// animator.setDuration(160);
// animator.setEndValue(0);
// animator.start();
animator.stop();
animator.setDuration(160);
animator.setEndValue(0);
animator.start();
}
void FancyTab::setFader(float value)
@ -443,8 +437,10 @@ void FancyTabBar::paintTab(QPainter* painter, int tabIndex) const
grad.setColorAt(0, Qt::transparent);
grad.setColorAt(0.5, QColor(255, 255, 255, fader));
grad.setColorAt(1, Qt::transparent);
painter->fillRect(rect, grad);
painter->setPen(QPen(grad, 1.0));
// painter->fillRect(rect, grad);
// painter->setPen(QPen(grad, 1.0));
painter->fillRect(rect, QColor(255, 255, 255, fader));
painter->setPen(QPen(QColor(255, 255, 255, fader), 1.0));
painter->drawLine(rect.topLeft(), rect.topRight());
painter->drawLine(rect.bottomLeft(), rect.bottomRight());
painter->restore();
@ -453,7 +449,7 @@ void FancyTabBar::paintTab(QPainter* painter, int tabIndex) const
const int textHeight = painter->fontMetrics().height();
tabIconRect.adjust(0, 4, 0, -textHeight);
Utils::StyleHelper::drawIconWithShadow(tabIcon(tabIndex), tabIconRect, painter, QIcon::Normal);
Utils::StyleHelper::drawIconWithShadow(tabIcon(tabIndex), tabIconRect, painter, selected ? QIcon::Selected : QIcon::Normal);
painter->translate(0, -1);
painter->drawText(tabTextRect, textFlags, tabText);

@ -37,6 +37,7 @@
#include <QTabBar>
#include <QTimer>
#include <QWidget>
#include <QPropertyAnimation>
class QActionGroup;
class QMenu;
@ -89,6 +90,7 @@ protected:
void leaveEvent(QEvent*);
private:
QPropertyAnimation animator;
QWidget* tabbar;
float m_fader;
};

@ -184,27 +184,17 @@ void StyleHelper::drawIconWithShadow(const QIcon &icon, const QRect &rect,
QString pixmapName = QString("icon %0 %1 %2").arg(icon.cacheKey()).arg(iconMode).arg(rect.height());
if (!QPixmapCache::find(pixmapName, cache)) {
QPixmap px = icon.pixmap(rect.size());
QPixmap px = icon.pixmap(rect.size(), iconMode);
px.setDevicePixelRatio(qApp->devicePixelRatio());
cache = QPixmap(px.size() + QSize(radius * 2, radius * 2));
cache.setDevicePixelRatio(px.devicePixelRatioF());
cache.fill(Qt::transparent);
QPainter cachePainter(&cache);
if (iconMode == QIcon::Disabled) {
QImage im = px.toImage().convertToFormat(QImage::Format_ARGB32);
for (int y = 0; y < im.height(); ++y) {
QRgb* scanLine = (QRgb*)im.scanLine(y);
for (int x = 0; x < im.width(); ++x) {
QRgb pixel = *scanLine;
char intensity = qGray(pixel);
*scanLine = qRgba(intensity, intensity, intensity, qAlpha(pixel));
++scanLine;
}
}
px = QPixmap::fromImage(im);
}
// Draw shadow
QImage tmp(px.size() + QSize(radius * 2, radius * 2 + 1), QImage::Format_ARGB32_Premultiplied);
tmp.setDevicePixelRatio(px.devicePixelRatioF());
tmp.fill(Qt::transparent);
QPainter tmpPainter(&tmp);
@ -233,7 +223,7 @@ void StyleHelper::drawIconWithShadow(const QIcon &icon, const QRect &rect,
tmpPainter.end();
// draw the blurred drop shadow...
cachePainter.drawImage(QRect(0, 0, cache.rect().width(), cache.rect().height()), tmp);
cachePainter.drawImage(QRect(0, 0, cache.rect().width() / cache.devicePixelRatioF(), cache.rect().height() / cache.devicePixelRatioF()), tmp);
// Draw the actual pixmap...
cachePainter.drawPixmap(QPoint(radius, radius) + offset, px);
@ -241,6 +231,8 @@ void StyleHelper::drawIconWithShadow(const QIcon &icon, const QRect &rect,
}
QRect targetRect = cache.rect();
targetRect.setWidth(cache.rect().width() / cache.devicePixelRatioF());
targetRect.setHeight(cache.rect().height() / cache.devicePixelRatioF());
targetRect.moveCenter(rect.center());
p->drawPixmap(targetRect.topLeft() - offset, cache);
}

@ -39,6 +39,7 @@ BookmarksWidget::BookmarksWidget(WebView* view, BookmarkItem* bookmark, QWidget*
, m_edited(false)
{
ui->setupUi(this);
ui->bookmarksButton->setIcon(QIcon::fromTheme(QSL("bookmark-new")));
init();
}

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>167</width>
<height>89</height>
<height>123</height>
</rect>
</property>
<property name="windowTitle">
@ -17,11 +17,7 @@
<item row="1" column="0">
<widget class="QPushButton" name="bookmarksButton">
<property name="text">
<string>Add to bookmarks</string>
</property>
<property name="icon">
<iconset resource="../data/icons.qrc">
<normaloff>:/icons/other/bigstar.png</normaloff>:/icons/other/bigstar.png</iconset>
<string>Add to Bookmarks</string>
</property>
<property name="flat">
<bool>true</bool>
@ -37,7 +33,7 @@
<string>Add to Speed Dial</string>
</property>
<property name="icon">
<iconset resource="../data/icons.qrc">
<iconset>
<normaloff>:/icons/theme/speeddial.png</normaloff>:/icons/theme/speeddial.png</iconset>
</property>
<property name="flat">
@ -57,8 +53,6 @@
<header>bookmarkstools.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../data/icons.qrc"/>
</resources>
<resources/>
<connections/>
</ui>

@ -13,7 +13,8 @@
<file>icons/menu/window-new.svg</file>
<file>icons/other/about.png</file>
<file>icons/other/about@2x.png</file>
<file>icons/other/bigstar.png</file>
<file>icons/other/bigstar.svg</file>
<file>icons/other/bigstar-selected.svg</file>
<file>icons/locationbar/safe.png</file>
<file>icons/locationbar/unsafe.png</file>
<file>icons/locationbar/visit1.png</file>
@ -25,7 +26,8 @@
<file>icons/preferences/document-properties.png</file>
<file>icons/other/adblock.png</file>
<file>icons/other/download.svg</file>
<file>icons/other/bighistory.png</file>
<file>icons/other/bighistory.svg</file>
<file>icons/other/bighistory-selected.svg</file>
<file>icons/preferences/style-default.png</file>
<file>icons/other/adblock-disabled.png</file>
<file>icons/menu/search-icon.svg</file>

@ -0,0 +1,22 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#4d4d4d;
}
.ColorScheme-Highlight {
color:#3daee9;
}
</style>
</defs>
<path
style="fill:currentColor;fill-opacity:1;stroke:none"
d="m11 3c-4.431998 0-8 3.568002-8 8 0 4.431998 3.568002 8 8 8 1.896399 0 3.632791-.656291 5-1.751953v-1.248047h-.09375c-1.261408 1.237774-2.99118 2-4.90625 2-3.877999 0-7-3.122001-7-7 0-3.877999 3.122001-7 7-7 3.877999 0 7 3.122001 7 7 0 .696167-.105435 1.366247-.292969 2h1.033203c.163714-.639651.259766-1.307916.259766-2 0-4.431998-3.568002-8-8-8m-1 2v7h1 5v-1h-5v-6h-1"
class="ColorScheme-Text"
/>
<path
style="fill:currentColor;fill-opacity:1;stroke:none"
d="m13.65625 14v1h.845703 1.998047a1.5 1.5 0 0 1 1.5 1.5 1.5 1.5 0 0 1 -1.5 1.5v1a2.5 2.5 0 0 0 2.5 -2.5 2.5 2.5 0 0 0 -2.5 -2.5h-2.84375"
class="ColorScheme-Highlight"
id="path10" />
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

@ -0,0 +1,22 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#ffffff;
}
.ColorScheme-Highlight {
color:#3daee9;
}
</style>
</defs>
<path
style="fill:currentColor;fill-opacity:1;stroke:none"
d="m11 3c-4.431998 0-8 3.568002-8 8 0 4.431998 3.568002 8 8 8 1.896399 0 3.632791-.656291 5-1.751953v-1.248047h-.09375c-1.261408 1.237774-2.99118 2-4.90625 2-3.877999 0-7-3.122001-7-7 0-3.877999 3.122001-7 7-7 3.877999 0 7 3.122001 7 7 0 .696167-.105435 1.366247-.292969 2h1.033203c.163714-.639651.259766-1.307916.259766-2 0-4.431998-3.568002-8-8-8m-1 2v7h1 5v-1h-5v-6h-1"
class="ColorScheme-Text"
/>
<path
style="fill:currentColor;fill-opacity:1;stroke:none"
d="m13.65625 14v1h.845703 1.998047a1.5 1.5 0 0 1 1.5 1.5 1.5 1.5 0 0 1 -1.5 1.5v1a2.5 2.5 0 0 0 2.5 -2.5 2.5 2.5 0 0 0 -2.5 -2.5h-2.84375"
class="ColorScheme-Highlight"
id="path10" />
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

@ -0,0 +1,14 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#4d4d4d;
}
</style>
</defs>
<path
style="fill:currentColor;fill-opacity:1;stroke:none"
d="M 12,4 9.5273438,9.2675781 4,10.111328 8,14.210938 7.0566406,20 12,17.267578 16.943359,20 16,14.210938 20,10.111328 14.472656,9.2675781 12,4 Z M 12,6 13.853516,9.9492188 18,10.583984 15,13.658203 15.708984,18 12,15.949219 8.2910156,18 9,13.658203 6,10.583984 10.146484,9.9492188 12,6 Z" transform="translate(-.99999-.99999)"
class="ColorScheme-Text"
/>
</svg>

After

Width:  |  Height:  |  Size: 674 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

@ -0,0 +1,14 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#ffffff;
}
</style>
</defs>
<path
style="fill:currentColor;fill-opacity:1;stroke:none"
d="M 12,4 9.5273438,9.2675781 4,10.111328 8,14.210938 7.0566406,20 12,17.267578 16.943359,20 16,14.210938 20,10.111328 14.472656,9.2675781 12,4 Z M 12,6 13.853516,9.9492188 18,10.583984 15,13.658203 15.708984,18 12,15.949219 8.2910156,18 9,13.658203 6,10.583984 10.146484,9.9492188 12,6 Z" transform="translate(-.99999-.99999)"
class="ColorScheme-Text"
/>
</svg>

After

Width:  |  Height:  |  Size: 674 B

@ -44,8 +44,16 @@ BrowsingLibrary::BrowsingLibrary(BrowserWindow* window, QWidget* parent)
QzTools::centerWidgetOnScreen(this);
ui->tabs->AddTab(m_historyManager, QIcon(":/icons/other/bighistory.png"), tr("History"));
ui->tabs->AddTab(m_bookmarksManager, QIcon(":/icons/other/bigstar.png"), tr("Bookmarks"));
QIcon historyIcon;
historyIcon.addFile(QSL(":/icons/other/bighistory.svg"), QSize(), QIcon::Normal);
historyIcon.addFile(QSL(":/icons/other/bighistory-selected.svg"), QSize(), QIcon::Selected);
QIcon bookmarksIcon;
bookmarksIcon.addFile(QSL(":/icons/other/bigstar.svg"), QSize(), QIcon::Normal);
bookmarksIcon.addFile(QSL(":/icons/other/bigstar-selected.svg"), QSize(), QIcon::Selected);
ui->tabs->AddTab(m_historyManager, historyIcon, tr("History"));
ui->tabs->AddTab(m_bookmarksManager, bookmarksIcon, tr("Bookmarks"));
ui->tabs->SetMode(FancyTabWidget::Mode_LargeSidebar);
ui->tabs->setFocus();

Loading…
Cancel
Save