Skip to content

Commit

Permalink
bugfixes, prepare next release.
Browse files Browse the repository at this point in the history
  • Loading branch information
global667 committed Apr 29, 2024
1 parent 82a56e2 commit 6977555
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 21 deletions.
54 changes: 54 additions & 0 deletions deployment-win11.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# PowerShell-Skript für das Deployen von ElephantChess unter Windows 11

# Pfad zur Qt-Installation
$QtDir = "C:\Qt\6.7.0\msvc2019_64" # "C:\Qt\6.7.0\mingw_64"
# Pfad zum Build-Verzeichnis Ihres Projekts
$BuildDir = "C:\Users\wolfk\CLionProjects\ElephantChess\cmake-build-debug-visual-studio"
#Installer data and config root dir
$InstRoot = "F:\deploy\ElephantChess\"
# Zielverzeichnis für das Deployment
$DataDir = $InstRoot + "\packages\com.boringgames.elephantchess\data"
# Name Ihrer ausführbaren Datei
$ExeName = "ElephantChess.exe"
# Name des/der Schachprogramms/Schachprogramme
#$PikaExe = "pikafish.exe"
#$PikaNet = "pikafish.nnue"

# Schritt 1: Kompilieren des Projekts (optional, falls nicht bereits geschehen)
# cd zum Projektverzeichnis, falls nötig
# Invoke-Expression "qmake && mingw32-make"

# Schritt 2: Erstellen des Deploy-Verzeichnisses, falls es nicht existiert
if (-not (Test-Path $DataDir)) {
New-Item -ItemType Directory -Force -Path $DataDir
}

# Schritt 3: Verwenden von windeployqt zum Sammeln der Abhängigkeiten
$QtBinDir = Join-Path -Path $QtDir -ChildPath "bin"
$WinDeployQt = Join-Path -Path $QtBinDir -ChildPath "windeployqt.exe"
$ExePath = Join-Path -Path $BuildDir -ChildPath $ExeName
#$PikaExePath = Join-Path -Path $BuildDir -ChildPath $PikaExe
#$PikaNetPath = Join-Path -Path $BuildDir -ChildPath $PikaNet

Copy-Item -Path $ExePath -Destination $DataDir

#& $WinDeployQt --dir $DeployDir $ExePath
# Führen Sie windeployqt aus, um die erforderlichen Abhängigkeiten zu kopieren
& $WinDeployQt --debug --no-translations --no-opengl-sw $DataDir"\"$ExeName
#--no-system-d3d-compiler --qmldir $QtDir\qml --no-compiler-runtime

# Schritt 4: Kopieren der ausführbaren Datei und anderer benötigter Dateien in das Deploy-Verzeichnis

#Copy-Item -Recurse -Force -Path $BuildDir"\*" -Destination $DataDir
#Copy-Item -Path $PikaExePath -Destination $DeployDir
#Copy-Item -Path $PikaNetPath -Destination $DeployDir



# Weitere benötigte Ressourcen oder Dateien kopieren
# Copy-Item -Path "" -Destination $DeployDir
cd $InstRoot
& C:\Qt\Tools\QtInstallerFramework\4.7\bin\binarycreator.exe -f -c F:\deploy\ElephantChess\config\config.xml -p F:\deploy\ElephantChess\packages $ExeName

# Deployment abgeschlossen
Write-Host "Deployment abgeschlossen. Überprüfen Sie das Verzeichnis: $InstRoot"
49 changes: 28 additions & 21 deletions sources/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ void MainWindow::InitConnections() {
//connect(settings, SIGNAL(boardStyleChanged()), SLOT(Newgame()));
connect(uci, SIGNAL(giveTipp(Point,Point)), SLOT(engineTipp(Point,Point)));

connect(
/*connect(
table, &QTreeWidget::itemClicked, this,
[=](const QTreeWidgetItem *item, int col) {
const int row = table->indexFromItem(item).row();
basemodel.position = basemodel.moveHistory[row];
isTableClicked = row;
repaint();
},
Qt::AutoConnection);
Qt::AutoConnection); */
// SLOT(ItemClicked(QTreeWidgetItem *, int)));

connect(
Expand Down Expand Up @@ -380,6 +380,8 @@ void MainWindow::Open() {

void MainWindow::ReadPGNData(QString data) const {
data.shrink_to_fit();
basemodel.moves.clear();
model->clear();
for (auto &s: data.split('\n')) {
if (s.contains("[Event ")) {
loca->setText(s.split("\"").at(1));
Expand Down Expand Up @@ -421,35 +423,41 @@ void MainWindow::ReadPGNData(QString data) const {
}

void MainWindow::PutPGNOnBoard() {

basemodel.position.setupInitialPositions();
basemodel.moveHistory.clear();
AddMoveToHistory();
basemodel.currentMove = 0;
for (const auto & m : model->findItems("*", Qt::MatchWildcard)) {
model->removeRow(m->row());
}
table->clear();
model->clear();
// row = 0,
column = 0;
auto moves = basemodel.moves;
basemodel.moves.clear();
AddMoveToHistory();
basemodel.currentMove = 0;
int c = 0;

for (QString &item1: moves) {
auto *item = new QStandardItem(item1);
for (auto& item1: moves) {
//auto *item = new QStandardItem(item1);
//if (c % 2 == 0) {
// model->setItem(c / 2, 0, item);
// }
//if (c % 2 == 1)
model->setItem(c , 0, item);
//model->appendRow(item);

const auto fx = ((char)item1.at(0).toLatin1() - 'a') ;
const auto fy = static_cast<char>(9 - item1[1].digitValue());
const auto tx = ((char) item1.at(2).toLatin1() -'a');
const auto ty = static_cast<char>(9 - item1[3].digitValue());

Board::movePiece(Point(9 - fy, 8 - fx), Point(9 - ty, 8 - tx), basemodel.position.board);
AddMoveToHistory();
AddMoveToHistory();
AddMoveToList(std::make_pair(Point(9 - fy, 8 - fx), Point(9 - ty, 8 - tx)));
Board::movePiece(Point(9 - fy, 8 - fx), Point(9 - ty, 8 - tx), basemodel.position.board);

c++;
basemodel.position.toggleColor();
}
basemodel.currentMove++;
column = c;
repaint();
}
Expand Down Expand Up @@ -482,19 +490,19 @@ void MainWindow::AddMoveToList(const std::pair<Point, Point> move) const {
: QString("+"));

auto *item = new QTreeWidgetItem(table);
const int ply = (basemodel.moves.size() - 1) % 2;
//const int ply = (basemodel.moves.size() - 1) % 2;
item->setText(0, QString::number(basemodel.currentMove) + ". " + mv.join(" "));

if (isTableClicked) {
/* if (isTableClicked) {
if (0 == ply) {
table->addTopLevelItem(item);
} else {
table->setCurrentItem(item);
//table->addTopLevelItem(item); // Insert the item at the top
}
} else {
table->addTopLevelItem(item);
}
} else { */
//table->addTopLevelItem(item);
//}
}

void MainWindow::Save() {
Expand Down Expand Up @@ -712,12 +720,11 @@ void MainWindow::Newgame() {
// End Toolbar slots

void MainWindow::ResetToHistory() {
//basemodel.position = basemodel.moveHistory[basemodel.currentMove];
basemodel.position = basemodel.moveHistory[basemodel.currentMove];
basemodel.fromHuman = {-1, -1};
basemodel.toHuman = {-1, -1};
basemodel.fromUCI = {-1, -1};
basemodel.toUCI = {-1, -1};
//basemodel.fromHuman = {-1, -1};
//basemodel.toHuman = {-1, -1};
//basemodel.fromUCI = {-1, -1};
//basemodel.toUCI = {-1, -1};

repaint();
}
Expand Down

0 comments on commit 6977555

Please sign in to comment.