diff options
-rw-r--r-- | data/lexica/copyrights.txt | 4 | ||||
-rw-r--r-- | data/lexica/naspa.gif | bin | 0 -> 3802 bytes | |||
-rw-r--r-- | lexiconparameters.cpp | 19 | ||||
-rw-r--r-- | lexiconparameters.h | 4 | ||||
-rw-r--r-- | quacker/quacker.cpp | 11 | ||||
-rw-r--r-- | quacker/settings.cpp | 21 | ||||
-rw-r--r-- | quacker/settings.h | 2 |
7 files changed, 51 insertions, 10 deletions
diff --git a/data/lexica/copyrights.txt b/data/lexica/copyrights.txt index 01c0c0e..bdfa56a 100644 --- a/data/lexica/copyrights.txt +++ b/data/lexica/copyrights.txt @@ -3,6 +3,6 @@ eea8dfe5:Collins Scrabble™ Words 2012, ©HarperCollins Publishers Ltd 2015 0109ce12:Official Tournament and Club Word List 2014 Edition (OTCWL2014), Copyright © 2014 Hasbro, Inc. Published under license with Merriam-Webster, Incorporated. 9ea8d964:Official Tournament and Club Word List 2016 Edition (OTCWL2016), Copyright © 2016 Hasbro, Inc. Published under license with Merriam-Webster, Incorporated. 5a728cf0:School Scrabble Word List 2016 Edition (SSWL2016), Copyright © 2016 Hasbro, Inc. Published under license with Merriam-Webster, Incorporated. -41da74af:NASPA Word List 2018 (NWL2018), Copyright © 2019 North American SCRABBLE Players Association. -de591703:NASPA School Word List 2018 (NSWL2018), Copyright © 2019 North American SCRABBLE Players Association. +41da74af:NASPA Word List 2018 (NWL2018), Copyright © 2019 North American SCRABBLE Players Association.:naspa.gif +de591703:NASPA School Word List 2018 (NSWL2018), Copyright © 2019 North American SCRABBLE Players Association.:naspa.gif d5aeccff:ODS7 diff --git a/data/lexica/naspa.gif b/data/lexica/naspa.gif Binary files differnew file mode 100644 index 0000000..1a69ad6 --- /dev/null +++ b/data/lexica/naspa.gif diff --git a/lexiconparameters.cpp b/lexiconparameters.cpp index 130804f..17910de 100644 --- a/lexiconparameters.cpp +++ b/lexiconparameters.cpp @@ -242,7 +242,7 @@ string LexiconParameters::hashString(bool shortened) const return hashStr; } -string LexiconParameters::copyrightString() const +string LexiconParameters::getLexiconCopyrightLine() const { string copyrightsFilename = QUACKLE_DATAMANAGER->makeDataFilename("lexica", "copyrights.txt", false); fstream copyrightsFile(copyrightsFilename, ios_base::in); @@ -254,10 +254,25 @@ string LexiconParameters::copyrightString() const continue; if (hashString(true).compare(line.substr(0,8)) != 0) continue; - return line.substr(9, line.size()); + return line.substr(9); } return string(); } +string LexiconParameters::copyrightString() const +{ + string copyrightLine = getLexiconCopyrightLine(); + size_t colonPos = min(copyrightLine.size(), copyrightLine.find_last_of(':')); + return copyrightLine.substr(0, colonPos); +} + +string LexiconParameters::logoFileName() const +{ + string copyrightLine = getLexiconCopyrightLine(); + size_t colonPos = copyrightLine.find_last_of(':'); + if (colonPos == string::npos) + return string(); + return QUACKLE_DATAMANAGER->makeDataFilename("lexica", copyrightLine.substr(colonPos + 1), false); +} LexiconInterpreter* LexiconParameters::createInterpreter(char version) const { diff --git a/lexiconparameters.h b/lexiconparameters.h index 7ba6fc2..3d1ac19 100644 --- a/lexiconparameters.h +++ b/lexiconparameters.h @@ -82,6 +82,7 @@ public: string hashString(bool shortened) const; string copyrightString() const; + string logoFileName() const; const vector<string> &utf8Alphabet() const { return m_utf8Alphabet; }; protected: @@ -93,6 +94,9 @@ protected: vector<string> m_utf8Alphabet; LexiconInterpreter* createInterpreter(char version) const; + +private: + string getLexiconCopyrightLine() const; }; } diff --git a/quacker/quacker.cpp b/quacker/quacker.cpp index 9bc252d..4498900 100644 --- a/quacker/quacker.cpp +++ b/quacker/quacker.cpp @@ -2164,9 +2164,14 @@ void TopLevel::about() QString line = strm.readLine(); while (!line.isNull()) { - int pos = line.indexOf(':'); - if (pos != -1 && pos + 1 < line.size()) - aboutText += "<li>" + line.mid(pos + 1) + "</li>"; + int startPos = line.indexOf(':'); + if (startPos != -1 && startPos + 1 < line.size()) + { + line = line.mid(startPos + 1); + int endPos = line.indexOf(':'); + line = line.mid(0, endPos); + aboutText += "<li>" + line + "</li>"; + } line = strm.readLine(); } fclose(file); diff --git a/quacker/settings.cpp b/quacker/settings.cpp index 53bb269..bb26dfc 100644 --- a/quacker/settings.cpp +++ b/quacker/settings.cpp @@ -100,6 +100,10 @@ void Settings::createGUI() return; QGridLayout *layout = new QGridLayout(this); + QMargins margins = layout->contentsMargins(); + margins.setBottom(0); // let logo image flow off of bottom + layout->setContentsMargins(margins); + layout->setVerticalSpacing(2); m_lexiconNameCombo = new QComboBox; connect(m_lexiconNameCombo, SIGNAL(activated(const QString &)), this, SLOT(lexiconChanged(const QString &))); @@ -150,8 +154,12 @@ void Settings::createGUI() m_buildGaddagLabel = new QLabel(); m_buildGaddagLabel->setWordWrap(true); + m_logoLabel = new QLabel(); + m_logoLabel->setAlignment(Qt::AlignTop | Qt::AlignHCenter); m_copyrightLabel = new QLabel(); m_copyrightLabel->setWordWrap(true); + m_separatorLabel = new QLabel(); + m_separatorLabel->setFrameStyle(QFrame::HLine | QFrame::Sunken); layout->addWidget(lexiconNameLabel, 0, 0, Qt::AlignRight); layout->addWidget(m_lexiconNameCombo, 0, 1); @@ -167,12 +175,13 @@ void Settings::createGUI() layout->addWidget(m_editBoard, 3, 2); layout->addWidget(m_buildGaddag, 4, 1); layout->addWidget(m_buildGaddagLabel, 5, 1); - layout->addWidget(m_copyrightLabel, 6, 0, 1, -1, Qt::AlignTop); + layout->addWidget(m_separatorLabel, 6, 0, 1, -1); + layout->addWidget(m_copyrightLabel, 7, 0, 1, -1, Qt::AlignTop); + layout->addWidget(m_logoLabel, 8, 0, 1, -1, Qt::AlignTop | Qt::AlignHCenter); layout->setColumnMinimumWidth(3, 0); layout->setColumnStretch(3, 1); - layout->setRowMinimumHeight(6, 0); - layout->setRowStretch(6, 1); + layout->setRowStretch(8, 1); load(); @@ -188,6 +197,7 @@ void Settings::load() m_themeNameCombo->setCurrentIndex(m_themeNameCombo->findText(m_themeName)); m_boardNameCombo->setCurrentIndex(m_boardNameCombo->findText(QuackleIO::Util::uvStringToQString(QUACKLE_BOARD_PARAMETERS->name()))); m_lastGoodBoardValue = m_boardNameCombo->currentIndex(); + //m_logoLabel->setPixmap(QPixmap()); m_copyrightLabel->setText(QString::fromUtf8(QUACKLE_LEXICON_PARAMETERS->copyrightString().c_str())); setGaddagLabel(); } @@ -348,6 +358,11 @@ void Settings::setQuackleToUseLexiconName(const QString &lexiconName) QUACKLE_DATAMANAGER->setBackupLexicon("default_english"); } QUACKLE_STRATEGY_PARAMETERS->initialize(lexiconNameStr); + string logoFileName = QUACKLE_LEXICON_PARAMETERS->logoFileName(); + if (logoFileName.empty()) + m_logoLabel->setPixmap(QPixmap()); + else + m_logoLabel->setPixmap(QPixmap(QString(logoFileName.c_str()))); m_copyrightLabel->setText(QString::fromUtf8(QUACKLE_LEXICON_PARAMETERS->copyrightString().c_str())); setGaddagLabel(); } diff --git a/quacker/settings.h b/quacker/settings.h index 3142b88..0171630 100644 --- a/quacker/settings.h +++ b/quacker/settings.h @@ -91,8 +91,10 @@ protected: QPushButton *m_editTheme; QPushButton *m_editBoard; QPushButton *m_buildGaddag; + QLabel *m_logoLabel; QLabel *m_copyrightLabel; QLabel *m_buildGaddagLabel; + QLabel *m_separatorLabel; QString m_appDataDir; QString m_userDataDir; QString m_themeName; |