diff options
author | Daniel Molkentin <danimo@owncloud.com> | 2015-02-12 21:44:30 +0300 |
---|---|---|
committer | Daniel Molkentin <danimo@owncloud.com> | 2015-02-12 21:44:40 +0300 |
commit | 00e42d117791809444d6bc95ab6ee759ed2bb851 (patch) | |
tree | fe671debc63a240d18a9e0670e8068fedf51b254 | |
parent | d37dd040d0a121f5ad14228e0440f2582bfd519a (diff) |
More HIDPI support
Except for the non-native activity tab
icon in settings, this should fix #11
42 files changed, 96 insertions, 59 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f7648c9a7..5d19ba3ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/client.qrc b/client.qrc index c1a156684..7f5f83565 100644 --- a/client.qrc +++ b/client.qrc @@ -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> diff --git a/resources/folder-remote-32.png b/resources/folder-remote-32.png Binary files differdeleted file mode 100644 index c986596c9..000000000 --- a/resources/folder-remote-32.png +++ /dev/null diff --git a/resources/folder-remote.png b/resources/folder-remote.png Binary files differdeleted file mode 100644 index c986596c9..000000000 --- a/resources/folder-remote.png +++ /dev/null diff --git a/resources/folder-sync@2x.png b/resources/folder-sync@2x.png Binary files differnew file mode 100644 index 000000000..e4f26106f --- /dev/null +++ b/resources/folder-sync@2x.png diff --git a/resources/lock-http@2x.png b/resources/lock-http@2x.png Binary files differnew file mode 100644 index 000000000..f705059fd --- /dev/null +++ b/resources/lock-http@2x.png diff --git a/resources/lock-https@2x.png b/resources/lock-https@2x.png Binary files differnew file mode 100644 index 000000000..34bcd5efb --- /dev/null +++ b/resources/lock-https@2x.png diff --git a/resources/owncloud_logo_blue.png b/resources/owncloud_logo_blue.png Binary files differdeleted file mode 100644 index 24770fb63..000000000 --- a/resources/owncloud_logo_blue.png +++ /dev/null diff --git a/resources/warning-16.png b/resources/warning.png Binary files differindex 43ca31a31..43ca31a31 100644 --- a/resources/warning-16.png +++ b/resources/warning.png diff --git a/resources/warning@2x.png b/resources/warning@2x.png Binary files differnew file mode 100644 index 000000000..8e9133789 --- /dev/null +++ b/resources/warning@2x.png diff --git a/src/gui/application.cpp b/src/gui/application.cpp index 0f88e09d2..305085a8e 100644 --- a/src/gui/application.cpp +++ b/src/gui/application.cpp @@ -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; diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp index 43869dd57..d86edd7b9 100644 --- a/src/gui/folderstatusmodel.cpp +++ b/src/gui/folderstatusmodel.cpp @@ -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 ); } diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp index 64e6d1f93..3d31ae277 100644 --- a/src/gui/owncloudgui.cpp +++ b/src/gui/owncloudgui.cpp @@ -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); } diff --git a/src/gui/sslbutton.cpp b/src/gui/sslbutton.cpp index 1dec4726f..198876345 100644 --- a/src/gui/sslbutton.cpp +++ b/src/gui/sslbutton.cpp @@ -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")); } } diff --git a/src/gui/wizard/owncloudadvancedsetuppage.cpp b/src/gui/wizard/owncloudadvancedsetuppage.cpp index 8252c2603..61b41f8cc 100644 --- a/src/gui/wizard/owncloudadvancedsetuppage.cpp +++ b/src/gui/wizard/owncloudadvancedsetuppage.cpp @@ -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() diff --git a/src/gui/wizard/owncloudsetuppage.cpp b/src/gui/wizard/owncloudsetuppage.cpp index ea2747b06..aaed85cba 100644 --- a/src/gui/wizard/owncloudsetuppage.cpp +++ b/src/gui/wizard/owncloudsetuppage.cpp @@ -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.")); } } diff --git a/src/gui/wizard/owncloudwizardresultpage.cpp b/src/gui/wizard/owncloudwizardresultpage.cpp index 23e47aae6..005bf79a2 100644 --- a/src/gui/wizard/owncloudwizardresultpage.cpp +++ b/src/gui/wizard/owncloudwizardresultpage.cpp @@ -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())); diff --git a/src/libsync/owncloudtheme.cpp b/src/libsync/owncloudtheme.cpp index bdedd0975..372d339a8 100644 --- a/src/libsync/owncloudtheme.cpp +++ b/src/libsync/owncloudtheme.cpp @@ -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 diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp index 70d6711a8..a746051b4 100644 --- a/src/libsync/theme.cpp +++ b/src/libsync/theme.cpp @@ -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)) { diff --git a/src/libsync/utility.cpp b/src/libsync/utility.cpp index db5a942c3..803ab368c 100644 --- a/src/libsync/utility.cpp +++ b/src/libsync/utility.cpp @@ -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 diff --git a/src/libsync/utility.h b/src/libsync/utility.h index 5935bf743..a8a1f20d7 100644 --- a/src/libsync/utility.h +++ b/src/libsync/utility.h @@ -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; @@ -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/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/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-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/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/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/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/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/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/wizard_logo.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> diff --git a/theme/colored/owncloud-framed-64.png b/theme/colored/owncloud-framed-64.png Binary files differdeleted file mode 100644 index fb49d63e5..000000000 --- a/theme/colored/owncloud-framed-64.png +++ /dev/null diff --git a/theme/colored/owncloud-icon-256.png b/theme/colored/owncloud-icon-256.png Binary files differnew file mode 100644 index 000000000..2180a25ca --- /dev/null +++ b/theme/colored/owncloud-icon-256.png diff --git a/theme/colored/owncloud-icon-512.png b/theme/colored/owncloud-icon-512.png Binary files differnew file mode 100644 index 000000000..fad5f4cdd --- /dev/null +++ b/theme/colored/owncloud-icon-512.png diff --git a/theme/colored/state-download-128.png b/theme/colored/state-download-128.png Binary files differnew file mode 100644 index 000000000..466f9d5da --- /dev/null +++ b/theme/colored/state-download-128.png diff --git a/theme/colored/state-download-256.png b/theme/colored/state-download-256.png Binary files differnew file mode 100644 index 000000000..38173ad2c --- /dev/null +++ b/theme/colored/state-download-256.png diff --git a/theme/colored/state-error-128.png b/theme/colored/state-error-128.png Binary files differnew file mode 100644 index 000000000..edcc0d085 --- /dev/null +++ b/theme/colored/state-error-128.png diff --git a/theme/colored/state-error-256.png b/theme/colored/state-error-256.png Binary files differnew file mode 100644 index 000000000..bded7c7b2 --- /dev/null +++ b/theme/colored/state-error-256.png diff --git a/theme/colored/state-information-128.png b/theme/colored/state-information-128.png Binary files differnew file mode 100644 index 000000000..a25792598 --- /dev/null +++ b/theme/colored/state-information-128.png diff --git a/theme/colored/state-information-256.png b/theme/colored/state-information-256.png Binary files differnew file mode 100644 index 000000000..8fd88b12a --- /dev/null +++ b/theme/colored/state-information-256.png diff --git a/theme/colored/state-offline-128.png b/theme/colored/state-offline-128.png Binary files differnew file mode 100644 index 000000000..e9032ddeb --- /dev/null +++ b/theme/colored/state-offline-128.png diff --git a/theme/colored/state-offline-256.png b/theme/colored/state-offline-256.png Binary files differnew file mode 100644 index 000000000..7bc4d8021 --- /dev/null +++ b/theme/colored/state-offline-256.png diff --git a/theme/colored/state-ok-128.png b/theme/colored/state-ok-128.png Binary files differnew file mode 100644 index 000000000..a3c55ce33 --- /dev/null +++ b/theme/colored/state-ok-128.png diff --git a/theme/colored/state-ok-256.png b/theme/colored/state-ok-256.png Binary files differnew file mode 100644 index 000000000..5820254bd --- /dev/null +++ b/theme/colored/state-ok-256.png diff --git a/theme/colored/state-pause-128.png b/theme/colored/state-pause-128.png Binary files differnew file mode 100644 index 000000000..f86212c43 --- /dev/null +++ b/theme/colored/state-pause-128.png diff --git a/theme/colored/state-pause-256.png b/theme/colored/state-pause-256.png Binary files differnew file mode 100644 index 000000000..1d3f8a932 --- /dev/null +++ b/theme/colored/state-pause-256.png diff --git a/theme/colored/state-sync-128.png b/theme/colored/state-sync-128.png Binary files differnew file mode 100644 index 000000000..1747e926d --- /dev/null +++ b/theme/colored/state-sync-128.png diff --git a/theme/colored/state-sync-256.png b/theme/colored/state-sync-256.png Binary files differnew file mode 100644 index 000000000..c51336217 --- /dev/null +++ b/theme/colored/state-sync-256.png diff --git a/theme/colored/state-warning-128.png b/theme/colored/state-warning-128.png Binary files differnew file mode 100644 index 000000000..1564f0747 --- /dev/null +++ b/theme/colored/state-warning-128.png diff --git a/theme/colored/state-warning-256.png b/theme/colored/state-warning-256.png Binary files differnew file mode 100644 index 000000000..982eba193 --- /dev/null +++ b/theme/colored/state-warning-256.png diff --git a/theme/colored/wizard_logo@2x.png b/theme/colored/wizard_logo@2x.png Binary files differnew file mode 100644 index 000000000..4f96f5c1e --- /dev/null +++ b/theme/colored/wizard_logo@2x.png |