summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-12-20 17:47:08 (UTC)
committer mickeyl <mickeyl>2003-12-20 17:47:08 (UTC)
commitd552ce3a94b53ae0fdb226411bd8f9e5bab6596a (patch) (side-by-side diff)
treeca9f1edd3ed945c98a6cd4587a5094fe9b2b3d36
parent8e96eec63c67cfcd1fb202fe7346e5408a142f2e (diff)
downloadopie-d552ce3a94b53ae0fdb226411bd8f9e5bab6596a.zip
opie-d552ce3a94b53ae0fdb226411bd8f9e5bab6596a.tar.gz
opie-d552ce3a94b53ae0fdb226411bd8f9e5bab6596a.tar.bz2
- start cleaning up (lot of stuff left)
- use odebug classes
Diffstat (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,8 +1,7 @@
/*
                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
@@ -30,24 +29,27 @@
*/
#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,8 +1,7 @@
/*
                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
@@ -48,11 +47,14 @@ class QLayoutItem;
* 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
@@ -82,8 +84,8 @@ class ODialog : public QDialog
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
@@ -33,9 +33,10 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#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)
@@ -62,9 +63,9 @@ QImage OImageEffect::gradient(const QSize &size, const QColor &ca,
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;
@@ -348,9 +349,9 @@ QImage OImageEffect::unbalancedGradient(const QSize &size, const QColor &ca,
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;
@@ -567,9 +568,9 @@ QImage OImageEffect::unbalancedGradient(const QSize &size, const QColor &ca,
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();
@@ -632,9 +633,9 @@ QImage& OImageEffect::intensity(QImage &image, float percent)
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();
@@ -722,9 +723,9 @@ 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;
@@ -851,9 +852,9 @@ 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();
@@ -894,14 +895,14 @@ QImage& OImageEffect::blend(QImage& src, QImage& dst, float opacity)
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);
@@ -939,9 +940,9 @@ 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();
@@ -1132,9 +1133,9 @@ QImage& OImageEffect::blend(QImage &image, float initial_intensity,
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...
@@ -1162,9 +1163,9 @@ QImage& OImageEffect::blend(QImage &image1, QImage &image2,
{
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;
@@ -1260,9 +1261,9 @@ unsigned int OImageEffect::uHash(unsigned int c)
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;
@@ -1768,9 +1769,9 @@ bool OImageEffect::blend(
upper.depth() != 32 ||
lower.depth() != 32
)
{
- qDebug( "OImageEffect::blend : Sizes not correct" );
+ odebug << "OImageEffect::blend : Sizes not correct" << oendl;
return false;
}
output = lower.copy();
@@ -1985,9 +1986,9 @@ void OImageEffect::normalize(QImage &img)
// 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;
}
@@ -2101,9 +2102,9 @@ void OImageEffect::equalize(QImage &img)
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;
@@ -2186,9 +2187,9 @@ QImage OImageEffect::sample(QImage &src, int w, int h)
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);
}
@@ -2204,9 +2205,9 @@ QImage OImageEffect::sample(QImage &src, int w, int h)
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);
@@ -2232,9 +2233,9 @@ QImage OImageEffect::sample(QImage &src, int w, int h)
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);
@@ -3071,9 +3072,9 @@ QImage OImageEffect::wave(QImage &src, double amplitude, double wavelength,
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;
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,8 +1,7 @@
/*
                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
@@ -36,8 +35,9 @@
#include <qpixmap.h>
/* OPIE */
+#include <opie2/odebug.h>
#include <opie2/olistview.h>
/*======================================================================================
* OListView
@@ -141,9 +141,9 @@ OListViewItem* OListView::childFactory()
#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 )
@@ -166,15 +166,15 @@ void OListView::serializeTo( QDataStream& s ) const
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 );
@@ -198,9 +198,9 @@ void OListView::serializeFrom( QDataStream& s )
OListViewItem* item = childFactory();
s >> *item;
}
- qDebug( "OListView loaded." );
+ odebug << "OListView loaded." << oendl;
}
QDataStream& operator<<( QDataStream& s, const OListView& lv )
@@ -376,9 +376,9 @@ OListViewItem* OListViewItem::childFactory()
#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 )
{
@@ -402,16 +402,16 @@ void OListViewItem::serializeTo( QDataStream& s ) const
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;
@@ -429,9 +429,9 @@ void OListViewItem::serializeFrom( QDataStream& s )
OListViewItem* item = childFactory();
s >> (*item);
}
- qDebug( "OListViewItem loaded." );
+ odebug << "OListViewItem loaded." << oendl;
}
QDataStream& operator<<( QDataStream& s, const OListViewItem& lvi )
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
@@ -9,11 +9,12 @@ HEADERS = olistview.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 \
@@ -22,28 +23,25 @@ SOURCES = olistview.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,7 +1,6 @@
/*
                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.
@@ -29,16 +28,17 @@
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);
@@ -68,9 +68,9 @@ void OSeparator::setOrientation(int orientation)
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 );
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
@@ -27,8 +27,15 @@
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>
@@ -43,14 +50,8 @@
#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",
@@ -288,9 +289,9 @@ void OVersatileView::setDefaultPixmaps( int mode, QPixmap& leaf, QPixmap& opened
_iconclosed = closed;
}
else
{
- qDebug( "OVersatileView::setDefaultPixmaps(): invalid mode" );
+ odebug << "OVersatileView::setDefaultPixmaps(): invalid mode" << oendl;
}
}
QIconView* OVersatileView::iconView() const
@@ -316,9 +317,9 @@ void OVersatileView::setViewMode( int mode )
raiseWidget( _iconview );
}
else
{
- qDebug( "OVersatileView::setViewMode(): invalid mode" );
+ odebug << "OVersatileView::setViewMode(): invalid mode" << oendl;
}
}
void OVersatileView::setIconViewMode()
@@ -342,23 +343,23 @@ bool OVersatileView::isValidViewMode( int mode ) const
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;
}
}
}
@@ -447,9 +448,9 @@ void OVersatileView::onItem( QIconViewItem * 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 ) ) );
}