summaryrefslogtreecommitdiff
path: root/quacker
diff options
context:
space:
mode:
Diffstat (limited to 'quacker')
-rw-r--r--quacker/boardsetupdialog.cpp16
-rw-r--r--quacker/boardsetupdialog.h2
-rw-r--r--quacker/lexicondialog.cpp7
-rw-r--r--quacker/lexicondialog.h2
-rw-r--r--quacker/newgame.cpp2
-rw-r--r--quacker/quacker.cpp5
-rw-r--r--quacker/quacker.h2
-rw-r--r--quacker/settings.cpp38
-rw-r--r--quacker/settings.h11
9 files changed, 51 insertions, 34 deletions
diff --git a/quacker/boardsetupdialog.cpp b/quacker/boardsetupdialog.cpp
index ffdf6a4..33c9f21 100644
--- a/quacker/boardsetupdialog.cpp
+++ b/quacker/boardsetupdialog.cpp
@@ -114,11 +114,11 @@ BoardSetupDialog::BoardSetupDialog(QWidget *parent) : QDialog(parent)
m_saveChanges->setDefault(true);
// hook up signals and slots
- connect(m_horizontalDimension, SIGNAL(activated(const QString &)), this, SLOT(parametersChanged(const QString &)));
- connect(m_horizontalDimension, SIGNAL(activated(const QString &)), this, SLOT(symmetryChanged()));
- connect(m_verticalDimension, SIGNAL(activated(const QString &)), this, SLOT(parametersChanged(const QString &)));
- connect(m_verticalDimension, SIGNAL(activated(const QString &)), this, SLOT(symmetryChanged()));
- connect(m_boardName, SIGNAL(textEdited(const QString &)), this, SLOT(parametersChanged(const QString &)));
+ connect(m_horizontalDimension, SIGNAL(activated(int)), this, SLOT(parametersChanged(int)));
+ connect(m_horizontalDimension, SIGNAL(activated(int)), this, SLOT(symmetryChanged()));
+ connect(m_verticalDimension, SIGNAL(activated(int)), this, SLOT(parametersChanged(int)));
+ connect(m_verticalDimension, SIGNAL(activated(int)), this, SLOT(symmetryChanged()));
+ connect(m_boardName, SIGNAL(textEdited(const QString &)), this, SLOT(parametersChanged(0)));
connect(m_saveChanges, SIGNAL(clicked()), this, SLOT(accept()));
connect(m_cancel, SIGNAL(clicked()), this, SLOT(reject()));
connect(m_undoAll, SIGNAL(clicked()), this, SLOT(undoAllChanges()));
@@ -134,7 +134,7 @@ BoardSetupDialog::BoardSetupDialog(QWidget *parent) : QDialog(parent)
QUACKLE_BOARD_PARAMETERS->Serialize(boardStream);
m_serializedOriginalBoard = boardStream.str();
- parametersChanged(QString());
+ parametersChanged(0);
symmetryChanged();
}
@@ -175,7 +175,7 @@ void BoardSetupDialog::initializeBoardName()
}
}
-void BoardSetupDialog::parametersChanged(const QString &)
+void BoardSetupDialog::parametersChanged(int unused)
{
QUACKLE_BOARD_PARAMETERS->setWidth(m_horizontalDimension->currentIndex() + QUACKLE_MINIMUM_BOARD_SIZE);
QUACKLE_BOARD_PARAMETERS->setHeight(m_verticalDimension->currentIndex() + QUACKLE_MINIMUM_BOARD_SIZE);
@@ -242,7 +242,7 @@ void BoardSetupDialog::undoAllChanges()
istringstream boardStream(m_serializedOriginalBoard);
QUACKLE_DATAMANAGER->setBoardParameters(Quackle::BoardParameters::Deserialize(boardStream));
- parametersChanged(QString());
+ parametersChanged(0);
}
void BoardSetupDialog::deleteBoard()
diff --git a/quacker/boardsetupdialog.h b/quacker/boardsetupdialog.h
index fb9d616..0929b66 100644
--- a/quacker/boardsetupdialog.h
+++ b/quacker/boardsetupdialog.h
@@ -45,7 +45,7 @@ public:
virtual void reject();
protected slots:
- void parametersChanged(const QString &unused);
+ void parametersChanged(int unused);
void symmetryChanged();
void undoAllChanges();
void deleteBoard();
diff --git a/quacker/lexicondialog.cpp b/quacker/lexicondialog.cpp
index e5f6e93..4f6d35d 100644
--- a/quacker/lexicondialog.cpp
+++ b/quacker/lexicondialog.cpp
@@ -113,13 +113,13 @@ LexiconDialog::LexiconDialog(QWidget *parent, const QString &originalName) : QDi
connect(m_saveChanges, SIGNAL(clicked()), this, SLOT(accept()));
connect(m_cancel, SIGNAL(clicked()), this, SLOT(reject()));
connect(m_deleteLexicon, SIGNAL(clicked()), this, SLOT(deleteLexicon()));
- connect(m_alphabetCombo, SIGNAL(activated(const QString &)), this, SLOT(alphabetChanged(const QString &)));
+ connect(m_alphabetCombo, SIGNAL(activated(int)), this, SLOT(alphabetChanged(int)));
setWindowTitle(tr("Configure Lexicon - Quackle"));
Settings::populateComboFromFilenames(m_alphabetCombo, "alphabets", ".quackle_alphabet", "");
m_alphabetCombo->setCurrentIndex(m_alphabetCombo->findText(QuackleIO::Util::stdStringToQString(QUACKLE_ALPHABET_PARAMETERS->alphabetName())));
- alphabetChanged(m_alphabetCombo->currentText());
+ alphabetChanged(m_alphabetCombo->currentIndex());
m_lexiconName->setValidator(m_fileNameValidator);
m_lexiconName->setText(m_originalName);
@@ -163,8 +163,9 @@ void LexiconDialog::addWordsFromFile()
updateLexiconInformation();
}
-void LexiconDialog::alphabetChanged(const QString &alphabet)
+void LexiconDialog::alphabetChanged(int alphabetIndex)
{
+ QString alphabet = m_alphabetCombo->currentText();
delete m_wordFactory;
m_wordFactory = NULL;
updateLexiconInformation();
diff --git a/quacker/lexicondialog.h b/quacker/lexicondialog.h
index 4978539..4e18398 100644
--- a/quacker/lexicondialog.h
+++ b/quacker/lexicondialog.h
@@ -54,7 +54,7 @@ protected slots:
void parametersChanged(const QString &) { updateLexiconInformation(); };
void deleteLexicon();
void addWordsFromFile();
- void alphabetChanged(const QString &);
+ void alphabetChanged(int);
void loadOriginalDictionary();
protected:
diff --git a/quacker/newgame.cpp b/quacker/newgame.cpp
index 1a0b272..380b650 100644
--- a/quacker/newgame.cpp
+++ b/quacker/newgame.cpp
@@ -121,7 +121,7 @@ PlayerTab::PlayerTab(QWidget *parent)
}
m_playerType->addItems(playerTypes);
- connect(m_playerType, SIGNAL(activated(const QString &)), this, SLOT(playerEdited()));
+ connect(m_playerType, SIGNAL(activated(int)), this, SLOT(playerEdited()));
editLayout->addWidget(m_playerType);
QVBoxLayout *topLayout = new QVBoxLayout;
diff --git a/quacker/quacker.cpp b/quacker/quacker.cpp
index 944aaef..e7cc401 100644
--- a/quacker/quacker.cpp
+++ b/quacker/quacker.cpp
@@ -1080,8 +1080,9 @@ void TopLevel::timeout()
UVcout << "toplevel::timeout" << endl;
}
-void TopLevel::pliesSet(const QString &plyString)
+void TopLevel::pliesSet(int plyIndex)
{
+ QString plyString = m_pliesCombo->currentText();
if (plyString == tr("Many"))
m_plies = -1;
else
@@ -1918,7 +1919,7 @@ void TopLevel::createWidgets()
plyOptions.push_back(tr("Many"));
m_pliesCombo->addItems(plyOptions);
- connect(m_pliesCombo, SIGNAL(activated(const QString &)), this, SLOT(pliesSet(const QString &)));
+ connect(m_pliesCombo, SIGNAL(activated(int)), this, SLOT(pliesSet(int)));
QLabel *plyLabel = new QLabel(tr("p&lies"));
plyLabel->setBuddy(m_pliesCombo);
diff --git a/quacker/quacker.h b/quacker/quacker.h
index c33de29..8a81cf4 100644
--- a/quacker/quacker.h
+++ b/quacker/quacker.h
@@ -216,7 +216,7 @@ protected slots:
void updateSimViews();
// simulator settings:
- void pliesSet(const QString &plyString);
+ void pliesSet(int plyIndex);
void ignoreOpposChanged();
void updatePliesCombo();
void logfileEnabled(bool on);
diff --git a/quacker/settings.cpp b/quacker/settings.cpp
index 8b08c76..8442105 100644
--- a/quacker/settings.cpp
+++ b/quacker/settings.cpp
@@ -106,7 +106,7 @@ void Settings::createGUI()
layout->setVerticalSpacing(2);
m_lexiconNameCombo = new QComboBox;
- connect(m_lexiconNameCombo, SIGNAL(activated(const QString &)), this, SLOT(lexiconChanged(const QString &)));
+ connect(m_lexiconNameCombo, SIGNAL(activated(int)), this, SLOT(lexiconChanged(int)));
populateComboFromFilenames(m_lexiconNameCombo, "lexica", ".dawg", "lexicon");
@@ -117,7 +117,7 @@ void Settings::createGUI()
connect(m_editLexicon, SIGNAL(clicked()), this, SLOT(editLexicon()));
m_alphabetNameCombo = new QComboBox;
- connect(m_alphabetNameCombo, SIGNAL(activated(const QString &)), this, SLOT(alphabetChanged(const QString &)));
+ connect(m_alphabetNameCombo, SIGNAL(activated(int)), this, SLOT(alphabetChanged(int)));
populateComboFromFilenames(m_alphabetNameCombo, "alphabets", ".quackle_alphabet", "");
@@ -128,7 +128,7 @@ void Settings::createGUI()
connect(m_editAlphabet, SIGNAL(clicked()), this, SLOT(editAlphabet()));
m_themeNameCombo = new QComboBox;
- connect(m_themeNameCombo, SIGNAL(activated(const QString &)), this, SLOT(themeChanged(const QString &)));
+ connect(m_themeNameCombo, SIGNAL(activated(int)), this, SLOT(themeChanged(int)));
populateComboFromFilenames(m_themeNameCombo, "themes", ".ini", "");
@@ -139,7 +139,7 @@ void Settings::createGUI()
connect(m_editTheme, SIGNAL(clicked()), this, SLOT(editTheme()));
m_boardNameCombo = new QComboBox;
- connect(m_boardNameCombo, SIGNAL(activated(const QString &)), this, SLOT(boardChanged(const QString &)));
+ connect(m_boardNameCombo, SIGNAL(activated(int)), this, SLOT(boardChanged(int)));
populateComboFromFilenames(m_boardNameCombo, "boards", "", "board");
@@ -428,11 +428,8 @@ void Settings::setQuackleToUseBoardName(const QString &boardName)
loadBoardNameCombo();
}
-void Settings::lexiconChanged(const QString &lexiconName)
+void Settings::lexiconChanged(int lexiconIndex)
{
- QString lexicon = lexiconName;
- if (lexicon.endsWith("*"))
- lexicon.truncate(lexicon.size() - 1);
if (m_lexiconNameCombo->currentIndex() == m_lexiconNameCombo->count() - 1)
{
editLexicon();
@@ -441,6 +438,15 @@ void Settings::lexiconChanged(const QString &lexiconName)
m_lexiconNameCombo->setCurrentIndex(m_lastGoodLexiconValue);
return;
}
+ lexiconChanged(m_lexiconNameCombo->currentText());
+}
+
+void Settings::lexiconChanged(const QString &lexiconName)
+{
+ QString lexicon = lexiconName;
+ if (lexicon.endsWith("*"))
+ lexicon.truncate(lexicon.size() - 1);
+
setQuackleToUseLexiconName(lexicon);
m_lastGoodLexiconValue = m_lexiconNameCombo->currentIndex();
@@ -450,7 +456,7 @@ void Settings::lexiconChanged(const QString &lexiconName)
emit refreshViews();
}
-void Settings::alphabetChanged(const QString &alphabetName)
+void Settings::alphabetChanged(int alphabetIndex)
{
// Uncomment when we support an add/edit alphabet dialog
// if (m_alphabetNameCombo->currentIndex() == m_alphabetNameCombo->count() - 1)
@@ -458,6 +464,7 @@ void Settings::alphabetChanged(const QString &alphabetName)
// editAlphabet();
// return;
// }
+ QString alphabetName = m_alphabetNameCombo->currentText();
setQuackleToUseAlphabetName(alphabetName);
CustomQSettings settings;
@@ -466,7 +473,7 @@ void Settings::alphabetChanged(const QString &alphabetName)
emit refreshViews();
}
-void Settings::themeChanged(const QString &themeName)
+void Settings::themeChanged(int themIndex)
{
// Uncomment when we support an add/edit theme dialog
// if (m_themeNameCombo->currentIndex() == m_themeNameCombo->count() - 1)
@@ -474,15 +481,15 @@ void Settings::themeChanged(const QString &themeName)
// editTheme();
// return;
// }
- setQuackleToUseThemeName(themeName);
+ setQuackleToUseThemeName(m_themeNameCombo->currentText());
CustomQSettings settings;
- settings.setValue("quackle/settings/theme-name", themeName);
+ settings.setValue("quackle/settings/theme-name", m_themeNameCombo->currentText());
emit refreshViews();
}
-void Settings::boardChanged(const QString &boardName)
+void Settings::boardChanged(int boardIndex)
{
if (m_boardNameCombo->currentIndex() == m_boardNameCombo->count() - 1)
{
@@ -492,6 +499,11 @@ void Settings::boardChanged(const QString &boardName)
m_boardNameCombo->setCurrentIndex(m_lastGoodBoardValue);
return;
}
+ boardChanged(m_boardNameCombo->currentText());
+}
+
+void Settings::boardChanged(const QString &boardName)
+{
CustomQSettings settings;
settings.setValue("quackle/settings/board-name", boardName);
diff --git a/quacker/settings.h b/quacker/settings.h
index 0171630..e0736c0 100644
--- a/quacker/settings.h
+++ b/quacker/settings.h
@@ -63,10 +63,10 @@ public slots:
void createGUI();
protected slots:
- void lexiconChanged(const QString &lexiconName);
- void alphabetChanged(const QString &alphabetName);
- void themeChanged(const QString &themeName);
- void boardChanged(const QString &boardName);
+ void lexiconChanged(int lexiconIndex);
+ void alphabetChanged(int alphabetIndex);
+ void themeChanged(int themeIndex);
+ void boardChanged(int boardIndex);
void addBoard();
void editBoard();
@@ -107,6 +107,9 @@ private:
void setGaddagLabel(const QString &label);
void pushIndex(GaddagFactory &factory, Quackle::LetterString &word, int index, int &wordCount);
+ void lexiconChanged(const QString &lexiconName);
+ void boardChanged(const QString &boardName);
+
static Settings *m_self;
int m_lastGoodLexiconValue;
int m_lastGoodBoardValue;