libplasma becomes our first lib with profiles support.

svn path=/trunk/KDE/kdelibs/; revision=1120434
This commit is contained in:
Kevin Ottens 2010-04-29 05:57:34 +00:00
parent 876345d389
commit 6a3240b051
10 changed files with 82 additions and 22 deletions

View File

@ -1,15 +1,15 @@
# strange conversion error in pushbutton.cpp
kde4_no_enable_final(plasma)
if(KDE_PLATFORM_FEATURE_BINARY_COMPATIBLE_FEATURE_REDUCTION)
set(PLASMA_NO_KDEWEBKIT TRUE)
set(PLASMA_NO_KNEWSTUFF TRUE)
set(PLASMA_NO_SOLID TRUE)
endif(KDE_PLATFORM_FEATURE_BINARY_COMPATIBLE_FEATURE_REDUCTION)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
${KDE4_KDECORE_INCLUDES}
${KDE4_KDEUI_INCLUDES}
${KDE4_KIO_INCLUDES}
${CMAKE_SOURCE_DIR}/kdewebkit/
${CMAKE_SOURCE_DIR}/knewstuff/
${CMAKE_BINARY_DIR}/solid/
${CMAKE_SOURCE_DIR}/solid/
${CMAKE_SOURCE_DIR}/threadweaver/
${CMAKE_SOURCE_DIR}/plasma/extenders
${CMAKE_SOURCE_DIR}/plasma/remote
@ -20,6 +20,22 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}
${KDE4_INCLUDES}
)
if(NOT PLASMA_NO_KDEWEBKIT)
include_directories(${CMAKE_SOURCE_DIR}/kdewebkit/)
set(PLASMA_EXTRA_LIBS ${PLASMA_EXTRA_LIBS} kdewebkit)
endif(NOT PLASMA_NO_KDEWEBKIT)
if(NOT PLASMA_NO_KNEWSTUFF)
include_directories(${CMAKE_SOURCE_DIR}/knewstuff/)
set(PLASMA_EXTRA_LIBS ${PLASMA_EXTRA_LIBS} knewstuff3)
endif(NOT PLASMA_NO_KNEWSTUFF)
if(NOT PLASMA_NO_SOLID)
include_directories(${CMAKE_BINARY_DIR}/solid/)
include_directories(${CMAKE_SOURCE_DIR}/solid/)
set(PLASMA_EXTRA_LIBS ${PLASMA_EXTRA_LIBS} ${KDE4_SOLID_LIBS})
endif(NOT PLASMA_NO_SOLID)
if(QCA2_FOUND)
include_directories(${QCA2_INCLUDE_DIR})
set(ENABLE_REMOTE_WIDGETS TRUE)
@ -218,9 +234,8 @@ endif(PHONON_FOUND)
kde4_add_library(plasma SHARED ${plasma_LIB_SRCS})
target_link_libraries(plasma ${KDE4_KIO_LIBS} ${KDE4_KFILE_LIBS} knewstuff3
${QT_QTUITOOLS_LIBRARY} ${QT_QTWEBKIT_LIBRARY} ${QT_QTSCRIPT_LIBRARY} kdewebkit
kdnssd threadweaver ${KDE4_SOLID_LIBS} )
target_link_libraries(plasma ${KDE4_KIO_LIBS} ${QT_QTUITOOLS_LIBRARY} ${QT_QTWEBKIT_LIBRARY}
${QT_QTSCRIPT_LIBRARY} kdnssd threadweaver ${PLASMA_EXTRA_LIBS})
if(QCA2_FOUND)
target_link_libraries(plasma ${QCA2_LIBRARIES})

View File

@ -22,6 +22,9 @@
#include "applet.h"
#include "private/applet_p.h"
#include "config-plasma.h"
#include <plasma/animations/animation.h>
#include <cmath>
@ -66,8 +69,9 @@
#include "kio/jobclasses.h" // for KIO::JobFlags
#include "kio/job.h"
#ifndef PLASMA_NO_SOLID
#include <solid/powermanagement.h>
#endif
#include "abstracttoolbox.h"
#include "authorizationmanager.h"
@ -111,7 +115,6 @@
#include "private/service_p.h"
#include "ui_publish.h"
#include "config-plasma.h"
namespace Plasma
{
@ -834,7 +837,11 @@ QString Applet::pluginName() const
bool Applet::shouldConserveResources() const
{
#ifndef PLASMA_NO_SOLID
return Solid::PowerManagement::appShouldConserveResources();
#else
return true;
#endif
}
QString Applet::category() const

View File

@ -1,3 +1,7 @@
#cmakedefine ENABLE_REMOTE_WIDGETS
#cmakedefine QCA2_FOUND
#cmakedefine PLASMA_NO_KDEWEBKIT
#cmakedefine PLASMA_NO_KNEWSTUFF
#cmakedefine PLASMA_NO_SOLID

View File

@ -30,7 +30,7 @@
using namespace Plasma;
AnimableGraphicsWebView::AnimableGraphicsWebView(QGraphicsItem * parent)
: KGraphicsWebView(parent)
: GraphicsWebViewBase(parent)
{
setAcceptTouchEvents(true);
m_dragToScroll = false;
@ -75,12 +75,12 @@ QPointF AnimableGraphicsWebView::scrollPosition() const
qreal AnimableGraphicsWebView::zoom() const
{
return KGraphicsWebView::zoomFactor();
return GraphicsWebViewBase::zoomFactor();
}
void AnimableGraphicsWebView::setZoom(const qreal zoom)
{
KGraphicsWebView::setZoomFactor(zoom);
GraphicsWebViewBase::setZoomFactor(zoom);
}
QRectF AnimableGraphicsWebView::viewportGeometry() const
@ -96,7 +96,7 @@ QRectF AnimableGraphicsWebView::viewportGeometry() const
void AnimableGraphicsWebView::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
if (!page()) {
KGraphicsWebView::mouseMoveEvent(event);
GraphicsWebViewBase::mouseMoveEvent(event);
return;
}
@ -116,7 +116,7 @@ void AnimableGraphicsWebView::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
void AnimableGraphicsWebView::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
if (!page()) {
KGraphicsWebView::mousePressEvent(event);
GraphicsWebViewBase::mousePressEvent(event);
return;
}
@ -135,7 +135,7 @@ void AnimableGraphicsWebView::mousePressEvent(QGraphicsSceneMouseEvent *event)
void AnimableGraphicsWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
if (!page()) {
KGraphicsWebView::mouseReleaseEvent(event);
GraphicsWebViewBase::mouseReleaseEvent(event);
return;
}
@ -154,7 +154,7 @@ void AnimableGraphicsWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void AnimableGraphicsWebView::wheelEvent(QGraphicsSceneWheelEvent *event)
{
if (!page()) {
KGraphicsWebView::wheelEvent(event);
GraphicsWebViewBase::wheelEvent(event);
return;
}

View File

@ -27,12 +27,20 @@
#include <QtGui/QGraphicsSceneWheelEvent>
#include <QtGui/QGraphicsView>
#include <config-plasma.h>
#ifndef PLASMA_NO_KDEWEBKIT
#include <kgraphicswebview.h>
#define GraphicsWebViewBase KGraphicsWebView
#else
#include <qgraphicswebview.h>
#define GraphicsWebViewBase QGraphicsWebView
#endif
namespace Plasma
{
class AnimableGraphicsWebView : public KGraphicsWebView
class AnimableGraphicsWebView : public GraphicsWebViewBase
{
Q_OBJECT

View File

@ -29,7 +29,9 @@
#include <klocale.h>
#include <kmessagebox.h>
#ifndef PLASMA_NO_KNEWSTUFF
#include <knewstuff3/downloaddialog.h>
#endif
#include "plasma/private/wallpaper_p.h"
@ -70,7 +72,9 @@ PlasmoidPackage::PlasmoidPackage(QObject *parent)
PlasmoidPackage::~PlasmoidPackage()
{
#ifndef PLASMA_NO_KNEWSTUFF
delete m_knsDialog.data();
#endif
}
void PlasmoidPackage::pathChanged()
@ -86,6 +90,7 @@ void PlasmoidPackage::pathChanged()
void PlasmoidPackage::createNewWidgetBrowser(QWidget *parent)
{
#ifndef PLASMA_NO_KNEWSTUFF
KNS3::DownloadDialog *knsDialog = m_knsDialog.data();
if (!knsDialog) {
m_knsDialog = knsDialog = new KNS3::DownloadDialog("plasmoids.knsrc", parent);
@ -94,6 +99,7 @@ void PlasmoidPackage::createNewWidgetBrowser(QWidget *parent)
knsDialog->show();
knsDialog->raise();
#endif
}
ThemePackage::ThemePackage(QObject *parent)

View File

@ -24,10 +24,14 @@
#include "plasma/wallpaper.h"
#include "plasma/plasma.h"
#include "config-plasma.h"
#ifndef PLASMA_NO_KNEWSTUFF
namespace KNS3
{
class DownloadDialog;
} // namespace KNS
#endif
namespace Plasma
{
@ -44,7 +48,9 @@ protected:
void pathChanged();
private:
#ifndef PLASMA_NO_KNEWSTUFF
QWeakPointer<KNS3::DownloadDialog> m_knsDialog;
#endif
};
class ThemePackage : public PackageStructure

View File

@ -21,6 +21,8 @@
#include "runnermanager.h"
#include "config-plasma.h"
#include <QMutex>
#include <QTimer>
#include <QCoreApplication>
@ -30,8 +32,10 @@
#include <kservicetypetrader.h>
#include <kstandarddirs.h>
#ifndef PLASMA_NO_SOLID
#include <solid/device.h>
#include <solid/deviceinterface.h>
#endif
#include <Weaver/DebuggingAids.h>
#include <Weaver/State.h>
@ -97,8 +101,12 @@ public:
KConfigGroup config = configGroup();
//The number of threads used scales with the number of processors.
#ifndef PLASMA_NO_SOLID
const int numProcs =
qMax(Solid::Device::listFromType(Solid::DeviceInterface::Processor).count(), 1);
#else
const int numProcs = 1;
#endif
//This entry allows to define a hard upper limit independent of the number of processors.
const int maxThreads = config.readEntry("maxThreads", 16);
const int numThreads = qMin(maxThreads, 2 + ((numProcs - 1) * 2));

View File

@ -20,6 +20,8 @@
#include "wallpaper.h"
#include "config-plasma.h"
#include <QColor>
#include <QFile>
#include <QFileInfo>
@ -37,8 +39,10 @@
#include <kio/job.h>
#ifndef PLASMA_NO_SOLID
#include <solid/device.h>
#include <solid/deviceinterface.h>
#endif
#include <version.h>
@ -424,7 +428,12 @@ void Wallpaper::render(const QString &sourceImagePath, const QSize &size,
}
}
if (WallpaperPrivate::s_renderers.size() < qMax(Solid::Device::listFromType(Solid::DeviceInterface::Processor).count(), 1)) {
#ifndef PLASMA_NO_SOLID
const int numProcs = Solid::Device::listFromType(Solid::DeviceInterface::Processor).count();
#else
const int numProcs = 1;
#endif
if (WallpaperPrivate::s_renderers.size() < qMax(numProcs, 1)) {
WallpaperRenderThread *renderThread = new WallpaperRenderThread();
WallpaperPrivate::s_renderers.append(renderThread);
d->renderToken = renderThread->render(sourceImagePath, size, resizeMethod, color);

View File

@ -28,9 +28,6 @@
#include <QtCore/QTimer>
#include <kdebug.h>
#include <kgraphicswebview.h>
#include <kio/accessmanager.h>
#include <accessmanager.h>
#include "animator.h"
#include "plasma.h"