nextcloud-desktop/src/mirall/owncloudtheme.cpp

115 lines
2.9 KiB
C++
Raw Normal View History

/*
* 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.
*/
2012-05-21 18:48:49 +04:00
#include "owncloudtheme.h"
#include <QString>
#include <QDebug>
2012-02-23 14:44:44 +04:00
#include <QPixmap>
#include <QIcon>
2012-08-02 13:09:37 +04:00
#include <QApplication>
namespace Mirall {
ownCloudTheme::ownCloudTheme()
{
2012-02-28 18:13:59 +04:00
// qDebug() << " ** running ownCloud theme!";
}
QString ownCloudTheme::appName() const
{
2012-08-02 13:09:37 +04:00
return QApplication::translate("appname", "ownCloud Client");
}
QString ownCloudTheme::configFileName() const
{
2012-08-02 13:17:24 +04:00
return QLatin1String("owncloud.cfg");
}
2012-02-23 14:44:44 +04:00
QPixmap ownCloudTheme::splashScreen() const
{
2012-08-02 13:17:24 +04:00
return QPixmap(QLatin1String(":/mirall/resources/owncloud_splash.png"));
2012-02-23 14:44:44 +04:00
}
QIcon ownCloudTheme::folderIcon( const QString& backend ) const
{
QString name;
2012-08-02 13:17:24 +04:00
if( backend == QLatin1String("owncloud")) {
name = QLatin1String( "owncloud-icon-framed" );
}
2012-08-02 13:17:24 +04:00
if( backend == QLatin1String("unison" )) {
name = QLatin1String( "folder-sync" );
}
2012-08-02 13:17:24 +04:00
if( backend == QLatin1String("csync" )) {
name = QLatin1String( "folder-remote" );
}
2012-08-02 13:17:24 +04:00
if( backend.isEmpty() || backend == QLatin1String("none") ) {
name = QLatin1String("folder-grey");
}
qDebug() << "==> load folder icon " << name;
return themeIcon( name );
}
QIcon ownCloudTheme::trayFolderIcon( const QString& ) const
{
return themeIcon( "owncloud-icon" );
}
QIcon ownCloudTheme::syncStateIcon( SyncResult::Status status ) const
{
// FIXME: Mind the size!
QString statusIcon;
switch( status ) {
case SyncResult::Undefined:
2012-08-02 13:17:24 +04:00
statusIcon = QLatin1String("owncloud-icon-error");
break;
case SyncResult::NotYetStarted:
2012-08-02 13:17:24 +04:00
statusIcon = QLatin1String("owncloud-icon");
break;
case SyncResult::SyncRunning:
2012-08-02 13:17:24 +04:00
statusIcon = QLatin1String("owncloud-icon-sync");
break;
case SyncResult::Success:
2012-08-02 13:17:24 +04:00
statusIcon = QLatin1String("owncloud-icon-sync-ok");
break;
case SyncResult::Error:
2012-08-02 13:17:24 +04:00
statusIcon = QLatin1String("owncloud-icon-error");
break;
case SyncResult::SetupError:
2012-08-02 13:17:24 +04:00
statusIcon = QLatin1String("owncloud-icon-error");
break;
default:
2012-08-02 13:17:24 +04:00
statusIcon = QLatin1String("owncloud-icon-error");
}
return themeIcon( statusIcon );
}
QIcon ownCloudTheme::folderDisabledIcon( ) const
{
// Fixme: Do we really want the dialog-canel from theme here?
2012-08-02 13:17:24 +04:00
return themeIcon( QLatin1String("owncloud-icon-error") );
}
QIcon ownCloudTheme::applicationIcon( ) const
{
2012-08-02 13:17:24 +04:00
return themeIcon( QLatin1String("owncloud-icon") );
}
}