summaryrefslogtreecommitdiff
path: root/quacker/settings.cpp
diff options
context:
space:
mode:
authorJohn Fultz <jfultz@wolfram.com>2023-07-15 16:46:26 -0500
committerJohn Fultz <jfultz@wolfram.com>2023-07-16 08:29:07 -0500
commit525f330420d6f3b112dbae36c2fb9769265321a8 (patch)
tree9c89e1b4a3b2ef647577a9320c514caa0e307cb8 /quacker/settings.cpp
parent9fe15e565708b1efbf2dbc6b6f9dd19d89ff29da (diff)
Fix up some Qt signals.
Some of the signals we’re using aren’t supported or working in Qt 6. Refactor for things that are working and documented.
Diffstat (limited to 'quacker/settings.cpp')
-rw-r--r--quacker/settings.cpp38
1 files changed, 25 insertions, 13 deletions
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);