/*
- * CarMainWindow main class
+ * Result dialog
*
* @author Janne Änäkkälä <janne.anakkala@fudeco.com>
- * @author Toni Jussila <toni.jussila@fudeco.com>
+ * @author Toni Jussila <toni.jussila@fudeco.com>
* @copyright (c) 2010 Speed Freak team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
#include "math.h"
#include <QPainter>
#include <QPicture>
+#include <QDebug>
const int DIAGRAM_WIDTH = 400;
const int DIAGRAM_HEIGHT = 300;
ui(new Ui::ResultDialog)
{
ui->setupUi(this);
+
+ helpAccelerationDialog = NULL;
+
timeAxelLength = 10;
resultString = "";
speedList << "0" << "10" << "20" << "30" << "40" << "50" << "60" << "70" << "80" << "90" << "100" ;
timeArray[i] = 0;
}
+ //Clear info label
+ ui->labelInfoToUser->setText("");
+
if (loginSaved())
{
ui->pushButtonSend->setEnabled(true);
else
{
ui->pushButtonSend->setEnabled(false);
+ ui->labelInfoToUser->setText("You're not logged! Please register or log in and accelerate again.");
}
}
}
resultString = "";
this->close();
+ emit rejected();
}
/**
*/
void ResultDialog::on_pushButtonSend_clicked()
{
- //emit sendresult();
+ ui->pushButtonSend->setEnabled(false);
emit sendresult(timeArray[this->getTargetChoice()]);
}
{
this->ui->labelInfoToUser->setText(infoText);
}
+
+/**
+ * This function enable send server button.
+ */
+void ResultDialog::setSendServerButtonEnabled()
+{
+ ui->pushButtonSend->setEnabled(true);
+}
+
+/**
+ * This slot function called when ever info button clicked.
+ */
+void ResultDialog::on_pushButtonInfo_clicked()
+{
+ if(!helpAccelerationDialog)
+ {
+ helpAccelerationDialog = new HelpAccelerationDialog;
+ }
+ connect(helpAccelerationDialog, SIGNAL(rejected()), this, SLOT(killHelpDialog()));
+ helpAccelerationDialog->show();
+}
+
+/**
+ * This slot function called when ever dialog rejected.
+ */
+void ResultDialog::killHelpDialog()
+{
+ if(helpAccelerationDialog)
+ {
+ qDebug() << "__Result kill: helpAccelerationDialog";
+ delete helpAccelerationDialog;
+ helpAccelerationDialog = NULL;
+ }
+}
+