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 "theme.h"
|
2012-02-21 13:48:18 +04:00
|
|
|
#include "version.h"
|
2012-02-16 13:42:44 +04:00
|
|
|
|
2012-02-20 19:45:27 +04:00
|
|
|
#include <QtCore>
|
|
|
|
#include <QtGui>
|
|
|
|
|
2012-02-16 13:42:44 +04:00
|
|
|
namespace Mirall {
|
|
|
|
|
|
|
|
Theme::Theme()
|
2012-02-20 19:45:27 +04:00
|
|
|
:QObject()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
QIcon Theme::folderIcon( const QString& backend, int size ) const
|
|
|
|
{
|
|
|
|
QString name;
|
|
|
|
|
|
|
|
if( backend == "owncloud") name = QString( "mirall-%1.png" ).arg(size);
|
|
|
|
if( backend == "unison" ) name = QString( "folder-%1.png" ).arg(size);
|
|
|
|
if( backend == "csync" ) name = QString( "folder-remote-%1.png" ).arg(size);
|
|
|
|
|
|
|
|
return QIcon( QString( ":/mirall/resources/%1").arg(name) );
|
|
|
|
}
|
|
|
|
|
|
|
|
QIcon Theme::syncStateIcon( SyncResult::Status status, int ) const
|
|
|
|
{
|
|
|
|
// FIXME: Mind the size!
|
|
|
|
QString statusIcon;
|
|
|
|
|
|
|
|
qDebug() << "Status: " << status;
|
|
|
|
|
|
|
|
if( status == SyncResult::NotYetStarted ) {
|
|
|
|
statusIcon = "dialog-close";
|
|
|
|
} else if( status == SyncResult::SyncRunning ) {
|
|
|
|
statusIcon = "view-refresh";
|
|
|
|
} else if( status == SyncResult::Success ) {
|
|
|
|
statusIcon = "dialog-ok";
|
|
|
|
} else if( status == SyncResult::Error ) {
|
|
|
|
statusIcon = "dialog-close";
|
|
|
|
} else if( status == SyncResult::Disabled ) {
|
|
|
|
statusIcon = "dialog-cancel";
|
|
|
|
} else if( status == SyncResult::SetupError ) {
|
|
|
|
statusIcon = "dialog-cancel";
|
|
|
|
} else {
|
|
|
|
statusIcon = "dialog-close";
|
|
|
|
}
|
|
|
|
return QIcon::fromTheme( statusIcon, QIcon( QString( ":/mirall/resources/%1").arg(statusIcon) ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
QString Theme::statusHeaderText( SyncResult::Status status ) const
|
2012-02-16 13:42:44 +04:00
|
|
|
{
|
2012-02-20 19:45:27 +04:00
|
|
|
QString resultStr;
|
2012-02-16 13:42:44 +04:00
|
|
|
|
2012-02-20 19:45:27 +04:00
|
|
|
if( status == SyncResult::NotYetStarted ) {
|
|
|
|
resultStr = tr("Not yet started");
|
|
|
|
} else if( status == SyncResult::SyncRunning ) {
|
|
|
|
resultStr = tr("Sync running");
|
|
|
|
} else if( status == SyncResult::Success ) {
|
|
|
|
resultStr = tr("Success");
|
|
|
|
} else if( status == SyncResult::Error ) {
|
|
|
|
resultStr = tr("Error");
|
|
|
|
} else if( status == SyncResult::Disabled ) {
|
|
|
|
resultStr = tr("Disabled");
|
|
|
|
} else if( status == SyncResult::SetupError ) {
|
|
|
|
resultStr = tr( "Setup Error" );
|
|
|
|
} else {
|
|
|
|
resultStr = tr("Undefined");
|
|
|
|
}
|
|
|
|
return resultStr;
|
2012-02-16 13:42:44 +04:00
|
|
|
}
|
|
|
|
|
2012-02-21 13:48:18 +04:00
|
|
|
QString Theme::version() const
|
|
|
|
{
|
|
|
|
return QString::fromLocal8Bit( MIRALL_STRINGIFY( MIRALL_VERSION ) );
|
|
|
|
}
|
|
|
|
|
2012-02-16 13:42:44 +04:00
|
|
|
}
|
|
|
|
|