LeechCraft
0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
util.cpp
Go to the documentation of this file.
1
/**********************************************************************
2
* LeechCraft - modular cross-platform feature rich internet client.
3
* Copyright (C) 2006-2014 Georg Rudoy
4
*
5
* Distributed under the Boost Software License, Version 1.0.
6
* (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7
**********************************************************************/
8
9
#include "
util.h
"
10
#include <QString>
11
#include <QImageWriter>
12
13
namespace
LC::Util
14
{
15
bool
HasSupportedImageExtension
(
const
QString
&
filename
)
16
{
17
if
(
filename
.count (
'.'
) < 1)
18
return
false
;
19
20
const
auto
&
ext
=
filename
.section (
'.'
, -1, -1);
21
const
auto
&
formats
= QImageWriter::supportedImageFormats ();
22
return
std::any_of (
formats
.begin (),
formats
.end (),
23
[&
ext
] (
const
QByteArray
&
format
)
24
{ return !QString::compare (ext, format, Qt::CaseInsensitive); });
25
}
26
27
bool
IsOSXLoadFromBundle
()
28
{
29
#if defined (Q_OS_MAC) && !defined (USE_UNIX_LAYOUT)
30
return
qgetenv
(
"LC_BUNDLE_DIRECT_LOAD"
) !=
"1"
;
31
#else
32
return
false
;
33
#endif
34
}
35
}
LC::Util
Definition
icoreproxy.h:34
LC::Util::Filter
Container< T > Filter(const Container< T > &c, F f)
Definition
prelude.h:118
LC::Util::HasSupportedImageExtension
bool HasSupportedImageExtension(const QString &filename)
Checks if the given filename has a known image extension.
Definition
util.cpp:15
LC::Util::IsOSXLoadFromBundle
bool IsOSXLoadFromBundle()
Definition
util.cpp:27
util.h
src
util
sys
util.cpp
Generated by
1.10.0