@@ -40,8 +40,10 @@ ui(new Ui::LogFileDialog)
|
||||
connect( ui->pushButton_exportLogHtml, SIGNAL(clicked()), this, SLOT (exportLogToHtml()));
|
||||
connect( ui->pushButton_exportLogTxt, SIGNAL(clicked()), this, SLOT (exportLogToTxt()));
|
||||
connect( ui->pushButton_saveLogAs, SIGNAL(clicked()), this, SLOT (saveLogFileAs()));
|
||||
connect( ui->treeWidget_logFiles, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(showLogFilePreview()));
|
||||
connect( ui->treeWidget_logFiles, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(showLogFilePreviewInit()));
|
||||
connect( ui->pushButton_analyseLogfile, SIGNAL(clicked()), this, SLOT (uploadFile()));
|
||||
connect( ui->comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(showLogFilePreviewSelected()));
|
||||
|
||||
}
|
||||
|
||||
LogFileDialog::~LogFileDialog()
|
||||
@@ -154,12 +156,23 @@ void LogFileDialog::saveLogFileAs()
|
||||
}
|
||||
}
|
||||
|
||||
void LogFileDialog::showLogFilePreview()
|
||||
void LogFileDialog::showLogFilePreview(ShowLogMode mode)
|
||||
{
|
||||
QTreeWidgetItem* selectedItem = ui->treeWidget_logFiles->currentItem();
|
||||
|
||||
if(mode == INIT_VIEW) {
|
||||
ui->comboBox->blockSignals(TRUE);
|
||||
ui->comboBox->clear();
|
||||
QList<int> gameIds = myGuiLog->getGameList(selectedItem->data(0, Qt::UserRole).toString());
|
||||
QList<int>::const_iterator it;
|
||||
for (it = gameIds.constBegin(); it != gameIds.constEnd(); ++it) {
|
||||
ui->comboBox->addItem(QString::number(*it));
|
||||
}
|
||||
ui->comboBox->blockSignals(FALSE);
|
||||
}
|
||||
|
||||
if(selectedItem) {
|
||||
myGuiLog->showLog(selectedItem->data(0, Qt::UserRole).toString(), ui->textBrowser_logPreview);
|
||||
myGuiLog->showLog(selectedItem->data(0, Qt::UserRole).toString(), ui->textBrowser_logPreview, ui->comboBox->itemText(ui->comboBox->currentIndex()).toInt());
|
||||
}
|
||||
|
||||
QTextCursor cursor(ui->textBrowser_logPreview->textCursor());
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace Ui {
|
||||
class LogFileDialog;
|
||||
}
|
||||
|
||||
enum ShowLogMode { INIT_VIEW, SELECTED_GAME };
|
||||
|
||||
class guiLog;
|
||||
class ConfigFile;
|
||||
@@ -48,7 +49,9 @@ public slots:
|
||||
void exportLogToHtml();
|
||||
void exportLogToTxt();
|
||||
void saveLogFileAs();
|
||||
void showLogFilePreview();
|
||||
void showLogFilePreviewInit() {showLogFilePreview(INIT_VIEW); }
|
||||
void showLogFilePreviewSelected() {showLogFilePreview(SELECTED_GAME); }
|
||||
void showLogFilePreview(ShowLogMode);
|
||||
void keyPressEvent ( QKeyEvent * event );
|
||||
void uploadFile();
|
||||
|
||||
|
||||
@@ -61,7 +61,6 @@ void SDLPlayer::initAudio()
|
||||
if( Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers) == 0) {
|
||||
Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels);
|
||||
audioEnabled = 1;
|
||||
qDebug() << "Mix_OpenAudio()";
|
||||
}
|
||||
else {
|
||||
qDebug() << "Mix_OpenAudio() was not successfull, no sound possible :(";
|
||||
@@ -73,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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user