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
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
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-04-30 10:56:56 +04:00
|
|
|
switch( status ) {
|
|
|
|
case SyncResult::Undefined:
|
2012-07-12 16:33:58 +04:00
|
|
|
resultStr = QObject::tr("Status undefined");
|
2012-04-30 10:56:56 +04:00
|
|
|
break;
|
|
|
|
case SyncResult::NotYetStarted:
|
2012-07-12 16:33:58 +04:00
|
|
|
resultStr = QObject::tr("Waiting to start sync");
|
2012-04-30 10:56:56 +04:00
|
|
|
break;
|
|
|
|
case SyncResult::SyncRunning:
|
2012-07-12 16:33:58 +04:00
|
|
|
resultStr = QObject::tr("Sync is running");
|
2012-04-30 10:56:56 +04:00
|
|
|
break;
|
|
|
|
case SyncResult::Success:
|
2012-07-12 16:33:58 +04:00
|
|
|
resultStr = QObject::tr("Sync Success");
|
2012-04-30 10:56:56 +04:00
|
|
|
break;
|
|
|
|
case SyncResult::Error:
|
2012-07-12 16:33:58 +04:00
|
|
|
resultStr = QObject::tr("Sync Error - Click info button for details.");
|
2012-04-30 10:56:56 +04:00
|
|
|
break;
|
|
|
|
case SyncResult::SetupError:
|
2012-07-12 16:33:58 +04:00
|
|
|
resultStr = QObject::tr( "Setup Error" );
|
2012-04-30 10:56:56 +04:00
|
|
|
break;
|
|
|
|
default:
|
2012-07-12 16:33:58 +04:00
|
|
|
resultStr = QObject::tr("Status undefined");
|
2012-02-20 19:45:27 +04:00
|
|
|
}
|
|
|
|
return resultStr;
|
2012-02-16 13:42:44 +04:00
|
|
|
}
|
|
|
|
|
2012-05-02 17:50:01 +04:00
|
|
|
QString Theme::version() const
|
2012-03-03 13:51:06 +04:00
|
|
|
{
|
2012-05-02 17:50:01 +04:00
|
|
|
return QString::fromLocal8Bit( MIRALL_STRINGIFY( MIRALL_VERSION ) );
|
2012-03-03 13:51:06 +04:00
|
|
|
}
|
|
|
|
|
2012-05-02 17:50:01 +04:00
|
|
|
QIcon Theme::trayFolderIcon( const QString& backend ) const
|
2012-02-21 13:48:18 +04:00
|
|
|
{
|
2012-05-02 17:50:01 +04:00
|
|
|
return folderIcon( backend );
|
2012-02-21 13:48:18 +04:00
|
|
|
}
|
|
|
|
|
2012-05-02 17:50:01 +04:00
|
|
|
/*
|
|
|
|
* helper to load a icon from either the icon theme the desktop provides or from
|
|
|
|
* the apps Qt resources.
|
|
|
|
*/
|
2012-07-18 19:29:06 +04:00
|
|
|
QIcon Theme::themeIcon( const QString& name ) const
|
2012-05-02 17:50:01 +04:00
|
|
|
{
|
|
|
|
QIcon icon;
|
|
|
|
if( QIcon::hasThemeIcon( name )) {
|
|
|
|
// use from theme
|
|
|
|
icon = QIcon::fromTheme( name );
|
|
|
|
} else {
|
2012-07-18 19:29:06 +04:00
|
|
|
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));
|
|
|
|
}
|
|
|
|
}
|
2012-05-02 17:50:01 +04:00
|
|
|
}
|
|
|
|
return icon;
|
2012-02-16 13:42:44 +04:00
|
|
|
}
|
|
|
|
|
2012-05-02 17:50:01 +04:00
|
|
|
} // end namespace mirall
|
|
|
|
|