mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
Another HighDPI icons fixes
This commit is contained in:
parent
e21636c661
commit
9a356a61d5
@ -25,6 +25,7 @@
|
|||||||
#include "tabbedwebview.h"
|
#include "tabbedwebview.h"
|
||||||
#include "tabwidget.h"
|
#include "tabwidget.h"
|
||||||
#include "desktopnotificationsfactory.h"
|
#include "desktopnotificationsfactory.h"
|
||||||
|
#include "qztools.h"
|
||||||
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
@ -39,7 +40,7 @@ AdBlockIcon::AdBlockIcon(BrowserWindow* window, QWidget* parent)
|
|||||||
{
|
{
|
||||||
setCursor(Qt::PointingHandCursor);
|
setCursor(Qt::PointingHandCursor);
|
||||||
setToolTip(tr("AdBlock lets you block unwanted content on web pages"));
|
setToolTip(tr("AdBlock lets you block unwanted content on web pages"));
|
||||||
setMinimumSize(16, 16);
|
setFixedSize(16, 16);
|
||||||
|
|
||||||
connect(this, SIGNAL(clicked(QPoint)), this, SLOT(showMenu(QPoint)));
|
connect(this, SIGNAL(clicked(QPoint)), this, SLOT(showMenu(QPoint)));
|
||||||
connect(AdBlockManager::instance(), SIGNAL(enabledChanged(bool)), this, SLOT(setEnabled(bool)));
|
connect(AdBlockManager::instance(), SIGNAL(enabledChanged(bool)), this, SLOT(setEnabled(bool)));
|
||||||
@ -187,7 +188,7 @@ void AdBlockIcon::animateIcon()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pixmap()->isNull()) {
|
if (pixmap()->isNull()) {
|
||||||
setPixmap(QPixmap(":icons/other/adblock.png"));
|
setPixmap(QIcon(QSL(":icons/other/adblock.png")).pixmap(16));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setPixmap(QPixmap());
|
setPixmap(QPixmap());
|
||||||
@ -206,10 +207,10 @@ void AdBlockIcon::stopAnimation()
|
|||||||
void AdBlockIcon::setEnabled(bool enabled)
|
void AdBlockIcon::setEnabled(bool enabled)
|
||||||
{
|
{
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
setPixmap(QPixmap(":icons/other/adblock.png"));
|
setPixmap(QIcon(QSL(":icons/other/adblock.png")).pixmap(16));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setPixmap(QPixmap(":icons/other/adblock-disabled.png"));
|
setPixmap(QIcon(QSL(":icons/other/adblock-disabled.png")).pixmap(16));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_enabled = enabled;
|
m_enabled = enabled;
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
<file>icons/preferences/applications-graphics.png</file>
|
<file>icons/preferences/applications-graphics.png</file>
|
||||||
<file>icons/preferences/document-properties.png</file>
|
<file>icons/preferences/document-properties.png</file>
|
||||||
<file>icons/other/adblock.png</file>
|
<file>icons/other/adblock.png</file>
|
||||||
<file>icons/notifications/download.png</file>
|
<file>icons/notifications/download.svg</file>
|
||||||
<file>icons/other/bighistory.png</file>
|
<file>icons/other/bighistory.png</file>
|
||||||
<file>icons/preferences/style-default.png</file>
|
<file>icons/preferences/style-default.png</file>
|
||||||
<file>icons/other/adblock-disabled.png</file>
|
<file>icons/other/adblock-disabled.png</file>
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 4.4 KiB |
15
src/lib/data/icons/notifications/download.svg
Normal file
15
src/lib/data/icons/notifications/download.svg
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||||
|
<defs id="defs3051">
|
||||||
|
<style type="text/css" id="current-color-scheme">
|
||||||
|
.ColorScheme-Text {
|
||||||
|
color:#4d4d4d;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</defs>
|
||||||
|
<path
|
||||||
|
transform="translate(1,1)"
|
||||||
|
style="fill:currentColor;fill-opacity:1;stroke:none"
|
||||||
|
d="M 8 3 L 8 9 L 9 9 L 9 4 L 13 4 L 13 9 L 14 9 L 14 3 L 13 3 L 9 3 L 8 3 z M 5.7929688 10 L 5 10.816406 L 11 17 L 17 10.816406 L 16.207031 10 L 11 15.367188 L 5.7929688 10 z M 4 17 L 4 19 L 5 19 L 17 19 L 18 19 L 18 17 L 17 17 L 17 18 L 5 18 L 5 17 L 4 17 z "
|
||||||
|
class="ColorScheme-Text"
|
||||||
|
/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 628 B |
Binary file not shown.
Before Width: | Height: | Size: 454 B After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 684 B After Width: | Height: | Size: 2.5 KiB |
@ -330,7 +330,7 @@ void DownloadManager::downloadFinished(bool success)
|
|||||||
|
|
||||||
if (downloadingAllFilesFinished) {
|
if (downloadingAllFilesFinished) {
|
||||||
if (success && qApp->activeWindow() != this) {
|
if (success && qApp->activeWindow() != this) {
|
||||||
mApp->desktopNotifications()->showNotification(QIcon::fromTheme(QSL("download"), QIcon(":icons/notifications/download.png")).pixmap(48), tr("Download Finished"), tr("All files have been successfully downloaded."));
|
mApp->desktopNotifications()->showNotification(QIcon::fromTheme(QSL("download"), QIcon(":icons/notifications/download.svg")).pixmap(48), tr("Download Finished"), tr("All files have been successfully downloaded."));
|
||||||
if (!m_closeOnFinish) {
|
if (!m_closeOnFinish) {
|
||||||
raise();
|
raise();
|
||||||
activateWindow();
|
activateWindow();
|
||||||
|
@ -170,7 +170,7 @@ QString QupZillaSchemeReply::startPage()
|
|||||||
sPage.append(QzTools::readAllFileContents(":html/start.html"));
|
sPage.append(QzTools::readAllFileContents(":html/start.html"));
|
||||||
sPage.replace(QLatin1String("%FAVICON%"), QLatin1String("qrc:icons/qupzilla.png"));
|
sPage.replace(QLatin1String("%FAVICON%"), QLatin1String("qrc:icons/qupzilla.png"));
|
||||||
sPage.replace(QLatin1String("%BOX-BORDER%"), QLatin1String("qrc:html/box-border.png"));
|
sPage.replace(QLatin1String("%BOX-BORDER%"), QLatin1String("qrc:html/box-border.png"));
|
||||||
sPage.replace(QLatin1String("%ABOUT-IMG%"), QzTools::pixmapToDataUrl(QIcon(":icons/other/startpage.png").pixmap(200, 155)).toString());
|
sPage.replace(QLatin1String("%ABOUT-IMG%"), QzTools::pixmapToDataUrl(QzTools::dpiAwarePixmap(QSL(":icons/other/startpage.png"))).toString());
|
||||||
|
|
||||||
sPage.replace(QLatin1String("%TITLE%"), tr("Start Page"));
|
sPage.replace(QLatin1String("%TITLE%"), tr("Start Page"));
|
||||||
sPage.replace(QLatin1String("%BUTTON-LABEL%"), tr("Search on Web"));
|
sPage.replace(QLatin1String("%BUTTON-LABEL%"), tr("Search on Web"));
|
||||||
@ -191,7 +191,7 @@ QString QupZillaSchemeReply::aboutPage()
|
|||||||
aPage.append(QzTools::readAllFileContents(":html/about.html"));
|
aPage.append(QzTools::readAllFileContents(":html/about.html"));
|
||||||
aPage.replace(QLatin1String("%FAVICON%"), QLatin1String("qrc:icons/qupzilla.png"));
|
aPage.replace(QLatin1String("%FAVICON%"), QLatin1String("qrc:icons/qupzilla.png"));
|
||||||
aPage.replace(QLatin1String("%BOX-BORDER%"), QLatin1String("qrc:html/box-border.png"));
|
aPage.replace(QLatin1String("%BOX-BORDER%"), QLatin1String("qrc:html/box-border.png"));
|
||||||
aPage.replace(QLatin1String("%ABOUT-IMG%"), QzTools::pixmapToDataUrl(QIcon(QSL(":icons/other/about.png")).pixmap(300, 130)).toString());
|
aPage.replace(QLatin1String("%ABOUT-IMG%"), QzTools::pixmapToDataUrl(QzTools::dpiAwarePixmap(QSL(":icons/other/about.png"))).toString());
|
||||||
aPage.replace(QLatin1String("%COPYRIGHT-INCLUDE%"), QzTools::readAllFileContents(":html/copyright").toHtmlEscaped());
|
aPage.replace(QLatin1String("%COPYRIGHT-INCLUDE%"), QzTools::readAllFileContents(":html/copyright").toHtmlEscaped());
|
||||||
|
|
||||||
aPage.replace(QLatin1String("%TITLE%"), tr("About QupZilla"));
|
aPage.replace(QLatin1String("%TITLE%"), tr("About QupZilla"));
|
||||||
@ -356,7 +356,7 @@ QString QupZillaSchemeReply::configPage()
|
|||||||
cPage.append(QzTools::readAllFileContents(":html/config.html"));
|
cPage.append(QzTools::readAllFileContents(":html/config.html"));
|
||||||
cPage.replace(QLatin1String("%FAVICON%"), QLatin1String("qrc:icons/qupzilla.png"));
|
cPage.replace(QLatin1String("%FAVICON%"), QLatin1String("qrc:icons/qupzilla.png"));
|
||||||
cPage.replace(QLatin1String("%BOX-BORDER%"), QLatin1String("qrc:html/box-border.png"));
|
cPage.replace(QLatin1String("%BOX-BORDER%"), QLatin1String("qrc:html/box-border.png"));
|
||||||
cPage.replace(QLatin1String("%ABOUT-IMG%"), QzTools::pixmapToDataUrl(QIcon(QSL(":icons/other/about.png")).pixmap(300, 130)).toString());
|
cPage.replace(QLatin1String("%ABOUT-IMG%"), QzTools::pixmapToDataUrl(QzTools::dpiAwarePixmap(QSL(":icons/other/about.png"))).toString());
|
||||||
|
|
||||||
cPage.replace(QLatin1String("%TITLE%"), tr("Configuration Information"));
|
cPage.replace(QLatin1String("%TITLE%"), tr("Configuration Information"));
|
||||||
cPage.replace(QLatin1String("%CONFIG%"), tr("Configuration Information"));
|
cPage.replace(QLatin1String("%CONFIG%"), tr("Configuration Information"));
|
||||||
|
@ -81,6 +81,15 @@ QUrl QzTools::pixmapToDataUrl(const QPixmap &pix)
|
|||||||
return data.isEmpty() ? QUrl() : QUrl(QSL("data:image/png;base64,") + data);
|
return data.isEmpty() ? QUrl() : QUrl(QSL("data:image/png;base64,") + data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QPixmap QzTools::dpiAwarePixmap(const QString &path)
|
||||||
|
{
|
||||||
|
const QIcon icon(path);
|
||||||
|
if (icon.availableSizes().isEmpty()) {
|
||||||
|
return QPixmap(path);
|
||||||
|
}
|
||||||
|
return icon.pixmap(icon.availableSizes().at(0));
|
||||||
|
}
|
||||||
|
|
||||||
QString QzTools::readAllFileContents(const QString &filename)
|
QString QzTools::readAllFileContents(const QString &filename)
|
||||||
{
|
{
|
||||||
return QString::fromUtf8(readAllFileByteContents(filename));
|
return QString::fromUtf8(readAllFileByteContents(filename));
|
||||||
|
@ -35,6 +35,7 @@ public:
|
|||||||
static QByteArray pixmapToByteArray(const QPixmap &pix);
|
static QByteArray pixmapToByteArray(const QPixmap &pix);
|
||||||
static QPixmap pixmapFromByteArray(const QByteArray &data);
|
static QPixmap pixmapFromByteArray(const QByteArray &data);
|
||||||
static QUrl pixmapToDataUrl(const QPixmap &pix);
|
static QUrl pixmapToDataUrl(const QPixmap &pix);
|
||||||
|
static QPixmap dpiAwarePixmap(const QString &path);
|
||||||
|
|
||||||
static QString readAllFileContents(const QString &filename);
|
static QString readAllFileContents(const QString &filename);
|
||||||
static QByteArray readAllFileByteContents(const QString &filename);
|
static QByteArray readAllFileByteContents(const QString &filename);
|
||||||
|
Loading…
Reference in New Issue
Block a user