mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-27 09:30:13 +03:00
Fixed icon setup. Theme now really supports icons in various sizes.
This commit is contained in:
parent
3244a922e3
commit
d225dd124b
7 changed files with 31 additions and 28 deletions
|
@ -44,11 +44,9 @@ QPixmap mirallTheme::splashScreen() const
|
|||
QIcon mirallTheme::folderIcon( const QString& backend ) const
|
||||
{
|
||||
QString name;
|
||||
int size = 48;
|
||||
|
||||
if( backend == QString::fromLatin1("owncloud")) {
|
||||
name = QString( "mirall" );
|
||||
size = 64;
|
||||
}
|
||||
if( backend == QString::fromLatin1("unison" )) {
|
||||
name = QString( "folder-sync" );
|
||||
|
@ -61,10 +59,10 @@ QIcon mirallTheme::folderIcon( const QString& backend ) const
|
|||
}
|
||||
|
||||
qDebug() << "==> load folder icon " << name;
|
||||
return themeIcon( name, size );
|
||||
return themeIcon( name );
|
||||
}
|
||||
|
||||
QIcon mirallTheme::syncStateIcon( SyncResult::Status status, int size ) const
|
||||
QIcon mirallTheme::syncStateIcon( SyncResult::Status status ) const
|
||||
{
|
||||
QString statusIcon;
|
||||
|
||||
|
@ -90,19 +88,19 @@ QIcon mirallTheme::syncStateIcon( SyncResult::Status status, int size ) const
|
|||
default:
|
||||
statusIcon = "dialog-close";
|
||||
}
|
||||
return themeIcon( statusIcon, size );
|
||||
return themeIcon( statusIcon );
|
||||
}
|
||||
|
||||
|
||||
QIcon mirallTheme::folderDisabledIcon( int size ) const
|
||||
QIcon mirallTheme::folderDisabledIcon() const
|
||||
{
|
||||
// Fixme: Do we really want the dialog-canel from theme here?
|
||||
return themeIcon( "dialog-cancel", size );
|
||||
return themeIcon( "dialog-cancel" );
|
||||
}
|
||||
|
||||
QIcon mirallTheme::applicationIcon( ) const
|
||||
{
|
||||
return themeIcon( "mirall", 48 );
|
||||
return themeIcon( "mirall");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@ public:
|
|||
QPixmap splashScreen() const;
|
||||
|
||||
QIcon folderIcon( const QString& ) const;
|
||||
QIcon syncStateIcon( SyncResult::Status, int ) const;
|
||||
QIcon folderDisabledIcon(int) const;
|
||||
QIcon syncStateIcon(SyncResult::Status) const;
|
||||
QIcon folderDisabledIcon() const;
|
||||
QIcon applicationIcon() const;
|
||||
|
||||
private:
|
||||
|
|
|
@ -44,11 +44,9 @@ QPixmap ownCloudTheme::splashScreen() const
|
|||
QIcon ownCloudTheme::folderIcon( const QString& backend ) const
|
||||
{
|
||||
QString name;
|
||||
int size = 48;
|
||||
|
||||
if( backend == QString::fromLatin1("owncloud")) {
|
||||
name = QString( "owncloud-icon-framed" );
|
||||
size = 64;
|
||||
}
|
||||
if( backend == QString::fromLatin1("unison" )) {
|
||||
name = QString( "folder-sync" );
|
||||
|
@ -61,16 +59,16 @@ QIcon ownCloudTheme::folderIcon( const QString& backend ) const
|
|||
}
|
||||
|
||||
qDebug() << "==> load folder icon " << name;
|
||||
return themeIcon( name, size );
|
||||
return themeIcon( name );
|
||||
}
|
||||
|
||||
QIcon ownCloudTheme::trayFolderIcon( const QString& ) const
|
||||
{
|
||||
return themeIcon( "owncloud-icon", 48 );
|
||||
return themeIcon( "owncloud-icon" );
|
||||
}
|
||||
|
||||
|
||||
QIcon ownCloudTheme::syncStateIcon( SyncResult::Status status, int size ) const
|
||||
QIcon ownCloudTheme::syncStateIcon( SyncResult::Status status ) const
|
||||
{
|
||||
// FIXME: Mind the size!
|
||||
QString statusIcon;
|
||||
|
@ -98,19 +96,19 @@ QIcon ownCloudTheme::syncStateIcon( SyncResult::Status status, int size ) const
|
|||
statusIcon = "owncloud-icon-error";
|
||||
}
|
||||
|
||||
return themeIcon( statusIcon, size );
|
||||
return themeIcon( statusIcon );
|
||||
}
|
||||
|
||||
|
||||
QIcon ownCloudTheme::folderDisabledIcon( int size ) const
|
||||
QIcon ownCloudTheme::folderDisabledIcon( ) const
|
||||
{
|
||||
// Fixme: Do we really want the dialog-canel from theme here?
|
||||
return themeIcon( "owncloud-icon-error", size );
|
||||
return themeIcon( "owncloud-icon-error" );
|
||||
}
|
||||
|
||||
QIcon ownCloudTheme::applicationIcon( ) const
|
||||
{
|
||||
return themeIcon( "owncloud-icon", 48 );
|
||||
return themeIcon( "owncloud-icon" );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ public:
|
|||
|
||||
QIcon folderIcon( const QString& ) const;
|
||||
QIcon trayFolderIcon( const QString& ) const;
|
||||
QIcon syncStateIcon( SyncResult::Status, int ) const;
|
||||
QIcon folderDisabledIcon(int) const;
|
||||
QIcon syncStateIcon( SyncResult::Status ) const;
|
||||
QIcon folderDisabledIcon() const;
|
||||
QIcon applicationIcon() const;
|
||||
|
||||
private:
|
||||
|
|
|
@ -313,9 +313,9 @@ void StatusDialog::folderToModelItem( QStandardItem *item, Folder *f )
|
|||
|
||||
item->setData( _theme->statusHeaderText( status ), Qt::ToolTipRole );
|
||||
if( f->syncEnabled() ) {
|
||||
item->setData( _theme->syncStateIcon( status, 48 ), FolderViewDelegate::FolderStatusIcon );
|
||||
item->setData( _theme->syncStateIcon( status ), FolderViewDelegate::FolderStatusIcon );
|
||||
} else {
|
||||
item->setData( _theme->folderDisabledIcon( 48 ), FolderViewDelegate::FolderStatusIcon );
|
||||
item->setData( _theme->folderDisabledIcon( ), FolderViewDelegate::FolderStatusIcon ); // size 48 before
|
||||
}
|
||||
item->setData( _theme->statusHeaderText( status ), FolderViewDelegate::FolderStatus );
|
||||
item->setData( errors, FolderViewDelegate::FolderErrorMsg );
|
||||
|
|
|
@ -68,14 +68,21 @@ QIcon Theme::trayFolderIcon( const QString& backend ) const
|
|||
* helper to load a icon from either the icon theme the desktop provides or from
|
||||
* the apps Qt resources.
|
||||
*/
|
||||
QIcon Theme::themeIcon( const QString& name, int size ) const
|
||||
QIcon Theme::themeIcon( const QString& name ) const
|
||||
{
|
||||
QIcon icon;
|
||||
if( QIcon::hasThemeIcon( name )) {
|
||||
// use from theme
|
||||
icon = QIcon::fromTheme( name );
|
||||
} else {
|
||||
icon.addFile( QString(":/mirall/resources/%1-%2").arg(name).arg(size), QSize(size, size) );
|
||||
QList<int> sizes;
|
||||
sizes <<16 << 24 << 32 << 48 << 64 << 128;
|
||||
foreach (int size, sizes) {
|
||||
QString pixmapName = QString(":/mirall/resources/%1-%2.png").arg(name).arg(size);
|
||||
if (QFile::exists(pixmapName)) {
|
||||
icon.addFile(pixmapName, QSize(size, size));
|
||||
}
|
||||
}
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
|
|
|
@ -49,9 +49,9 @@ public:
|
|||
/**
|
||||
* get an sync state icon
|
||||
*/
|
||||
virtual QIcon syncStateIcon( SyncResult::Status, int ) const = 0;
|
||||
virtual QIcon syncStateIcon( SyncResult::Status ) const = 0;
|
||||
|
||||
virtual QIcon folderDisabledIcon( int ) const = 0;
|
||||
virtual QIcon folderDisabledIcon() const = 0;
|
||||
virtual QPixmap splashScreen() const = 0;
|
||||
|
||||
virtual QIcon applicationIcon() const = 0;
|
||||
|
@ -60,7 +60,7 @@ public:
|
|||
virtual QString version() const;
|
||||
|
||||
protected:
|
||||
QIcon themeIcon( const QString& name, int size ) const;
|
||||
QIcon themeIcon(const QString& name) const;
|
||||
|
||||
private:
|
||||
|
||||
|
|
Loading…
Reference in a new issue