Commit 74e8e4a5 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Remove all checks for Qt versions < 5.3

If 5.3 is our minimum, it doesn't make sense to check for Qt
4.7, 4.8 or 5.2.
parent 4fd79c21
......@@ -193,10 +193,8 @@ QString platformToStringWin(QSysInfo::WinVersion version)
return "Windows 7";
case QSysInfo::WV_WINDOWS8:
return "Windows 8";
#if QT_VERSION >= 0x040806
case QSysInfo::WV_WINDOWS8_1:
return "Windows 8.1";
#endif
default:
return "Unknown Windows version";
};
......
......@@ -175,7 +175,7 @@ int main( int argc, char** argv )
app.processEvents();
}
#if defined HAVE_X11 && QT_VERSION >= 0x040800
#if defined HAVE_X11
QApplication::setAttribute(Qt::AA_X11InitThreads);
#endif
......
......@@ -74,12 +74,10 @@ private:
template<class U, Vc::Implementation V> struct TypeHelper {};
private:
#if QT_VERSION >= 0x040700
template<class U>
inline void startProcessing(const QRect &rect, TypeHelper<U, Vc::ScalarImpl>) {
KisBrushMaskScalarApplicator<MaskGenerator, _impl>::processScalar(rect);
}
#endif
template<class U, Vc::Implementation V>
inline void startProcessing(const QRect &rect, TypeHelper<U, V>) {
......
......@@ -87,11 +87,7 @@ KisConvolutionKernelSP KisConvolutionKernel::fromQImage(const QImage& image)
KisConvolutionKernelSP kernel = new KisConvolutionKernel(image.width(), image.height(), 0, 0);
Matrix<qreal, Dynamic, Dynamic>& data = kernel->data();
#if QT_VERSION >= 0x040700
const quint8* itImage = image.constBits();
#else
const quint8* itImage = image.bits();
#endif
qreal factor = 0;
for (int r = 0; r < image.height(); r++) {
......
......@@ -122,19 +122,11 @@ void KisFixedPaintDevice::convertFromQImage(const QImage& _image, const QString
// Don't convert if not no profile is given and both paint dev and qimage are rgba.
if (srcProfileName.isEmpty() && colorSpace()->id() == "RGBA") {
#if QT_VERSION >= 0x040700
memcpy(data(), image.constBits(), image.byteCount());
#else
memcpy(data(), image.bits(), image.byteCount());
#endif
} else {
KoColorSpaceRegistry::instance()
->colorSpace( RGBAColorModelID.id(), Integer8BitsColorDepthID.id(), srcProfileName)
#if QT_VERSION >= 0x040700
->convertPixelsTo(image.constBits(), data(), colorSpace(), image.width() * image.height(),
#else
->convertPixelsTo(image.bits(), data(), colorSpace(), image.width() * image.height(),
#endif
KoColorConversionTransformation::InternalRenderingIntent,
KoColorConversionTransformation::InternalConversionFlags);
}
......
......@@ -795,21 +795,13 @@ void KisPaintDevice::convertFromQImage(const QImage& _image, const KoColorProfil
}
// Don't convert if not no profile is given and both paint dev and qimage are rgba.
if (!profile && colorSpace()->id() == "RGBA") {
#if QT_VERSION >= 0x040700
writeBytes(image.constBits(), offsetX, offsetY, image.width(), image.height());
#else
writeBytes(image.bits(), offsetX, offsetY, image.width(), image.height());
#endif
} else {
try {
quint8 * dstData = new quint8[image.width() * image.height() * pixelSize()];
KoColorSpaceRegistry::instance()
->colorSpace(RGBAColorModelID.id(), Integer8BitsColorDepthID.id(), profile)
#if QT_VERSION >= 0x040700
->convertPixelsTo(image.constBits(), dstData, colorSpace(), image.width() * image.height(),
#else
->convertPixelsTo(image.bits(), dstData, colorSpace(), image.width() * image.height(),
#endif
KoColorConversionTransformation::InternalRenderingIntent,
KoColorConversionTransformation::InternalConversionFlags);
......
......@@ -29,9 +29,7 @@
#include <QFile>
#include <QDir>
#if QT_VERSION >= 0x040700
#include <QElapsedTimer>
#endif
#include <QFileInfo>
......@@ -52,21 +50,15 @@ struct StrokeTicket
QRegion dirtyRegion;
void start() {
#if QT_VERSION >= 0x040700
m_timer.start();
#endif
}
void jobCompleted() {
#if QT_VERSION >= 0x040700
m_jobTime = m_timer.restart();
#endif
}
void updateCompleted() {
#if QT_VERSION >= 0x040700
m_updateTime = m_timer.restart();
#endif
}
qint64 jobTime() const {
......@@ -78,9 +70,7 @@ struct StrokeTicket
}
private:
#if QT_VERSION >= 0x040700
QElapsedTimer m_timer;
#endif
qint64 m_jobTime;
qint64 m_updateTime;
};
......@@ -109,9 +99,7 @@ struct Q_DECL_HIDDEN KisUpdateTimeMonitor::Private
qreal mousePath;
QPointF lastMousePos;
#if QT_VERSION >= 0x040700
QElapsedTimer strokeTime;
#endif
KisPaintOpPresetSP preset;
bool loggingEnabled;
......@@ -120,7 +108,6 @@ struct Q_DECL_HIDDEN KisUpdateTimeMonitor::Private
KisUpdateTimeMonitor::KisUpdateTimeMonitor()
: m_d(new Private)
{
#if QT_VERSION >= 0x040700
if (m_d->loggingEnabled) {
QDir dir;
if (dir.exists("log")) {
......@@ -128,7 +115,6 @@ KisUpdateTimeMonitor::KisUpdateTimeMonitor()
}
dir.mkdir("log");
}
#endif
}
KisUpdateTimeMonitor::~KisUpdateTimeMonitor()
......@@ -144,7 +130,6 @@ KisUpdateTimeMonitor* KisUpdateTimeMonitor::instance()
void KisUpdateTimeMonitor::startStrokeMeasure()
{
#if QT_VERSION >= 0x040700
if (!m_d->loggingEnabled) return;
QMutexLocker locker(&m_d->mutex);
......@@ -158,12 +143,10 @@ void KisUpdateTimeMonitor::startStrokeMeasure()
m_d->lastMousePos = QPointF();
m_d->preset = 0;
m_d->strokeTime.start();
#endif
}
void KisUpdateTimeMonitor::endStrokeMeasure()
{
#if QT_VERSION >= 0x040700
if (!m_d->loggingEnabled) return;
QMutexLocker locker(&m_d->mutex);
......@@ -171,21 +154,17 @@ void KisUpdateTimeMonitor::endStrokeMeasure()
if(m_d->numTickets) {
printValues();
}
#endif
}
void KisUpdateTimeMonitor::reportPaintOpPreset(KisPaintOpPresetSP preset)
{
#if QT_VERSION >= 0x040700
if (!m_d->loggingEnabled) return;
m_d->preset = preset;
#endif
}
void KisUpdateTimeMonitor::reportMouseMove(const QPointF &pos)
{
#if QT_VERSION >= 0x040700
if (!m_d->loggingEnabled) return;
QMutexLocker locker(&m_d->mutex);
......@@ -196,12 +175,10 @@ void KisUpdateTimeMonitor::reportMouseMove(const QPointF &pos)
}
m_d->lastMousePos = pos;
#endif
}
void KisUpdateTimeMonitor::printValues()
{
#if QT_VERSION >= 0x040700
qint64 strokeTime = m_d->strokeTime.elapsed();
qreal responseTime = qreal(m_d->responseTime) / m_d->numTickets;
qreal nonUpdateTime = qreal(m_d->jobsTime) / m_d->numTickets;
......@@ -225,12 +202,10 @@ void KisUpdateTimeMonitor::printValues()
<< nonUpdateTime << "\t"
<< responseTime << "\n";
logFile.close();
#endif
}
void KisUpdateTimeMonitor::reportJobStarted(void *key)
{
#if QT_VERSION >= 0x040700
if (!m_d->loggingEnabled) return;
QMutexLocker locker(&m_d->mutex);
......@@ -239,12 +214,10 @@ void KisUpdateTimeMonitor::reportJobStarted(void *key)
ticket->start();
m_d->preliminaryTickets.insert(key, ticket);
#endif
}
void KisUpdateTimeMonitor::reportJobFinished(void *key, const QVector<QRect> &rects)
{
#if QT_VERSION >= 0x040700
if (!m_d->loggingEnabled) return;
QMutexLocker locker(&m_d->mutex);
......@@ -256,12 +229,10 @@ void KisUpdateTimeMonitor::reportJobFinished(void *key, const QVector<QRect> &re
ticket->dirtyRegion += rect;
}
m_d->finishedTickets.insert(ticket);
#endif
}
void KisUpdateTimeMonitor::reportUpdateFinished(const QRect &rect)
{
#if QT_VERSION >= 0x040700
if (!m_d->loggingEnabled) return;
QMutexLocker locker(&m_d->mutex);
......@@ -279,5 +250,4 @@ void KisUpdateTimeMonitor::reportUpdateFinished(const QRect &rect)
}
}
m_d->numUpdates++;
#endif
}
......@@ -496,11 +496,7 @@ void KisBrush::generateMaskAndApplyMaskOrCreateDab(KisFixedPaintDeviceSP dst,
bool hasColor = this->hasColor();
for (int y = 0; y < maskHeight; y++) {
#if QT_VERSION >= 0x040700
const quint8* maskPointer = outputImage.constScanLine(y);
#else
const quint8* maskPointer = outputImage.scanLine(y);
#endif
if (coloringInformation) {
for (int x = 0; x < maskWidth; x++) {
if (color) {
......
......@@ -68,13 +68,7 @@ void sliceQImage(const QImage &image, QVector<QVector<QByteArray> > *dstPlanes,
uncompressedRows[i].append(QByteArray(image.width(), '\0'));
quint8 *dstPtr = (quint8*)uncompressedRows[i].last().data();
#if QT_VERSION >= 0x040700
const quint8 *srcPtr = image.constScanLine(row) + srcRowOffset;
#else
const quint8 *srcPtr = image.scanLine(row) + srcRowOffset;
#endif
const quint8 *srcPtr = image.constScanLine(row) + srcRowOffset;
for (int col = 0; col < image.width(); col++) {
*dstPtr = *srcPtr;
......
......@@ -52,12 +52,7 @@
#include "kis_crash_handler.h"
#endif
#elif defined HAVE_X11
#include <ui/input/wintab/kis_tablet_support_x11.h>
#if QT_VERSION < 0x040800
// needed for XInitThreads()
#include <X11/Xlib.h>
#endif
#include <ui/input/wintab/kis_tablet_support_x11.h>
#endif
extern "C" int main(int argc, char **argv)
......@@ -103,14 +98,10 @@ extern "C" int main(int argc, char **argv)
key = key.replace(":", "_").replace("\\","_");
#if defined HAVE_X11
#if QT_VERSION >= 0x040800
// we need to call XInitThreads() (which this does) because of gmic (and possibly others)
// do their own X11 stuff in their own threads
// this call must happen before the creation of the application (see AA_X11InitThreads docs)
QCoreApplication::setAttribute(Qt::AA_X11InitThreads, true);
#else
XInitThreads();
#endif
#endif
#if defined HAVE_OPENGL
......
......@@ -76,9 +76,7 @@ CompositionDockerDock::CompositionDockerDock( ) : QDockWidget(i18n("Compositions
connect( deleteButton, SIGNAL(clicked(bool)), this, SLOT(deleteClicked()));
connect( saveButton, SIGNAL(clicked(bool)), this, SLOT(saveClicked()));
connect( exportButton, SIGNAL(clicked(bool)), this, SLOT(exportClicked()));
#if QT_VERSION >= 0x040700
saveNameEdit->setPlaceholderText(i18n("Insert Name"));
#endif
updateAction = new KisAction(i18n("Update Composition"), this);
updateAction->setObjectName("update_composition");
......
......@@ -426,7 +426,6 @@ void KisGmicWidget::slotNotImplemented()
void KisGmicWidget::slotExpandCollapse()
{
#if QT_VERSION >= 0x040700
const QString &iconName = expandCollapseBtn->icon().name();
if (iconName == "zoom-in")
{
......@@ -439,5 +438,4 @@ void KisGmicWidget::slotExpandCollapse()
m_filterTree->collapseAll();
expandCollapseBtn->setIcon(themedIcon("zoom-in"));
}
#endif
}
......@@ -42,9 +42,7 @@ CurveBrush::CurveBrush() :
m_branch(0)
{
srand48(time(0));
#if QT_VERSION >= 0x040700
m_pens.reserve(1024);
#endif
}
CurveBrush::~CurveBrush()
......
......@@ -46,11 +46,7 @@ struct KisCurrentOutlineFetcher::Private {
QScopedPointer<KisPressureMirrorOption> mirrorOption;
bool isDirty;
#if QT_VERSION >= 0x040700
QTime lastUpdateTime;
#else
QElapsedTimer lastUpdateTime;
#endif
qreal lastRotationApplied;
qreal lastSizeApplied;
......
......@@ -278,11 +278,7 @@ void KisTextureProperties::recalculateMask()
QRect rc = KisAlgebra2D::ensureRectNotSmaller(tf.mapRect(mask.rect()), QSize(2,2));
mask = mask.scaled(rc.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
}
#if QT_VERSION >= 0x040700
const QRgb* pixel = reinterpret_cast<const QRgb*>(mask.constBits());
#else
const QRgb* pixel = reinterpret_cast<const QRgb*>(mask.bits());
#endif
int width = mask.width();
int height = mask.height();
......
......@@ -139,7 +139,7 @@ int main( int argc, char** argv )
app.setEventFilter(&KisTabletSupportX11::eventFilter);
#endif
#if defined HAVE_X11 && QT_VERSION >= 0x040800
#if defined HAVE_X11
QApplication::setAttribute(Qt::AA_X11InitThreads);
#endif
......
......@@ -363,13 +363,6 @@ if(UNIX)
endif()
endif()
if (APPLE)
set(kritaui_LIB_SRCS
${kritaui_LIB_SRCS}
MacSupport.mm
)
endif ()
kde_enable_exceptions()
if(WIN32)
......
......@@ -291,7 +291,6 @@ void KisApplication::clearConfig()
void KisApplication::askClearConfig()
{
#if QT_VERSION >= 0x040800
Qt::KeyboardModifiers mods = QApplication::queryKeyboardModifiers();
bool askClearConfig = (mods & Qt::ControlModifier) && (mods & Qt::ShiftModifier) && (mods & Qt::AltModifier);
......@@ -304,7 +303,6 @@ void KisApplication::askClearConfig()
clearConfig();
}
}
#endif
}
bool KisApplication::start()
......
......@@ -22,9 +22,6 @@
#include "KisMainWindow.h"
#if defined (Q_OS_MAC) && QT_VERSION < 0x050000
#include "MacSupport.h"
#endif
// qt includes
#include <QApplication>
#include <QByteArray>
......@@ -297,12 +294,7 @@ KisMainWindow::KisMainWindow()
qApp->setStartDragDistance(25); // 25 px is a distance that works well for Tablet and Mouse events
#ifdef Q_OS_MAC
#if QT_VERSION < 0x050000
MacSupport::addFullscreen(this);
#endif
#if QT_VERSION >= 0x050201
setUnifiedTitleAndToolBarOnMac(true);
#endif
#endif
connect(this, SIGNAL(restoringDone()), this, SLOT(forceDockTabFonts()));
......@@ -355,9 +347,7 @@ KisMainWindow::KisMainWindow()
d->mdiArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
d->mdiArea->setTabPosition(QTabWidget::North);
#if QT_VERSION >= 0x040800
d->mdiArea->setTabsClosable(true);
#endif /* QT_VERSION >= 0x040800 */
setCentralWidget(d->mdiArea);
d->mdiArea->show();
......
......@@ -1225,7 +1225,6 @@ void KisViewManager::openResourcesDirectory()
void KisViewManager::updateIcons()
{
#if QT_VERSION >= 0x040700
if (mainWindow()) {
QList<QDockWidget*> dockers = mainWindow()->dockWidgets();
foreach(QDockWidget* dock, dockers) {
......@@ -1245,7 +1244,6 @@ void KisViewManager::updateIcons()
}
}
}
#endif
}
void KisViewManager::makeStatusBarVisible()
{
......@@ -1270,9 +1268,7 @@ void KisViewManager::showFloatingMessage(const QString message, const QIcon& ico
if (!d->currentImageView) return;
d->currentImageView->showFloatingMessageImpl(message, icon, timeout, priority, alignment);
#if QT_VERSION >= 0x040700
emit floatingMessageRequested(message, icon.name());
#endif
}
KisMainWindow *KisViewManager::mainWindow() const
......
/* This file is part of the KDE project
Copyright (C) 2012 Yue Liu <yue.liu@mail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef MACSUPPORT_H
#define MACSUPPORT_H
#include "KisMainWindow.h"
class MacSupport
{
public:
// adds fullscreen button for osx >= 10.7
static void addFullscreen(KisMainWindow *window);
};
#endif // MACSUPPORT_H
/* This file is part of the KDE project
Copyright (C) 2012 Yue Liu <yue.liu@mail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "MacSupport.h"
#include <QSysInfo>
void MacSupport::addFullscreen(KisMainWindow *window)
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) {
NSView *nsview = (NSView *) window->winId();
NSWindow *nswindow = [nsview window];
[nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
}
#endif
}
\ No newline at end of file
......@@ -69,15 +69,8 @@ void KisInputConfigurationPage::setDefaults()
QDir profileDir(KGlobal::dirs()->saveLocation("data", "krita/input/", false));
if (profileDir.exists()) {
#if QT_VERSION >= 0x040700
QStringList entries = profileDir.entryList(QStringList() << "*.profile", QDir::NoDot | QDir::NoDotDot);
#else
QStringList entries = profileDir.entryList(QStringList() << "*.profile");
#endif
Q_FOREACH(const QString & file, entries) {
#if QT_VERSION < 0x040700
if (file == "." || file == "..") continue;
#endif
profileDir.remove(file);
}
......
......@@ -162,9 +162,5 @@ KisExtendedModifiersMapper::queryExtendedModifiers()
Qt::KeyboardModifiers KisExtendedModifiersMapper::queryStandardModifiers()
{
#if QT_VERSION >= 0x040800
return QApplication::queryKeyboardModifiers();
#else
return QApplication::keyboardModifiers();
#endif
}
......@@ -583,11 +583,7 @@ bool translateXinputEvent(const XEvent *ev, QTabletDeviceData *tablet, QWidget *
KisTabletEvent::ExtraEventType t = KisTabletEvent::TabletMoveEx;
Qt::KeyboardModifiers modifiers = 0;
#if QT_VERSION >= 0x040800
modifiers = QApplication::queryKeyboardModifiers();
#else
modifiers = QApplication::keyboardModifiers();
#endif
#if !defined (Q_OS_IRIX)
XID device_id = 0;
......
......@@ -331,11 +331,7 @@ void KisOpenGLImageTextures::generateCheckerTexture(const QImage &checkImage)
img = checkImage.scaled(BACKGROUND_TEXTURE_SIZE, BACKGROUND_TEXTURE_SIZE);
}
m_glFuncs->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, BACKGROUND_TEXTURE_SIZE, BACKGROUND_TEXTURE_SIZE,
#if QT_VERSION >= 0x040700
0, GL_BGRA, GL_UNSIGNED_BYTE, img.constBits());
#else
0, GL_BGRA, GL_UNSIGNED_BYTE, img.bits());
#endif
}
else {
qDebug() << "OpenGL: Tried to generate checker texture before OpenGL was initialized.";
......
......@@ -28,7 +28,7 @@
#include <QRectF>
#include <QOpenGLFunctions>
#if QT_VERSION >= 0x040700 && !defined(QT_OPENGL_ES)
#if !defined(QT_OPENGL_ES)
#define USE_PIXEL_BUFFERS
#include <QOpenGLBuffer>
#endif
......
......@@ -19,11 +19,7 @@
#include "kis_speed_smoother.h"
#include <boost/circular_buffer.hpp>
#if QT_VERSION >= 0x040700
#include <QElapsedTimer>
#else
#include <QTime>
#endif
#include <QPointF>
#include "kis_debug.h"
......@@ -63,11 +59,7 @@ struct KisSpeedSmoother::Private
DistanceBuffer distances;
QPointF lastPoint;
#if QT_VERSION >= 0x040700
QElapsedTimer timer;
#else
QTime timer;
#endif
qreal lastSpeed;
};
......@@ -88,11 +80,7 @@ qreal KisSpeedSmoother::getNextSpeed(const QPointF &pt)
return 0.0;
}
#if QT_VERSION >= 0x040700
qreal time = qreal(m_d->timer.nsecsElapsed()) / 1000000;
#else
qreal time = qreal(m_d->timer.elapsed());
#endif
qreal dist = kisDistance(pt, m_d->lastPoint);
m_d->lastPoint = pt;
......
......@@ -41,10 +41,8 @@ KoPACanvasItem::KoPACanvasItem( KoPADocument * doc)