[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Camino-devel] camino/src/client Theme.h Theme.cpp
From: |
Pascal Audoux |
Subject: |
[Camino-devel] camino/src/client Theme.h Theme.cpp |
Date: |
Sat, 01 Feb 2003 06:13:17 -0500 |
CVSROOT: /cvsroot/camino
Module name: camino
Changes by: Pascal Audoux <address@hidden> 03/02/01 06:13:17
Modified files:
src/client : Theme.h Theme.cpp
Log message:
add method for choosing theme name and for clearing old theme
Patches:
Index: camino/src/client/Theme.cpp
diff -u camino/src/client/Theme.cpp:1.3 camino/src/client/Theme.cpp:1.4
--- camino/src/client/Theme.cpp:1.3 Tue Jan 28 15:35:25 2003
+++ camino/src/client/Theme.cpp Sat Feb 1 06:13:17 2003
@@ -2,7 +2,7 @@
**
** Camino
**
-** Version : $Id: Theme.cpp,v 1.3 2003/01/28 20:35:25 Audoux Exp $
+** Version : $Id: Theme.cpp,v 1.4 2003/02/01 11:13:17 Audoux Exp $
**
** Author(s) : Philippe Fremy, Pascal Audoux
** Creation : 22/01/2003
@@ -37,6 +37,7 @@
{
_level = 1;
_tiles = 0;
+ _name = "";
}
Theme::~Theme()
@@ -46,24 +47,45 @@
}
}
-void Theme::init()
+void Theme::init( QString name )
+{
+ if( _name != "" ) {
+ clear();
+ }
+ if( _name != name ) {
+ _name = name;
+ _tiles = new QCanvasPixmapArray *** [3];
+ for( int i = 0; i < 3; i++ ) {
+ _tiles[i] = new QCanvasPixmapArray ** [14];
+ for( int j = 0; j < 14; j++ ) {
+ _tiles[i][j] = new QCanvasPixmapArray * [4];
+ for( int k = 0; k < 4; k++ ) {
+ QPtrList<QPixmap> list1;
+ list1.setAutoDelete( true );
+ QPtrList<QPoint> list2;
+ list2.setAutoDelete( true );
+ list1.append( new QPixmap(
"./themes/classic/large/tile_0_0_0.png" ) );
+ list2.append( new QPoint( 0, 0 ) );
+ _tiles[i][j][k] = new
QCanvasPixmapArray( list1, list2 );
+ }
+ }
+ }
+ }
+}
+
+void Theme::clear()
{
- _tiles = new QCanvasPixmapArray *** [3];
for( int i = 0; i < 3; i++ ) {
- _tiles[i] = new QCanvasPixmapArray ** [14];
for( int j = 0; j < 14; j++ ) {
- _tiles[i][j] = new QCanvasPixmapArray * [4];
for( int k = 0; k < 4; k++ ) {
- QPtrList<QPixmap> list1;
- list1.setAutoDelete( true );
- QPtrList<QPoint> list2;
- list2.setAutoDelete( true );
- list1.append( new QPixmap(
"./themes/classic/large/tile_0_0_0.png" ) );
- list2.append( new QPoint( 0, 0 ) );
- _tiles[i][j][k] = new QCanvasPixmapArray(
list1, list2 );
+ delete _tiles[i][j][k];
}
+ delete [] _tiles[i][j];
}
+ delete [] _tiles[i];
}
+ delete [] _tiles;
+ _tiles = 0;
}
int Theme::getZoomSize()
Index: camino/src/client/Theme.h
diff -u camino/src/client/Theme.h:1.3 camino/src/client/Theme.h:1.4
--- camino/src/client/Theme.h:1.3 Tue Jan 28 15:35:25 2003
+++ camino/src/client/Theme.h Sat Feb 1 06:13:17 2003
@@ -5,7 +5,7 @@
** Theme.h
** Manage theme data and pictures
**
-** Version : $Id: Theme.h,v 1.3 2003/01/28 20:35:25 Audoux Exp $
+** Version : $Id: Theme.h,v 1.4 2003/02/01 11:13:17 Audoux Exp $
** Author(s) : Philippe Fremy, Pascal Audoux
** Creation : 22/01/2003
** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -31,6 +31,7 @@
// generic include files
// include files for QT
#include <qcanvas.h>
+#include <qstring.h>
// application specific include files
@@ -52,7 +53,9 @@
virtual ~Theme();
/** Initializes the theme */
- void init();
+ void init( QString name );
+
+ QString getName() { return _name; }
QCanvasPixmapArray * getTileArray( int num, int side );
@@ -65,7 +68,10 @@
const QPixmap & getTilePixmap( int num, int side );
protected:
+ void clear();
+
int _level;
+ QString _name;
QCanvasPixmapArray **** _tiles;
};
- [Camino-devel] camino/src/client Theme.h Theme.cpp,
Pascal Audoux <=