More HIDPI support

Except for the non-native activity tab
icon in settings, this should fix #11
This commit is contained in:
Daniel Molkentin 2015-02-12 19:44:30 +01:00
parent d37dd040d0
commit 00e42d1177
42 changed files with 98 additions and 61 deletions

View file

@ -172,11 +172,6 @@ configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
configure_file(test/test_journal.db "${CMAKE_BINARY_DIR}/test/test_journal.db" COPYONLY)
# Copy that logo, the installer uses it later
if(BUILD_OWNCLOUD_OSX_BUNDLE)
install(FILES resources/owncloud_logo_blue.png DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/)
endif()
include(OwnCloudCPack.cmake)
add_definitions(-DUNICODE)

View file

@ -3,18 +3,19 @@
<file>resources/dialog-close.png</file>
<file>resources/dialog-ok.png</file>
<file>resources/dialog-cancel.png</file>
<file>resources/folder-remote-32.png</file>
<file>resources/folder-remote.png</file>
<file>resources/folder-sync.png</file>
<file>resources/folder-grey.png</file>
<file>resources/folder-sync@2x.png</file>
<file>resources/task-ongoing.png</file>
<file>resources/view-refresh.png</file>
<file>resources/warning-16.png</file>
<file>resources/warning.png</file>
<file>resources/warning@2x.png</file>
<file>resources/settings.png</file>
<file>resources/activity.png</file>
<file>resources/network.png</file>
<file>resources/lock-http.png</file>
<file>resources/lock-http@2x.png</file>
<file>resources/lock-https.png</file>
<file>resources/lock-https@2x.png</file>
<file>resources/accounts.png</file>
</qresource>
</RCC>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

BIN
resources/lock-http@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
resources/lock-https@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

View file

Before

Width:  |  Height:  |  Size: 596 B

After

Width:  |  Height:  |  Size: 596 B

BIN
resources/warning@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -96,7 +96,7 @@ Application::Application(int &argc, char **argv) :
setOrganizationDomain(QLatin1String(APPLICATION_REV_DOMAIN));
setApplicationName( _theme->appNameGUI() );
setWindowIcon( _theme->applicationIcon() );
setAttribute(Qt::AA_UseHighDpiPixmaps, true);
parseOptions(arguments());
//no need to waste time;
if ( _helpOnly ) return;

View file

@ -181,7 +181,7 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
warnRect.setWidth(16);
warnRect.setHeight(16);
QIcon warnIcon(":/client/resources/warning-16");
QIcon warnIcon(":/client/resources/warning");
QPixmap pm = warnIcon.pixmap(16,16, syncEnabled ? QIcon::Normal : QIcon::Disabled );
painter->drawPixmap(QPoint(warnRect.left(), warnRect.top()),pm );
}

View file

@ -498,7 +498,7 @@ void ownCloudGui::slotUpdateProgress(const QString &folder, const Progress::Info
if (Progress::isWarningKind(progress._lastCompletedItem._status)) {
// display a warn icon if warnings happend.
QIcon warnIcon(":/client/resources/warning-16");
QIcon warnIcon(":/client/resources/warning");
_actionRecent->setIcon(warnIcon);
}

View file

@ -184,7 +184,7 @@ void SslButton::updateAccountState(AccountState *accountState)
oldMenu->deleteLater(); // setMenu do not delete the previous menu.
}
if (account->url().scheme() == QLatin1String("https")) {
setIcon(QIcon(QPixmap(":/client/resources/lock-https.png")));
setIcon(QIcon(QPixmap(Utility::hidpiFileName(":/client/resources/lock-https.png"))));
QSslCipher cipher = account->sslConfiguration().sessionCipher();
setToolTip(tr("This connection is encrypted using %1 bit %2.\n").arg(cipher.usedBits()).arg(cipher.name()));
QMenu *menu = new QMenu(this);
@ -217,7 +217,7 @@ void SslButton::updateAccountState(AccountState *accountState)
}
setMenu(menu);
} else {
setIcon(QIcon(QPixmap(":/client/resources/lock-http.png")));
setIcon(QIcon(QPixmap(Utility::hidpiFileName(":/client/resources/lock-http.png"))));
setToolTip(tr("This connection is NOT secure as it is not encrypted.\n"));
}
}

View file

@ -67,7 +67,7 @@ OwncloudAdvancedSetupPage::OwncloudAdvancedSetupPage()
_ui.lServerIcon->setText(QString());
_ui.lServerIcon->setPixmap(appIcon.pixmap(48));
_ui.lLocalIcon->setText(QString());
_ui.lLocalIcon->setPixmap(QPixmap(":/client/resources/folder-sync.png"));
_ui.lLocalIcon->setPixmap(QPixmap(Utility::hidpiFileName(":/client/resources/folder-sync.png")));
}
void OwncloudAdvancedSetupPage::setupCustomization()

View file

@ -116,11 +116,11 @@ void OwncloudSetupPage::slotUrlChanged(const QString& url)
}
if (url.startsWith(QLatin1String("http://"))) {
_ui.urlLabel->setPixmap( QPixmap(":/client/resources/lock-http.png"));
_ui.urlLabel->setPixmap(QPixmap(Utility::hidpiFileName(":/client/resources/lock-http.png")));
_ui.urlLabel->setToolTip(tr("This url is NOT secure as it is not encrypted.\n"
"It is not advisable to use it."));
} else {
_ui.urlLabel->setPixmap( QPixmap(":/client/resources/lock-https.png"));
_ui.urlLabel->setPixmap(QPixmap(Utility::hidpiFileName(":/client/resources/lock-https.png")));
_ui.urlLabel->setToolTip(tr("This url is secure. You can use it."));
}
}

View file

@ -21,6 +21,7 @@
#include "wizard/owncloudwizardresultpage.h"
#include "wizard/owncloudwizardcommon.h"
#include "theme.h"
#include "utility.h"
namespace OCC
{
@ -40,7 +41,7 @@ OwncloudWizardResultPage::OwncloudWizardResultPage()
setSubTitle( QLatin1String(" ") );
_ui.pbOpenLocal->setText(tr("Open Local Folder"));
_ui.pbOpenLocal->setIcon(QIcon(":/client/resources/folder-sync.png"));
_ui.pbOpenLocal->setIcon(QIcon(Utility::hidpiFileName(":/client/resources/folder-sync.png")));
_ui.pbOpenLocal->setIconSize(QSize(48, 48));
_ui.pbOpenLocal->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
connect(_ui.pbOpenLocal, SIGNAL(clicked()), SLOT(slotOpenLocal()));

View file

@ -23,9 +23,9 @@
#include <QApplication>
#endif
#include <QCoreApplication>
#include <QDebug>
#include "utility.h"
#include "version.h"
#include "config.h"
@ -108,7 +108,7 @@ QColor ownCloudTheme::wizardHeaderTitleColor() const
QPixmap ownCloudTheme::wizardHeaderLogo() const
{
return QPixmap(":/client/theme/colored/wizard_logo.png");
return QPixmap(Utility::hidpiFileName(":/client/theme/colored/wizard_logo.png"));
}
#endif

View file

@ -126,7 +126,7 @@ QIcon Theme::themeIcon( const QString& name, bool sysTray ) const
icon = QIcon::fromTheme( name );
} else {
QList<int> sizes;
sizes <<16 << 22 << 32 << 48 << 64 << 128;
sizes <<16 << 22 << 32 << 48 << 64 << 128 << 256;
foreach (int size, sizes) {
QString pixmapName = QString::fromLatin1(":/client/theme/%1/%2-%3.png").arg(flavor).arg(name).arg(size);
if (QFile::exists(pixmapName)) {

View file

@ -16,7 +16,7 @@
#include "version.h"
#include <QCoreApplication>
#include <QApplication>
#include <QSettings>
#include <QTextStream>
#include <QDir>
@ -27,7 +27,8 @@
#include <QThread>
#include <QDateTime>
#include <QSysInfo>
#include <QPaintDevice>
#include <QScreen>
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#include <QTextDocument>
#else
@ -445,5 +446,27 @@ quint64 Utility::StopWatch::durationOfLap( const QString& lapName ) const
return _lapTimes.value(lapName, 0);
}
QString Utility::hidpiFileName(const QString &fileName, QPaintDevice *dev)
{
qreal devicePixelRatio = dev ? dev->devicePixelRatio() :
qApp->primaryScreen()->devicePixelRatio();
if (devicePixelRatio <= 1.0) {
return fileName;
}
// try to find a 2x version
const int dotIndex = fileName.lastIndexOf(QLatin1Char('.'));
if (dotIndex != -1) {
QString at2xfileName = fileName;
at2xfileName.insert(dotIndex, QStringLiteral("@2x"));
if (QFile::exists(at2xfileName)) {
return at2xfileName;
}
}
return fileName;
}
} // namespace OCC

View file

@ -22,6 +22,7 @@
#include <QElapsedTimer>
#include <QHash>
class QPaintDevice;
class QWidget;
namespace OCC {
@ -100,6 +101,8 @@ namespace Utility
// if false, the two cases are two different files.
OWNCLOUDSYNC_EXPORT bool fsCasePreserving();
OWNCLOUDSYNC_EXPORT QString hidpiFileName(const QString &fileName, QPaintDevice *dev = 0);
class OWNCLOUDSYNC_EXPORT StopWatch {
private:
QHash<QString, quint64> _lapTimes;

View file

@ -1,47 +1,61 @@
<RCC>
<qresource prefix="/client">
<file>theme/colored/state-sync-32.png</file>
<file>theme/colored/state-pause-32.png</file>
<file>theme/colored/state-ok-32.png</file>
<file>theme/colored/state-offline-32.png</file>
<file>theme/colored/state-error-32.png</file>
<file>theme/colored/state-information-32.png</file>
<file>theme/black/state-sync-32.png</file>
<file>theme/black/state-pause-32.png</file>
<file>theme/black/state-ok-32.png</file>
<file>theme/black/state-offline-32.png</file>
<file>theme/black/state-error-32.png</file>
<file>theme/black/state-information-32.png</file>
<file>theme/white/state-sync-32.png</file>
<file>theme/white/state-pause-32.png</file>
<file>theme/white/state-ok-32.png</file>
<file>theme/white/state-offline-32.png</file>
<file>theme/white/state-error-32.png</file>
<file>theme/white/state-information-32.png</file>
<file>theme/colored/state-sync-64.png</file>
<file>theme/colored/state-pause-64.png</file>
<file>theme/colored/state-ok-64.png</file>
<file>theme/colored/state-offline-64.png</file>
<file>theme/colored/state-error-64.png</file>
<file>theme/colored/state-information-64.png</file>
<file>theme/black/state-sync-64.png</file>
<file>theme/black/state-pause-64.png</file>
<file>theme/black/state-ok-64.png</file>
<file>theme/black/state-offline-64.png</file>
<file>theme/black/state-error-64.png</file>
<file>theme/black/state-information-64.png</file>
<file>theme/white/state-sync-64.png</file>
<file>theme/white/state-pause-64.png</file>
<file>theme/white/state-ok-64.png</file>
<file>theme/white/state-offline-64.png</file>
<file>theme/white/state-error-64.png</file>
<file>theme/white/state-information-64.png</file>
<file>theme/colored/owncloud-icon-512.png</file>
<file>theme/colored/owncloud-icon-256.png</file>
<file>theme/colored/owncloud-icon-128.png</file>
<file>theme/colored/owncloud-icon-22.png</file>
<file>theme/colored/owncloud-icon-32.png</file>
<file>theme/colored/owncloud-icon-48.png</file>
<file>theme/colored/owncloud-icon-64.png</file>
<file>theme/colored/owncloud-icon-128.png</file>
<file>theme/colored/owncloud-framed-64.png</file>
<file>theme/colored/state-error-32.png</file>
<file>theme/colored/state-error-64.png</file>
<file>theme/colored/state-error-128.png</file>
<file>theme/colored/state-error-256.png</file>
<file>theme/colored/state-information-32.png</file>
<file>theme/colored/state-information-64.png</file>
<file>theme/colored/state-information-128.png</file>
<file>theme/colored/state-information-256.png</file>
<file>theme/colored/state-offline-32.png</file>
<file>theme/colored/state-offline-64.png</file>
<file>theme/colored/state-offline-128.png</file>
<file>theme/colored/state-offline-256.png</file>
<file>theme/colored/state-ok-32.png</file>
<file>theme/colored/state-ok-64.png</file>
<file>theme/colored/state-ok-128.png</file>
<file>theme/colored/state-ok-256.png</file>
<file>theme/colored/state-pause-32.png</file>
<file>theme/colored/state-pause-64.png</file>
<file>theme/colored/state-pause-128.png</file>
<file>theme/colored/state-pause-256.png</file>
<file>theme/colored/state-sync-32.png</file>
<file>theme/colored/state-sync-64.png</file>
<file>theme/colored/state-sync-128.png</file>
<file>theme/colored/state-sync-256.png</file>
<file>theme/colored/wizard_logo.png</file>
<file>theme/colored/wizard_logo@2x.png</file>
<file>theme/black/state-error-32.png</file>
<file>theme/black/state-error-64.png</file>
<file>theme/black/state-information-32.png</file>
<file>theme/black/state-information-64.png</file>
<file>theme/black/state-offline-32.png</file>
<file>theme/black/state-offline-64.png</file>
<file>theme/black/state-ok-32.png</file>
<file>theme/black/state-ok-64.png</file>
<file>theme/black/state-pause-32.png</file>
<file>theme/black/state-pause-64.png</file>
<file>theme/black/state-sync-32.png</file>
<file>theme/black/state-sync-64.png</file>
<file>theme/white/state-error-32.png</file>
<file>theme/white/state-error-64.png</file>
<file>theme/white/state-information-32.png</file>
<file>theme/white/state-information-64.png</file>
<file>theme/white/state-offline-32.png</file>
<file>theme/white/state-offline-64.png</file>
<file>theme/white/state-ok-32.png</file>
<file>theme/white/state-ok-64.png</file>
<file>theme/white/state-pause-32.png</file>
<file>theme/white/state-pause-64.png</file>
<file>theme/white/state-sync-32.png</file>
<file>theme/white/state-sync-64.png</file>
</qresource>
</RCC>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB