Hide mono icon options if the resource has no mono icons

This commit is contained in:
Daniel Molkentin 2013-08-14 16:35:36 +02:00
parent e89bdfc422
commit 697e355f07
3 changed files with 30 additions and 6 deletions

View File

@ -21,6 +21,7 @@
#include "mirall/mirallconfigfile.h"
#include <QNetworkProxy>
#include <QDir>
namespace Mirall {
@ -49,6 +50,16 @@ GeneralSettings::GeneralSettings(QWidget *parent) :
// misc
connect(_ui->monoIconsCheckBox, SIGNAL(toggled(bool)), SLOT(saveMiscSettings()));
// OEM themes are not obliged to ship mono icons, so there
// is no point in offering an option
QString themeDir = QString::fromLatin1(":/mirall/theme/1%1/")
.arg(Theme::instance()->systrayIconFlavor(true));
if (QDir(themeDir).exists())
{
_ui->monoIconsCheckBox->setVisible(false);
}
}
GeneralSettings::~GeneralSettings()

View File

@ -94,12 +94,8 @@ QIcon Theme::trayFolderIcon( const QString& backend ) const
QIcon Theme::themeIcon( const QString& name, bool sysTray ) const
{
QString flavor;
if (sysTray && _mono) {
#ifdef Q_OS_MAC
flavor = QLatin1String("black");
#else
flavor = QLatin1String("white");
#endif
if (sysTray) {
flavor = systrayIconFlavor(_mono);
} else {
flavor = QLatin1String("colored");
}
@ -158,6 +154,21 @@ QString Theme::defaultClientFolder() const
return appName();
}
QString Theme::systrayIconFlavor(bool mono) const
{
QString flavor;
if (mono) {
#ifdef Q_OS_MAC
flavor = QLatin1String("black");
#else
flavor = QLatin1String("white");
#endif
} else {
flavor = QLatin1String("colored");
}
return flavor;
}
void Theme::setSystrayUseMonoIcons(bool mono)
{
_mono = mono;

View File

@ -119,6 +119,8 @@ public:
*/
virtual QString enforcedLocale() const { return QString::null; }
/** colored, white or black */
QString systrayIconFlavor(bool mono) const;
/**
* Override to use a string or a custom image name.