Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed merge problems

  • Loading branch information...
commit d2ad21f23dcf6c39907a624482c4484d6b2d72c2 2 parents e477309 + 9e588f1
Vincent Foley authored
3  mainwindow.cpp
View
@@ -153,7 +153,8 @@ MainWindow::MainWindow(QWidget *parent) :
//important tout le monde partage la scène !
CarteWidget::setScene(scene);
- UserInterface *userInterface = new UserInterface(smodel, vmodel, rmodel, this);
+ UserInterface *userInterface = new UserInterface(smodel, vmodel, umodel, rmodel, this);
+ connect(this, SIGNAL(interfaceUsagerId(qint64)), userInterface, SLOT(setUser(qint64)));
userInterface->show();
}
1  stationmodel.cpp
View
@@ -27,6 +27,7 @@
StationModel::StationModel(QObject *parent) :
QAbstractTableModel(parent)
{
+ currentPosition = new GeoPosition;
}
QVariant StationModel::fieldAt(const QModelIndex &index, int role) const
37 userinterface.cpp
View
@@ -28,18 +28,20 @@
UserInterface::UserInterface(
StationModel *smodel,
VehiculeModel *vmodel,
+ UsagerModel *umodel,
ReservationModel *rmodel,
QWidget *parent) :
QMainWindow(parent),
stationModel(smodel),
vehiculeModel(vmodel),
+ usagerModel(umodel),
ui(new Ui::UserInterface)
{
ui->setupUi(this);
- qDebug() << "Nombre total de vehicules: " << stationModel->getStations().count();
reservation = new Reservation(this);
+ setUser(2);
currentPosition = new GeoPosition(45.52, -73.58);
stationModel->updateCurrentPosition(*currentPosition);
@@ -53,19 +55,7 @@ UserInterface::UserInterface(
vehiculeProxy->setDynamicSortFilter(true);
pages = new QMap<PageName, Page*>;
-
- pages->insert(Page_MainMenu, new MainMenuPage(this));
- pages->insert(Page_FindStation, new FindStationPage(this));
- pages->insert(Page_SelectPosition, new SelectPositionPage(this));
- pages->insert(Page_SelectStation, new SelectStationPage(stationProxy, this));
- pages->insert(Page_SelectTime, new SelectTimePage(this));
- pages->insert(Page_SelectCar, new SelectCarPage(vehiculeProxy, this));
- pages->insert(Page_Confirm, new ConfirmPage(this));
- pages->insert(Page_Bookings, new BookingsPage(this));
- pages->insert(Page_Comments, new CommentsPage(this)); // comments main page
- pages->insert(Page_WriteComment, new WriteCommentPage(this)); // comment editing
- pages->insert(Page_Unexpected, new UnexpectedPage(this));
- pages->insert(Page_Email, new MyMessagesPage(this));
+ createPages();
QMapIterator<PageName, Page*> iter(*pages);
while (iter.hasNext()) {
@@ -145,11 +135,30 @@ UserInterface::UserInterface(
connect(getPage(Page_Email), SIGNAL(Menu()), this, SLOT(gotoMainMenu()));
}
+void UserInterface::createPages() {
+ pages->insert(Page_MainMenu, new MainMenuPage(this));
+ pages->insert(Page_FindStation, new FindStationPage(this));
+ pages->insert(Page_SelectPosition, new SelectPositionPage(this));
+ pages->insert(Page_SelectStation, new SelectStationPage(stationProxy, this));
+ pages->insert(Page_SelectTime, new SelectTimePage(this));
+ pages->insert(Page_SelectCar, new SelectCarPage(vehiculeProxy, this));
+ pages->insert(Page_Confirm, new ConfirmPage(this));
+ pages->insert(Page_Bookings, new BookingsPage(this));
+ pages->insert(Page_Comments, new CommentsPage(this)); // comments main page
+ pages->insert(Page_WriteComment, new WriteCommentPage(this)); // comment editing
+ pages->insert(Page_Unexpected, new UnexpectedPage(this));
+ pages->insert(Page_Email, new MyMessagesPage(this));
+}
+
UserInterface::~UserInterface()
{
delete ui;
}
+void UserInterface::setUser(qint64 id) {
+ user = usagerModel->getUsager(id);
+ ui->lblUserName->setText(user->getNom());
+}
Page* UserInterface::getPage(PageName name) {
return pages->value(name);
6 userinterface.h
View
@@ -11,6 +11,7 @@
#include "stationmodel.h"
#include "stationsortproxy.h"
#include "vehiculemodel.h"
+#include "usagermodel.h"
#include "vehiculefilterproxy.h"
#include "reservation.h"
#include "reservationmodel.h"
@@ -33,18 +34,22 @@ class UserInterface : public QMainWindow
explicit UserInterface(
StationModel *smodel,
VehiculeModel *vmodel,
+ UsagerModel *umodel,
ReservationModel *rmodel,
QWidget *parent = 0);
~UserInterface();
private:
Ui::UserInterface *ui;
+ Usager *user;
QMap<PageName, Page*> *pages;
+ void createPages();
Page* getPage(PageName name);
StationModel *stationModel;
StationSortProxy *stationProxy;
VehiculeModel *vehiculeModel;
VehiculeFilterProxy *vehiculeProxy;
+ UsagerModel *usagerModel;
GeoPosition *currentPosition;
Reservation *reservation;
@@ -68,6 +73,7 @@ public slots:
void setTimes(QDateTime start, QDateTime end);
void setStationId(qint64 stationId);
void setCarId(qint64 carId);
+ void setUser(qint64 id);
};
#endif // USERINTERFACE_H
Please sign in to comment.
Something went wrong with that request. Please try again.