generic: bump minimum Katie version requirement to 4.12.0

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-05-22 04:04:43 +03:00
parent a03833f7bd
commit 847dc8273e
9 changed files with 2 additions and 119 deletions

View file

@ -33,11 +33,7 @@
#include <Plasma/Applet> #include <Plasma/Applet>
#include <Plasma/Theme> #include <Plasma/Theme>
#if QT_VERSION >= 0x041200
static const QByteArray pixmapFormat = QImageWriter::defaultImageFormat(); static const QByteArray pixmapFormat = QImageWriter::defaultImageFormat();
#else
static const QByteArray pixmapFormat = "png";
#endif
BlackBoardWidget::BlackBoardWidget(Plasma::Applet *parent) BlackBoardWidget::BlackBoardWidget(Plasma::Applet *parent)
: QGraphicsWidget(parent) : QGraphicsWidget(parent)

View file

@ -29,11 +29,7 @@
#include <kdebug.h> #include <kdebug.h>
#include <kstandarddirs.h> #include <kstandarddirs.h>
#if QT_VERSION >= 0x041200
static const QByteArray imageFormat = QImageWriter::defaultImageFormat(); static const QByteArray imageFormat = QImageWriter::defaultImageFormat();
#else
static const QByteArray imageFormat = "png";
#endif
LoadImageThread::LoadImageThread(const QString &filePath) LoadImageThread::LoadImageThread(const QString &filePath)
: m_filePath(filePath) : m_filePath(filePath)

View file

@ -94,30 +94,6 @@ void VncClientThread::outputHandlerStatic(const char *format, ...)
void VncClientThread::setClientColorDepth(rfbClient* cl, VncClientThread::ColorDepth cd) void VncClientThread::setClientColorDepth(rfbClient* cl, VncClientThread::ColorDepth cd)
{ {
switch(cd) { switch(cd) {
#if QT_VERSION < 0x041200
case bpp8:
if (m_colorTable.isEmpty()) {
m_colorTable.resize(256);
int r,g,b;
for (int i = 0; i < 256; ++i) {
//pick out the red (3 bits), green (3 bits) and blue (2 bits) bits and make them maximum significant in 8bits
//this gives a colortable for 8bit true colors
r= (i & 0x07) << 5;
g= (i & 0x38) << 2;
b= i & 0xc0;
m_colorTable[i] = qRgb(r, g, b);
}
}
cl->format.depth = 8;
cl->format.bitsPerPixel = 8;
cl->format.redShift = 0;
cl->format.greenShift = 3;
cl->format.blueShift = 6;
cl->format.redMax = 7;
cl->format.greenMax = 7;
cl->format.blueMax = 3;
break;
#endif // QT_VERSION < 0x041200
case bpp16: case bpp16:
cl->format.depth = 16; cl->format.depth = 16;
cl->format.bitsPerPixel = 16; cl->format.bitsPerPixel = 16;
@ -189,12 +165,6 @@ void VncClientThread::updatefb(int x, int y, int w, int h)
const int width = cl->width, height = cl->height; const int width = cl->width, height = cl->height;
QImage img; QImage img;
switch(colorDepth()) { switch(colorDepth()) {
#if QT_VERSION < 0x041200
case bpp8:
img = QImage(cl->frameBuffer, width, height, QImage::Format_Indexed8);
img.setColorTable(m_colorTable);
break;
#endif
case bpp16: case bpp16:
img = QImage(cl->frameBuffer, width, height, QImage::Format_RGB16); img = QImage(cl->frameBuffer, width, height, QImage::Format_RGB16);
break; break;

View file

@ -187,10 +187,6 @@ private:
RemoteView::Quality m_quality; RemoteView::Quality m_quality;
ColorDepth m_colorDepth; ColorDepth m_colorDepth;
QQueue<ClientEvent* > m_eventQueue; QQueue<ClientEvent* > m_eventQueue;
#if QT_VERSION < 0x041200
//color table for 8bit indexed colors
QVector<QRgb> m_colorTable;
#endif
QString outputErrorMessageString; QString outputErrorMessageString;
volatile bool m_stopped; volatile bool m_stopped;

View file

@ -64,15 +64,6 @@ static void deleteObjectRects( QList< ObjectRect * >& rects, const QSet<ObjectRe
++it; ++it;
} }
static inline QString createAnnotationID()
{
#if QT_VERSION >= 0x041200
return QString::fromLatin1(qRandomUuid());
#else
return QString::number(qrand());
#endif
}
PagePrivate::PagePrivate( Page *page, uint n, double w, double h, Rotation o ) PagePrivate::PagePrivate( Page *page, uint n, double w, double h, Rotation o )
: m_page( page ), m_number( n ), m_orientation( o ), : m_page( page ), m_number( n ), m_orientation( o ),
m_width( w ), m_height( h ), m_doc( 0 ), m_boundingBox( 0, 0, 1, 1 ), m_width( w ), m_height( h ), m_doc( 0 ), m_boundingBox( 0, 0, 1, 1 ),
@ -642,7 +633,7 @@ void Page::addAnnotation( Annotation * annotation )
// Generate uniqueName: okular-UUID // Generate uniqueName: okular-UUID
if(annotation->uniqueName().isEmpty()) if(annotation->uniqueName().isEmpty())
{ {
QString uniqueName = "okular-" + createAnnotationID(); QString uniqueName = QString::fromLatin1("okular-") + QString::fromLatin1(qRandomUuid());
annotation->setUniqueName( uniqueName ); annotation->setUniqueName( uniqueName );
} }
annotation->d_ptr->m_page = d; annotation->d_ptr->m_page = d;

View file

@ -1497,24 +1497,7 @@ QFont XpsFile::getFontByName( const QString &fileName, float size )
kWarning(XpsDebug) << "Requesting uknown font:" << fileName; kWarning(XpsDebug) << "Requesting uknown font:" << fileName;
return QFont(); return QFont();
} }
#if QT_VERSION < 0x041200
const QStringList fontFamilies = m_fontDatabase.applicationFontFamilies( index );
if ( fontFamilies.isEmpty() ) {
kWarning(XpsDebug) << "The unexpected has happened. No font family for a known font:" << fileName << index;
return QFont();
}
const QString fontFamily = fontFamilies[0];
const QStringList fontStyles = m_fontDatabase.styles( fontFamily );
if ( fontStyles.isEmpty() ) {
kWarning(XpsDebug) << "The unexpected has happened. No font style for a known font family:" << fileName << index << fontFamily ;
return QFont();
}
const QString fontStyle = fontStyles[0];
return m_fontDatabase.font(fontFamily, fontStyle, qRound(size));
#else
return QFont(m_fonts.at(index)); return QFont(m_fonts.at(index));
#endif
} }
int XpsFile::loadFontByName( const QString &fileName ) int XpsFile::loadFontByName( const QString &fileName )
@ -1528,38 +1511,6 @@ int XpsFile::loadFontByName( const QString &fileName )
QByteArray fontData = readFileOrDirectoryParts( fontFile ); // once per file, according to the docs QByteArray fontData = readFileOrDirectoryParts( fontFile ); // once per file, according to the docs
#if QT_VERSION < 0x041200
int result = m_fontDatabase.addApplicationFontFromData( fontData );
if (-1 == result) {
// Try to deobfuscate font
// TODO Use deobfuscation depending on font content type, don't do it always when standard loading fails
const QString baseName = resourceName( fileName );
unsigned short guid[16];
if (!parseGUID(baseName, guid))
{
kDebug(XpsDebug) << "File to load font - file name isn't a GUID";
}
else
{
if (fontData.length() < 32)
{
kDebug(XpsDebug) << "Font file is too small";
} else {
// Obfuscation - xor bytes in font binary with bytes from guid (font's filename)
const static int mapping[] = {15, 14, 13, 12, 11, 10, 9, 8, 6, 7, 4, 5, 0, 1, 2, 3};
for (int i = 0; i < 16; i++) {
fontData[i] = fontData[i] ^ guid[mapping[i]];
fontData[i+16] = fontData[i+16] ^ guid[mapping[i]];
}
result = m_fontDatabase.addApplicationFontFromData( fontData );
}
}
}
// kDebug(XpsDebug) << "Loaded font: " << m_fontDatabase.applicationFontFamilies( result );
#else
int result = -1; int result = -1;
KTemporaryFile tempfile; KTemporaryFile tempfile;
tempfile.setSuffix(QFileInfo(fileName).suffix()); tempfile.setSuffix(QFileInfo(fileName).suffix());
@ -1576,7 +1527,6 @@ int XpsFile::loadFontByName( const QString &fileName )
result = (m_fonts.size() - 1); result = (m_fonts.size() - 1);
// kDebug(XpsDebug) << "Saved font: " << tempfile.fileName(); // kDebug(XpsDebug) << "Saved font: " << tempfile.fileName();
#endif // QT_VERSION
return result; // a font ID return result; // a font ID
} }
@ -1925,13 +1875,9 @@ XpsFile::XpsFile() : m_docInfo( 0 )
XpsFile::~XpsFile() XpsFile::~XpsFile()
{ {
m_fontCache.clear(); m_fontCache.clear();
#if QT_VERSION < 0x041200
m_fontDatabase.removeAllApplicationFonts();
#else
foreach (const QString &fontfile, m_fonts) { foreach (const QString &fontfile, m_fonts) {
QFile::remove(fontfile); QFile::remove(fontfile);
} }
#endif
} }

View file

@ -294,11 +294,7 @@ private:
KZip * m_xpsArchive; KZip * m_xpsArchive;
QMap<QString, int> m_fontCache; QMap<QString, int> m_fontCache;
#if QT_VERSION < 0x041200
QFontDatabase m_fontDatabase;
#else
QStringList m_fonts; QStringList m_fonts;
#endif
}; };

View file

@ -455,6 +455,6 @@ void MainShellTest::testUnique2FilesError()
QVERIFY(!s); QVERIFY(!s);
} }
QTEST_KDEMAIN( MainShellTest, GUI ) QTEST_KDEMAIN( MainShellTest, GUI )
#include "mainshelltest.moc" #include "mainshelltest.moc"

View file

@ -28,10 +28,6 @@
#include <config.h> #include <config.h>
#if QT_VERSION < 0x041200
# include <QUuid>
#endif
/** Creates a new FileSystem object /** Creates a new FileSystem object
@param firstsector the first sector used by this FileSystem on the Device @param firstsector the first sector used by this FileSystem on the Device
@param lastsector the last sector used by this FileSystem on the Device @param lastsector the last sector used by this FileSystem on the Device
@ -397,11 +393,7 @@ bool FileSystem::findExternal(const QString& cmdName, const QStringList& args, i
*/ */
QString FileSystem::createUUID() QString FileSystem::createUUID()
{ {
#if QT_VERSION >= 0x041200
return QString::fromLatin1(qRandomUuid()); return QString::fromLatin1(qRandomUuid());
#else
return QUuid::createUuid().toString().remove(QRegExp("\\{|\\}"));
#endif
} }
FileSystem::Type FileSystem::defaultFileSystem() FileSystem::Type FileSystem::defaultFileSystem()