mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 08:28:25 +00:00
Move loadableImageFormats() to the frontend.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25163 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
264f32ec37
commit
9d00e2ec0a
@ -302,7 +302,6 @@ src_support_header_files = Split('''
|
||||
foreach.h
|
||||
gettext.h
|
||||
gzstream.h
|
||||
imagetools.h
|
||||
lassert.h
|
||||
limited_stack.h
|
||||
lstrings.h
|
||||
@ -339,7 +338,6 @@ src_support_files = Split('''
|
||||
filetools.cpp
|
||||
gettext.cpp
|
||||
gzstream.cpp
|
||||
imagetools.cpp
|
||||
kill.cpp
|
||||
lassert.cpp
|
||||
lstrings.cpp
|
||||
|
@ -229,6 +229,9 @@ public:
|
||||
virtual docstring iconName(FuncRequest const & f, bool unknown) = 0;
|
||||
};
|
||||
|
||||
/// Return the list of loadable formats.
|
||||
std::vector<std::string> loadableImageFormats();
|
||||
|
||||
} // namespace frontend
|
||||
|
||||
frontend::Application * theApp();
|
||||
|
@ -61,12 +61,14 @@
|
||||
#include "support/linkback/LinkBackProxy.h"
|
||||
#endif
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QClipboard>
|
||||
#include <QDir>
|
||||
#include <QEventLoop>
|
||||
#include <QFileOpenEvent>
|
||||
#include <QHash>
|
||||
#include <QIcon>
|
||||
#include <QImageReader>
|
||||
#include <QLocale>
|
||||
#include <QLibraryInfo>
|
||||
#include <QList>
|
||||
@ -129,6 +131,34 @@ frontend::Application * createApplication(int & argc, char * argv[])
|
||||
|
||||
namespace frontend {
|
||||
|
||||
|
||||
/// Return the list of loadable formats.
|
||||
vector<string> loadableImageFormats()
|
||||
{
|
||||
vector<string> fmts;
|
||||
|
||||
QList<QByteArray> qt_formats = QImageReader::supportedImageFormats();
|
||||
|
||||
LYXERR(Debug::GRAPHICS,
|
||||
"\nThe image loader can load the following directly:\n");
|
||||
|
||||
if (qt_formats.empty())
|
||||
LYXERR(Debug::GRAPHICS, "\nQt4 Problem: No Format available!");
|
||||
|
||||
for (QList<QByteArray>::const_iterator it = qt_formats.begin(); it != qt_formats.end(); ++it) {
|
||||
|
||||
LYXERR(Debug::GRAPHICS, (const char *) *it << ", ");
|
||||
|
||||
string ext = ascii_lowercase((const char *) *it);
|
||||
// special case
|
||||
if (ext == "jpeg")
|
||||
ext = "jpg";
|
||||
fmts.push_back(ext);
|
||||
}
|
||||
|
||||
return fmts;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Icon loading support code.
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
@ -17,10 +17,11 @@
|
||||
|
||||
#include "Format.h"
|
||||
|
||||
#include "frontends/Application.h"
|
||||
|
||||
#include "support/debug.h"
|
||||
#include "support/FileName.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/imagetools.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
@ -74,7 +75,7 @@ vector<string> const & Cache::loadableFormats() const
|
||||
Formats::const_iterator end = formats.end();
|
||||
|
||||
// The formats natively loadable.
|
||||
vector<string> nformat = loadableImageFormats();
|
||||
vector<string> nformat = frontend::loadableImageFormats();
|
||||
|
||||
vector<string>::const_iterator it = nformat.begin();
|
||||
for (; it != nformat.end(); ++it) {
|
||||
|
@ -62,8 +62,6 @@ liblyxsupport_la_SOURCES = \
|
||||
gettext.h \
|
||||
gzstream.cpp \
|
||||
gzstream.h \
|
||||
imagetools.cpp \
|
||||
imagetools.h \
|
||||
kill.cpp \
|
||||
lassert.h \
|
||||
lassert.cpp \
|
||||
|
@ -1,55 +0,0 @@
|
||||
/**
|
||||
* \file imagetools.cpp
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Abdelrazak Younes
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "support/debug.h"
|
||||
#include "support/imagetools.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QImageReader>
|
||||
#include <QList>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace lyx {
|
||||
namespace support {
|
||||
|
||||
/// Return the list of loadable formats.
|
||||
vector<string> loadableImageFormats()
|
||||
{
|
||||
vector<string> fmts;
|
||||
|
||||
QList<QByteArray> qt_formats = QImageReader::supportedImageFormats();
|
||||
|
||||
LYXERR(Debug::GRAPHICS,
|
||||
"\nThe image loader can load the following directly:\n");
|
||||
|
||||
if (qt_formats.empty())
|
||||
LYXERR(Debug::GRAPHICS, "\nQt4 Problem: No Format available!");
|
||||
|
||||
for (QList<QByteArray>::const_iterator it = qt_formats.begin(); it != qt_formats.end(); ++it) {
|
||||
|
||||
LYXERR(Debug::GRAPHICS, (const char *) *it << ", ");
|
||||
|
||||
string ext = ascii_lowercase((const char *) *it);
|
||||
// special case
|
||||
if (ext == "jpeg")
|
||||
ext = "jpg";
|
||||
fmts.push_back(ext);
|
||||
}
|
||||
|
||||
return fmts;
|
||||
}
|
||||
|
||||
|
||||
} // namespace support
|
||||
} // namespace lyx
|
@ -1,27 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file imagetools.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author João Luis M. Assirati
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef IMAGETOOLS_H
|
||||
#define IMAGETOOLS_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace lyx {
|
||||
namespace support {
|
||||
|
||||
/// Return the list of loadable formats.
|
||||
std::vector<std::string> loadableImageFormats();
|
||||
|
||||
} // namespace support
|
||||
} // namespace lyx
|
||||
|
||||
#endif // IMAGETOOLS_H
|
Loading…
Reference in New Issue
Block a user