From 662eab575f3678364fbd3f317624fdd840e03c3c Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Fri, 9 Apr 2010 10:25:59 +0200 Subject: port linuxfb to platform api name change --- src/plugins/platforms/linuxfb/linuxfb.pro | 4 +- src/plugins/platforms/linuxfb/main.cpp | 14 +++--- .../platforms/linuxfb/qgraphicssystem_linuxfb.cpp | 52 +++++++++++----------- .../platforms/linuxfb/qgraphicssystem_linuxfb.h | 22 ++++----- 4 files changed, 45 insertions(+), 47 deletions(-) diff --git a/src/plugins/platforms/linuxfb/linuxfb.pro b/src/plugins/platforms/linuxfb/linuxfb.pro index 031b843..2633a10 100644 --- a/src/plugins/platforms/linuxfb/linuxfb.pro +++ b/src/plugins/platforms/linuxfb/linuxfb.pro @@ -1,12 +1,12 @@ TARGET = qlinuxfbgraphicssystem include(../../qpluginbase.pri) -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms SOURCES = main.cpp qgraphicssystem_linuxfb.cpp HEADERS = qgraphicssystem_linuxfb.h include(../fb_base/fb_base.pri) -target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems +target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target diff --git a/src/plugins/platforms/linuxfb/main.cpp b/src/plugins/platforms/linuxfb/main.cpp index 4d03fe5..4f7684b 100644 --- a/src/plugins/platforms/linuxfb/main.cpp +++ b/src/plugins/platforms/linuxfb/main.cpp @@ -39,33 +39,33 @@ ** ****************************************************************************/ -#include +#include #include "qgraphicssystem_linuxfb.h" QT_BEGIN_NAMESPACE -class QLinuxFbGraphicsSystemPlugin : public QGraphicsSystemPlugin +class QLinuxFbIntegrationPlugin : public QPlatformIntegrationPlugin { public: QStringList keys() const; - QGraphicsSystem *create(const QString&); + QPlatformIntegration *create(const QString&); }; -QStringList QLinuxFbGraphicsSystemPlugin::keys() const +QStringList QLinuxFbIntegrationPlugin::keys() const { QStringList list; list << "LinuxFb"; return list; } -QGraphicsSystem* QLinuxFbGraphicsSystemPlugin::create(const QString& system) +QPlatformIntegration* QLinuxFbIntegrationPlugin::create(const QString& system) { if (system.toLower() == "linuxfb") - return new QLinuxFbGraphicsSystem; + return new QLinuxFbIntegration; return 0; } -Q_EXPORT_PLUGIN2(linuxfb, QLinuxFbGraphicsSystemPlugin) +Q_EXPORT_PLUGIN2(linuxfb, QLinuxFbIntegrationPlugin) QT_END_NAMESPACE diff --git a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp index 44960bb..6310062 100644 --- a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp +++ b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.cpp @@ -69,11 +69,11 @@ QT_BEGIN_NAMESPACE -class QLinuxFbGraphicsSystemPrivate +class QLinuxFbPrivate { public: - QLinuxFbGraphicsSystemPrivate(); - ~QLinuxFbGraphicsSystemPrivate(); + QLinuxFbPrivate(); + ~QLinuxFbPrivate(); void openTty(); void closeTty(); @@ -94,7 +94,7 @@ public: QString displaySpec; }; -QLinuxFbGraphicsSystemPrivate::QLinuxFbGraphicsSystemPrivate() +QLinuxFbPrivate::QLinuxFbPrivate() : fd(-1), blank(true), doGraphicsMode(true), #ifdef QT_QWS_DEPTH_GENERIC doGenericColors(false), @@ -103,12 +103,12 @@ QLinuxFbGraphicsSystemPrivate::QLinuxFbGraphicsSystemPrivate() { } -QLinuxFbGraphicsSystemPrivate::~QLinuxFbGraphicsSystemPrivate() +QLinuxFbPrivate::~QLinuxFbPrivate() { closeTty(); } -void QLinuxFbGraphicsSystemPrivate::openTty() +void QLinuxFbPrivate::openTty() { const char *const devs[] = {"/dev/tty0", "/dev/tty", "/dev/console", 0}; @@ -139,7 +139,7 @@ void QLinuxFbGraphicsSystemPrivate::openTty() QT_WRITE(ttyfd, termctl, sizeof(termctl)); } -void QLinuxFbGraphicsSystemPrivate::closeTty() +void QLinuxFbPrivate::closeTty() { if (ttyfd == -1) return; @@ -155,9 +155,9 @@ void QLinuxFbGraphicsSystemPrivate::closeTty() ttyfd = -1; } -QLinuxFbGraphicsSystem::QLinuxFbGraphicsSystem() +QLinuxFbIntegration::QLinuxFbIntegration() { - d_ptr = new QLinuxFbGraphicsSystemPrivate(); + d_ptr = new QLinuxFbPrivate(); // XXX QString displaySpec = QString::fromLatin1(qgetenv("QWS_DISPLAY")); @@ -168,20 +168,18 @@ QLinuxFbGraphicsSystem::QLinuxFbGraphicsSystem() // Create a QImage directly on the screen's framebuffer. // This is the blit target for copying windows to the screen. - mPrimaryScreen = new QLinuxFbGraphicsSystemScreen(data, w, h, lstep, - screenFormat); + mPrimaryScreen = new QLinuxFbScreen(data, w, h, lstep, screenFormat); mPrimaryScreen->setPhysicalSize(QSize(physWidth, physHeight)); - mScreens.append(mPrimaryScreen); } -QLinuxFbGraphicsSystem::~QLinuxFbGraphicsSystem() +QLinuxFbIntegration::~QLinuxFbIntegration() { delete mPrimaryScreen; delete d_ptr; } -bool QLinuxFbGraphicsSystem::connect(const QString &displaySpec) +bool QLinuxFbIntegration::connect(const QString &displaySpec) { const QStringList args = displaySpec.split(QLatin1Char(':')); @@ -411,7 +409,7 @@ bool QLinuxFbGraphicsSystem::connect(const QString &displaySpec) return true; } -bool QLinuxFbGraphicsSystem::initDevice() +bool QLinuxFbIntegration::initDevice() { d_ptr->openTty(); @@ -538,7 +536,7 @@ bool QLinuxFbGraphicsSystem::initDevice() return true; } -void QLinuxFbGraphicsSystem::setPixelFormat(struct fb_var_screeninfo info) +void QLinuxFbIntegration::setPixelFormat(struct fb_var_screeninfo info) { const fb_bitfield rgba[4] = { info.red, info.green, info.blue, info.transp }; @@ -626,7 +624,7 @@ void QLinuxFbGraphicsSystem::setPixelFormat(struct fb_var_screeninfo info) screenFormat = format; } -void QLinuxFbGraphicsSystem::createPalette(fb_cmap &cmap, fb_var_screeninfo &vinfo, fb_fix_screeninfo &finfo) +void QLinuxFbIntegration::createPalette(fb_cmap &cmap, fb_var_screeninfo &vinfo, fb_fix_screeninfo &finfo) { if((vinfo.bits_per_pixel==8) || (vinfo.bits_per_pixel==4)) { screencols= (vinfo.bits_per_pixel==8) ? 256 : 16; @@ -756,7 +754,7 @@ void QLinuxFbGraphicsSystem::createPalette(fb_cmap &cmap, fb_var_screeninfo &vin } } -void QLinuxFbGraphicsSystem::blank(bool on) +void QLinuxFbIntegration::blank(bool on) { if (d_ptr->blank == on) return; @@ -781,22 +779,22 @@ void QLinuxFbGraphicsSystem::blank(bool on) d_ptr->blank = on; } -QPixmapData *QLinuxFbGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const +QPixmapData *QLinuxFbIntegration::createPixmapData(QPixmapData::PixelType type) const { return new QRasterPixmapData(type); } -QWindowSurface *QLinuxFbGraphicsSystem::createWindowSurface(QWidget *widget) const +QWindowSurface *QLinuxFbIntegration::createWindowSurface(QWidget *widget) const { if (widget->windowType() == Qt::Desktop) return 0; // Don't create an explicit window surface for the destkop. - QGraphicsSystemFbWindowSurface * surface = - new QGraphicsSystemFbWindowSurface(mPrimaryScreen, widget); + QFbWindowSurface * surface = + new QFbWindowSurface(mPrimaryScreen, widget); mPrimaryScreen->addWindowSurface(surface); return surface; } -QLinuxFbGraphicsSystemScreen::QLinuxFbGraphicsSystemScreen(uchar * d, int w, +QLinuxFbScreen::QLinuxFbScreen(uchar * d, int w, int h, int lstep, QImage::Format screenFormat) : compositePainter(0) { data = d; @@ -811,7 +809,7 @@ QLinuxFbGraphicsSystemScreen::QLinuxFbGraphicsSystemScreen(uchar * d, int w, cursor = new QGraphicsSystemSoftwareCursor(this); } -void QLinuxFbGraphicsSystemScreen::setGeometry(QRect rect) +void QLinuxFbScreen::setGeometry(QRect rect) { mGeometry = rect; delete mFbScreenImage; @@ -825,7 +823,7 @@ void QLinuxFbGraphicsSystemScreen::setGeometry(QRect rect) mFormat); } -void QLinuxFbGraphicsSystemScreen::setFormat(QImage::Format format) +void QLinuxFbScreen::setFormat(QImage::Format format) { mFormat = format; delete mFbScreenImage; @@ -839,10 +837,10 @@ void QLinuxFbGraphicsSystemScreen::setFormat(QImage::Format format) mFormat); } -QRegion QLinuxFbGraphicsSystemScreen::doRedraw() +QRegion QLinuxFbScreen::doRedraw() { QRegion touched; - touched = QGraphicsSystemFbScreen::doRedraw(); + touched = QFbPlatformScreen::doRedraw(); if (!compositePainter) { compositePainter = new QPainter(mFbScreenImage); diff --git a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h index cc8ce7e..bb4c920 100644 --- a/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h +++ b/src/plugins/platforms/linuxfb/qgraphicssystem_linuxfb.h @@ -42,15 +42,15 @@ #ifndef QGRAPHICSSYSTEM_LINUXFB_H #define QGRAPHICSSYSTEM_LINUXFB_H -#include +#include #include "../fb_base/fb_base.h" QT_BEGIN_NAMESPACE -class QLinuxFbGraphicsSystemScreen : public QGraphicsSystemFbScreen +class QLinuxFbScreen : public QFbPlatformScreen { public: - QLinuxFbGraphicsSystemScreen(uchar * d, int w, int h, int lstep, QImage::Format screenFormat); + QLinuxFbScreen(uchar * d, int w, int h, int lstep, QImage::Format screenFormat); void setGeometry(QRect rect); void setFormat(QImage::Format format); @@ -65,26 +65,26 @@ private: QPainter *compositePainter; }; -class QLinuxFbGraphicsSystemPrivate; +class QLinuxFbPrivate; struct fb_cmap; struct fb_var_screeninfo; struct fb_fix_screeninfo; -class QLinuxFbGraphicsSystem : public QGraphicsSystem +class QLinuxFbIntegration : public QPlatformIntegration { public: - QLinuxFbGraphicsSystem(); - ~QLinuxFbGraphicsSystem(); + QLinuxFbIntegration(); + ~QLinuxFbIntegration(); QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QWindowSurface *createWindowSurface(QWidget *widget) const; - QList screens() const { return mScreens; } + QList screens() const { return mScreens; } private: - QLinuxFbGraphicsSystemScreen *mPrimaryScreen; - QList mScreens; - QLinuxFbGraphicsSystemPrivate *d_ptr; + QLinuxFbScreen *mPrimaryScreen; + QList mScreens; + QLinuxFbPrivate *d_ptr; enum PixelType { NormalPixel, BGRPixel }; -- cgit v0.12