Commit dfafcd6b authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Adding Norway data files thanks to Mikolaj Machowski

BTW Norway is such a crazy country, how can Oslo and Akershus region have the same capital???

svn path=/trunk/kdenonbeta/kgeography/; revision=373811
parent 47f28f5e
2004-12-28 Albert Astals Cid <tsdgeos@terra.es>
* Add Norway map
2004-12-28 Albert Astals Cid <tsdgeos@terra.es>
* Add Poland and Austia map
......
......@@ -4,4 +4,5 @@ kgeographydir = $(kde_datadir)/kgeography/
kgeography_DATA = africa.png europe.png france.png germany.png ncamerica.png \
southamerica.png spain.png usa.png africa.kgm europe.kgm france.kgm \
germany.kgm ncamerica.kgm southamerica.kgm spain.kgm usa.kgm \
italy.png italy.kgm poland.kgm poland.png austria.kgm austria.png
italy.png italy.kgm poland.kgm poland.png austria.kgm austria.png \
norway.kgm norway.png
<map>
<mapFile>norway.png</mapFile>
<name>Norway</name>
<division>
<name>Frontier</name>
<ignore>yes</ignore>
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</division>
<division>
<name>Not Norway</name>
<ignore>yes</ignore>
<color>
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</division>
<division>
<name>Finnmark</name>
<capital>Vadsø</capital>
<color>
<red>241</red>
<green>14</green>
<blue>14</blue>
</color>
</division>
<division>
<name>Troms</name>
<capital>Tromsø</capital>
<color>
<red>14</red>
<green>41</green>
<blue>241</blue>
</color>
</division>
<division>
<name>Nordland</name>
<capital>Bodø</capital>
<color>
<red>14</red>
<green>238</green>
<blue>241</blue>
</color>
</division>
<division>
<name>Nord-Trøndelag</name>
<capital>Steinkjer</capital>
<color>
<red>241</red>
<green>228</green>
<blue>14</blue>
</color>
</division>
<division>
<name>Sør-Trøndelag</name>
<capital>Trondheim</capital>
<color>
<red>241</red>
<green>142</green>
<blue>14</blue>
</color>
</division>
<division>
<name>Møre Og Romsdal</name>
<capital>Molde</capital>
<color>
<red>198</red>
<green>0</green>
<blue>255</blue>
</color>
</division>
<division>
<name>Oppland</name>
<capital>Lillehammer</capital>
<color>
<red>255</red>
<green>255</green>
<blue>0</blue>
</color>
</division>
<division>
<name>Hedmark</name>
<capital>Hamar</capital>
<color>
<red>241</red>
<green>14</green>
<blue>137</blue>
</color>
</division>
<division>
<name>Sogn Og Fjordane</name>
<capital>Hermansverk</capital>
<color>
<red>149</red>
<green>137</green>
<blue>130</blue>
</color>
</division>
<division>
<name>Hordaland</name>
<capital>Bergen</capital>
<color>
<red>45</red>
<green>95</green>
<blue>47</blue>
</color>
</division>
<division>
<name>Rogaland</name>
<capital>Stavenger</capital>
<color>
<red>255</red>
<green>79</green>
<blue>79</blue>
</color>
</division>
<division>
<name>Vest-Agder</name>
<capital>Kristiansand</capital>
<color>
<red>18</red>
<green>235</green>
<blue>29</blue>
</color>
</division>
<division>
<name>Aust-Agder</name>
<capital>Arendal</capital>
<color>
<red>255</red>
<green>186</green>
<blue>0</blue>
</color>
</division>
<division>
<name>Telemark</name>
<capital>Skien</capital>
<color>
<red>189</red>
<green>217</green>
<blue>215</blue>
</color>
</division>
<division>
<name>Buskerud</name>
<capital>Drammen</capital>
<color>
<red>45</red>
<green>48</green>
<blue>95</blue>
</color>
</division>
<division>
<name>Vestfold</name>
<capital>Tønsberg</capital>
<color>
<red>125</red>
<green>172</green>
<blue>57</blue>
</color>
</division>
<division>
<name>Oslo</name>
<capital>Oslo</capital>
<color>
<red>168</red>
<green>223</green>
<blue>255</blue>
</color>
</division>
<division>
<name>Akershus</name>
<capital>Oslo</capital>
<color>
<red>255</red>
<green>102</green>
<blue>0</blue>
</color>
</division>
<division>
<name>Østfold</name>
<capital>Sarpsborg</capital>
<color>
<red>219</red>
<green>185</green>
<blue>228</blue>
</color>
</division>
</map>
......@@ -82,14 +82,14 @@ void boxAsker::nextQuestionHook(const QString &division)
nextBoxAskerQuestionHook(division, p_position, true);
// we put other 3 names
for (i = 0; i < 4; i++)
i = 0;
while (i < 4)
{
otherDivision = p_map -> getRandomDivision();
while (auxList.find(otherDivision) != auxList.end()) otherDivision = p_map -> getRandomDivision();
if (i == p_position) i++;
nextBoxAskerQuestionHook(otherDivision, i, false);
if (i < 4 && nextBoxAskerQuestionHook(otherDivision, i, false)) i++;
auxList << otherDivision;
if (p_position == 3 && i == 2) i++;
}
}
......
......@@ -29,7 +29,7 @@ Q_OBJECT
protected:
void clean();
virtual void cleanHook();
virtual void nextBoxAskerQuestionHook(const QString &division, int i, bool isAnswer) = 0;
virtual bool nextBoxAskerQuestionHook(const QString &division, int i, bool isAnswer) = 0;
void nextQuestionHook(const QString &division);
void setQuestion(const QString &q);
virtual void setAnswerHook(int userSays) = 0;
......
......@@ -20,18 +20,35 @@ capitalDivisionAsker::capitalDivisionAsker(QWidget *parent, KGmap *m, QWidget *w
init();
}
void capitalDivisionAsker::nextBoxAskerQuestionHook(const QString &division, int i, bool isAnswer)
bool capitalDivisionAsker::nextBoxAskerQuestionHook(const QString &division, int i, bool isAnswer)
{
p_rb[i] -> setText(division);
bool b;
if (isAnswer)
{
QString capital;
capital = p_map -> getDivisionCapital(division);
p_currentAnswer.setQuestion(capital);
p_capital = p_map -> getDivisionCapital(division);
p_currentAnswer.setQuestion(p_capital);
p_currentAnswer.setCorrectAnswer(division);
setQuestion(i18n("%1 is the capital of...").arg(capital));
setQuestion(i18n("%1 is the capital of...").arg(p_capital));
p_rb[i] -> setText(division);
b = true;
}
else
{
// There are crazy countries like Norway where two different divisions
// have the same capital, avoid asking
// Oslo is the capital of ...
// Oslo (true)
// Akershus (true)
// Buskerud
// Hedmark
if (p_map -> getDivisionCapital(division) != p_capital)
{
p_rb[i] -> setText(division);
b = true;
}
else b = false;
}
return b;
}
void capitalDivisionAsker::setAnswerHook(int userSays)
......
......@@ -21,9 +21,12 @@ class capitalDivisionAsker : public boxAsker
capitalDivisionAsker(QWidget *parent, KGmap *m, QWidget *w, uint count);
protected:
void nextBoxAskerQuestionHook(const QString &division, int i, bool isAnswer);
bool nextBoxAskerQuestionHook(const QString &division, int i, bool isAnswer);
void setAnswerHook(int userSays);
QString getQuestionHook() const;
private:
QString p_capital;
};
#endif
......@@ -20,15 +20,37 @@ divisionCapitalAsker::divisionCapitalAsker(QWidget *parent, KGmap *m, QWidget *w
init();
}
void divisionCapitalAsker::nextBoxAskerQuestionHook(const QString &division, int i, bool isAnswer)
bool divisionCapitalAsker::nextBoxAskerQuestionHook(const QString &division, int i, bool isAnswer)
{
p_rb[i] -> setText(p_map -> getDivisionCapital(division));
bool b;
if (isAnswer)
{
setQuestion(i18n("The capital of %1 is...").arg(division));
p_currentAnswer.setCorrectAnswer(p_rb[i] -> text());
p_currentAnswer.setQuestion(division);
p_capital = p_map -> getDivisionCapital(division);
p_rb[i] -> setText(p_capital);
b = true;
}
else
{
QString capital;
capital = p_map -> getDivisionCapital(division);
// There are crazy countries like Norway where two different divisions
// have the same capital, avoid asking
// The capital of Akershus is ...
// Oslo (true)
// Oslo (true)
// Lillehammer
// Moss
if (capital != p_capital)
{
p_rb[i] -> setText(capital);
b = true;
}
else b = false;
}
return b;
}
void divisionCapitalAsker::setAnswerHook(int userSays)
......
......@@ -19,9 +19,12 @@ class divisionCapitalAsker : public boxAsker
divisionCapitalAsker(QWidget *parent, KGmap *m, QWidget *w, uint count);
protected:
void nextBoxAskerQuestionHook(const QString &division, int i, bool isAnswer);
bool nextBoxAskerQuestionHook(const QString &division, int i, bool isAnswer);
void setAnswerHook(int userSays);
QString getQuestionHook() const;
private:
QString p_capital;
};
#endif
......@@ -21,7 +21,7 @@ divisionFlagAsker::divisionFlagAsker(QWidget *parent, KGmap *m, QWidget *w, uint
init();
}
void divisionFlagAsker::nextBoxAskerQuestionHook(const QString &division, int i, bool isAnswer)
bool divisionFlagAsker::nextBoxAskerQuestionHook(const QString &division, int i, bool isAnswer)
{
QImage im(p_map -> getDivisionFlagFile(division));
im = im.smoothScale(im.width()/5, im.height()/5);
......@@ -32,6 +32,7 @@ void divisionFlagAsker::nextBoxAskerQuestionHook(const QString &division, int i,
p_currentAnswer.setCorrectAnswer(im);
p_currentAnswer.setQuestion(division);
}
return true;
}
void divisionFlagAsker::setAnswerHook(int userSays)
......
......@@ -19,7 +19,7 @@ class divisionFlagAsker : public boxAsker
divisionFlagAsker(QWidget *parent, KGmap *m, QWidget *w, uint count);
protected:
void nextBoxAskerQuestionHook(const QString &division, int i, bool isAnswer);
bool nextBoxAskerQuestionHook(const QString &division, int i, bool isAnswer);
void setAnswerHook(int userSays);
QString getQuestionHook() const;
};
......
......@@ -30,7 +30,7 @@ void flagDivisionAsker::cleanHook()
p_flag -> unsetPalette();
}
void flagDivisionAsker::nextBoxAskerQuestionHook(const QString &division, int i, bool isAnswer)
bool flagDivisionAsker::nextBoxAskerQuestionHook(const QString &division, int i, bool isAnswer)
{
if (isAnswer)
{
......@@ -43,6 +43,7 @@ void flagDivisionAsker::nextBoxAskerQuestionHook(const QString &division, int i,
p_currentAnswer.setCorrectAnswer(division);
}
p_rb[i] -> setText(division);
return true;
}
void flagDivisionAsker::setAnswerHook(int userSays)
......
......@@ -20,7 +20,7 @@ class flagDivisionAsker : public boxAsker
protected:
void cleanHook();
void nextBoxAskerQuestionHook(const QString &division, int i, bool isAnswer);
bool nextBoxAskerQuestionHook(const QString &division, int i, bool isAnswer);
void setAnswerHook(int userSays);
QString getQuestionHook() const;
......
......@@ -549,6 +549,47 @@ i18n("Tegucigalpa");
i18n("Managua");
i18n("San José");
i18n("Panama City");
i18n("Norway");
i18n("Frontier");
i18n("Not Norway");
i18n("Finnmark");
i18n("Troms");
i18n("Nordland");
i18n("Nord-Trøndelag");
i18n("Sør-Trøndelag");
i18n("Møre Og Romsdal");
i18n("Oppland");
i18n("Hedmark");
i18n("Sogn Og Fjordane");
i18n("Hordaland");
i18n("Rogaland");
i18n("Vest-Agder");
i18n("Aust-Agder");
i18n("Telemark");
i18n("Buskerud");
i18n("Vestfold");
i18n("Oslo");
i18n("Akershus");
i18n("Østfold");
i18n("Vadsø");
i18n("Tromsø");
i18n("Bodø");
i18n("Steinkjer");
i18n("Trondheim");
i18n("Molde");
i18n("Lillehammer");
i18n("Hamar");
i18n("Hermansverk");
i18n("Bergen");
i18n("Stavenger");
i18n("Kristiansand");
i18n("Arendal");
i18n("Skien");
i18n("Drammen");
i18n("Tønsberg");
i18n("Oslo");
i18n("Oslo");
i18n("Sarpsborg");
i18n("Poland");
i18n("Frontier");
i18n("Not Poland");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment