Removed the now useless preference about the default AI level

This commit is contained in:
Olivier Teulière 2012-04-27 20:21:58 +02:00
parent eaf536b3ba
commit f83b397549
5 changed files with 15 additions and 64 deletions

View file

@ -313,15 +313,6 @@ void MainWindow::prefsUpdated()
// Refresh one signal/slot connection
linkArbitrationAnd7P1();
// XXX: is this preference still useful?
#if 0
// Refresh the default level for the Eliot player
if (m_newGameDialog != NULL)
{
m_newGameDialog->refresh();
}
#endif
// Refresh the timer values
QSettings qs;
int timerTotal = qs.value(PrefsDialog::kINTF_TIMER_TOTAL_DURATION).toInt();

View file

@ -67,15 +67,6 @@ NewGame::NewGame(QWidget *iParent)
this, SLOT(addSelectedToFav()));
m_helper->addPopupAction(addToFavAction);
// Retrieve the default computer level
QSettings qs;
int defLevel = qs.value(PrefsDialog::kINTF_DEFAULT_AI_LEVEL, 100).toInt();
// Ensure a valid range
if (defLevel < 0)
defLevel = 0;
if (defLevel > 100)
defLevel = 100;
// Initialize the model of the default players
QList<PlayerDef> fav = PlayersTableHelper::getFavPlayers();
Q_FOREACH(const PlayerDef &def, fav)
@ -88,7 +79,7 @@ NewGame::NewGame(QWidget *iParent)
if (m_helper->getRowCount() == 0)
{
m_helper->addPlayer(PlayerDef(_q("Player %1").arg(1), _q(kHUMAN), "", false));
m_helper->addPlayer(PlayerDef(_q("Eliot"), _q(kAI), QString("%1").arg(defLevel), false));
m_helper->addPlayer(PlayerDef(_q("Eliot"), _q(kAI), "100", false));
}
// Enable the Ok button only if there are enough players for the

View file

@ -41,7 +41,6 @@ const QString PrefsDialog::kINTF_DEFINITIONS_SITE_URL = "Interface/DefinitionsSi
const QString PrefsDialog::kINTF_SHOW_TILES_POINTS = "Interface/ShowTilesPoints";
const QString PrefsDialog::kINTF_WARN_REPLAY_TURN = "Interface/WarnReplayTurn";
const QString PrefsDialog::kINTF_SHOW_TOOLBAR = "Interface/ShowToolBar";
const QString PrefsDialog::kINTF_DEFAULT_AI_LEVEL = "Interface/DefaultAiLevel";
const QString PrefsDialog::kINTF_TIMER_TOTAL_DURATION = "Interface/TimerTotalDuration";
const QString PrefsDialog::kINTF_TIMER_ALERT_DURATION = "Interface/TimerAlertDuration";
const QString PrefsDialog::kINTF_TIMER_BEEPS = "Interface/TimerBeeps";
@ -59,9 +58,6 @@ PrefsDialog::PrefsDialog(QWidget *iParent)
"\thttp://fr.wiktionary.org/wiki/%w\n"
"\thttp://en.wiktionary.org/wiki/%w\n"
"\thttp://images.google.com/images?q=%w"));
spinBoxDefaultLevel->setToolTip(_q("Default level for Eliot, "
"used when creating a new game.\n"
"Accepted range: [0-100]"));
spinBoxTimerTotal->setToolTip(_q("Total duration of the timer, in seconds.\n"
"Changing this value will reset the timer."));
spinBoxTimerAlert->setToolTip(_q("Number of remaining seconds when an alert is triggered.\n"
@ -99,8 +95,6 @@ PrefsDialog::PrefsDialog(QWidget *iParent)
checkBoxIntfShowPoints->setChecked(showPoints);
bool warnReplayTurn = qs.value(kINTF_WARN_REPLAY_TURN, true).toBool();
checkBoxIntfWarnReplayTurn->setChecked(warnReplayTurn);
int defaultAiLevel = qs.value(kINTF_DEFAULT_AI_LEVEL, 100).toInt();
spinBoxDefaultLevel->setValue(defaultAiLevel);
int timerTotal = qs.value(kINTF_TIMER_TOTAL_DURATION, 180).toInt();
spinBoxTimerTotal->setValue(timerTotal);
int timerAlert = qs.value(kINTF_TIMER_ALERT_DURATION, 30).toInt();
@ -175,12 +169,6 @@ void PrefsDialog::updateSettings()
qs.setValue(kINTF_SHOW_TILES_POINTS, checkBoxIntfShowPoints->isChecked());
}
qs.setValue(kINTF_WARN_REPLAY_TURN, checkBoxIntfWarnReplayTurn->isChecked());
if (qs.value(kINTF_DEFAULT_AI_LEVEL, 100).toInt() != spinBoxDefaultLevel->value())
{
// We need to change the default AI level
shouldEmitUpdate = true;
qs.setValue(kINTF_DEFAULT_AI_LEVEL, spinBoxDefaultLevel->value());
}
if (qs.value(kINTF_TIMER_TOTAL_DURATION, 180).toInt() != spinBoxTimerTotal->value())
{
// We need to change the default AI level

View file

@ -44,7 +44,6 @@ public:
static const QString kINTF_SHOW_TILES_POINTS;
static const QString kINTF_WARN_REPLAY_TURN;
static const QString kINTF_SHOW_TOOLBAR;
static const QString kINTF_DEFAULT_AI_LEVEL;
static const QString kINTF_TIMER_TOTAL_DURATION;
static const QString kINTF_TIMER_ALERT_DURATION;
static const QString kINTF_TIMER_BEEPS;

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>443</width>
<height>817</height>
<height>784</height>
</rect>
</property>
<property name="windowTitle">
@ -123,36 +123,6 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>_(&quot;Default computer level:&quot;)</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="spinBoxDefaultLevel">
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="spinBoxTimerTotal">
<property name="maximum">
@ -183,6 +153,19 @@
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
@ -428,7 +411,6 @@
<tabstop>checkBoxIntfShowPoints</tabstop>
<tabstop>checkBoxIntfAlignHistory</tabstop>
<tabstop>checkBoxIntfWarnReplayTurn</tabstop>
<tabstop>spinBoxDefaultLevel</tabstop>
<tabstop>spinBoxTimerTotal</tabstop>
<tabstop>spinBoxTimerAlert</tabstop>
<tabstop>checkBoxDuplRefuseInvalid</tabstop>