[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeedu/kgeography/src
From:       Laurent Garnier <lauranger () free ! fr>
Date:       2008-09-28 20:15:59
Message-ID: 1222632959.272203.27401.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 865734 by lauranger:

Sums up input files errors into a unique dialog instead of a potential dialog war. \
Adds a slider in number of question asking.

 M  +1 -0      CMakeLists.txt  
 M  +2 -1      answersdialog.cpp  
 M  +20 -7     kgeography.cpp  
 M  +3 -0      kgeography.h  
 M  +1 -1      main.cpp  
 M  +7 -1      mapchooser.cpp  


--- trunk/KDE/kdeedu/kgeography/src/CMakeLists.txt #865733:865734
@@ -23,6 +23,7 @@
    divisioncapitalasker.cpp 
    boxasker.cpp 
    divisionflagasker.cpp 
+   integerinputdialog.cpp
    answer.cpp 
    answersdialog.cpp )
 
--- trunk/KDE/kdeedu/kgeography/src/answersdialog.cpp #865733:865734
@@ -18,7 +18,8 @@
 
 #include "answer.h"
 
-answersDialog::answersDialog(QWidget *parent, const QVector<userAnswer> \
&userAnswers, const QString &question, int correctAnswers) : KDialog(parent) \
+answersDialog::answersDialog(QWidget *parent, const QVector<userAnswer> \
&userAnswers, const QString &question, int correctAnswers) +	: KDialog(parent)
 {
 	setCaption(i18n("Your Answers Were"));
 	setButtons(KDialog::Ok);
--- trunk/KDE/kdeedu/kgeography/src/kgeography.cpp #865733:865734
@@ -39,6 +39,7 @@
 #include "mapparser.h"
 #include "map.h"
 #include "placeasker.h"
+#include "integerinputdialog.h"
 
 kgeography::kgeography() : KXmlGuiWindow(), p_firstShow(true), \
p_mustShowResultsDialog(false)  {
@@ -216,12 +217,23 @@
 	putAskWidget();
 }
 
+int kgeography::askQuestionNumber(int upto, bool *rOK)
+{
+	int i;
+	bool ok;
+	i = IntegerInputDialog::GetInteger(NULL, i18n("Number of Questions"),
+					   i18n("How many questions do you want? (1 to %1)", upto),
+					   1, upto, 1, &ok);
+	if ( rOK != NULL ) *rOK = ok;
+	return i;
+}
+
 void kgeography::askCapitalDivisions()
 {
 	int i;
 	bool ok;
 	showResultsDialog();
-	i = KInputDialog::getInteger(i18n("Number of Questions"), i18n("How many questions \
do you want? (1 to %1)", p_map -> count(division::eCapital)), 1, 1, p_map -> \
count(division::eCapital), 1, &ok); +	i = askQuestionNumber(p_map -> \
count(division::eCapital), &ok);  if (ok)
 	{
 		removeOldAskWidget();
@@ -237,7 +249,7 @@
 	int i;
 	bool ok;
 	showResultsDialog();
-	i = KInputDialog::getInteger(i18n("Number of Questions"), i18n("How many questions \
do you want? (1 to %1)", p_map -> count(division::eCapital)), 1, 1, p_map -> \
count(division::eCapital), 1, &ok); +	i = askQuestionNumber(p_map -> \
count(division::eCapital), &ok);  if (ok)
 	{
 		removeOldAskWidget();
@@ -253,7 +265,7 @@
 	int i;
 	bool ok;
 	showResultsDialog();
-	i = KInputDialog::getInteger(i18n("Number of Questions"), i18n("How many questions \
do you want? (1 to %1)", p_map -> count(division::eClick)), 1, 1, p_map -> \
count(division::eClick), 1, &ok); +	i = askQuestionNumber(p_map -> \
count(division::eClick), &ok);  if (ok)
 	{
 		removeOldAskWidget();
@@ -272,7 +284,7 @@
 	int i;
 	bool ok;
 	showResultsDialog();
-	i = KInputDialog::getInteger(i18n("Number of Questions"), i18n("How many questions \
do you want? (1 to %1)", p_map -> count(division::eClick)), 1, 1, p_map -> \
count(division::eClick), 1, &ok); +	i = askQuestionNumber(p_map -> \
count(division::eClick), &ok);  if (ok)
 	{
 		removeOldAskWidget();
@@ -291,7 +303,7 @@
 	int i;
 	bool ok;
 	showResultsDialog();
-	i = KInputDialog::getInteger(i18n("Number of Questions"), i18n("How many questions \
do you want? (1 to %1)", p_map -> count(division::eFlag)), 1, 1, p_map -> \
count(division::eFlag), 1, &ok); +	i = askQuestionNumber(p_map -> \
count(division::eFlag), &ok);  if (ok)
 	{
 		removeOldAskWidget();
@@ -307,7 +319,7 @@
 	int i;
 	bool ok;
 	showResultsDialog();
-	i = KInputDialog::getInteger(i18n("Number of Questions"), i18n("How many questions \
do you want? (1 to %1)", p_map -> count(division::eFlag)), 1, 1, p_map -> \
count(division::eFlag), 1, &ok); +	i = askQuestionNumber(p_map -> \
count(division::eFlag), &ok);  if (ok)
 	{
 		removeOldAskWidget();
@@ -385,7 +397,8 @@
 
 void kgeography::disclaimer()
 {
-	KMessageBox::information(this, i18n("Maps, flags, translations, etc. are as \
accurate as their respective authors could achieve, but KGeography should not be \
taken as an authoritative source."), i18n("Disclaimer")); \
+	KMessageBox::information(this, i18n("Maps, flags, translations, etc. are as \
accurate as their respective authors could achieve," +					    " but KGeography \
should not be taken as an authoritative source."), i18n("Disclaimer"));  }
 
 void kgeography::showMapAuthor()
--- trunk/KDE/kdeedu/kgeography/src/kgeography.h #865733:865734
@@ -57,6 +57,9 @@
 		void removeOldAskWidget();
 		void setMap(KGmap *m);
 
+		int askQuestionNumber(int upto, bool *rOK);
+
+
 		QWidget *p_bigWidget;
 		QWidget *p_underLeftWidget;
 
--- trunk/KDE/kdeedu/kgeography/src/main.cpp #865733:865734
@@ -16,7 +16,7 @@
 
 int main(int argc, char *argv[])
 {
-	KAboutData about("kgeography", 0, ki18n("KGeography"), "0.5.9", ki18n("A geography \
learning program"), KAboutData::License_GPL, ki18n(" © 2004-2005 Albert Astals Cid"), \
KLocalizedString(), "http://kgeography.berlios.de"); +	KAboutData about("kgeography", \
0, ki18n("KGeography"), "0.5.9-l0", ki18n("A geography learning program"), \
KAboutData::License_GPL, ki18n(" © 2004-2005 Albert Astals Cid"), KLocalizedString(), \
"http://kgeography.berlios.de");  about.addAuthor(ki18n("Albert Astals Cid"), \
ki18n("Programmer and designer"), "tsdgeos@terra.es");  \
about.addCredit(ki18n("Sodipodi flags collection"), ki18n("Got some flags from it"), \
0, "http://www.sodipodi.com/index.php3?section=clipart/flags");  \
                KCmdLineArgs::init(argc, argv, &about);
--- trunk/KDE/kdeedu/kgeography/src/mapchooser.cpp #865733:865734
@@ -45,12 +45,13 @@
 	mainHBLayout -> addWidget(p_listBox);
 	QStringList::iterator it;
 	QStringList texts;
+	QStringList errorTexts;
 	for(it = list.begin(); it != list.end(); ++it)
 	{
 		m = p_reader.parseMap(*it);
 		if (!m)
 		{
-			KMessageBox::error(this, i18n("Error parsing %1: %2", *it, p_reader.getError()));
+			errorTexts << i18n("Error parsing %1: %2", *it, p_reader.getError());
 		}
 		else
 		{
@@ -59,6 +60,11 @@
 			p_maps.insert(text, m);
 		}
 	}
+
+	if ( errorTexts.size() > 0 )
+	{
+		KMessageBox::errorList(this, "Error parsing", errorTexts);
+	}
 	
 	p_image = new QLabel(mainHB);
 	p_image -> setFixedSize(300, 225);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic