avoid removal of current db log file
This commit is contained in:
@@ -317,7 +317,7 @@ void gameLobbyDialogImpl::createGame()
|
||||
|
||||
updateDialogBlinds(gameData);
|
||||
|
||||
label_GameTiming->setText(QString::number(gameData.playerActionTimeoutSec));
|
||||
label_GameTiming->setText(QString::number(gameData.playerActionTimeoutSec)+tr(" sec (action)")+"\n"+QString::number(gameData.delayBetweenHandsSec)+tr(" sec (hand delay)"));
|
||||
|
||||
mySession->clientCreateGame(gameData, currentGameName.toUtf8().constData(), myCreateInternetGameDialog->lineEdit_Password->text().toUtf8().constData());
|
||||
|
||||
@@ -1135,7 +1135,7 @@ void gameLobbyDialogImpl::joinedGameDialogUpdate()
|
||||
label_SmallBlind->setText(QString("%L1").arg(info.data.firstSmallBlind));
|
||||
label_StartCash->setText(QString("%L1").arg(info.data.startMoney));
|
||||
updateDialogBlinds(info.data);
|
||||
label_GameTiming->setText(QString::number(info.data.playerActionTimeoutSec));
|
||||
label_GameTiming->setText(QString::number(info.data.playerActionTimeoutSec)+tr(" sec (action)")+"\n"+QString::number(info.data.delayBetweenHandsSec)+tr(" sec (hand delay)"));
|
||||
|
||||
QTreeWidgetItem *header = treeWidget_connectedPlayers->headerItem();
|
||||
header->setText(0, tr("Connected players - Max. %1").arg(info.data.maxNumberOfPlayers));
|
||||
|
||||
@@ -70,7 +70,6 @@ public slots:
|
||||
void showLog(QString fileStringPdb, QTextBrowser *tb);
|
||||
int exportLog(QString fileStringPdb, int modus);
|
||||
|
||||
|
||||
public:
|
||||
QStringList translateCardCode(int cardCode);
|
||||
|
||||
@@ -79,6 +78,7 @@ public:
|
||||
void setMySqliteLogFileName(std::string theValue) {
|
||||
mySqliteLogFileName = theValue;
|
||||
}
|
||||
std::string getMySqliteLogFileName() { return mySqliteLogFileName; }
|
||||
|
||||
signals:
|
||||
void signalLogPlayerActionMsg(QString playerName, int action, int setValue);
|
||||
@@ -116,12 +116,11 @@ private:
|
||||
QString logFileStreamString;
|
||||
QString myAppDataPath;
|
||||
QTextBrowser* tb;
|
||||
|
||||
GameTableStyleReader *myStyle;
|
||||
std::string mySqliteLogFileName;
|
||||
|
||||
friend class GuiWrapper;
|
||||
|
||||
std::string mySqliteLogFileName;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1347,6 +1347,9 @@ void settingsDialogImpl::refreshLogFileList()
|
||||
filters << "*.pdb";
|
||||
QFileInfoList dbFilesList = logFileDir.entryInfoList(filters, QDir::Files, QDir::Time);
|
||||
|
||||
QFileInfo currentSqliteLogFile(QString::fromStdString(myGuiLog->getMySqliteLogFileName()));
|
||||
|
||||
|
||||
treeWidget_logFiles->clear();
|
||||
int i;
|
||||
for (i=0; i < dbFilesList.size(); i++) {
|
||||
@@ -1354,6 +1357,11 @@ void settingsDialogImpl::refreshLogFileList()
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem;
|
||||
item->setText(0, dbFilesList.at(i).fileName());
|
||||
item->setData(0, Qt::UserRole, dbFilesList.at(i).absoluteFilePath());
|
||||
if(currentSqliteLogFile.fileName() == dbFilesList.at(i).fileName()) {
|
||||
item->setData(0, Qt::BackgroundColorRole, QColor(Qt::red));
|
||||
item->setData(0, Qt::TextColorRole, QColor(Qt::white));
|
||||
item->setData(0, Qt::UserRole+1, "current");
|
||||
}
|
||||
treeWidget_logFiles->addTopLevelItem(item);
|
||||
}
|
||||
treeWidget_logFiles->sortItems(0, Qt::DescendingOrder);
|
||||
@@ -1370,8 +1378,10 @@ void settingsDialogImpl::deleteLogFile()
|
||||
|
||||
if(ret == QMessageBox::Yes) {
|
||||
for (int i = 0; i < selectedItemsList.size(); ++i) {
|
||||
if(!QFile::remove(selectedItemsList.at(i)->data(0, Qt::UserRole).toString())) {
|
||||
QMessageBox::warning(this, "Remove log file", "PokerTH cannot remove this log file, please verify that you have write access to this file!", QMessageBox::Close );
|
||||
if(selectedItemsList.at(i)->data(0, Qt::UserRole+1).toString() != "current") {
|
||||
if(!QFile::remove(selectedItemsList.at(i)->data(0, Qt::UserRole).toString())) {
|
||||
QMessageBox::warning(this, "Remove log file", "PokerTH cannot remove this log file, please verify that you have write access to this file!", QMessageBox::Close );
|
||||
}
|
||||
}
|
||||
}
|
||||
refreshLogFileList();
|
||||
@@ -1433,6 +1443,13 @@ void settingsDialogImpl::showLogFilePreview()
|
||||
|
||||
if(selectedItem) {
|
||||
myGuiLog->showLog(selectedItem->data(0, Qt::UserRole).toString(), textBrowser_logPreview);
|
||||
|
||||
if(selectedItem->data(0, Qt::UserRole+1).toString() == "current") {
|
||||
pushButton_deleteLog->setDisabled(true);
|
||||
}
|
||||
else {
|
||||
pushButton_deleteLog->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
QTextCursor cursor(textBrowser_logPreview->textCursor());
|
||||
|
||||
@@ -198,7 +198,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>450</width>
|
||||
<height>20</height>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuPokerTH">
|
||||
@@ -213,8 +213,8 @@
|
||||
<addaction name="actionJoin_Network_Game"/>
|
||||
</widget>
|
||||
<addaction name="actionStart_Local_Game"/>
|
||||
<addaction name="menuNetwork_Game"/>
|
||||
<addaction name="actionInternet_Game"/>
|
||||
<addaction name="menuNetwork_Game"/>
|
||||
<addaction name="actionAbout_PokerTH"/>
|
||||
<addaction name="actionQuit"/>
|
||||
</widget>
|
||||
|
||||
Reference in New Issue
Block a user