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

[Fix:] Fixes invalid icons in Linux theme on some systems.

- using now fallback icons (Faenza) when QIcon::fromTheme returns
  invalid icon, occurs for example on LXDE
- also setting default width for locationbar and websearchbar rather
  then counting it from available space. This used to have problems on
  some systems, thus making websearchbar too big.
This commit is contained in:
nowrep 2011-12-03 11:27:53 +01:00
parent b1083226b8
commit 2aedf3bef6
12 changed files with 43 additions and 28 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 667 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 619 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 993 B

View File

@ -26,6 +26,7 @@
#navigation-button-back
{
qproperty-themeIcon: "go-previous";
qproperty-fallbackIcon: url(images/go-previous.png);
}
#navigation-button-back::menu-indicator
@ -36,6 +37,7 @@
#navigation-button-next
{
qproperty-themeIcon: "go-next";
qproperty-fallbackIcon: url(images/go-next.png);
}
#navigation-button-next::menu-indicator
@ -46,26 +48,31 @@
#navigation-button-stop
{
qproperty-themeIcon: "process-stop";
qproperty-fallbackIcon: url(images/process-stop.png);
}
#navigation-button-reload
{
qproperty-themeIcon: "view-refresh";
qproperty-fallbackIcon: url(images/view-refresh.png);
}
#navigation-button-home
{
qproperty-themeIcon: "go-home";
qproperty-fallbackIcon: url(images/go-home.png);
}
#navigation-button-addtab
{
qproperty-themeIcon: "list-add";
qproperty-fallbackIcon: url(images/list-add.png);
}
#navigation-button-supermenu
{
qproperty-themeIcon: "preferences-desktop";
qproperty-fallbackIcon: url(images/preferences-desktop.png);
}
/*TabWidget*/
@ -88,6 +95,7 @@
#tabwidget-button-addtab
{
qproperty-themeIcon: "list-add";
qproperty-fallbackIcon: url(images/list-add.png);
qproperty-fixedsize: 22px 25px;
}

View File

@ -215,8 +215,8 @@ void QupZilla::setupUi()
}
}
locationBarWidth = settings.value("LocationBarWidth", 0).toInt();
websearchBarWidth = settings.value("WebSearchBarWidth", 0).toInt();
locationBarWidth = settings.value("LocationBarWidth", 480).toInt();
websearchBarWidth = settings.value("WebSearchBarWidth", 140).toInt();
QWidget* widget = new QWidget(this);
setCentralWidget(widget);

View File

@ -176,31 +176,27 @@ QPixmap IconProvider::standardPixmap(QStyle::StandardPixmap icon)
QIcon IconProvider::fromTheme(const QString &icon)
{
#ifdef Q_WS_X11
return QIcon::fromTheme(icon);
#else
if (icon == "go-home") {
return QIcon(":/icons/faenza/home.png");
return QIcon::fromTheme("go-home", QIcon(":/icons/faenza/home.png"));
}
else if (icon == "text-plain") {
return QIcon(":icons/locationbar/unknownpage.png");
return QIcon::fromTheme("text-plain", QIcon(":icons/locationbar/unknownpage.png"));
}
else if (icon == "user-bookmarks") {
return QIcon(":icons/faenza/user-bookmarks.png");
return QIcon::fromTheme("user-bookmarks", QIcon(":icons/faenza/user-bookmarks.png"));
}
else if (icon == "list-remove") {
return QIcon(":icons/faenza/list-remove.png");
return QIcon::fromTheme("list-remove", QIcon(":icons/faenza/list-remove.png"));
}
else if (icon == "go-next") {
return QIcon(":icons/faenza/go-next.png");
return QIcon::fromTheme("go-next", QIcon(":icons/faenza/go-next.png"));
}
else if (icon == "go-previous") {
return QIcon(":icons/faenza/go-previous.png");
return QIcon::fromTheme("go-previous", QIcon(":icons/faenza/go-previous.png"));
}
else {
return QIcon();
return QIcon::fromTheme(icon);
}
#endif
}
QIcon IconProvider::iconFromBase64(const QByteArray &data)

View File

@ -23,21 +23,29 @@ ToolButton::ToolButton(QWidget* parent)
{
}
void ToolButton::setThemeIcon(const QString &icon)
void ToolButton::setThemeIcon(const QString &image)
{
m_themeIcon = icon;
setIcon(QIcon::fromTheme(icon));
m_themeIcon = image;
setIcon(QIcon::fromTheme(image));
m_usingMultiIcon = false;
}
void ToolButton::setIcon(const QIcon &icon)
void ToolButton::setFallbackIcon(const QIcon &image)
{
if (icon().isNull()) {
setIcon(image);
m_usingMultiIcon = false;
}
}
void ToolButton::setIcon(const QIcon &image)
{
if (m_usingMultiIcon) {
setFixedSize(sizeHint());
}
m_usingMultiIcon = false;
QToolButton::setIcon(icon);
QToolButton::setIcon(image);
}
void ToolButton::setData(const QVariant &data)
@ -50,15 +58,15 @@ QVariant ToolButton::data()
return m_data;
}
void ToolButton::setMultiIcon(const QPixmap &icon)
void ToolButton::setMultiIcon(const QPixmap &image)
{
int w = icon.width();
int h = icon.height();
int w = image.width();
int h = image.height();
m_normalIcon = icon.copy(0, 0, w, h / 4);
m_hoverIcon = icon.copy(0, h / 4, w, h / 4);
m_activeIcon = icon.copy(0, h / 2, w, h / 4);
m_disabledIcon = icon.copy(0, 3 * h / 4, w, h / 4);
m_normalIcon = image.copy(0, 0, w, h / 4);
m_hoverIcon = image.copy(0, h / 4, w, h / 4);
m_activeIcon = image.copy(0, h / 2, w, h / 4);
m_disabledIcon = image.copy(0, 3 * h / 4, w, h / 4);
m_usingMultiIcon = true;

View File

@ -33,6 +33,7 @@ class ToolButton : public QToolButton
Q_PROPERTY(QPixmap multiIcon READ pixmap WRITE setMultiIcon)
Q_PROPERTY(QIcon icon READ icon WRITE setIcon)
Q_PROPERTY(QString themeIcon READ themeIcon WRITE setThemeIcon)
Q_PROPERTY(QIcon fallbackIcon READ icon WRITE setFallbackIcon)
public:
explicit ToolButton(QWidget* parent = 0);
@ -40,13 +41,15 @@ public:
void setData(const QVariant &data);
QVariant data();
void setMultiIcon(const QPixmap &icon);
void setMultiIcon(const QPixmap &image);
QPixmap pixmap() { return m_normalIcon; }
void setThemeIcon(const QString &icon);
void setThemeIcon(const QString &image);
QString themeIcon() { return m_themeIcon; }
void setIcon(const QIcon &icon);
void setFallbackIcon(const QIcon &image);
void setIcon(const QIcon &image);
signals:
void middleMouseClicked();