2012-02-16 13:42:44 +04:00
|
|
|
/*
|
|
|
|
* Copyright (C) by Klaas Freitag <freitag@owncloud.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
#include <QDebug>
|
2012-02-23 14:44:44 +04:00
|
|
|
#include <QPixmap>
|
2012-05-02 17:50:01 +04:00
|
|
|
#include <QIcon>
|
2012-02-16 13:42:44 +04:00
|
|
|
|
|
|
|
#include "owncloudtheme.h"
|
|
|
|
|
|
|
|
namespace Mirall {
|
|
|
|
|
|
|
|
ownCloudTheme::ownCloudTheme()
|
|
|
|
{
|
2012-02-28 18:13:59 +04:00
|
|
|
// qDebug() << " ** running ownCloud theme!";
|
2012-02-16 13:42:44 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
QString ownCloudTheme::appName() const
|
|
|
|
{
|
2012-02-17 14:11:18 +04:00
|
|
|
return QString::fromLocal8Bit("ownCloud");
|
2012-02-16 13:42:44 +04:00
|
|
|
}
|
|
|
|
|
2012-02-17 14:11:18 +04:00
|
|
|
QString ownCloudTheme::configFileName() const
|
|
|
|
{
|
|
|
|
return QString::fromLocal8Bit("owncloud.cfg");
|
|
|
|
}
|
2012-02-23 14:44:44 +04:00
|
|
|
|
|
|
|
QPixmap ownCloudTheme::splashScreen() const
|
|
|
|
{
|
|
|
|
return QPixmap(":/mirall/resources/owncloud_splash.png");
|
|
|
|
}
|
|
|
|
|
2012-05-02 17:50:01 +04:00
|
|
|
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" );
|
|
|
|
}
|
|
|
|
if( backend == QString::fromLatin1("csync" )) {
|
|
|
|
name = QString( "folder-remote" );
|
|
|
|
}
|
|
|
|
if( backend.isEmpty() || backend == QString::fromLatin1("none") ) {
|
|
|
|
name = QString("folder-grey.png");
|
|
|
|
}
|
|
|
|
|
|
|
|
qDebug() << "==> load folder icon " << name;
|
|
|
|
return themeIcon( name, size );
|
|
|
|
}
|
|
|
|
|
|
|
|
QIcon ownCloudTheme::trayFolderIcon( const QString& ) const
|
|
|
|
{
|
|
|
|
return themeIcon( "owncloud-icon", 48 );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QIcon ownCloudTheme::syncStateIcon( SyncResult::Status status, int size ) const
|
|
|
|
{
|
|
|
|
// FIXME: Mind the size!
|
|
|
|
QString statusIcon;
|
|
|
|
|
|
|
|
switch( status ) {
|
|
|
|
case SyncResult::Undefined:
|
|
|
|
statusIcon = "owncloud-icon-error";
|
|
|
|
break;
|
|
|
|
case SyncResult::NotYetStarted:
|
|
|
|
statusIcon = "owncloud-icon";
|
|
|
|
break;
|
|
|
|
case SyncResult::SyncRunning:
|
|
|
|
statusIcon = "owncloud-icon-sync";
|
|
|
|
break;
|
|
|
|
case SyncResult::Success:
|
2012-05-02 19:12:45 +04:00
|
|
|
statusIcon = "owncloud-icon-sync-ok";
|
2012-05-02 17:50:01 +04:00
|
|
|
break;
|
|
|
|
case SyncResult::Error:
|
|
|
|
statusIcon = "owncloud-icon-error";
|
|
|
|
break;
|
|
|
|
case SyncResult::SetupError:
|
|
|
|
statusIcon = "owncloud-icon-error";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
statusIcon = "owncloud-icon-error";
|
|
|
|
}
|
|
|
|
|
|
|
|
return themeIcon( statusIcon, size );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QIcon ownCloudTheme::folderDisabledIcon( int size ) const
|
|
|
|
{
|
|
|
|
// Fixme: Do we really want the dialog-canel from theme here?
|
|
|
|
return themeIcon( "owncloud-icon-error", size );
|
|
|
|
}
|
|
|
|
|
|
|
|
QIcon ownCloudTheme::applicationIcon( ) const
|
|
|
|
{
|
|
|
|
return themeIcon( "owncloud-icon", 48 );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-02-16 13:42:44 +04:00
|
|
|
}
|
|
|
|
|