LeechCraft 0.6.70-17609-g3dde4097dd
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
13namespace 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
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}
bool HasSupportedImageExtension(const QString &filename)
Checks if the given filename has a known image extension.
Definition util.cpp:15
bool IsOSXLoadFromBundle()
Definition util.cpp:27