summaryrefslogtreecommitdiff
path: root/quacker
diff options
context:
space:
mode:
Diffstat (limited to 'quacker')
-rw-r--r--quacker/Info.plist2
-rw-r--r--quacker/boarddisplay.cpp28
-rw-r--r--quacker/boarddisplay.h17
-rw-r--r--quacker/configpages.cpp4
-rw-r--r--quacker/configpages.h1
-rw-r--r--quacker/graphicalboard.cpp2
-rw-r--r--quacker/graphicalreporter.cpp2
-rw-r--r--quacker/letterbox.cpp9
-rw-r--r--quacker/lister.cpp2
-rw-r--r--quacker/quacker.cpp71
-rw-r--r--quacker/quacker.plist4
-rw-r--r--quacker/quacker.pro2
-rw-r--r--quacker/quackersettings.cpp2
13 files changed, 100 insertions, 46 deletions
diff --git a/quacker/Info.plist b/quacker/Info.plist
index 854c8a9..29cb164 100644
--- a/quacker/Info.plist
+++ b/quacker/Info.plist
@@ -26,7 +26,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>1.0</string>
+ <string>1.0.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
diff --git a/quacker/boarddisplay.cpp b/quacker/boarddisplay.cpp
index e2d7056..d8b2a8d 100644
--- a/quacker/boarddisplay.cpp
+++ b/quacker/boarddisplay.cpp
@@ -39,8 +39,9 @@ BoardWithQuickEntry::BoardWithQuickEntry(QWidget *parent)
m_vlayout = new QVBoxLayout(this);
Geometry::setupInnerLayout(m_vlayout);
- m_lineEdit = new QLineEdit;
+ m_lineEdit = new QLineEditWithShiftReturn;
connect(m_lineEdit, SIGNAL(returnPressed()), this, SLOT(quickEditReturnPressed()));
+ connect(m_lineEdit, SIGNAL(shiftReturnPressed()), this, SLOT(quickEditShiftReturnPressed()));
QLabel *placeLabel = new QLabel(tr("Move: '<position> <word>' or 'exchange <tiles|number>'"));
placeLabel->setBuddy(m_lineEdit);
@@ -103,6 +104,13 @@ void BoardWithQuickEntry::quickEditReturnPressed()
m_lineEdit->clear();
}
+void BoardWithQuickEntry::quickEditShiftReturnPressed()
+{
+ quickEditReturnPressed();
+ performCommit();
+ m_lineEdit->setFocus();
+}
+
void BoardWithQuickEntry::plusFive()
{
m_localCandidateMove.setScoreAddition(m_localCandidateMove.scoreAddition() + 5);
@@ -177,7 +185,7 @@ void BoardWithQuickEntry::processCommand(const QString &command)
if (isPass)
move = Quackle::Move::createPassMove();
else
- move = Quackle::Move::createExchangeMove(encodedLetters);
+ move = Quackle::Move::createExchangeMove(encodedLetters, isIntConvertable);
}
else
{
@@ -224,3 +232,19 @@ void TextBoard::positionChanged(const Quackle::GamePosition &position)
//m_textEdit->setHtml(QString("<html><font size=\"+4\"><pre>%1</pre></font></html>").arg(QuackleIO::Util::uvStringToQString(position.boardAfterMoveMade().toString())));
m_textEdit->setPlainText(QString("%1").arg(QuackleIO::Util::uvStringToQString(position.boardAfterMoveMade().toString())));
}
+
+///////////
+
+void QLineEditWithShiftReturn::keyPressEvent(QKeyEvent * e)
+{
+ if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter)
+ {
+ if (e->modifiers() & Qt::ShiftModifier)
+ {
+ emit shiftReturnPressed();
+ return;
+ }
+ }
+ QLineEdit::keyPressEvent(e);
+}
+
diff --git a/quacker/boarddisplay.h b/quacker/boarddisplay.h
index 35ebcb7..fbb71c1 100644
--- a/quacker/boarddisplay.h
+++ b/quacker/boarddisplay.h
@@ -22,8 +22,10 @@
#include <move.h>
#include "view.h"
+#include <QLineEdit>
class QLineEdit;
+class QLineEditWithShiftReturn;
class QPushButton;
class QTextEdit;
class QVBoxLayout;
@@ -49,6 +51,7 @@ protected slots:
private slots:
void quickEditReturnPressed();
+ void quickEditShiftReturnPressed();
void plusFive();
void performCommit();
void reset();
@@ -60,7 +63,7 @@ protected:
QVBoxLayout *m_vlayout;
private:
- QLineEdit *m_lineEdit;
+ QLineEditWithShiftReturn *m_lineEdit;
QPushButton *m_commitButton;
Quackle::Move m_localCandidateMove;
};
@@ -79,4 +82,16 @@ private:
QTextEdit *m_textEdit;
};
+class QLineEditWithShiftReturn : public QLineEdit
+{
+Q_OBJECT
+
+signals:
+ void shiftReturnPressed();
+
+public:
+ virtual void keyPressEvent(QKeyEvent * e);
+};
+
+
#endif
diff --git a/quacker/configpages.cpp b/quacker/configpages.cpp
index 7cd0083..a424c15 100644
--- a/quacker/configpages.cpp
+++ b/quacker/configpages.cpp
@@ -103,10 +103,12 @@ InterfacePage::InterfacePage(QWidget *parent)
QGroupBox *miscellanyGroup = new QGroupBox(tr("Miscellany"));
m_vowelFirstCheck = new QCheckBox(tr("&Vowel-first alphabetizing"));
m_octothorpCheck = new QCheckBox(tr("&Octothorp British words"));
+ m_scoreInvalidAsZero = new QCheckBox(tr("&Score 0 for plays with illegal words"));
QGridLayout *miscellanyLayout = new QGridLayout;
miscellanyLayout->addWidget(m_vowelFirstCheck, 0, 0);
miscellanyLayout->addWidget(m_octothorpCheck, 1, 0);
+ miscellanyLayout->addWidget(m_scoreInvalidAsZero, 2, 0);
miscellanyGroup->setLayout(miscellanyLayout);
QVBoxLayout *mainLayout = new QVBoxLayout;
@@ -123,6 +125,7 @@ void InterfacePage::readConfig()
m_verboseLabelsCheck->setChecked(QuackerSettings::self()->verboseLabels);
m_scoreLabelsCheck->setChecked(QuackerSettings::self()->scoreLabels);
m_octothorpCheck->setChecked(QuackleIO::UtilSettings::self()->octothorpBritish);
+ m_scoreInvalidAsZero->setChecked(QuackleIO::UtilSettings::self()->scoreInvalidAsZero);
}
void InterfacePage::writeConfig()
@@ -132,5 +135,6 @@ void InterfacePage::writeConfig()
QuackerSettings::self()->verboseLabels = m_verboseLabelsCheck->isChecked();
QuackerSettings::self()->scoreLabels = m_scoreLabelsCheck->isChecked();
QuackleIO::UtilSettings::self()->octothorpBritish = m_octothorpCheck->isChecked();
+ QuackleIO::UtilSettings::self()->scoreInvalidAsZero = m_scoreInvalidAsZero->isChecked();
}
diff --git a/quacker/configpages.h b/quacker/configpages.h
index 6d02ec0..6b61375 100644
--- a/quacker/configpages.h
+++ b/quacker/configpages.h
@@ -52,6 +52,7 @@ private:
QCheckBox *m_verboseLabelsCheck;
QCheckBox *m_scoreLabelsCheck;
QCheckBox *m_octothorpCheck;
+ QCheckBox *m_scoreInvalidAsZero;
QComboBox *m_britishColoringCombo;
};
diff --git a/quacker/graphicalboard.cpp b/quacker/graphicalboard.cpp
index 71a29c6..37db686 100644
--- a/quacker/graphicalboard.cpp
+++ b/quacker/graphicalboard.cpp
@@ -327,7 +327,7 @@ QPoint GraphicalBoardFrame::coordinatesOfMark(const QSize &loc)
void GraphicalBoardFrame::drawMove(const Quackle::Move &move)
{
- if (move.action == Quackle::Move::Place)
+ if (move.action == Quackle::Move::Place || move.action == Quackle::Move::PlaceError)
{
if (move.tiles().empty())
return;
diff --git a/quacker/graphicalreporter.cpp b/quacker/graphicalreporter.cpp
index 8b95536..39e74ef 100644
--- a/quacker/graphicalreporter.cpp
+++ b/quacker/graphicalreporter.cpp
@@ -161,6 +161,7 @@ void GraphicalReporter::reportPosition(const Quackle::GamePosition &position, Qu
switch ((*it).action)
{
case Quackle::Move::Place:
+ case Quackle::Move::PlaceError:
{
if (m_generateImages)
{
@@ -193,6 +194,7 @@ void GraphicalReporter::reportPosition(const Quackle::GamePosition &position, Qu
}
case Quackle::Move::Exchange:
+ case Quackle::Move::BlindExchange:
default:
item = QuackleIO::Util::moveToDetailedString(*it);
break;
diff --git a/quacker/letterbox.cpp b/quacker/letterbox.cpp
index 8834b61..492f24d 100644
--- a/quacker/letterbox.cpp
+++ b/quacker/letterbox.cpp
@@ -241,6 +241,7 @@ void Letterbox::loadFile()
QTextStream stream(&file);
QString line;
+ stream.setCodec(QTextCodec::codecForName("UTF-8"));
m_initializationChuu = true;
@@ -526,6 +527,7 @@ void Letterbox::outputResults()
}
QTextStream stream(&file);
+ stream.setCodec(QTextCodec::codecForName("UTF-8"));
if (m_numberIterator < m_clueResults.count())
stream << "\" Resume: " << m_numberIterator << "\n";
@@ -562,6 +564,7 @@ void Letterbox::outputResults()
}
QTextStream stream(&missesFile);
+ stream.setCodec(QTextCodec::codecForName("UTF-8"));
for (ClueResultList::iterator it = m_clueResults.begin(); it != m_clueResults.end(); ++it)
{
@@ -927,6 +930,7 @@ void Letterbox::print()
setModified(wasModified);
QTextStream stream(&file);
+ stream.setCodec(QTextCodec::codecForName("UTF-8"));
stream << printer.html() << "\n";
file.close();
@@ -957,6 +961,7 @@ void Letterbox::printStudy()
jumpTo(m_clueResults.size() - 1);
QTextStream stream(&file);
+ stream.setCodec(QTextCodec::codecForName("UTF-8"));
stream << generateStudySheet(m_answers.begin(), m_answers.end()) << "\n";
file.close();
@@ -1178,7 +1183,9 @@ void HTMLRepresentation::setHTML(const QString &text, ContentType type)
QString HTMLRepresentation::html()
{
- return m_html;
+ return QString("<html>\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n</head>\n<body>") +
+ m_html +
+ QString("</body></html>");
}
void HTMLRepresentation::setWords(ClueResultList::ConstIterator start, ClueResultList::ConstIterator end, bool revers)
diff --git a/quacker/lister.cpp b/quacker/lister.cpp
index 87ee9a6..316ac49 100644
--- a/quacker/lister.cpp
+++ b/quacker/lister.cpp
@@ -242,6 +242,7 @@ void ListerDialog::openFile()
if (file.open(QIODevice::ReadOnly | QIODevice::Text))
{
QTextStream stream(&file);
+ stream.setCodec(QTextCodec::codecForName("UTF-8"));
QString line;
while (!stream.atEnd())
{
@@ -439,6 +440,7 @@ QString ListerDialog::writeList(bool alphagrams)
}
QTextStream stream(&file);
+ stream.setCodec(QTextCodec::codecForName("UTF-8"));
QMap<QString, Dict::WordList> map(anagramMap());
diff --git a/quacker/quacker.cpp b/quacker/quacker.cpp
index d979256..f7cc336 100644
--- a/quacker/quacker.cpp
+++ b/quacker/quacker.cpp
@@ -215,36 +215,6 @@ void TopLevel::commit()
return;
}
- const bool askSillyQuestion = false;
-
- if (askSillyQuestion)
- {
- if (!(m_game->currentPosition().location() == m_game->history().lastLocation()))
- {
- int result = QMessageBox::warning(this, tr("Previous Position Commit - Quackle"), dialogText(tr("You've asked to commit a move from a previous position. You have three options: <ol><li>Commit and resume the game from directly after this position. This throws away all later positions.</li><li>Commit and leave later moves the same. This is risky because scores and board position of all later moves might become inconsistent. You'll need to save the game and reopen it to have the scores make sense.</li><li>Cancel this commit. <b>Canceling is recommended.</b></li></ol>Which would you like to do?")), tr("&Commit and resume from after this position"), tr("&Commit and leave later moves the same"), tr("&Cancel"), 0, 2);
-
- switch (result)
- {
- case 0:
- // Commit and resume after this position.
- // We can just pass back to the normal commit method.
- break;
-
- case 1:
- // commit silently
- m_game->currentPosition().prepareForCommit();
- setModified(true);
- showToHuman();
- return;
-
- case 2:
- default:
- // cancel
- return;
- }
- }
- }
-
if (m_game->candidate().isAMove())
{
stopEverything();
@@ -325,6 +295,7 @@ void TopLevel::setCandidateMove(const Quackle::Move &move)
}
else
{
+ bool playHasIllegalWords = false;
int validityFlags = m_game->currentPosition().validateMove(prettiedMove);
bool carryOn = true;
@@ -353,7 +324,16 @@ void TopLevel::setCandidateMove(const Quackle::Move &move)
}
else
{
- carryOn = askToCarryOn(tr("%1's rack does not include all tiles in %2; make play anyway?").arg(QuackleIO::Util::uvStringToQString(m_game->currentPosition().currentPlayer().name())).arg(QuackleIO::Util::moveToDetailedString(prettiedMove)));
+ QMessageBox mb(QMessageBox::Question, tr("Verify Play"),
+ tr("%1's rack does not include all tiles in %2; make play anyway?").arg(QuackleIO::Util::uvStringToQString(m_game->currentPosition().currentPlayer().name())).arg(QuackleIO::Util::moveToDetailedString(prettiedMove)));
+ QPushButton* mb_yes = mb.addButton(QMessageBox::Yes);
+ mb.addButton(QMessageBox::No);
+ QPushButton* mb_unknownRacks = mb.addButton(tr("Assume unknown racks for this game"), QMessageBox::ApplyRole);
+ mb.exec();
+ if (mb.clickedButton() == mb_yes || mb.clickedButton() == mb_unknownRacks)
+ carryOn = true;
+ if (mb.clickedButton() == mb_unknownRacks)
+ m_game->currentPosition().currentPlayer().setRacksAreKnown(false);
}
validityFlags ^= Quackle::GamePosition::InvalidTiles;
@@ -384,6 +364,8 @@ void TopLevel::setCandidateMove(const Quackle::Move &move)
{
prettiedMove.setIsChallengedPhoney(true);
}
+ else
+ playHasIllegalWords = true;
}
validityFlags ^= Quackle::GamePosition::UnacceptableWord;
@@ -401,13 +383,18 @@ void TopLevel::setCandidateMove(const Quackle::Move &move)
if (!carryOn)
return;
- m_game->currentPosition().scoreMove(prettiedMove);
+ if (playHasIllegalWords && QuackleIO::UtilSettings::self()->scoreInvalidAsZero)
+ prettiedMove.score = 0;
+ else
+ m_game->currentPosition().scoreMove(prettiedMove);
m_game->currentPosition().addAndSetMoveMade(prettiedMove);
switchToTab(ChoicesTabIndex);
ensureUpToDateSimulatorMoveList();
}
- if (!m_game->currentPosition().currentPlayer().racksAreKnown() && !m_game->currentPosition().currentPlayer().rack().contains(prettiedMove.usedTiles()))
+ if (!m_game->currentPosition().currentPlayer().racksAreKnown() &&
+ !m_game->currentPosition().currentPlayer().rack().contains(prettiedMove.usedTiles()) &&
+ prettiedMove.action != Quackle::Move::BlindExchange)
{
m_game->currentPosition().setCurrentPlayerRack(Quackle::Rack(prettiedMove.usedTiles()));
}
@@ -797,7 +784,14 @@ void TopLevel::setCaption(const QString &text)
if (!text.isNull())
m_ourCaption = text;
- setWindowTitle(QString("%1[*] - Quackle").arg(m_ourCaption));
+ if (m_filename.isEmpty())
+ setWindowTitle(QString("%1 - Quackle").arg(m_ourCaption));
+ else
+ {
+ QString filename = QDir::fromNativeSeparators(m_filename);
+ filename = filename.mid(filename.lastIndexOf('/') + 1);
+ setWindowTitle(QString("%1[*] - %2 - Quackle").arg(filename, m_ourCaption));
+ }
}
void TopLevel::setModified(bool modified)
@@ -1336,6 +1330,7 @@ void TopLevel::reportAs(Quackle::ComputerPlayer *player)
Quackle::ComputerPlayer *clone = player->clone();
QTextStream stream(&file);
+ stream.setCodec(QTextCodec::codecForName("UTF-8"));
QuackleIO::StreamingReporter::reportGame(*m_game, clone, stream);
delete clone;
}
@@ -2094,6 +2089,7 @@ void TopLevel::writeAsciiToFile(const QString &text, const QString &filename)
}
QTextStream stream(&file);
+ stream.setCodec(QTextCodec::codecForName("UTF-8"));
stream << text << "\n";
file.close();
@@ -2119,6 +2115,7 @@ void TopLevel::print()
}
QTextStream stream(&file);
+ stream.setCodec(QTextCodec::codecForName("UTF-8"));
//stream << printer.html() << "\n";
file.close();
@@ -2135,9 +2132,9 @@ void TopLevel::firstTimeRun()
void TopLevel::about()
{
QString aboutText = tr(
-"<p><b>Quackle</b> 1.0.1 is a crossword game playing, analysis, and study tool. Visit the Quackle homepage at <tt><a href=\"http://quackle.org\">http://quackle.org</a></tt> for more information.</p>"
+"<p><b>Quackle</b> 1.0.3 is a crossword game playing, analysis, and study tool. Visit the Quackle homepage at <tt><a href=\"http://quackle.org\">http://quackle.org</a></tt> for more information.</p>"
"<p>Quackle was written by Jason Katz-Brown, John O'Laughlin, John Fultz, Matt Liberty, and Anand Buddhdev. We thank the anonymous donor who made this software free.</p>"
-"<p>Copyright 2005-2015 by</p>"
+"<p>Copyright 2005-2016 by</p>"
"<ul>"
"<li>Jason Katz-Brown &lt;jasonkatzbrown@gmail.com&gt;</li>"
"<li>John O'Laughlin &lt;olaughlin@gmail.com&gt;</li>"
@@ -2163,7 +2160,7 @@ void TopLevel::about()
fclose(file);
aboutText += "</ul>";
}
- QMessageBox::about(this, tr("About Quackle 1.0.1"), dialogText(aboutText));
+ QMessageBox::about(this, tr("About Quackle 1.0.3"), dialogText(aboutText));
}
void TopLevel::hints()
diff --git a/quacker/quacker.plist b/quacker/quacker.plist
index eef0ac9..3969d54 100644
--- a/quacker/quacker.plist
+++ b/quacker/quacker.plist
@@ -13,7 +13,7 @@
<key>CFBundleName</key>
<string>Quackle</string>
<key>CFBundleShortVersionString</key>
- <string>1.0.0</string>
+ <string>1.0.3</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>LSApplicationCategoryType</key>
@@ -21,6 +21,6 @@
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHumanReadableCopyright</key>
- <string>Copyright &copy; 2005-2015 by Jason Katz-Brown & John O'Laughlin</string>
+ <string>Copyright &copy; 2005-2016 by Jason Katz-Brown & John O'Laughlin</string>
</dict>
</plist>
diff --git a/quacker/quacker.pro b/quacker/quacker.pro
index dcf2954..7bc5a6d 100644
--- a/quacker/quacker.pro
+++ b/quacker/quacker.pro
@@ -1,5 +1,5 @@
TEMPLATE = app
-VERSION = 1.0.1
+VERSION = 1.0.3
TARGET = Quackle
DEPENDPATH += .. ../quackleio
INCLUDEPATH += . ..
diff --git a/quacker/quackersettings.cpp b/quacker/quackersettings.cpp
index 1889848..510e43a 100644
--- a/quacker/quackersettings.cpp
+++ b/quacker/quackersettings.cpp
@@ -45,6 +45,7 @@ void QuackerSettings::readSettings()
scoreLabels = settings.value("quackle/settings/score-labels", scoreLabels).toBool();
QuackleIO::UtilSettings::self()->vowelFirst = settings.value("quackle/settings/vowel-first", QuackleIO::UtilSettings::self()->vowelFirst).toBool();
QuackleIO::UtilSettings::self()->octothorpBritish = settings.value("quackle/settings/octothorp-british", QuackleIO::UtilSettings::self()->octothorpBritish).toBool();
+ QuackleIO::UtilSettings::self()->scoreInvalidAsZero = settings.value("quackle/settings/score-invalid-as-zero", QuackleIO::UtilSettings::self()->scoreInvalidAsZero).toBool();
m_letterboxSettings.readSettings();
}
@@ -57,6 +58,7 @@ void QuackerSettings::writeSettings()
settings.setValue("quackle/settings/score-labels", scoreLabels);
settings.setValue("quackle/settings/vowel-first", QuackleIO::UtilSettings::self()->vowelFirst);
settings.setValue("quackle/settings/octothorp-british", QuackleIO::UtilSettings::self()->octothorpBritish);
+ settings.setValue("quackle/settings/score-invalid-as-zero", QuackleIO::UtilSettings::self()->scoreInvalidAsZero);
m_letterboxSettings.writeSettings();
}