essageBox :: Ok); reset (uiReg.loginLineEdit, uiReg.passwordLineEdit);}} delete windowRegistration;} void Login :: slotUserGuest () {emit accept (); readPostersHiring (); readPostersRent ();} User * Login :: getCurrentUser () {return current;} QLinkedList * Login :: getUsers () {return users;} void Login :: fillPosterHiring (QDataStream & in, QString & tempQStr, int & tempInt, bool & tempBool, PosterHiring * poster) {in>> tempQStr; poster-> setLogin (tempQStr); in>> tempQStr; poster-> setCity (tempQStr); in>> tempQStr; poster-> setArea (tempQStr); in>> tempQStr; poster-> setNumberPhone (tempQStr); in>> tempInt; poster-> setPrice (tempInt), in>> tempBool; poster-> setFurtiture (tempBool), in>> tempBool; poster-> setAnimal (tempBool), in>> tempQStr; poster- > setSumRoom (tempQStr); in>> tempQStr; poster-> setTenant (tempQStr);} void Login :: fillPosterRent (QDataStream & in, QString & tempQStr, int & tempInt, bool & tempBool, PosterRent * poster) {fillPosterHiring (in, tempQStr, tempInt, tempBool, poster); in>> tempQStr; poster-> setStreet (tempQStr); in>> tempQStr; poster-> setHome (tempQStr); in>> tempInt; poster-> setNumberFloor (tempInt);} void Login :: readPostersHiring () {file-> setFileName ("posterHiring.bin"); if (! file-> open (QIODevice: : ReadOnly)) return; QDataStream in (file); QString tempQStr; int tempInt; bool tempBool; PosterHiring * poster = 0; QLinkedList :: Iterator passage = users-> begin (); while (passage! = users-> end ()) {if (! poster) {poster = new PosterHiring; fillPosterHiring (in, tempQStr, tempInt, tempBool, poster);} if ((* passage) -> getLogin () == poster -> getLogin ()) {(* passage) -> setPostersHiring (poster); if (! in.atEnd ()) poster = 0; else break;} else + + passage;} file-> close () ;} void Login :: readPostersRent () {file-> setFileName ("posterRent.bin"); if (! file-> open (QIODevice :: ReadOnly)) return; QDataStream in (file); QString tempQStr; int tempInt; bool tempBool; PosterRent * poster = 0; QLinkedList :: Iterator passage = users-> begin (); while (passage! = users-> end ()) {if (! poster) {poster = new PosterRent; fillPosterRent (in, tempQStr, tempInt, tempBool, poster);} if ((* passage) -> getLogin () == poster-> getLogin ()) {(* passage) -> setPostersRent (poster); if (! in.atEnd ()) poster = 0; else break;} else + + passage;} if (! poster) delete poster; file-> close ();}
Лістинг mainWindow.h
mainWindow.h # ifndef MAINWINDOW_H # define MAINWINDOW_H # include # include "ui_mainWindow.h" class MainWindow: public QMainWindow {Q_OBJECT protected: Ui :: MainWindow uiMainWindow; public: MainWindow ( QWidget * parent = 0): QMainWindow (parent) {uiMainWindow.setupUi (this);}}; # endif// MAINWINDOW_H
Лістинг functionGuest.h
functionGuest.h # ifndef FUNCTIONGUEST_H # define FUNCTIONGUEST_H # include # include "user.h" # include "ui_posterHirin...