summaryrefslogtreecommitdiff
path: root/libopie2
Side-by-side diff
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/odialog.cpp16
-rw-r--r--libopie2/opieui/odialog.h10
-rw-r--r--libopie2/opieui/oimageeffect.cpp41
-rw-r--r--libopie2/opieui/olistview.cpp20
-rw-r--r--libopie2/opieui/opieui.pro22
-rw-r--r--libopie2/opieui/oseparator.cpp12
-rw-r--r--libopie2/opieui/oversatileview.cpp25
7 files changed, 75 insertions, 71 deletions
diff --git a/libopie2/opieui/odialog.cpp b/libopie2/opieui/odialog.cpp
index 00a7a7e..4d269d4 100644
--- a/libopie2/opieui/odialog.cpp
+++ b/libopie2/opieui/odialog.cpp
@@ -1,53 +1,55 @@
/*
                This file is part of the Opie Project
-
-              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
+              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@Vanille.de>
=.
.=l.
           .>+-=
 _;:,     .>    :=|. This program is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This program 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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <opie2/odialog.h>
-int ODialog::mMarginSize = 5; // 11 like in KDialog is probably too much for PDA
-int ODialog::mSpacingSize = 2; // 6 like in KDialog is probably too much for PDA
+#warning Make Margin and Spacing device dependend and configurable!
+
+int ODialog::mMarginSize = 5;
+int ODialog::mSpacingSize = 2;
ODialog::ODialog(QWidget *parent, const char *name, bool modal, WFlags f)
- : QDialog(parent, name, modal, f)
+ :QDialog(parent, name, modal, f)
{
+ // d = new ODialogPrivate();
}
int ODialog::marginHint()
{
- return( mMarginSize );
+ return( mMarginSize );
}
int ODialog::spacingHint()
{
- return( mSpacingSize );
+ return( mSpacingSize );
}
// Placeholder for even more sophisticed things
diff --git a/libopie2/opieui/odialog.h b/libopie2/opieui/odialog.h
index 4116ed7..ceff612 100644
--- a/libopie2/opieui/odialog.h
+++ b/libopie2/opieui/odialog.h
@@ -1,20 +1,19 @@
/*
                This file is part of the Opie Project
-
-              (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
+              (C) 2003 Michael 'Mickey' Lauer <mickey@Vanille.de>
=.
.=l.
           .>+-=
 _;:,     .>    :=|. This program is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This program 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
@@ -36,54 +35,57 @@ class QLayoutItem;
#include <qdialog.h>
/**
* Dialog with extended nonmodal support and methods for OPIE standard
* compliance.
*
* The @ref marginHint() and @ref spacingHint() sizes shall be used
* whenever you layout the interior of a dialog. One special note. If
* you make your own action buttons (OK, Cancel etc), the space
* beteween the buttons shall be @ref spacingHint(), whereas the space
* above, below, to the right and to the left shall be @ref marginHint().
* If you add a separator line above the buttons, there shall be a
* @ref marginHint() between the buttons and the separator and a
* @ref marginHint() above the separator as well.
*
- * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
+ * @author Michael 'Mickey' Lauer <mickey@Vanille.de>
*/
+
// lets fix up Qt instead! Size does matter. -zecke
+ // while that may be true, reducing maintainance effort for the future does also matter -
+ // and I believe that maintaining a patch against QtE is more work than our classes -mml
class ODialog : public QDialog
{
Q_OBJECT
public:
/**
* Constructor.
*
* Takes the same arguments as @ref QDialog.
*/
ODialog(QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags f = 0);
/**
* Return the number of pixels you shall use between a
* dialog edge and the outermost widget(s) according to the KDE standard.
**/
static int marginHint();
/**
* Return the number of pixels you shall use between
* widgets inside a dialog according to the KDE standard.
*/
static int spacingHint();
private:
static int mMarginSize;
static int mSpacingSize;
class ODialogPrivate;
- ODialogPrivate *d; // d pointer always needed! -zecke
+ ODialogPrivate *d;
};
#endif // ODIALOG_H
diff --git a/libopie2/opieui/oimageeffect.cpp b/libopie2/opieui/oimageeffect.cpp
index 01e7c6f..9a58bb9 100644
--- a/libopie2/opieui/oimageeffect.cpp
+++ b/libopie2/opieui/oimageeffect.cpp
@@ -21,62 +21,63 @@ IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// $Id$
#include <math.h>
#include <qimage.h>
#include <stdlib.h>
-#include "oimageeffect.h"
+#include <opie2/oimageeffect.h>
+#include <opie2/odebug.h>
#define MaxRGB 255L
#define DegreesToRadians(x) ((x)*M_PI/180.0)
using namespace std;
inline unsigned int intensityValue(unsigned int color)
{
return((unsigned int)((0.299*qRed(color) +
0.587*qGreen(color) +
0.1140000000000001*qBlue(color))));
}
//======================================================================
//
// Gradient effects
//
//======================================================================
QImage OImageEffect::gradient(const QSize &size, const QColor &ca,
const QColor &cb, GradientType eff, int ncols)
{
int rDiff, gDiff, bDiff;
int rca, gca, bca, rcb, gcb, bcb;
QImage image(size, 32);
if (size.width() == 0 || size.height() == 0) {
- qDebug( "WARNING: OImageEffect::gradient: invalid image" );
+ odebug << "WARNING: OImageEffect::gradient: invalid image" << oendl;
return image;
}
register int x, y;
rDiff = (rcb = cb.red()) - (rca = ca.red());
gDiff = (gcb = cb.green()) - (gca = ca.green());
bDiff = (bcb = cb.blue()) - (bca = ca.blue());
if( eff == VerticalGradient || eff == HorizontalGradient ){
uint *p;
uint rgb;
register int rl = rca << 16;
register int gl = gca << 16;
@@ -336,33 +337,33 @@ QImage OImageEffect::unbalancedGradient(const QSize &size, const QColor &ca,
if (xfactor > 200 ) xfactor = 200;
if (yfactor > 200 ) yfactor = 200;
// float xbal = xfactor/5000.;
// float ybal = yfactor/5000.;
float xbal = xfactor/30./size.width();
float ybal = yfactor/30./size.height();
float rat;
int rDiff, gDiff, bDiff;
int rca, gca, bca, rcb, gcb, bcb;
QImage image(size, 32);
if (size.width() == 0 || size.height() == 0) {
- qDebug( "WARNING: OImageEffect::unbalancedGradient : invalid image" );
+ odebug << "WARNING: OImageEffect::unbalancedGradient : invalid image" << oendl;
return image;
}
register int x, y;
unsigned int *scanline;
rDiff = (rcb = cb.red()) - (rca = ca.red());
gDiff = (gcb = cb.green()) - (gca = ca.green());
bDiff = (bcb = cb.blue()) - (bca = ca.blue());
if( eff == VerticalGradient || eff == HorizontalGradient){
QColor cRow;
uint *p;
uint rgbRow;
@@ -555,33 +556,33 @@ QImage OImageEffect::unbalancedGradient(const QSize &size, const QColor &ca,
//
// Intensity effects
//
//======================================================================
/* This builds a 256 byte unsigned char lookup table with all
* the possible percent values prior to applying the effect, then uses
* integer math for the pixels. For any image larger than 9x9 this will be
* less expensive than doing a float operation on the 3 color components of
* each pixel. (mosfet)
*/
QImage& OImageEffect::intensity(QImage &image, float percent)
{
if (image.width() == 0 || image.height() == 0) {
- qDebug( "WARNING: OImageEffect::intensity : invalid image" );
+ odebug << "WARNING: OImageEffect::intensity : invalid image" << oendl;
return image;
}
int segColors = image.depth() > 8 ? 256 : image.numColors();
unsigned char *segTbl = new unsigned char[segColors];
int pixels = image.depth() > 8 ? image.width()*image.height() :
image.numColors();
unsigned int *data = image.depth() > 8 ? (unsigned int *)image.bits() :
(unsigned int *)image.colorTable();
bool brighten = (percent >= 0);
if(percent < 0)
percent = -percent;
if(brighten){ // keep overflow check out of loops
for(int i=0; i < segColors; ++i){
@@ -620,33 +621,33 @@ QImage& OImageEffect::intensity(QImage &image, float percent)
int a = qAlpha(data[i]);
r = r - segTbl[r] < 0 ? 0 : r - segTbl[r];
g = g - segTbl[g] < 0 ? 0 : g - segTbl[g];
b = b - segTbl[b] < 0 ? 0 : b - segTbl[b];
data[i] = qRgba(r, g, b, a);
}
}
delete [] segTbl;
return image;
}
QImage& OImageEffect::channelIntensity(QImage &image, float percent,
RGBComponent channel)
{
if (image.width() == 0 || image.height() == 0) {
- qDebug( "WARNING: OImageEffect::channelIntensity : invalid image" );
+ odebug << "WARNING: OImageEffect::channelIntensity : invalid image" << oendl;
return image;
}
int segColors = image.depth() > 8 ? 256 : image.numColors();
unsigned char *segTbl = new unsigned char[segColors];
int pixels = image.depth() > 8 ? image.width()*image.height() :
image.numColors();
unsigned int *data = image.depth() > 8 ? (unsigned int *)image.bits() :
(unsigned int *)image.colorTable();
bool brighten = (percent >= 0);
if(percent < 0)
percent = -percent;
if(brighten){ // keep overflow check out of loops
for(int i=0; i < segColors; ++i){
int tmp = (int)(i*percent);
@@ -710,33 +711,33 @@ QImage& OImageEffect::channelIntensity(QImage &image, float percent,
data[i] = qRgba(qRed(data[i]), qGreen(data[i]), c, qAlpha(data[i]));
}
}
}
delete [] segTbl;
return image;
}
// Modulate an image with an RBG channel of another image
//
QImage& OImageEffect::modulate(QImage &image, QImage &modImage, bool reverse,
ModulationType type, int factor, RGBComponent channel)
{
if (image.width() == 0 || image.height() == 0 ||
modImage.width() == 0 || modImage.height() == 0) {
- qDebug( "WARNING: OImageEffect::modulate : invalid image" );
+ odebug << "WARNING: OImageEffect::modulate : invalid image" << oendl;
return image;
}
int r, g, b, h, s, v, a;
QColor clr;
int mod=0;
unsigned int x1, x2, y1, y2;
register int x, y;
// for image, we handle only depth 32
if (image.depth()<32) image = image.convertDepth(32);
// for modImage, we handle depth 8 and 32
if (modImage.depth()<8) modImage = modImage.convertDepth(8);
unsigned int *colorTable2 = (modImage.depth()==8) ?
@@ -839,33 +840,33 @@ QImage& OImageEffect::modulate(QImage &image, QImage &modImage, bool reverse,
//======================================================================
//
// Blend effects
//
//======================================================================
// Nice and fast direct pixel manipulation
QImage& OImageEffect::blend(const QColor& clr, QImage& dst, float opacity)
{
if (dst.width() <= 0 || dst.height() <= 0)
return dst;
if (opacity < 0.0 || opacity > 1.0) {
- qDebug( "WARNING: OImageEffect::blend : invalid opacity. Range [0, 1] ");
+ odebug << "WARNING: OImageEffect::blend : invalid opacity. Range [0, 1] " << oendl;
return dst;
}
int depth = dst.depth();
if (depth != 32)
dst = dst.convertDepth(32);
int pixels = dst.width() * dst.height();
int rcol, gcol, bcol;
clr.rgb(&rcol, &gcol, &bcol);
#ifdef WORDS_BIGENDIAN // ARGB (skip alpha)
register unsigned char *data = (unsigned char *)dst.bits() + 1;
#else // BGRA
register unsigned char *data = (unsigned char *)dst.bits();
#endif
@@ -882,38 +883,38 @@ QImage& OImageEffect::blend(const QColor& clr, QImage& dst, float opacity)
*(data++) += (unsigned char)((rcol - *data) * opacity);
#endif
data++; // skip alpha
}
return dst;
}
// Nice and fast direct pixel manipulation
QImage& OImageEffect::blend(QImage& src, QImage& dst, float opacity)
{
if (src.width() <= 0 || src.height() <= 0)
return dst;
if (dst.width() <= 0 || dst.height() <= 0)
return dst;
if (src.width() != dst.width() || src.height() != dst.height()) {
- qDebug( "WARNING: OImageEffect::blend : src and destination images are not the same size" );
+ odebug << "WARNING: OImageEffect::blend : src and destination images are not the same size" << oendl;
return dst;
}
if (opacity < 0.0 || opacity > 1.0) {
- qDebug( "WARNING: OImageEffect::blend : invalid opacity. Range [0, 1]" );
+ odebug << "WARNING: OImageEffect::blend : invalid opacity. Range [0, 1]" << oendl;
return dst;
}
if (src.depth() != 32) src = src.convertDepth(32);
if (dst.depth() != 32) dst = dst.convertDepth(32);
int pixels = src.width() * src.height();
#ifdef WORDS_BIGENDIAN // ARGB (skip alpha)
register unsigned char *data1 = (unsigned char *)dst.bits() + 1;
register unsigned char *data2 = (unsigned char *)src.bits() + 1;
#else // BGRA
register unsigned char *data1 = (unsigned char *)dst.bits();
register unsigned char *data2 = (unsigned char *)src.bits();
#endif
for (register int i=0; i<pixels; i++)
@@ -927,33 +928,33 @@ QImage& OImageEffect::blend(QImage& src, QImage& dst, float opacity)
*(data1++) += (unsigned char)((*(data2++) - *data1) * opacity);
*(data1++) += (unsigned char)((*(data2++) - *data1) * opacity);
#endif
data1++; // skip alpha
data2++;
}
return dst;
}
QImage& OImageEffect::blend(QImage &image, float initial_intensity,
const QColor &bgnd, GradientType eff,
bool anti_dir)
{
if (image.width() == 0 || image.height() == 0 || image.depth()!=32 ) {
- qDebug( "WARNING: OImageEffect::blend : invalid image" );
+ odebug << "WARNING: OImageEffect::blend : invalid image" << oendl;
return image;
}
int r_bgnd = bgnd.red(), g_bgnd = bgnd.green(), b_bgnd = bgnd.blue();
int r, g, b;
int ind;
unsigned int xi, xf, yi, yf;
unsigned int a;
// check the boundaries of the initial intesity param
float unaffected = 1;
if (initial_intensity > 1) initial_intensity = 1;
if (initial_intensity < -1) initial_intensity = -1;
if (initial_intensity < 0) {
unaffected = 1. + initial_intensity;
@@ -1120,63 +1121,63 @@ QImage& OImageEffect::blend(QImage &image, float initial_intensity,
//SE
ind = image_width-x-1 + image_width * (image_height - y - 1) ;
r = qRed (data[ind]) + (int)(intensity *
(r_bgnd - qRed (data[ind])));
g = qGreen(data[ind]) + (int)(intensity *
(g_bgnd - qGreen(data[ind])));
b = qBlue (data[ind]) + (int)(intensity *
(b_bgnd - qBlue (data[ind])));
if (r > 255) r = 255; if (r < 0 ) r = 0;
if (g > 255) g = 255; if (g < 0 ) g = 0;
if (b > 255) b = 255; if (b < 0 ) b = 0;
a = qAlpha(data[ind]);
data[ind] = qRgba(r, g, b, a);
}
}
}
- else qDebug( "OImageEffect::blend effect not implemented" );
+ else odebug << "OImageEffect::blend effect not implemented" << oendl;
return image;
}
// Not very efficient as we create a third big image...
//
QImage& OImageEffect::blend(QImage &image1, QImage &image2,
GradientType gt, int xf, int yf)
{
if (image1.width() == 0 || image1.height() == 0 ||
image2.width() == 0 || image2.height() == 0)
return image1;
QImage image3;
image3 = OImageEffect::unbalancedGradient(image1.size(),
QColor(0,0,0), QColor(255,255,255),
gt, xf, yf, 0);
return blend(image1,image2,image3, Red); // Channel to use is arbitrary
}
// Blend image2 into image1, using an RBG channel of blendImage
//
QImage& OImageEffect::blend(QImage &image1, QImage &image2,
QImage &blendImage, RGBComponent channel)
{
if (image1.width() == 0 || image1.height() == 0 ||
image2.width() == 0 || image2.height() == 0 ||
blendImage.width() == 0 || blendImage.height() == 0) {
- qDebug( "OImageEffect::blend effect invalid image" );
+ odebug << "OImageEffect::blend effect invalid image" << oendl;
return image1;
}
int r, g, b;
int ind1, ind2, ind3;
unsigned int x1, x2, x3, y1, y2, y3;
unsigned int a;
register int x, y;
// for image1 and image2, we only handle depth 32
if (image1.depth()<32) image1 = image1.convertDepth(32);
if (image2.depth()<32) image2 = image2.convertDepth(32);
// for blendImage, we handle depth 8 and 32
@@ -1248,33 +1249,33 @@ unsigned int OImageEffect::uHash(unsigned int c)
{
unsigned char r = qRed(c), g = qGreen(c), b = qBlue(c), a = qAlpha(c);
unsigned char nr, ng, nb;
nr = r + (r >> 3); nr = nr < r ? ~0 : nr;
ng = g + (g >> 3); ng = ng < g ? ~0 : ng;
nb = b + (b >> 3); nb = nb < b ? ~0 : nb;
return qRgba(nr, ng, nb, a);
}
// -----------------------------------------------------------------------------
QImage& OImageEffect::hash(QImage &image, Lighting lite, unsigned int spacing)
{
if (image.width() == 0 || image.height() == 0) {
- qDebug( "OImageEffect::hash effect invalid image" );
+ odebug << "OImageEffect::hash effect invalid image" << oendl;
return image;
}
register int x, y;
unsigned int *data = (unsigned int *)image.bits();
unsigned int ind;
//CT no need to do it if not enough space
if ((lite == NorthLite ||
lite == SouthLite)&&
(unsigned)image.height() < 2+spacing) return image;
if ((lite == EastLite ||
lite == WestLite)&&
(unsigned)image.height() < 2+spacing) return image;
if (lite == NorthLite || lite == SouthLite) {
@@ -1756,33 +1757,33 @@ int OImageEffect::nearestColor( int r, int g, int b, const QColor *palette, int
return nearest;
}
bool OImageEffect::blend(
const QImage & upper,
const QImage & lower,
QImage & output
)
{
if (
upper.width() > lower.width() ||
upper.height() > lower.height() ||
upper.depth() != 32 ||
lower.depth() != 32
)
{
- qDebug( "OImageEffect::blend : Sizes not correct" );
+ odebug << "OImageEffect::blend : Sizes not correct" << oendl;
return false;
}
output = lower.copy();
register uchar *i, *o;
register int a;
register int col;
register int w = upper.width();
int row(upper.height() - 1);
do {
i = upper.scanLine(row);
o = output.scanLine(row);
@@ -1973,33 +1974,33 @@ QImage& OImageEffect::selectedImage( QImage &img, const QColor &col )
// ===================================================================
//
void OImageEffect::normalize(QImage &img)
{
int *histogram, threshold_intensity, intense;
int x, y, i;
unsigned int gray_value;
unsigned int *normalize_map;
unsigned int high, low;
// allocate histogram and normalize map
histogram = (int *)calloc(MaxRGB+1, sizeof(int));
normalize_map = (unsigned int *)malloc((MaxRGB+1)*sizeof(unsigned int));
if(!normalize_map || !histogram){
- qWarning("Unable to allocate normalize histogram and map");
+ owarn << "Unable to allocate normalize histogram and map" << oendl;
free(normalize_map);
free(histogram);
return;
}
// form histogram
if(img.depth() > 8){ // DirectClass
unsigned int *data;
for(y=0; y < img.height(); ++y){
data = (unsigned int *)img.scanLine(y);
for(x=0; x < img.width(); ++x){
gray_value = intensityValue(data[x]);
histogram[gray_value]++;
}
}
}
@@ -2089,33 +2090,33 @@ void OImageEffect::normalize(QImage &img)
}
void OImageEffect::equalize(QImage &img)
{
int *histogram, *map, *equalize_map;
int x, y, i, j;
unsigned int high, low;
// allocate histogram and maps
histogram = (int *)calloc(MaxRGB+1, sizeof(int));
map = (int *)malloc((MaxRGB+1)*sizeof(unsigned int));
equalize_map = (int *)malloc((MaxRGB+1)*sizeof(unsigned int));
if(!histogram || !map || !equalize_map){
- qWarning("Unable to allocate equalize histogram and maps");
+ owarn << "Unable to allocate equalize histogram and maps" << oendl;
free(histogram);
free(map);
free(equalize_map);
return;
}
// form histogram
if(img.depth() > 8){ // DirectClass
unsigned int *data;
for(y=0; y < img.height(); ++y){
data = (unsigned int *)img.scanLine(y);
for(x=0; x < img.width(); ++x){
histogram[intensityValue(data[x])]++;
}
}
}
else{ // PsudeoClass
@@ -2174,79 +2175,79 @@ void OImageEffect::equalize(QImage &img)
free(equalize_map);
}
QImage OImageEffect::sample(QImage &src, int w, int h)
{
if(w == src.width() && h == src.height())
return(src);
double *x_offset, *y_offset;
int j, k, y;
register int x;
QImage dest(w, h, src.depth());
x_offset = (double *)malloc(w*sizeof(double));
y_offset = (double *)malloc(h*sizeof(double));
if(!x_offset || !y_offset){
- qWarning("Unable to allocate pixels buffer");
+ owarn << "Unable to allocate pixels buffer" << oendl;
free(x_offset);
free(y_offset);
return(src);
}
// init pixel offsets
for(x=0; x < w; ++x)
x_offset[x] = x*src.width()/((double)w);
for(y=0; y < h; ++y)
y_offset[y] = y*src.height()/((double)h);
// sample each row
if(src.depth() > 8){ // DirectClass source image
unsigned int *srcData, *destData;
unsigned int *pixels;
pixels = (unsigned int *)malloc(src.width()*sizeof(unsigned int));
if(!pixels){
- qWarning("Unable to allocate pixels buffer");
+ owarn << "Unable to allocate pixels buffer" << oendl;
free(pixels);
free(x_offset);
free(y_offset);
return(src);
}
j = (-1);
for(y=0; y < h; ++y){
destData = (unsigned int *)dest.scanLine(y);
if(j != y_offset[y]){
// read a scan line
j = (int)(y_offset[y]);
srcData = (unsigned int *)src.scanLine(j);
(void)memcpy(pixels, srcData, src.width()*sizeof(unsigned int));
}
// sample each column
for(x=0; x < w; ++x){
k = (int)(x_offset[x]);
destData[x] = pixels[k];
}
}
free(pixels);
}
else{ // PsudeoClass source image
unsigned char *srcData, *destData;
unsigned char *pixels;
pixels = (unsigned char *)malloc(src.width()*sizeof(unsigned char));
if(!pixels){
- qWarning("Unable to allocate pixels buffer");
+ owarn << "Unable to allocate pixels buffer" << oendl;
free(pixels);
free(x_offset);
free(y_offset);
return(src);
}
// copy colortable
dest.setNumColors(src.numColors());
(void)memcpy(dest.colorTable(), src.colorTable(),
src.numColors()*sizeof(unsigned int));
// sample image
j = (-1);
for(y=0; y < h; ++y){
destData = (unsigned char *)dest.scanLine(y);
if(j != y_offset[y]){
// read a scan line
@@ -3059,33 +3060,33 @@ QImage OImageEffect::wave(QImage &src, double amplitude, double wavelength,
// wave image
for(y=0; y < dest.height(); ++y){
q = (unsigned int *)dest.scanLine(y);
for (x=0; x < dest.width(); x++){
*q=interpolateColor(&src, x, (int)(y-sine_map[x]), background);
++q;
}
}
free(sine_map);
return(dest);
}
QImage OImageEffect::oilPaint(QImage &src, int radius)
{
// TODO 8bpp src!
if(src.depth() < 32){
- qWarning("Oil Paint source image < 32bpp. Convert before using!");
+ owarn << "Oil Paint source image < 32bpp. Convert before using!" << oendl;
return(src);
}
int j, k, i, x, y;
unsigned int *histogram;
unsigned int *s;
unsigned int count;
unsigned int *srcData, *destData;
QImage dest(src);
dest.detach();
histogram = (unsigned int *) malloc((MaxRGB+1)*sizeof(unsigned int));
if(!histogram)
return(src);
// paint each row
k=0;
diff --git a/libopie2/opieui/olistview.cpp b/libopie2/opieui/olistview.cpp
index ec503dd..38f3fe2 100644
--- a/libopie2/opieui/olistview.cpp
+++ b/libopie2/opieui/olistview.cpp
@@ -1,20 +1,19 @@
/*
                This file is part of the Opie Project
-
- =. (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
+ =. (C) 2003 Michael 'Mickey' Lauer <mickey@Vanille.de>
.=l.
           .>+-=
 _;:,     .>    :=|. This program is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This program 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.
@@ -24,32 +23,33 @@
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/* QT */
#include <qcolor.h>
#include <qheader.h>
#include <qpainter.h>
#include <qpixmap.h>
/* OPIE */
+#include <opie2/odebug.h>
#include <opie2/olistview.h>
/*======================================================================================
* OListView
*======================================================================================*/
OListView::OListView( QWidget *parent, const char *name )
:QListView( parent, name )
{
//FIXME: get from global settings and calculate ==> see oglobalsettings.*
m_alternateBackground = QColor( 238, 246, 255 );
m_columnSeparator = QPen( QColor( 150, 160, 170 ), 0, DotLine );
m_fullWidth = true;
connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*)));
}
@@ -129,90 +129,90 @@ void OListView::setColumnSeparator( const QPen& p )
}
void OListView::expand(QListViewItem *item)
{
((OListViewItem*)item)->expand();
}
OListViewItem* OListView::childFactory()
{
return new OListViewItem( this );
}
#ifndef QT_NO_DATASTREAM
void OListView::serializeTo( QDataStream& s ) const
{
#warning Caution... the binary format is still under construction...
- qDebug( "storing OListView..." );
+ odebug << "storing OListView..." << oendl;
// store number of columns and the labels
s << columns();
for ( int i = 0; i < columns(); ++i )
s << columnText( i );
// calculate the number of top-level items to serialize
int items = 0;
QListViewItem* item = firstChild();
while ( item )
{
item = item->nextSibling();
items++;
}
// store number of items and the items itself
s << items;
item = firstChild();
for ( int i = 0; i < items; ++i )
{
s << *static_cast<OListViewItem*>( item );
item = item->nextSibling();
}
- qDebug( "OListview stored." );
+ odebug << "OListview stored." << oendl;
}
void OListView::serializeFrom( QDataStream& s )
{
#warning Caution... the binary format is still under construction...
- qDebug( "loading OListView..." );
+ odebug << "loading OListView..." << oendl;
int cols;
s >> cols;
qDebug( "read number of columns = %d", cols );
while ( columns() < cols ) addColumn( QString::null );
for ( int i = 0; i < cols; ++i )
{
QString coltext;
s >> coltext;
qDebug( "read text '%s' for column %d", (const char*) coltext, i );
setColumnText( i, coltext );
}
int items;
s >> items;
qDebug( "read number of items = %d", items );
for ( int i = 0; i < items; ++i )
{
OListViewItem* item = childFactory();
s >> *item;
}
- qDebug( "OListView loaded." );
+ odebug << "OListView loaded." << oendl;
}
QDataStream& operator<<( QDataStream& s, const OListView& lv )
{
lv.serializeTo( s );
}
QDataStream& operator>>( QDataStream& s, OListView& lv )
{
lv.serializeFrom( s );
}
#endif // QT_NO_DATASTREAM
/*======================================================================================
* OListViewItem
@@ -364,86 +364,86 @@ void OListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, in
const QPen& pen = static_cast<OListView*>( listView() )->columnSeparator();
p->setPen( pen );
p->drawLine( width-1, 0, width-1, height() );
}
OListViewItem* OListViewItem::childFactory()
{
return new OListViewItem( this );
}
#ifndef QT_NO_DATASTREAM
void OListViewItem::serializeTo( QDataStream& s ) const
{
#warning Caution... the binary format is still under construction...
- qDebug( "storing OListViewItem..." );
+ odebug << "storing OListViewItem..." << oendl;
// store item text
for ( int i = 0; i < listView()->columns(); ++i )
{
s << text( i );
}
// calculate the number of children to serialize
int items = 0;
QListViewItem* item = firstChild();
while ( item )
{
item = item->nextSibling();
items++;
}
// store number of items and the items itself
s << items;
item = firstChild();
for ( int i = 0; i < items; ++i )
{
s << *static_cast<OListViewItem*>( item );
item = item->nextSibling();
}
- qDebug( "OListviewItem stored." );
+ odebug << "OListviewItem stored." << oendl;
}
void OListViewItem::serializeFrom( QDataStream& s )
{
#warning Caution... the binary format is still under construction...
- qDebug( "loading OListViewItem..." );
+ odebug << "loading OListViewItem..." << oendl;
for ( int i = 0; i < listView()->columns(); ++i )
{
QString coltext;
s >> coltext;
qDebug( "read text '%s' for column %d", (const char*) coltext, i );
setText( i, coltext );
}
int items;
s >> items;
qDebug( "read number of items = %d", items );
for ( int i = 0; i < items; ++i )
{
OListViewItem* item = childFactory();
s >> (*item);
}
- qDebug( "OListViewItem loaded." );
+ odebug << "OListViewItem loaded." << oendl;
}
QDataStream& operator<<( QDataStream& s, const OListViewItem& lvi )
{
lvi.serializeTo( s );
}
QDataStream& operator>>( QDataStream& s, OListViewItem& lvi )
{
lvi.serializeFrom( s );
}
#endif // QT_NO_DATASTREAM
diff --git a/libopie2/opieui/opieui.pro b/libopie2/opieui/opieui.pro
index b455602..61f9bbb 100644
--- a/libopie2/opieui/opieui.pro
+++ b/libopie2/opieui/opieui.pro
@@ -1,49 +1,47 @@
TEMPLATE = lib
CONFIG += qt warn_on debug
DESTDIR = $(OPIEDIR)/lib
HEADERS = olistview.h \
oimageeffect.h \
opixmapeffect.h \
opopupmenu.h \
opixmapprovider.h \
oselector.h \
oversatileview.h \
oversatileviewitem.h \
odialog.h \
- omessagebox.h \
- oresource.h \
- oseparator.h
+ omessagebox.h \
+ oresource.h \
+ otaskbarapplet.h \
+ oseparator.h
SOURCES = olistview.cpp \
oimageeffect.cpp \
opixmapeffect.cpp \
opopupmenu.cpp \
opixmapprovider.cpp \
oselector.cpp \
oversatileview.cpp \
oversatileviewitem.cpp \
odialog.cpp \
- oresource.cpp \
- oseparator.cpp
+ oresource.cpp \
+ otaskbarapplet.cpp \
+ oseparator.cpp
INTERFACES =
TARGET = opieui2
VERSION = 1.8.2
+
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
-LIBS += -lopiecore2
-MOC_DIR = moc
-OBJECTS_DIR = obj
+LIBS += -lopiecore2
!contains( platform, x11 ) {
include ( $(OPIEDIR)/include.pro )
- HEADERS += otaskbarapplet.h
- SOURCES += otaskbarapplet.cpp
}
contains( platform, x11 ) {
- LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib
- message( Warning: NO otaskbarapplet ATM )
+ LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib
}
diff --git a/libopie2/opieui/oseparator.cpp b/libopie2/opieui/oseparator.cpp
index 85181dc..98d42c7 100644
--- a/libopie2/opieui/oseparator.cpp
+++ b/libopie2/opieui/oseparator.cpp
@@ -1,88 +1,88 @@
/*
                This file is part of the Opie Project
-
              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
Copyright (C) 1997 Michael Roth <mroth@wirlweb.de>
=.
.=l.
           .>+-=
 _;:,     .>    :=|. This program is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This program 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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-/* QT */
-
-#include <qstyle.h>
-
/* OPIE */
+#include <opie2/odebug.h>
#include <opie2/oseparator.h>
+/* QT */
+
+#include <qstyle.h>
+
OSeparator::OSeparator(QWidget* parent, const char* name, WFlags f)
: QFrame(parent, name, f)
{
setLineWidth(1);
setMidLineWidth(0);
setOrientation( HLine );
}
OSeparator::OSeparator(int orientation, QWidget* parent, const char* name, WFlags f)
: QFrame(parent, name, f)
{
setLineWidth(1);
setMidLineWidth(0);
setOrientation( orientation );
}
void OSeparator::setOrientation(int orientation)
{
switch(orientation)
{
case Vertical:
case VLine:
setFrameStyle( QFrame::VLine | QFrame::Sunken );
setMinimumSize(2, 0);
break;
default:
- qWarning( "OSeparator::setOrientation(): invalid orientation, using default orientation HLine" );
+ owarn << "OSeparator::setOrientation(): invalid orientation, using default orientation HLine" << oendl;
case Horizontal:
case HLine:
setFrameStyle( QFrame::HLine | QFrame::Sunken );
setMinimumSize(0, 2);
break;
}
}
int OSeparator::orientation() const
{
if ( frameStyle() & VLine )
return VLine;
diff --git a/libopie2/opieui/oversatileview.cpp b/libopie2/opieui/oversatileview.cpp
index 6808539..65fe3d8 100644
--- a/libopie2/opieui/oversatileview.cpp
+++ b/libopie2/opieui/oversatileview.cpp
@@ -15,54 +15,55 @@
     +  .  -:.       = 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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
+/* OPIE */
+
+#include <opie2/odebug.h>
+#include <opie2/oversatileview.h>
+#include <opie2/oversatileviewitem.h>
+#include <opie2/olistview.h>
+
/* QT */
#include <qaction.h>
#include <qbrush.h>
#include <qfont.h>
#include <qiconset.h>
#include <qiconview.h>
#include <qlistview.h>
#include <qpalette.h>
#include <qpoint.h>
#include <qpopupmenu.h>
#include <qrect.h>
#include <qsize.h>
#include <qstring.h>
#include <qwidgetstack.h>
-/* OPIE */
-
-#include <opie2/oversatileview.h>
-#include <opie2/oversatileviewitem.h>
-#include <opie2/olistview.h>
-
/* XPM */
static const char * view_icon_xpm[] = {
"16 16 16 1",
" c None",
". c #87BD88",
"+ c #8BBE8B",
"@ c #81BA81",
"# c #6DAF6D",
"$ c #87BD87",
"% c #FCFDFC",
"& c #AED0AE",
"* c #4E9C4C",
"= c #91BD91",
"- c #72B172",
"; c #448643",
"> c #519F50",
@@ -276,101 +277,101 @@ bool OVersatileView::synchronization()
void OVersatileView::setDefaultPixmaps( int mode, QPixmap& leaf, QPixmap& opened, QPixmap& closed )
{
if ( mode == Tree )
{
_treeleaf = leaf;
_treeopened = opened;
_treeclosed = closed;
}
else if ( mode == Icons )
{
_iconleaf = leaf;
_iconopened = opened;
_iconclosed = closed;
}
else
{
- qDebug( "OVersatileView::setDefaultPixmaps(): invalid mode" );
+ odebug << "OVersatileView::setDefaultPixmaps(): invalid mode" << oendl;
}
}
QIconView* OVersatileView::iconView() const
{
return _iconview;
}
OListView* OVersatileView::listView() const
{
return _listview;
}
void OVersatileView::setViewMode( int mode )
{
if ( mode == Tree )
{
_viewmode = mode;
raiseWidget( _listview );
}
else if ( mode == Icons )
{
_viewmode = mode;
raiseWidget( _iconview );
}
else
{
- qDebug( "OVersatileView::setViewMode(): invalid mode" );
+ odebug << "OVersatileView::setViewMode(): invalid mode" << oendl;
}
}
void OVersatileView::setIconViewMode()
{
setViewMode( Icons );
}
void OVersatileView::setTreeViewMode()
{
setViewMode( Tree );
}
bool OVersatileView::isValidViewMode( int mode ) const
{
switch ( _warningpolicy )
{
case OVersatileView::None:
{
return true;
}
case OVersatileView::Warn:
{
if ( _viewmode != mode )
{
- qDebug( "OVersatileView::isValidViewMode(): Requested operation not valid in current mode." );
+ odebug << "OVersatileView::isValidViewMode(): Requested operation not valid in current mode." << oendl;
return true;
}
}
case OVersatileView::WarnReturn:
{
if ( _viewmode != mode )
{
- qDebug( "OVersatileView::isValidViewMode(): Requested operation not valid in current mode." );
+ odebug << "OVersatileView::isValidViewMode(): Requested operation not valid in current mode." << oendl;
return false;
}
}
default:
{
- qWarning( "OVersatileView::isValidViewMode(): Inconsistent object state!" );
+ owarn << "OVersatileView::isValidViewMode(): Inconsistent object state!" << oendl;
return true;
}
}
}
void OVersatileView::setWarningPolicy( int policy ) const
{
_warningpolicy = policy;
}
bool OVersatileView::warningPolicy() const
{
return _warningpolicy;
}
//==============================================================================================//
// Stupid Signal forwarders...
// Folks, this is why I like python with its dynamic typing:
// I can code the following dozens of lines C++ in four Python lines...
@@ -435,33 +436,33 @@ void OVersatileView::returnPressed( QIconViewItem * item )
{
emit( returnPressed( static_cast<OVersatileViewItem*>( item ) ) );
}
void OVersatileView::onItem( QListViewItem * item )
{
emit( onItem( static_cast<OVersatileViewItem*>( item ) ) );
}
void OVersatileView::onItem( QIconViewItem * item )
{
emit( onItem( static_cast<OVersatileViewItem*>( item ) ) );
}
void OVersatileView::expanded( QListViewItem *item ) // QListView
{
- //qDebug( "OVersatileView::expanded(): opening tree..." );
+ //odebug << "OVersatileView::expanded(): opening tree..." << oendl;
if ( !_treeopened.isNull() )
item->setPixmap( 0, _treeopened );
emit( expanded( static_cast<OVersatileViewItem*>( item ) ) );
}
void OVersatileView::collapsed( QListViewItem *item ) // QListView
{
if ( !_treeclosed.isNull() )
item->setPixmap( 0, _treeclosed );
emit( collapsed( static_cast<OVersatileViewItem*>( item ) ) );
}
//=============================================================================================//
// OVersatileView Case I - API only existing in QListView or QIconView but not in both!
//==============================================================================================//
int OVersatileView::treeStepSize() const // QListView