mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 10:22:55 +00:00
reimplement XPM handler via libXpm
TODO: alternative to qt_read_xpm_array() to load XPM with color table for the style pixmaps Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
c3d07c87f7
commit
6b4f25f6d0
23 changed files with 134 additions and 1218 deletions
|
@ -480,7 +480,7 @@ if(NOT HAVE_pic)
|
|||
endif()
|
||||
|
||||
# keep in sync with the GUI component CMake file, only definitions setup is needed here
|
||||
foreach(x11ext Xshape Xinerama Xrandr Xrender Xfixes Xcursor)
|
||||
foreach(x11ext Xshape Xinerama Xrandr Xrender Xfixes Xcursor Xpm)
|
||||
if(NOT X11_${x11ext}_FOUND)
|
||||
message(WARNING "The X11 ${x11ext} extension was not found")
|
||||
string(TOUPPER "${x11ext}" upperext)
|
||||
|
@ -493,7 +493,7 @@ if(NOT X11_Xext_FOUND)
|
|||
katie_config(QT_NO_XSHAPE)
|
||||
endif()
|
||||
if(NOT X11_SM_FOUND OR NOT X11_ICE_FOUND)
|
||||
message(WARNING "X11 SM/ICE was not found thus disabling session manager support")
|
||||
message(WARNING "The X11 SM/ICE was not found thus disabling session manager support")
|
||||
katie_config(QT_NO_SESSIONMANAGER)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ pkgdesc='C++ toolkit derived from the Qt 4.8 framework'
|
|||
arch=('i486' 'i686' 'pentium4' 'x86_64' 'arm')
|
||||
url='https://github.com/fluxer/katie'
|
||||
license=('LGPL' 'BSD')
|
||||
depends=('libsm' 'libxcursor' 'libxinerama' 'icu' 'libcups' 'libxrandr' 'fontconfig'
|
||||
'xdg-utils' 'jansson')
|
||||
depends=('libsm' 'libxcursor' 'libxinerama' 'libxpm' 'libxrandr' 'fontconfig'
|
||||
'icu' 'jansson' 'libcups' 'xdg-utils')
|
||||
makedepends=('cmake' 'git' 'unifdef')
|
||||
source=("git+https://github.com/fluxer/katie")
|
||||
sha1sums=('SKIP')
|
||||
|
|
|
@ -9,7 +9,7 @@ Build-Depends: debhelper (>= 9~), libssl-dev, zlib1g-dev, libzstd-dev,
|
|||
libc6-dev, libjansson-dev, libpng-dev, libcups2-dev, libfreetype6-dev,
|
||||
libfontconfig1-dev, libpcre3-dev, libdbus-1-dev, libicu-dev, cmake,
|
||||
git, xserver-xorg-dev, libxinerama-dev, libxrandr-dev, libxrender-dev,
|
||||
libxcursor-dev, libsm-dev, unifdef | dpkg
|
||||
libxcursor-dev, libsm-dev, libxpm-dev, unifdef | dpkg
|
||||
|
||||
Package: katie-runtime
|
||||
Architecture: amd64 arm64 armel armhf i386 mips mips64el mipsel ppc64el s390x hurd-i386
|
||||
|
|
|
@ -14,7 +14,7 @@ DIST_SUBDIR = ${PORTNAME}
|
|||
WRKSRC = ${WRKDIR}/katie-master
|
||||
|
||||
USES = compiler:c++11-lang pkgconfig cmake ssl xorg desktop-file-utils
|
||||
USE_XORG = x11 xinerama xrandr xrender xfixes xcursor xext sm ice
|
||||
USE_XORG = x11 xinerama xrandr xrender xfixes xcursor xext xpm sm ice
|
||||
USE_LDCONFIG = yes
|
||||
RUN_DEPENDS = xdg-open:devel/xdg-utils
|
||||
LIB_DEPENDS = libzstd.so:archivers/zstd libicuuc.so:devel/icu \
|
||||
|
|
|
@ -38,6 +38,7 @@ BUILD_DEPENDS = unifdef-[0-9]*:../../devel/unifdef
|
|||
.include "../../x11/libXrandr/buildlink3.mk"
|
||||
.include "../../x11/libXrender/buildlink3.mk"
|
||||
.include "../../x11/libX11/buildlink3.mk"
|
||||
.include "../../x11/libXpm/buildlink3.mk"
|
||||
.include "../../x11/libICE/buildlink3.mk"
|
||||
.include "../../x11/libSM/buildlink3.mk"
|
||||
.include "../../fonts/fontconfig/buildlink3.mk"
|
||||
|
|
|
@ -24,7 +24,7 @@ RUN_DEPENDS = devel/desktop-file-utils devel/xdg-utils
|
|||
LIB_DEPENDS = archivers/zstd textproc/icu4c devel/jansson devel/pcre \
|
||||
graphics/png x11/dbus print/cups,-libs devel/gettext,-runtime
|
||||
WANTLIB = ${COMPILER_LIBCXX} ICE SM X11 Xcursor Xext Xfixes Xinerama Xrandr \
|
||||
Xrender fontconfig freetype zstd icui18n icuuc pcre png \
|
||||
Xrender Xpm fontconfig freetype zstd icui18n icuuc pcre png \
|
||||
dbus-1 cups intl ssl z c crypto m
|
||||
SEPARATE_BUILD = Yes
|
||||
CONFIGURE_ARGS = -DKATIE_TOOLS_SUFFIX="-katie" -Wno-dev
|
||||
|
|
|
@ -149,6 +149,7 @@
|
|||
#cmakedefine QT_NO_XRENDER
|
||||
#cmakedefine QT_NO_XSHAPE
|
||||
#cmakedefine QT_NO_XSYNC
|
||||
#cmakedefine QT_NO_XPM
|
||||
|
||||
// Misc
|
||||
#cmakedefine QT_NO_USING_NAMESPACE
|
||||
|
@ -442,7 +443,7 @@
|
|||
#endif
|
||||
|
||||
// Drag and drop
|
||||
#if !defined(QT_NO_DRAGANDDROP) && defined(QT_NO_IMAGEFORMAT_XPM)
|
||||
#if !defined(QT_NO_DRAGANDDROP) && defined(QT_NO_XPM)
|
||||
# define QT_NO_DRAGANDDROP
|
||||
#endif
|
||||
|
||||
|
@ -472,12 +473,12 @@
|
|||
#endif
|
||||
|
||||
// QCleanLooksStyle
|
||||
#if !defined(QT_NO_STYLE_CLEANLOOKS) && (defined(QT_NO_STYLE_WINDOWS) || defined(QT_NO_IMAGEFORMAT_XPM))
|
||||
#if !defined(QT_NO_STYLE_CLEANLOOKS) && (defined(QT_NO_STYLE_WINDOWS) || defined(QT_NO_XPM))
|
||||
# define QT_NO_STYLE_CLEANLOOKS
|
||||
#endif
|
||||
|
||||
// QPlastiqueStyle
|
||||
#if !defined(QT_NO_STYLE_PLASTIQUE) && (defined(QT_NO_STYLE_WINDOWS) || defined(QT_NO_IMAGEFORMAT_XPM))
|
||||
#if !defined(QT_NO_STYLE_PLASTIQUE) && (defined(QT_NO_STYLE_WINDOWS) || defined(QT_NO_XPM))
|
||||
# define QT_NO_STYLE_PLASTIQUE
|
||||
#endif
|
||||
|
||||
|
|
|
@ -911,7 +911,7 @@ set(GUI_SOURCES
|
|||
)
|
||||
|
||||
# keep in sync with the top-level CMake file, only libraries setup is needed here
|
||||
foreach(x11ext Xshape Xinerama Xrandr Xrender Xfixes Xcursor Xext SM ICE)
|
||||
foreach(x11ext Xshape Xinerama Xrandr Xrender Xfixes Xcursor Xpm Xext SM ICE)
|
||||
if(X11_${x11ext}_FOUND AND X11_${x11ext}_LIB)
|
||||
set(EXTRA_GUI_LIBS
|
||||
${EXTRA_GUI_LIBS}
|
||||
|
|
|
@ -877,8 +877,8 @@ QImage::QImage(const char *fileName, const char *format)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_IMAGEFORMAT_XPM
|
||||
extern bool qt_read_xpm_array(const char * const *source, QImage &image);
|
||||
#ifndef QT_NO_XPM
|
||||
extern bool qt_read_xpm_array(const char* const *source, QImage &image);
|
||||
|
||||
/*!
|
||||
Constructs an image from the given \a xpm image.
|
||||
|
@ -906,7 +906,7 @@ QImage::QImage(const char * const xpm[])
|
|||
// Issue: Warning because the constructor may be ambigious
|
||||
qWarning("QImage::QImage(), XPM is not supported");
|
||||
}
|
||||
#endif // QT_NO_IMAGEFORMAT_XPM
|
||||
#endif // QT_NO_XPM
|
||||
|
||||
/*!
|
||||
\fn QImage::QImage(const QByteArray &data)
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
QImage(uchar *data, int width, int height, int bytesPerLine, Format format);
|
||||
QImage(const uchar *data, int width, int height, int bytesPerLine, Format format);
|
||||
|
||||
#ifndef QT_NO_IMAGEFORMAT_XPM
|
||||
#ifndef QT_NO_XPM
|
||||
explicit QImage(const char * const xpm[]);
|
||||
#endif
|
||||
explicit QImage(const QString &fileName, const char *format = nullptr);
|
||||
|
|
|
@ -133,7 +133,7 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
|
|||
// check if we have built-in support for the format first
|
||||
if (form == "png") {
|
||||
handler = new QPngHandler;
|
||||
#ifndef QT_NO_IMAGEFORMAT_XPM
|
||||
#ifndef QT_NO_XPM
|
||||
} else if (form == "xpm") {
|
||||
handler = new QXpmHandler;
|
||||
#endif
|
||||
|
@ -161,7 +161,7 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
|
|||
if (QPngHandler::canRead(device)) {
|
||||
handler = new QPngHandler;
|
||||
}
|
||||
#ifndef QT_NO_IMAGEFORMAT_XPM
|
||||
#ifndef QT_NO_XPM
|
||||
if (!handler && QXpmHandler::canRead(device)) {
|
||||
handler = new QXpmHandler;
|
||||
}
|
||||
|
@ -1076,7 +1076,7 @@ QList<QByteArray> QImageReader::supportedImageFormats()
|
|||
#ifndef QT_NO_IMAGEFORMAT_PPM
|
||||
<< "ppm" << "pbm"
|
||||
#endif
|
||||
#ifndef QT_NO_IMAGEFORMAT_XPM
|
||||
#ifndef QT_NO_XPM
|
||||
<< "xpm"
|
||||
#endif
|
||||
;
|
||||
|
|
|
@ -88,7 +88,6 @@
|
|||
|
||||
// image handlers
|
||||
#include "qppmhandler_p.h"
|
||||
#include "qxpmhandler_p.h"
|
||||
#include "qpnghandler_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
@ -102,10 +101,6 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device,
|
|||
// check if any built-in handlers can write the image
|
||||
if (form == "png") {
|
||||
handler = new QPngHandler;
|
||||
#ifndef QT_NO_IMAGEFORMAT_XPM
|
||||
} else if (form == "xpm") {
|
||||
handler = new QXpmHandler;
|
||||
#endif
|
||||
#ifndef QT_NO_IMAGEFORMAT_PPM
|
||||
} else if (form == "pbm" || form == "pbmraw" || form == "ppm" || form == "ppmraw") {
|
||||
handler = new QPpmHandler;
|
||||
|
@ -497,7 +492,6 @@ bool QImageWriter::supportsOption(QImageIOHandler::ImageOption option) const
|
|||
\header \o Format \o Description
|
||||
\row \o PNG \o Portable Network Graphics
|
||||
\row \o PPM \o Portable Pixmap
|
||||
\row \o XPM \o X11 Pixmap
|
||||
\endtable
|
||||
|
||||
Reading and writing SVG files is supported through Qt's
|
||||
|
@ -515,9 +509,6 @@ QList<QByteArray> QImageWriter::supportedImageFormats()
|
|||
#ifndef QT_NO_IMAGEFORMAT_PPM
|
||||
formats << "ppm";
|
||||
#endif
|
||||
#ifndef QT_NO_IMAGEFORMAT_XPM
|
||||
formats << "xpm";
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_LIBRARY
|
||||
QFactoryLoader *l = imageloader();
|
||||
|
|
|
@ -247,7 +247,7 @@ QPixmap::QPixmap(const QPixmap &pixmap)
|
|||
slightly more efficient (for example, when the code is in a shared
|
||||
library) and ROMable when the application is to be stored in ROM.
|
||||
*/
|
||||
#ifndef QT_NO_IMAGEFORMAT_XPM
|
||||
#ifndef QT_NO_XPM
|
||||
QPixmap::QPixmap(const char * const xpm[])
|
||||
: QPaintDevice()
|
||||
{
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
QPixmap(int w, int h);
|
||||
QPixmap(const QSize &);
|
||||
QPixmap(const QString& fileName, const char *format = nullptr, Qt::ImageConversionFlags flags = Qt::AutoColor);
|
||||
#ifndef QT_NO_IMAGEFORMAT_XPM
|
||||
#ifndef QT_NO_XPM
|
||||
QPixmap(const char * const xpm[]);
|
||||
#endif
|
||||
QPixmap(const QPixmap &);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,6 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Copyright (C) 2016 Ivailo Monev
|
||||
** Copyright (C) 2021 Ivailo Monev
|
||||
**
|
||||
** This file is part of the QtGui module of the Katie Toolkit.
|
||||
**
|
||||
|
@ -35,7 +34,7 @@
|
|||
|
||||
#include "QtGui/qimageiohandler.h"
|
||||
|
||||
#ifndef QT_NO_IMAGEFORMAT_XPM
|
||||
#ifndef QT_NO_XPM
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
@ -45,35 +44,14 @@ public:
|
|||
QXpmHandler();
|
||||
bool canRead() const;
|
||||
bool read(QImage *image);
|
||||
bool write(const QImage &image);
|
||||
|
||||
static bool canRead(QIODevice *device);
|
||||
|
||||
QByteArray name() const;
|
||||
|
||||
QVariant option(ImageOption option) const;
|
||||
void setOption(ImageOption option, const QVariant &value);
|
||||
bool supportsOption(ImageOption option) const;
|
||||
|
||||
private:
|
||||
bool readHeader();
|
||||
enum State {
|
||||
Ready,
|
||||
ReadHeader,
|
||||
Error
|
||||
};
|
||||
State state;
|
||||
int width;
|
||||
int height;
|
||||
int ncols;
|
||||
int cpp;
|
||||
QByteArray buffer;
|
||||
int index;
|
||||
QString fileName;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_IMAGEFORMAT_XPM
|
||||
#endif // QT_NO_XPM
|
||||
|
||||
#endif // QXPMHANDLER_P_H
|
||||
|
|
|
@ -80,21 +80,25 @@
|
|||
#endif // QT_NO_XRENDER
|
||||
|
||||
#ifndef QT_NO_XSYNC
|
||||
# include "X11/extensions/sync.h"
|
||||
# include "X11/extensions/sync.h"
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_XCURSOR
|
||||
#include <X11/Xcursor/Xcursor.h>
|
||||
#include <X11/cursorfont.h>
|
||||
# include <X11/Xcursor/Xcursor.h>
|
||||
# include <X11/cursorfont.h>
|
||||
#endif // QT_NO_XCURSOR
|
||||
|
||||
#ifndef QT_NO_XFIXES
|
||||
# include <X11/extensions/Xfixes.h>
|
||||
#endif // QT_NO_XFIXES
|
||||
|
||||
#ifndef QT_NO_XPM
|
||||
# include <X11/xpm.h>
|
||||
#endif // QT_NO_XPM
|
||||
|
||||
#ifndef QT_NO_SESSIONMANAGER
|
||||
#include <X11/SM/SMlib.h>
|
||||
#endif
|
||||
# include <X11/SM/SMlib.h>
|
||||
#endif // QT_NO_SESSIONMANAGER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
|
|
@ -467,7 +467,7 @@ private slots:
|
|||
|
||||
QWhatsThisAction::QWhatsThisAction(QObject *parent) : QAction(tr("What's This?"), parent)
|
||||
{
|
||||
#ifndef QT_NO_IMAGEFORMAT_XPM
|
||||
#ifndef QT_NO_XPM
|
||||
QPixmap p((const char**)button_image);
|
||||
setIcon(p);
|
||||
#endif
|
||||
|
|
|
@ -382,7 +382,7 @@ inline static int lowest_bit(uint v)
|
|||
|
||||
static const qreal inv_dist_to_plane = 1. / 1024.;
|
||||
|
||||
#ifndef QT_NO_IMAGEFORMAT_XPM
|
||||
#ifndef QT_NO_XPM
|
||||
// Message box icons, from page 210 of the Windows style guide.
|
||||
|
||||
// Hand-drawn to resemble Microsoft's icons, but in the Mac/Netscape palette.
|
||||
|
|
|
@ -4280,7 +4280,7 @@ QPixmap QCleanlooksStyle::standardPixmap(StandardPixmap standardPixmap, const QS
|
|||
{
|
||||
QPixmap pixmap;
|
||||
|
||||
#ifndef QT_NO_IMAGEFORMAT_XPM
|
||||
#ifndef QT_NO_XPM
|
||||
switch (standardPixmap) {
|
||||
case SP_TitleBarNormalButton:
|
||||
return QPixmap((const char **)qt_cleanlooks_dock_widget_restore_xpm);
|
||||
|
@ -4293,7 +4293,7 @@ QPixmap QCleanlooksStyle::standardPixmap(StandardPixmap standardPixmap, const QS
|
|||
default:
|
||||
break;
|
||||
}
|
||||
#endif //QT_NO_IMAGEFORMAT_XPM
|
||||
#endif //QT_NO_XPM
|
||||
|
||||
return QWindowsStyle::standardPixmap(standardPixmap, opt, widget);
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef QT_NO_IMAGEFORMAT_XPM
|
||||
#ifndef QT_NO_XPM
|
||||
static const char * const tree_branch_open_xpm[] = {
|
||||
"9 9 2 1",
|
||||
" c None",
|
||||
|
@ -167,7 +167,7 @@ static const char * const filedialog_end_xpm[]={
|
|||
"aaeeeeeeeeeeeee.",
|
||||
"aaa.............",
|
||||
"aaaaaaaaaaaaaaaa"};
|
||||
#endif // QT_NO_IMAGEFORMAT_XPM
|
||||
#endif // QT_NO_XPM
|
||||
|
||||
/*!
|
||||
\class QCommonStyle
|
||||
|
@ -360,7 +360,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
|
|||
int bef_v = mid_v;
|
||||
int aft_h = mid_h;
|
||||
int aft_v = mid_v;
|
||||
#ifndef QT_NO_IMAGEFORMAT_XPM
|
||||
#ifndef QT_NO_XPM
|
||||
static const int decoration_size = 9;
|
||||
static QPixmap open(tree_branch_open_xpm);
|
||||
static QPixmap closed(tree_branch_closed_xpm);
|
||||
|
@ -372,7 +372,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
|
|||
aft_v += delta;
|
||||
p->drawPixmap(bef_h, bef_v, opt->state & State_Open ? open : closed);
|
||||
}
|
||||
#endif // QT_NO_IMAGEFORMAT_XPM
|
||||
#endif // QT_NO_XPM
|
||||
if (opt->state & State_Item) {
|
||||
if (opt->direction == Qt::RightToLeft)
|
||||
p->drawLine(opt->rect.left(), mid_v, bef_h, mid_v);
|
||||
|
@ -5212,7 +5212,7 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti
|
|||
return pixmap;
|
||||
|
||||
switch (sp) {
|
||||
#ifndef QT_NO_IMAGEFORMAT_XPM
|
||||
#ifndef QT_NO_XPM
|
||||
case SP_ToolBarHorizontalExtensionButton:
|
||||
if (rtl) {
|
||||
QImage im(tb_extension_arrow_h_xpm);
|
||||
|
|
|
@ -1986,7 +1986,7 @@ QMotifStyle::subElementRect(SubElement sr, const QStyleOption *opt, const QWidge
|
|||
return rect;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_IMAGEFORMAT_XPM
|
||||
#ifndef QT_NO_XPM
|
||||
static const char * const qt_motif_menu_xpm[] = {
|
||||
"16 16 11 1",
|
||||
" c #000000",
|
||||
|
@ -2161,7 +2161,7 @@ QPixmap
|
|||
QMotifStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt,
|
||||
const QWidget *widget) const
|
||||
{
|
||||
#ifndef QT_NO_IMAGEFORMAT_XPM
|
||||
#ifndef QT_NO_XPM
|
||||
switch (standardPixmap) {
|
||||
case SP_TitleBarMenuButton:
|
||||
return QPixmap(qt_motif_menu_xpm);
|
||||
|
|
|
@ -336,7 +336,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_IMAGEFORMAT_XPM
|
||||
#ifndef QT_NO_XPM
|
||||
|
||||
/* XPM */
|
||||
static const char * const qt_windows_menu_xpm[] = {
|
||||
|
@ -547,7 +547,7 @@ static const char * qt_windows_dock_widget_close_xpm[] = {
|
|||
".##..##.",
|
||||
"........",
|
||||
"........"};
|
||||
#endif //QT_NO_IMAGEFORMAT_XPM
|
||||
#endif //QT_NO_XPM
|
||||
|
||||
/*!
|
||||
\reimp
|
||||
|
@ -555,7 +555,7 @@ static const char * qt_windows_dock_widget_close_xpm[] = {
|
|||
QPixmap QWindowsStyle::standardPixmap(StandardPixmap standardpixmap, const QStyleOption *opt,
|
||||
const QWidget *widget) const
|
||||
{
|
||||
#ifndef QT_NO_IMAGEFORMAT_XPM
|
||||
#ifndef QT_NO_XPM
|
||||
switch (standardpixmap) {
|
||||
case SP_TitleBarMenuButton:
|
||||
return QPixmap(qt_windows_menu_xpm);
|
||||
|
@ -586,7 +586,7 @@ QPixmap QWindowsStyle::standardPixmap(StandardPixmap standardpixmap, const QStyl
|
|||
default:
|
||||
break;
|
||||
}
|
||||
#endif //QT_NO_IMAGEFORMAT_XPM
|
||||
#endif //QT_NO_XPM
|
||||
return QCommonStyle::standardPixmap(standardpixmap, opt, widget);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue