summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/games/backgammon/moveengine.cpp2
-rw-r--r--noncore/games/kbill/UI.cpp11
-rw-r--r--noncore/games/kcheckers/echeckers.cpp12
-rw-r--r--noncore/games/kcheckers/rcheckers.cpp36
-rw-r--r--noncore/settings/sysinfo/contrib/fft.c2
-rw-r--r--noncore/styles/theme/othemebase.cpp2
6 files changed, 39 insertions, 26 deletions
diff --git a/noncore/games/backgammon/moveengine.cpp b/noncore/games/backgammon/moveengine.cpp
index a4145cc..b102258 100644
--- a/noncore/games/backgammon/moveengine.cpp
+++ b/noncore/games/backgammon/moveengine.cpp
@@ -8,139 +8,141 @@ MoveEngine::MoveEngine()
{
int offset=7;
int a=0; //counter variable
int xfill[]={210,185,170,155,140,125,110,85,70,55,40,25,10,10,25,40,55,70,85,110,125,140,155,170,185,210};
for(a=0;a<26;a++)
{
x_coord[a]=xfill[a];
}
int yfill[]={10,25,40,55,70,10+offset,25+offset,40+offset,55+offset,25,40,55, 25+offset,40+offset,40};
int zfill[]={1,1,1,1,1,2,2,2,2,3,3,3,4,4,5};
for(a=0;a<15;a++)
{
yup_coord[a]=yfill[a];
ylow_coord[a]=185-(yfill[a]);
z_coord[a]=zfill[a];
}
for(a=0;a<5;a++)
{
if(a<3)
{
x_fin1[a]=65+a*15;
x_fin2[a]=155-a*15;
}
y_fin[a]=225-a*5;
}
z_fin=1;
reset();
}
MoveEngine::~MoveEngine()
{}
void MoveEngine::position(Pieces& pieces,bool non_qte)
{
int player1_counter=0;
int player2_counter=0;
//non qte styles are smaller !!
int offset=(non_qte) ? 5 : 0;
for(int a=0;a<28;a++)
{
for(int b=0;b<abs(population[a].total);b++)
{
if(population[a].total>0) //player 1 pieces
{
+ if (a < 26)
pieces.player1[player1_counter].x=x_coord[a]-offset;
if(a>=0 && a<13)
{
pieces.player1[player1_counter].y=yup_coord[b]-offset;
pieces.player1[player1_counter].z=z_coord[b];
pieces.player1[player1_counter].side=false;
player1_counter++;
}
else if(a>12 && a<26)
{
pieces.player1[player1_counter].y=ylow_coord[b]-offset;
pieces.player1[player1_counter].z=z_coord[b];
pieces.player1[player1_counter].side=false;
player1_counter++;
}
else if(a==26)
{
if(b<5)
{
pieces.player1[player1_counter].x=x_fin1[0]-offset;
pieces.player1[player1_counter].y=y_fin[b]-offset;
pieces.player1[player1_counter].z=z_fin;
}
else if(b>=5 && b<10)
{
pieces.player1[player1_counter].x=x_fin1[1]-offset;
pieces.player1[player1_counter].y=y_fin[b-5]-offset;
pieces.player1[player1_counter].z=z_fin;
}
else
{
pieces.player1[player1_counter].x=x_fin1[2]-offset;
pieces.player1[player1_counter].y=y_fin[b-10]-offset;
pieces.player1[player1_counter].z=z_fin;
}
pieces.player1[player1_counter].side=true;
player1_counter++;
}
}
else if(population[a].total<0) //player 2 pieces
{
+ if (a < 26)
pieces.player2[player2_counter].x=x_coord[a]-offset;
if(a>=0 && a<13)
{
pieces.player2[player2_counter].y=yup_coord[b]-offset;
pieces.player2[player2_counter].z=z_coord[b];
pieces.player2[player2_counter].side=false;
player2_counter++;
}
else if(a>12 && a<26)
{
pieces.player2[player2_counter].y=ylow_coord[b]-offset;
pieces.player2[player2_counter].z=z_coord[b];
pieces.player2[player2_counter].side=false;
player2_counter++;
}
else if(a==27)
{
if(b<5)
{
pieces.player2[player2_counter].x=x_fin2[0]-offset;
pieces.player2[player2_counter].y=y_fin[b]-offset;
pieces.player2[player2_counter].z=z_fin;
}
else if(b>=5 && b<10)
{
pieces.player2[player2_counter].x=x_fin2[1]-offset;
pieces.player2[player2_counter].y=y_fin[b-5]-offset;
pieces.player2[player2_counter].z=z_fin;
}
else
{
pieces.player2[player2_counter].x=x_fin2[2]-offset;
pieces.player2[player2_counter].y=y_fin[b-10]-offset;
pieces.player2[player2_counter].z=z_fin;
}
pieces.player2[player2_counter].side=true;
player2_counter++;
}
}
}
}
}
void MoveEngine::diceroll(const int& newplayer,const int& face1,const int& face2,const int& face3,const int& face4,bool computer)
{
checkstate();
player=newplayer;
diff --git a/noncore/games/kbill/UI.cpp b/noncore/games/kbill/UI.cpp
index 611cebf..a49c3c1 100644
--- a/noncore/games/kbill/UI.cpp
+++ b/noncore/games/kbill/UI.cpp
@@ -26,110 +26,109 @@
/**************************/
/* Timer control routines */
/**************************/
UI::~UI() {
paint.end();
delete pix;
}
void UI::restart_timer() {
field->startTimer();
}
void UI::kill_timer() {
field->stopTimer();
}
/*******************/
/* Window routines */
/*******************/
void UI::initialize(int *argc, char **argv) {
#ifdef KDEVER
app = new KApplication(*argc, argv, "kbill");
#endif
app = new QPEApplication(*argc, argv);
}
void UI::graph_init() {
pix = new QPixmap(Game::scrwidth, Game::scrheight);
paint.begin(pix, field);
paint.setPen(QPen(Qt::black, 3));
}
void UI::make_mainwin() {
main = new KBill();
app->showMainWidget(main,true);
main->showMaximized();
field = main->getField();
}
void UI::popup_dialog (int dialog) {
kill_timer();
switch (dialog) {
case Game::ENDGAME:
QMessageBox::message(("Endgame"), QT_TR_NOOP(endgamestr));
break;
case Game::HIGHSCORE:
- // QMessageBox::message(("HighScore"), highscorestr);
break;
- case Game::ENTERNAME: {
+ case Game::ENTERNAME:
+ {
InputBox b(main, 0, ("Enter Name"), QT_TR_NOOP(enternamestr));
bool state = b.exec() == 2;
char str[20], *nl;
- strcpy(str, b.getText());
+ strncpy(str, b.getText(), 19);
if (!str[0] || state)
strcpy(str, "Anonymous");
else if ((nl = strchr(str, '\n')))
*nl = '\0';
- if (strlen(str) > 20)
- str[20] = 0; /* truncate string if too long */
-// scores.recalc(str);
+ if (strlen(str) > 19)
+ str[19] = '\0'; /* truncate/terminate the string if it is too long */
}
break;
case Game::SCORE:
QMessageBox::message(("Score"), scorestr);
break;
}
restart_timer();
}
/*********************/
/* Graphics routines */
/*********************/
void UI::set_cursor(int cursor) {
QCursor *cur;
switch (cursor) {
case Game::BUCKETC:
cur = bucket.cursor.cursor;
break;
case Game::DOWNC:
cur = downcursor.cursor;
break;
case Game::DEFAULTC:
cur = defaultcursor.cursor;
break;
default:
cur = OS.cursor[cursor].cursor;
}
field->setCursor(*cur);
}
void UI::load_cursors() {
defaultcursor.load("hand_up", MCursor::SEP_MASK);
field->setCursor(*defaultcursor.cursor);
downcursor.load("hand_down", MCursor::SEP_MASK);
}
void UI::clear() {
paint.eraseRect(0, 0, field->width(), field->height());
}
void UI::refresh() {
paint.flush();
field->setPixmap(pix);
field->repaint(FALSE);
}
void UI::draw (Picture pict, int x, int y) {
diff --git a/noncore/games/kcheckers/echeckers.cpp b/noncore/games/kcheckers/echeckers.cpp
index 1146059..afe62eb 100644
--- a/noncore/games/kcheckers/echeckers.cpp
+++ b/noncore/games/kcheckers/echeckers.cpp
@@ -34,99 +34,99 @@ bool ECheckers::go1(int from,int field)
}
}
else
{
switch(board[from])
{
case MAN1:
if((to==(from-6))||(to==(from-5)))
{
board[from]=FREE;
if(to<10) board[to]=KING1;
else board[to]=MAN1;
return true;
}
return false;
case KING1:
if((to==(from-6))||(to==(from-5))||
(to==(from+5))||(to==(from+6)) )
{
board[from]=FREE;
board[to]=KING1;
return true;
}
return false;
}
}
return false;
}
bool ECheckers::checkCapture1()
{
for(int i=6;i<48;i++)
{
switch(board[i])
{
case MAN1:
if(board[i-6]==MAN2 || board[i-6]==KING2)
if(board[i-12]==FREE) return true;
if(board[i-5]==MAN2 || board[i-5]==KING2)
if(board[i-10]==FREE) return true;
break;
case KING1:
if(board[i-6]==MAN2 || board[i-6]==KING2)
if(board[i-12]==FREE) return true;
if(board[i-5]==MAN2 || board[i-5]==KING2)
if(board[i-10]==FREE) return true;
if(board[i+5]==MAN2 || board[i+5]==KING2)
- if(board[i+10]==FREE) return true;
+ if(board[((i+10) < 54) ? i+10 : 53]==FREE) return true;
if(board[i+6]==MAN2 || board[i+6]==KING2)
- if(board[i+12]==FREE) return true;
+ if(board[((i+12) < 54) ? i+12 : 53]==FREE) return true;
}
}
return false;
}
// Return TRUE if a course of the user true
// Return FALSE if a course of the user incorrect
bool ECheckers::manCapture1(int from,int direction,bool &capture)
{
int i=from+direction;
if(board[i]==MAN2 || board[i]==KING2)
{
int k=i+direction;
if(board[k]==FREE)
{
bool next=false;
int save=board[i];
board[from]=FREE;
board[i]=NONE;
if(k<10)
{
board[k]=KING1;
if(kingCapture1(k,direction+11,next)) {board[i]=FREE;return true;}
}
else
{
board[k]=MAN1;
if(manCapture1(k,UL,next)) {board[i]=FREE;return true;}
if(manCapture1(k,UR,next)) {board[i]=FREE;return true;}
}
if((!next) && k==to) {board[i]=FREE;return true;}
board[k]=FREE;
board[i]=save;
board[from]=MAN1;
capture=true;
}
}
return false;
}
bool ECheckers::kingCapture1(int from,int direction,bool &capture)
{
@@ -176,109 +176,109 @@ bool ECheckers::kingCapture1(int from,int direction,bool &capture)
void ECheckers::kingMove2(int from,int &resMax)
{
board[from]=FREE;
int i=from-6;
if(board[i]==FREE)
{
board[i]=KING2;
turn(resMax);
board[i]=FREE;
}
i=from-5;
if(board[i]==FREE)
{
board[i]=KING2;
turn(resMax);
board[i]=FREE;
}
i=from+5;
if(board[i]==FREE)
{
board[i]=KING2;
turn(resMax);
board[i]=FREE;
}
i=from+6;
if(board[i]==FREE)
{
board[i]=KING2;
turn(resMax);
board[i]=FREE;
}
board[from]=KING2;
}
bool ECheckers::checkCapture2()
{
for(int i=6;i<48;i++)
{
switch(board[i])
{
case MAN2:
if(board[i+5]==MAN1 || board[i+5]==KING1)
- if(board[i+10]==FREE) return true;
+ if(board[((i+10) < 54) ? i+10 : 53]==FREE) return true;
if(board[i+6]==MAN1 || board[i+6]==KING1)
- if(board[i+12]==FREE) return true;
+ if(board[((i+12) < 54) ? i+12 : 53]==FREE) return true;
break;
case KING2:
if(board[i-6]==MAN1 || board[i-6]==KING1)
if(board[i-12]==FREE) return true;
if(board[i-5]==MAN1 || board[i-5]==KING1)
if(board[i-10]==FREE) return true;
if(board[i+5]==MAN1 || board[i+5]==KING1)
- if(board[i+10]==FREE) return true;
+ if(board[((i+10) < 54) ? i+10 : 53]==FREE) return true;
if(board[i+6]==MAN1 || board[i+6]==KING1)
- if(board[i+12]==FREE) return true;
+ if(board[((i+12) < 54) ? i+12 : 53]==FREE) return true;
}
}
return false;
}
// Return TRUE if it is possible to capture
// Return FALSE if it is impossible to capture
bool ECheckers::manCapture2(int from,int &resMax)
{
bool capture=false;
int i=from+5;
if(board[i]==MAN1 || board[i]==KING1)
{
int k=from+10;
if(board[k]==FREE)
{
int save=board[i];
board[from]=FREE;
board[i]=NONE;
resMax--;
if(from>32)
{
board[k]=KING2;
if(!kingCapture2(k,UL,resMax)) turn(resMax,true);
}
else
{
board[k]=MAN2;
if(!manCapture2(k,resMax)) turn(resMax,true);
}
resMax++;
board[k]=FREE;
board[i]=save;
board[from]=MAN2;
capture=true;
}
}
i=from+6;
if(board[i]==MAN1 || board[i]==KING1)
{
int k=from+12;
if(board[k]==FREE)
{
int save=board[i];
diff --git a/noncore/games/kcheckers/rcheckers.cpp b/noncore/games/kcheckers/rcheckers.cpp
index a1c7afa..d808780 100644
--- a/noncore/games/kcheckers/rcheckers.cpp
+++ b/noncore/games/kcheckers/rcheckers.cpp
@@ -67,117 +67,123 @@ bool RCheckers::go1(int from,int field)
board[from]=FREE;
board[to]=KING1;
return true;
}
else if(board[i]==FREE) continue;
else break;
}
for(int i=from+5;;i+=5)
{
if(i==to)
{
board[from]=FREE;
board[to]=KING1;
return true;
}
else if(board[i]==FREE) continue;
else break;
}
for(int i=from+6;;i+=6)
{
if(i==to)
{
board[from]=FREE;
board[to]=KING1;
return true;
}
else if(board[i]==FREE) continue;
else break;
}
return false;
}
}
return false;
}
bool RCheckers::checkCapture1()
{
for(int i=6;i<48;i++)
{
switch(board[i])
{
case MAN1:
if(board[i-6]==MAN2 || board[i-6]==KING2)
if(board[i-12]==FREE) return true;
if(board[i-5]==MAN2 || board[i-5]==KING2)
if(board[i-10]==FREE) return true;
if(board[i+5]==MAN2 || board[i+5]==KING2)
- if(board[i+10]==FREE) return true;
+ if(board[((i+10) < 54) ? i+10 : 53]==FREE) return true;
if(board[i+6]==MAN2 || board[i+6]==KING2)
- if(board[i+12]==FREE) return true;
+ if(board[((i+12) < 54) ? i+12 : 53]==FREE) return true;
break;
case KING1:
int k;
for(k=i-6;board[k]==FREE;k-=6);
if(board[k]==MAN2 || board[k]==KING2)
if(board[k-6]==FREE) return true;
for(k=i-5;board[k]==FREE;k-=5);
if(board[k]==MAN2 || board[k]==KING2)
if(board[k-5]==FREE) return true;
- for(k=i+5;board[k]==FREE;k+=5);
+ for(k=i+5;board[k]==FREE;k+=5) {
+ if (k >= 49)
+ break;
+ }
if(board[k]==MAN2 || board[k]==KING2)
- if(board[k+5]==FREE) return true;
+ if(board[((k+5) < 54) ? k+5 : 53]==FREE) return true;
- for(k=i+6;board[k]==FREE;k+=6);
+ for(k=i+6;board[k]==FREE;k+=6) {
+ if (k >=48)
+ break;
+ }
if(board[k]==MAN2 || board[k]==KING2)
- if(board[k+6]==FREE) return true;
+ if(board[((k+6) < 54) ? k+6 : 53]==FREE) return true;
}
}
return false;
}
// Return TRUE if a course of the user true
// Return FALSE if a course of the user incorrect
bool RCheckers::manCapture1(int from,int direction,bool &capture)
{
int i=from+direction;
if(board[i]==MAN2 || board[i]==KING2)
{
int k=i+direction;
if(board[k]==FREE)
{
bool next=false;
int save=board[i];
board[from]=FREE;
board[i]=NONE;
if(k<10)
{
board[k]=KING1;
if(kingCapture1(k,direction+11,next)) {board[i]=FREE;return true;}
}
else
{
board[k]=MAN1;
if(direction==UL || direction==DR)
{
if(manCapture1(k,UR,next)) {board[i]=FREE;return true;}
if(manCapture1(k,DL,next)) {board[i]=FREE;return true;}
}
else
{
if(manCapture1(k,UL,next)) {board[i]=FREE;return true;}
if(manCapture1(k,DR,next)) {board[i]=FREE;return true;}
}
if(manCapture1(k,direction,next)) {board[i]=FREE;return true;}
}
if((!next) && k==to) {board[i]=FREE;return true;}
board[k]=FREE;
board[i]=save;
board[from]=MAN1;
@@ -241,117 +247,123 @@ bool RCheckers::kingCapture1(int from,int direction,bool &capture)
// Computer Functions
//
////////////////////////////////////////////////////
void RCheckers::kingMove2(int from,int &resMax)
{
board[from]=FREE;
for(int i=from-6;board[i]==FREE;i-=6)
{
board[i]=KING2;
turn(resMax);
board[i]=FREE;
}
for(int i=from-5;board[i]==FREE;i-=5)
{
board[i]=KING2;
turn(resMax);
board[i]=FREE;
}
for(int i=from+5;board[i]==FREE;i+=5)
{
board[i]=KING2;
turn(resMax);
board[i]=FREE;
}
for(int i=from+6;board[i]==FREE;i+=6)
{
board[i]=KING2;
turn(resMax);
board[i]=FREE;
}
board[from]=KING2;
}
bool RCheckers::checkCapture2()
{
for(int i=6;i<48;i++)
{
switch(board[i])
{
case MAN2:
if(board[i-6]==MAN1 || board[i-6]==KING1)
if(board[i-12]==FREE) return true;
if(board[i-5]==MAN1 || board[i-5]==KING1)
if(board[i-10]==FREE) return true;
if(board[i+5]==MAN1 || board[i+5]==KING1)
- if(board[i+10]==FREE) return true;
+ if(board[((i+10) < 54) ? i+10 : 53]==FREE) return true;
if(board[i+6]==MAN1 || board[i+6]==KING1)
- if(board[i+12]==FREE) return true;
+ if(board[((i+12) < 54) ? i+12 : 53]==FREE) return true;
break;
case KING2:
int k;
for(k=i-6;board[k]==FREE;k-=6);
if(board[k]==MAN1 || board[k]==KING1)
if(board[k-6]==FREE) return true;
for(k=i-5;board[k]==FREE;k-=5);
if(board[k]==MAN1 || board[k]==KING1)
if(board[k-5]==FREE) return true;
- for(k=i+5;board[k]==FREE;k+=5);
+ for(k=i+5;board[k]==FREE;k+=5) {
+ if (k>=49)
+ break;
+ }
if(board[k]==MAN1 || board[k]==KING1)
- if(board[k+5]==FREE) return true;
+ if(board[((k+5) < 54) ? k+5 : 53]==FREE) return true;
- for(k=i+6;board[k]==FREE;k+=6);
+ for(k=i+6;board[k]==FREE;k+=6) {
+ if (k>=48)
+ break;
+ }
if(board[k]==MAN1 || board[k]==KING1)
- if(board[k+6]==FREE) return true;
+ if(board[((k+6) < 54) ? k+6 : 53]==FREE) return true;
}
}
return false;
}
// Return TRUE if it is possible to capture
// Return FALSE if it is impossible to capture
bool RCheckers::manCapture2(int from,int &resMax)
{
bool capture=false;
int i=from-6;
if(board[i]==MAN1 || board[i]==KING1)
{
int k=from-12;
if(board[k]==FREE)
{
int save=board[i];
board[from]=FREE;
board[i]=NONE;
board[k]=MAN2;
resMax--;
if(!manCapture2(k,resMax)) turn(resMax,true);
resMax++;
board[k]=FREE;
board[i]=save;
board[from]=MAN2;
capture=true;
}
}
i=from-5;
if(board[i]==MAN1 || board[i]==KING1)
{
int k=from-10;
if(board[k]==FREE)
{
int save=board[i];
board[from]=FREE;
board[i]=NONE;
board[k]=MAN2;
resMax--;
if(!manCapture2(k,resMax)) turn(resMax,true);
resMax++;
board[k]=FREE;
board[i]=save;
diff --git a/noncore/settings/sysinfo/contrib/fft.c b/noncore/settings/sysinfo/contrib/fft.c
index 01a1b26..60ee27d 100644
--- a/noncore/settings/sysinfo/contrib/fft.c
+++ b/noncore/settings/sysinfo/contrib/fft.c
@@ -1,80 +1,80 @@
// ******************************************************************
// Copyright (c) 2002- Satoshi, All Rights Reserved.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
//
// Author : Satoshi ( af230533@im07.alpha-net.ne.jp )
// ******************************************************************
//***********************************************************************
// ¹â®¥Õ¡¼¥ê¥¨ÊÑ´¹¡Ê£Æ£Æ£Ô¡Ë
// ¹¹¤Ë¥¹¥Ô¡¼¥É¡¦¥¢¥Ã¥×¤¹¤ë¤Ë¤Ï£Ã£Ï£Ó¤ò¸ÇÄê¤Ç»ý¤Ä¤³¤È¡ª
//
// Copyright (C) Satoshi 1994-2002 All rights reserved.
// ***********************************************************************
#include <math.h>
-#define FFT_TEST_COUNT 500 // Bench FFT
+#define FFT_TEST_COUNT 332 // Bench FFT
// ----------------------------------------------------- FFT
#define OBJ_DATA_COUNT 128
#define OBJ_DATA_SISU 7 // 128 = 2 ** 7
#define OBJ_DATA_SLIDE 1
#define FFT_TRN 1
#define IFFT_TRN -1
typedef struct _fft {
int N; // ¥Ç¥¸¥¿¥ë¡¦¥Ç¡¼¥¿·ï¿ô
int r; // N = 2^r
double* result_A; // ¥µ¥ó¥×¥ê¥ó¥°¥Ç¡¼¥¿¤ò¤³¤³¤Ë¥»¥Ã¥È¤¹¤ë
// cos À®Ê¬¡Äµá¤á¤ë¥¹¥Ú¥¯¥È¥ëÀ®Ê¬¤Î¿ôʬ¤ÎÎΰ褬ɬÍ×
double* result_B; // sin À®Ê¬¡Äµá¤á¤ë¥¹¥Ú¥¯¥È¥ëÀ®Ê¬¤Î¿ôʬ¤ÎÎΰ褬ɬÍ×
} FFT;
#define FFT_SIZE sizeof( FFT )
void digital_fft( FFT* fft );
double SpectA[OBJ_DATA_COUNT];
double SpectB[OBJ_DATA_COUNT];
double TestData[] = {
0.998795456205172405,
0.995184726672196929,
0.146735474455360860,
0.098217140329559660,
0.980784545503230431,
0.970031253194543974,
0.956940335252408824,
-0.857728610000272118,
-0.831465612302545236,
-0.803205431480644943,
-0.774010453362736882,
-0.747954125354958995,
-0.707116781186547351,
-0.671125754847018219,
-0.634394284163645266,
-0.594619304492433024,
-0.555545233019601845,
0.941544045483020806,
0.923879532511286738,
0.903989293123443338,
0.881541264344545050,
0.857728610000272118,
diff --git a/noncore/styles/theme/othemebase.cpp b/noncore/styles/theme/othemebase.cpp
index 4275dd6..7fb12a3 100644
--- a/noncore/styles/theme/othemebase.cpp
+++ b/noncore/styles/theme/othemebase.cpp
@@ -959,97 +959,97 @@ void OThemeBase::applyResourceGroup( Config *config, int i, QString *copyfrom, Q
// Various widget specific settings. This was more efficent when bunched
// together in the misc group, but this makes an easier to read config.
if ( i == SliderGroove )
roundedSlider = config->readBoolEntry( "SmallGroove", false );
else if ( i == ActiveTab ) {
aTabLine = config->readBoolEntry( "BottomLine", true );
}
else if ( i == InactiveTab ) {
iTabLine = config->readBoolEntry( "BottomLine", true );
}
else if ( i == Splitter )
splitterWidth = config->readNumEntry( "Width", 10 );
else if ( i == ComboBox || i == ComboBoxDown ) {
roundedCombo = config->readBoolEntry( "Round", false );
}
else if ( i == PushButton || i == PushButtonDown ) {
btnXShift = config->readNumEntry( "XShift", 0 );
btnYShift = config->readNumEntry( "YShift", 0 );
focus3D = config->readBoolEntry( "3DFocusRect", false );
focus3DOffset = config->readBoolEntry( "3DFocusOffset", 0 );
roundedButton = config->readBoolEntry( "Round", false );
}
}
void OThemeBase::readResourceGroup( int i, QString *copyfrom, QString *pixnames, QString *brdnames,
bool *loadArray )
{
if ( loadArray[ i ] == true ) {
return ; // already been preloaded.
}
int tmpVal;
QString tmpStr;
tmpStr = copyfrom [ i ];
if ( !tmpStr.isEmpty() ) { // Duplicate another widget's config
int sIndex;
loadArray[ i ] = true;
for ( sIndex = 0; sIndex < WIDGETS; ++sIndex ) {
if ( tmpStr == widgetEntries[ sIndex ] ) {
if ( !loadArray[ sIndex ] ) // hasn't been loaded yet
readResourceGroup( sIndex, copyfrom, pixnames, brdnames,
loadArray );
break;
}
}
- if ( loadArray[ sIndex ] ) {
+ if ( sIndex < 54 && loadArray[ sIndex ] ) {
copyWidgetConfig( sIndex, i, pixnames, brdnames );
}
else
odebug << "OThemeBase: Unable to identify source widget for " << widgetEntries[ i ] << oendl;
return ;
}
// special inheritance for disabled arrows (these are tri-state unlike
// the rest of what we handle).
for ( tmpVal = DisArrowUp; tmpVal <= DisArrowRight; ++tmpVal ) {
if ( tmpVal == i ) {
tmpStr = pixnames [ i ];
if ( tmpStr.isEmpty() ) {
copyWidgetConfig( ArrowUp + ( tmpVal - DisArrowUp ), i, pixnames,
brdnames );
return ;
}
}
}
// Pixmap
int existing;
// Scan for duplicate pixmaps(two identical pixmaps, tile scale, no blend,
// no pixmapped border)
if ( !pixnames [ i ].isEmpty() ) {
for ( existing = 0; existing < i; ++existing ) {
if ( pixnames[ i ] == pixnames[ existing ] && scaleHints[ i ] == TileScale &&
scaleHints[ existing ] == TileScale && blends[ existing ] == 0.0 &&
blends[ i ] == 0.0 ) {
pixmaps[ i ] = pixmaps[ existing ];
duplicate[ i ] = true;
break;
}
}
}
// load
if ( !duplicate[ i ] && !pixnames[ i ].isEmpty() ) {
pixmaps[ i ] = loadPixmap( pixnames[ i ] );
// load and save images for scaled/blended widgets for speed.
if ( scaleHints[ i ] == TileScale && blends[ i ] == 0.0 )
images[ i ] = NULL;
else
images[ i ] = loadImage( pixnames[ i ] );
}
// Pixmap border
if ( !brdnames [ i ]. isEmpty () ) {
// duplicate check
for ( existing = 0; existing < i; ++existing ) {