#include <QtGui>
#include <QInputContext>
+#ifdef Q_WS_MAEMO_5
+#include <QMaemo5InformationBox>
+#endif
#include "score-dialog.h"
#include "score-common.h"
SelectDialog::SelectDialog(QWidget *parent) : QDialog(parent)
{
+ resize(800, 350);
+
QWidget *centralWidget = new QWidget(this);
createLayout(centralWidget);
connect(pushButtonNext, SIGNAL(clicked()), this, SLOT(next()));
+ QDialogButtonBox * buttonBox = new QDialogButtonBox(Qt::Vertical);
+ buttonBox->addButton(pushButtonNext, QDialogButtonBox::ActionRole);
+
leftLayout = new QVBoxLayout;
leftLayout->addWidget(listClub);
rightLayout = new QVBoxLayout;
rightLayout->addStretch();
- rightLayout->addWidget(pushButtonNext);
+ rightLayout->addWidget(buttonBox);
QHBoxLayout *mainLayout = new QHBoxLayout(parent);
mainLayout->addLayout(leftLayout);
leftLayout = new QVBoxLayout;
leftLayout->addWidget(table);
+ QDialogButtonBox * buttonBoxUp = new QDialogButtonBox(Qt::Vertical);
+ buttonBoxUp->addButton(pushButtonUp, QDialogButtonBox::ActionRole);
+ buttonBoxUp->addButton(pushButtonDown, QDialogButtonBox::ActionRole);
+ buttonBoxUp->addButton(pushButtonNext, QDialogButtonBox::ActionRole);
+
+ QDialogButtonBox * buttonBoxDown = new QDialogButtonBox(Qt::Vertical);
+ buttonBoxDown->addButton(pushButtonFinish, QDialogButtonBox::ActionRole);
+
rightLayout = new QVBoxLayout;
- rightLayout->addWidget(pushButtonUp);
- rightLayout->addWidget(pushButtonDown);
- rightLayout->addWidget(pushButtonNext);
+ rightLayout->addWidget(buttonBoxUp);
rightLayout->addStretch();
- rightLayout->addWidget(pushButtonFinish);
+ rightLayout->addWidget(buttonBoxDown);
QHBoxLayout *mainLayout = new QHBoxLayout(parent);
mainLayout->addLayout(leftLayout);
table->verticalHeader()->setResizeMode(QHeaderView::Stretch);
table->horizontalHeader()->hide();
- //table->setStyleSheet(ScoreColor::styleSheet());
+ table->setStyleSheet(ScoreStyle::style());
QStringList headers;
headers << "" << "Par" << "HCP" << "Score" << "" << "Par" << "HCP" << "Score";
scoreItem = new QTableWidgetItem("");
holeNum = new QTableWidgetItem(QString::number(i+1));
- holeNum->setBackgroundColor(ScoreColor::holeBg());
+ holeNum->setTextAlignment(Qt::AlignCenter);
+ holeNum->setFlags(Qt::NoItemFlags);
+ holeNum->setForeground(ScoreColor::holeBg());
par->setTextAlignment(Qt::AlignCenter);
+ par->setFlags(Qt::NoItemFlags);
+
hcp->setTextAlignment(Qt::AlignCenter);
+ hcp->setFlags(Qt::NoItemFlags);
+
scoreItem->setTextAlignment(Qt::AlignCenter);
- holeNum->setTextAlignment(Qt::AlignCenter);
if (i < 9) {
table->setItem(ROW_HOLE, i, holeNum);
void ScoreDialog::finish(void)
{
- if (validate())
- done(1);
- else {
- qDebug() << "ScoreDialog: invalid data, cancel or correct";
- }
+ if (validate())
+ done(1);
+ else {
+ showNote("Invalid data - cancel or correct");
+ }
}
void ScoreDialog::reject(void)
{
done(0);
}
+
+void ScoreDialog::showNote(QString msg)
+{
+#ifdef Q_WS_MAEMO_5
+ QMaemo5InformationBox::information(this,
+ msg,
+ QMaemo5InformationBox::DefaultTimeout);
+#endif
+}