-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added possibility to create new player, places and drinks
- Loading branch information
Niclas Raabe
committed
Aug 7, 2014
1 parent
5303146
commit cd31450
Showing
11 changed files
with
284 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#include "placeinformationdialog.h" | ||
#include "ui_placeinformationdialog.h" | ||
|
||
#include <data/place.h> | ||
#include <QPushButton> | ||
|
||
PlaceInformationDialog::PlaceInformationDialog(QWidget *parent) : | ||
QDialog(parent), | ||
ui(new Ui::PlaceInformationDialog) | ||
{ | ||
ui->setupUi(this); | ||
|
||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); | ||
|
||
connect(ui->lineEditNumber, SIGNAL(editingFinished()), this, SLOT(checkData())); | ||
connect(ui->lineEditPLZ, SIGNAL(editingFinished()), this, SLOT(checkData())); | ||
connect(ui->lineEditStreet, SIGNAL(editingFinished()), this, SLOT(checkData())); | ||
connect(ui->lineEditTown, SIGNAL(editingFinished()), this, SLOT(checkData())); | ||
} | ||
|
||
PlaceInformationDialog::~PlaceInformationDialog() | ||
{ | ||
delete ui; | ||
} | ||
|
||
void PlaceInformationDialog::setPlace(QSharedPointer<Place> place) | ||
{ | ||
m_place = place; | ||
} | ||
|
||
void PlaceInformationDialog::checkData() | ||
{ | ||
if(ui->lineEditNumber->text() == "" || ui->lineEditPLZ->text() == "" || ui->lineEditStreet->text() == "" || ui->lineEditTown->text() == "") { | ||
return; | ||
} | ||
|
||
bool ok = false; | ||
ui->lineEditPLZ->text().toInt(&ok); | ||
if(!ok) | ||
return; | ||
|
||
ok = false; | ||
ui->lineEditNumber->text().toInt(&ok); | ||
if(!ok) | ||
return; | ||
|
||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); | ||
} | ||
|
||
void PlaceInformationDialog::accept() | ||
{ | ||
bool create = false; | ||
|
||
if(!m_place) { | ||
m_place = Qp::create<Place>(); | ||
create = true; | ||
} | ||
|
||
m_place->setCity(ui->lineEditTown->text()); | ||
m_place->setPostalCode(ui->lineEditPLZ->text().toInt()); | ||
m_place->setStreet(ui->lineEditStreet->text()); | ||
m_place->setHouseNumber(ui->lineEditNumber->text().toInt()); | ||
|
||
|
||
if(create) | ||
emit placeAdded(m_place); | ||
|
||
QDialog::accept(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#ifndef PLACEINFORMATIONDIALOG_H | ||
#define PLACEINFORMATIONDIALOG_H | ||
|
||
#include <QDialog> | ||
|
||
class Place; | ||
|
||
namespace Ui { | ||
class PlaceInformationDialog; | ||
} | ||
|
||
class PlaceInformationDialog : public QDialog | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit PlaceInformationDialog(QWidget *parent = 0); | ||
~PlaceInformationDialog(); | ||
|
||
void setPlace(QSharedPointer<Place> place); | ||
|
||
public slots: | ||
void accept() Q_DECL_OVERRIDE; | ||
void checkData(); | ||
|
||
signals: | ||
void placeAdded(QSharedPointer<Place> place); | ||
|
||
private: | ||
Ui::PlaceInformationDialog *ui; | ||
|
||
QSharedPointer<Place> m_place; | ||
}; | ||
|
||
#endif // PLACEINFORMATIONDIALOG_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>PlaceInformationDialog</class> | ||
<widget class="QDialog" name="PlaceInformationDialog"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>452</width> | ||
<height>133</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Dialog</string> | ||
</property> | ||
<layout class="QGridLayout" name="gridLayout"> | ||
<item row="0" column="0"> | ||
<widget class="QLabel" name="label"> | ||
<property name="text"> | ||
<string>Street:</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="0" column="1"> | ||
<widget class="QLineEdit" name="lineEditStreet"> | ||
<property name="placeholderText"> | ||
<string>Street</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="2" column="2"> | ||
<widget class="QDialogButtonBox" name="buttonBox"> | ||
<property name="orientation"> | ||
<enum>Qt::Horizontal</enum> | ||
</property> | ||
<property name="standardButtons"> | ||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="0" column="2"> | ||
<widget class="QLineEdit" name="lineEditNumber"> | ||
<property name="placeholderText"> | ||
<string>Number</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="1" column="0"> | ||
<widget class="QLabel" name="label_2"> | ||
<property name="text"> | ||
<string>Town:</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="1" column="1"> | ||
<widget class="QLineEdit" name="lineEditPLZ"> | ||
<property name="placeholderText"> | ||
<string>PLZ</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="1" column="2"> | ||
<widget class="QLineEdit" name="lineEditTown"> | ||
<property name="placeholderText"> | ||
<string>Town</string> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources/> | ||
<connections> | ||
<connection> | ||
<sender>buttonBox</sender> | ||
<signal>accepted()</signal> | ||
<receiver>PlaceInformationDialog</receiver> | ||
<slot>accept()</slot> | ||
<hints> | ||
<hint type="sourcelabel"> | ||
<x>248</x> | ||
<y>254</y> | ||
</hint> | ||
<hint type="destinationlabel"> | ||
<x>157</x> | ||
<y>274</y> | ||
</hint> | ||
</hints> | ||
</connection> | ||
<connection> | ||
<sender>buttonBox</sender> | ||
<signal>rejected()</signal> | ||
<receiver>PlaceInformationDialog</receiver> | ||
<slot>reject()</slot> | ||
<hints> | ||
<hint type="sourcelabel"> | ||
<x>316</x> | ||
<y>260</y> | ||
</hint> | ||
<hint type="destinationlabel"> | ||
<x>286</x> | ||
<y>274</y> | ||
</hint> | ||
</hints> | ||
</connection> | ||
</connections> | ||
</ui> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters