Commit 98c6c2ca authored by Boudewijn Rempt's avatar Boudewijn Rempt

* Show messagebox if the colorspaces are not installed.

* Better fix for compiling without koffice installed: the kritacolor
  library does not depend on koffice, so don't use the koffice 
  export definitions here.

svn path=/trunk/koffice/; revision=471075
parent c99dd453
......@@ -40,6 +40,7 @@
#include <kmimetype.h>
#include <knotifyclient.h>
#include <klocale.h>
#include <kmessagebox.h>
// KOffice
#include <koFilterManager.h>
......@@ -206,7 +207,6 @@ bool KisDoc::initDoc(InitDocFlags flags, QWidget* parentWidget)
} else if (ret == KoTemplateChooseDia::File) {
KURL url( file );
kdDebug() << "KisDoc::initDoc opening URL " << url.prettyURL() << endl;
ok = openURL(url);
} else if (ret == KoTemplateChooseDia::Empty) {
......@@ -246,6 +246,11 @@ bool KisDoc::init()
m_nserver = new KisNameServer(i18n("Image %1"), 1);
Q_CHECK_PTR(m_nserver);
if (!KisMetaRegistry::instance()->csRegistry()->exists(KisID("RGBA",""))) {
KMessageBox::sorry(0, i18n("No colorspace modules loaded: cannot run Krita"));
return false;
}
return true;
}
......
......@@ -3,7 +3,6 @@ INCLUDES = -I$(srcdir) \
-I$(srcdir)/../sdk \
-I$(srcdir)/colorspaces \
$(OPENEXR_CFLAGS) \
$(KOFFICE_INCLUDES) \
$(all_includes)
lib_LTLIBRARIES = libkritacolor.la
......
......@@ -31,8 +31,6 @@
#include "kis_composite_op.h"
#include "kis_colorspace.h"
#include "koffice_export.h"
class QPainter;
class KisPixel;
class KisPixelRO;
......@@ -59,7 +57,7 @@ struct transform {
* A colorspace strategy is the definition of a certain color model
* in Krita.
*/
class KRITACORE_EXPORT KisAbstractColorSpace : public KisColorSpace {
class KisAbstractColorSpace : public KisColorSpace {
public:
......
......@@ -19,7 +19,6 @@
#define _KIS_COLOR_H_
#include <qcolor.h>
#include <koffice_export.h>
#include "ksharedptr.h"
#include "kis_global.h"
......@@ -31,7 +30,7 @@
* A KisColor describes a color in a certain colorspace.
*
*/
class KRITACORE_EXPORT KisColor {
class KisColor {
public:
// Create an empty KisColor. It will be valid, but also black and transparent
......
......@@ -19,7 +19,6 @@
#include <cmath>
#include <qglobal.h>
#include <kdebug.h>
#include "kis_color_conversions.h"
......
......@@ -20,32 +20,30 @@
#define _KIS_CONVERSIONS_H_
#include <qglobal.h>
#include <kdebug.h>
#include "koffice_export.h"
/**
* A number of often-used conversions between color models
*/
// 8-bit integer versions. RGBSL are 0-255, H is 0-360.
KRITA_EXPORT void rgb_to_hsv(int R, int G, int B, int *H, int *S, int *V);
KRITA_EXPORT void hsv_to_rgb(int H, int S, int V, int *R, int *G, int *B);
void rgb_to_hsv(int R, int G, int B, int *H, int *S, int *V);
void hsv_to_rgb(int H, int S, int V, int *R, int *G, int *B);
// Floating point versions. RGBSL are 0-1, H is 0-360.
KRITA_EXPORT void RGBToHSV(float r, float g, float b, float *h, float *s, float *v);
KRITA_EXPORT void HSVToRGB(float h, float s, float v, float *r, float *g, float *b);
void RGBToHSV(float r, float g, float b, float *h, float *s, float *v);
void HSVToRGB(float h, float s, float v, float *r, float *g, float *b);
KRITA_EXPORT void RGBToHSL(float r, float g, float b, float *h, float *s, float *l);
KRITA_EXPORT void HSLToRGB(float h, float sl, float l, float *r, float *g, float *b);
void RGBToHSL(float r, float g, float b, float *h, float *s, float *l);
void HSLToRGB(float h, float sl, float l, float *r, float *g, float *b);
KRITA_EXPORT void rgb_to_hls(Q_UINT8 r, Q_UINT8 g, Q_UINT8 b, float * h, float * l, float * s);
void rgb_to_hls(Q_UINT8 r, Q_UINT8 g, Q_UINT8 b, float * h, float * l, float * s);
KRITA_EXPORT float hue_value(float n1, float n2, float hue);
float hue_value(float n1, float n2, float hue);
KRITA_EXPORT void hls_to_rgb(float h, float l, float s, Q_UINT8 * r, Q_UINT8 * g, Q_UINT8 * b);
void hls_to_rgb(float h, float l, float s, Q_UINT8 * r, Q_UINT8 * g, Q_UINT8 * b);
KRITA_EXPORT void rgb_to_hls(Q_UINT8 r, Q_UINT8 g, Q_UINT8 b, int * h, int * l, int * s);
KRITA_EXPORT void hls_to_rgb(int h, int l, int s, Q_UINT8 * r, Q_UINT8 * g, Q_UINT8 * b);
void rgb_to_hls(Q_UINT8 r, Q_UINT8 g, Q_UINT8 b, int * h, int * l, int * s);
void hls_to_rgb(int h, int l, int s, Q_UINT8 * r, Q_UINT8 * g, Q_UINT8 * b);
#endif // _KIS_CONVERSIONS_H_
......@@ -23,7 +23,6 @@
#include <qvaluevector.h>
#include "koffice_export.h"
#include "kis_composite_op.h"
#include "kis_channelinfo.h"
......@@ -40,7 +39,7 @@ struct KisColorAdjustment;
* in Krita. This is the definition of the public API for
* colormodels.
*/
class KRITACORE_EXPORT KisColorSpace {
class KisColorSpace {
public:
......@@ -325,7 +324,7 @@ public:
const KisCompositeOp& op) = 0;
};
class KRITACORE_EXPORT KisColorSpaceFactory {
class KisColorSpaceFactory {
public:
/**
* Krita definition for use in .kra files and internally: unchanging name +
......
......@@ -22,6 +22,8 @@
#include <kservice.h>
#include <ktrader.h>
#include <kparts/componentfactory.h>
#include <kmessagebox.h>
#include <klocale.h>
#include "kis_colorspace.h"
#include "kis_profile.h"
......@@ -57,8 +59,12 @@ KisColorSpaceFactoryRegistry::KisColorSpaceFactoryRegistry(QStringList profileFi
QString::fromLatin1("(Type == 'Service') and "
"([X-KDE-Version] == 2)"));
KTrader::OfferList::ConstIterator iter;
if (offers.empty()) {
KMessageBox::sorry(0, i18n("Cannot start Krita: no colorspaces available."));
abort();
}
KTrader::OfferList::ConstIterator iter;
for(iter = offers.begin(); iter != offers.end(); ++iter)
{
KService::Ptr service = *iter;
......@@ -95,6 +101,7 @@ QValueVector<KisProfile *> KisColorSpaceFactoryRegistry::profilesFor(KisID id)
QValueVector<KisProfile *> KisColorSpaceFactoryRegistry::profilesFor(KisColorSpaceFactory * csf)
{
QValueVector<KisProfile *> profiles;
QMap<QString, KisProfile * >::Iterator it;
......
......@@ -23,7 +23,7 @@
//#include "kis_global.h"
#include "kis_id.h"
#include "koffice_export.h"
enum CompositeOp {
COMPOSITE_OVER,
COMPOSITE_IN,
......@@ -71,7 +71,7 @@ enum CompositeOp {
COMPOSITE_UNDEF
};
class KRITACORE_EXPORT KisCompositeOp {
class KisCompositeOp {
public:
KisCompositeOp();
KisCompositeOp(const QString& id);
......
......@@ -30,14 +30,13 @@
#include <qcstring.h>
#include <kio/job.h>
#include <koffice_export.h>
#include <kis_annotation.h>
//XXX: Profiles should be loaded by the color strategies
// and be available only through the color strategy
// that matches the profile's color model
class KRITACORE_EXPORT KisProfile {
class KisProfile {
public:
KisProfile(QByteArray rawData);
......
......@@ -21,7 +21,7 @@
#include <qcolor.h>
#include <qcolor.h>
#include <koffice_export.h>
#include "kis_global.h"
#include "kis_abstract_colorspace.h"
#include "kis_pixel.h"
......@@ -29,7 +29,7 @@
/**
* This class is the base for all homogenous 8-bit/channel colorspaces with 8-bit alpha channels
*/
class KRITACORE_EXPORT KisU8BaseColorSpace : public KisAbstractColorSpace {
class KisU8BaseColorSpace : public KisAbstractColorSpace {
public:
......
......@@ -135,8 +135,13 @@ QString KisDlgCreateImg::profileName() const
void KisDlgCreateImg::fillCmbProfiles(const KisID & s)
{
m_page -> cmbProfile -> clear();
if (!KisMetaRegistry::instance()->csRegistry()->exists(s)) {
return;
}
KisColorSpaceFactory * csf = KisMetaRegistry::instance()->csRegistry() -> get(s);
if (csf == 0) return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment