bugfix for logfiledialog crash

This commit is contained in:
doitux
2012-12-17 14:19:02 +01:00
parent f23aedb87f
commit 35628b057c
2 changed files with 65 additions and 62 deletions
@@ -67,6 +67,7 @@ void LogFileDialog::refreshLogFileList()
QFileInfo currentSqliteLogFile(QString::fromStdString(myGuiLog->getMySqliteLogFileName()));
ui->treeWidget_logFiles->blockSignals(TRUE);
ui->treeWidget_logFiles->clear();
int i;
for (i=0; i < dbFilesList.size(); i++) {
@@ -86,6 +87,8 @@ void LogFileDialog::refreshLogFileList()
ui->treeWidget_logFiles->addTopLevelItem(item);
}
ui->treeWidget_logFiles->sortItems(0, Qt::DescendingOrder);
ui->treeWidget_logFiles->blockSignals(FALSE);
ui->treeWidget_logFiles->setCurrentItem(ui->treeWidget_logFiles->topLevelItem(0));
}
void LogFileDialog::deleteLogFile()
+62 -62
View File
@@ -72,76 +72,76 @@ void SDLPlayer::initAudio()
void SDLPlayer::playSound(string audioString, int playerID)
{
#ifndef ANDROID
// if(audioEnabled && myConfig->readConfigInt("PlaySoundEffects")) {
if(audioEnabled && myConfig->readConfigInt("PlaySoundEffects")) {
// QFile myFile(myAppDataPath + "sounds/default/" + QString::fromStdString(audioString)+".wav");
QFile myFile(myAppDataPath + "sounds/default/" + QString::fromStdString(audioString)+".wav");
// if(myFile.open(QIODevice::ReadOnly)) {
if(myFile.open(QIODevice::ReadOnly)) {
// //set 3d position for player
// int position = 0;
// int distance = 0;
//set 3d position for player
int position = 0;
int distance = 0;
// switch (playerID) {
switch (playerID) {
// case 0: {
// position = 180;
// distance = 10;
// }
// break;
// case 1: {
// position = 281;
// distance = 50;
// }
// break;
// case 2: {
// position = 315;
// distance = 120;
// }
// break;
// case 3: {
// position = 338;
// distance = 160;
// }
// break;
// case 4: {
// position = 23;
// distance = 160;
// }
// break;
// case 5: {
// position = 45;
// distance = 120;
// }
// break;
// case 6: {
// position = 79;
// distance = 50;
// }
// break;
// default: {
// position = 0;
// distance = 0;
// }
// break;
// }
case 0: {
position = 180;
distance = 10;
}
break;
case 1: {
position = 281;
distance = 50;
}
break;
case 2: {
position = 315;
distance = 120;
}
break;
case 3: {
position = 338;
distance = 160;
}
break;
case 4: {
position = 23;
distance = 160;
}
break;
case 5: {
position = 45;
distance = 120;
}
break;
case 6: {
position = 79;
distance = 50;
}
break;
default: {
position = 0;
distance = 0;
}
break;
}
// QDataStream in(&myFile);
// soundData = new Uint8[(int)myFile.size()];
// in.readRawData( (char*)soundData, (int)myFile.size() );
// sound = Mix_QuickLoad_WAV(soundData);
QDataStream in(&myFile);
soundData = new Uint8[(int)myFile.size()];
in.readRawData( (char*)soundData, (int)myFile.size() );
sound = Mix_QuickLoad_WAV(soundData);
// // set channel 0 to settings volume
// Mix_Volume(-1,myConfig->readConfigInt("SoundVolume")*10);
// set channel 0 to settings volume
Mix_Volume(-1,myConfig->readConfigInt("SoundVolume")*10);
// // set 3d effect
// if(!Mix_SetPosition(0, position, distance)) {
// printf("Mix_SetPosition: %s\n", Mix_GetError());
// // no position effect, is it ok?
// }
// currentChannel = Mix_PlayChannel(-1, sound,0);
// }
// }
// set 3d effect
if(!Mix_SetPosition(0, position, distance)) {
printf("Mix_SetPosition: %s\n", Mix_GetError());
// no position effect, is it ok?
}
currentChannel = Mix_PlayChannel(-1, sound,0);
}
}
#endif
}