Skip to content

Commit

Permalink
Fix annotations losing time and adding blanks
Browse files Browse the repository at this point in the history
  • Loading branch information
Isarhamster committed Jul 3, 2024
1 parent d68ebeb commit 2e2aad8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
8 changes: 6 additions & 2 deletions src/database/gamex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ static const char strSquareNames[64][3] =
"a8", "b8", "c8", "d8", "e8", "f8", "g8", "h8"
};

const QList<QRegularExpression> GameX::s_specList = QList<QRegularExpression>() << SquareAnnotation().filter() << ArrowAnnotation().filter() << EvalAnnotation().filter();
const QList<QRegularExpression> GameX::s_specList = QList<QRegularExpression>()
<< SquareAnnotation().filter()
<< ArrowAnnotation().filter()
<< EvalAnnotation().filter()
<< TimeAnnotation().filter();

GameX::GameX()
: QObject()
Expand Down Expand Up @@ -1021,7 +1025,7 @@ bool GameX::dbAppendAnnotation(QString a, MoveId moveId, Position position)
bool GameX::dbPrependAnnotation(QString a, char delimiter, MoveId moveId, Position position)
{
QString s = annotation();
if (s.length())
if (s.length() && delimiter)
{
a.append(delimiter);
}
Expand Down
2 changes: 1 addition & 1 deletion src/dialogs/preferences.ui
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<bool>false</bool>
</property>
<property name="currentIndex">
<number>2</number>
<number>1</number>
</property>
<widget class="QWidget" name="tabGeneral">
<attribute name="title">
Expand Down
4 changes: 2 additions & 2 deletions src/gui/annotationwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void AnnotationWidget::variationClicked(QModelIndex index)
QString AnnotationWidget::getComment() const
{
QString s = ui->editComment->toPlainText();
if (AppSettings->getValue("HTMLComments").toBool())
if (AppSettings->getValue("/GameText/HTMLComments").toBool())
{
s.replace("\n","<br>");
}
Expand All @@ -39,7 +39,7 @@ QString AnnotationWidget::getComment() const
void AnnotationWidget::setComment(const QString &value)
{
QString s = value;
if (AppSettings->getValue("HTMLComments").toBool())
if (AppSettings->getValue("/GameText/HTMLComments").toBool())
{
s.replace("<br>","\n");
}
Expand Down
9 changes: 5 additions & 4 deletions src/gui/mainwindowactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2029,7 +2029,7 @@ bool MainWindow::gameAddAnalysis(const Analysis& analysis, QString annotation, b
annotation += scoreText(analysis);
if (AppSettings->getValue("/Board/AnnotateScore").toBool())
{
game().dbPrependAnnotation(scoreText(analysis));
game().dbPrependAnnotation(scoreText(analysis), 0);
UpdateGameText();
}
if (game().atLineEnd())
Expand Down Expand Up @@ -2649,7 +2649,7 @@ void MainWindow::slotEngineTimeout(const Analysis& analysis)
{
if (AppSettings->getValue("/Board/AnnotateScore").toBool())
{
game().prependAnnotation(scoreText(a));
game().prependAnnotation(scoreText(a), 0);
UpdateGameText();
}
}
Expand All @@ -2661,14 +2661,14 @@ void MainWindow::slotEngineTimeout(const Analysis& analysis)
addAutoNag(m.color(), score, lastScore, threashold, lastNode);
if (AppSettings->getValue("/Board/AnnotateScore").toBool())
{
game().prependAnnotation(scoreText(a));
game().prependAnnotation(scoreText(a), 0);
}
UpdateGameText();
}
}
else if (AppSettings->getValue("/Board/AnnotateScore").toBool())
{
game().prependAnnotation(scoreText(a));
game().prependAnnotation(scoreText(a), 0);
UpdateGameText();
}
lastScore = score;
Expand Down Expand Up @@ -2895,6 +2895,7 @@ void MainWindow::AutoMoveAtEndOfGame()
{
QString engineAnnotation = tr("Engine %1").arg(m_mainAnalysis->displayName());
game().dbSetAnnotation(engineAnnotation, game().lastMove());
UpdateGameText();

if (AppSettings->getValue("/Board/AutoSaveAndContinue").toBool())
{
Expand Down

0 comments on commit 2e2aad8

Please sign in to comment.