diff --git a/.directory b/.directory new file mode 100644 index 0000000..fe48173 --- /dev/null +++ b/.directory @@ -0,0 +1,4 @@ +[Dolphin] +Timestamp=2022,4,6,18,51,59.955 +Version=4 +ViewMode=1 diff --git a/afdrukker.h b/afdrukker.h index 0612afa..ea1dab2 100644 --- a/afdrukker.h +++ b/afdrukker.h @@ -3,12 +3,9 @@ #include -class QTextBrowser; - class Afdrukker{ public: Afdrukker(); - QTextBrowser* brow; virtual void toonText(std::string)=0; virtual void clearMedium()=0; }; diff --git a/drukbox.cpp b/drukbox.cpp index 14b64e8..f26e21b 100644 --- a/drukbox.cpp +++ b/drukbox.cpp @@ -1,13 +1,13 @@ #include "drukbox.h" -Drukbox::Drukbox(){ - +Drukbox::Drukbox(QTextBrowser *a): browser(a){ } -void Drukbox::toonText(std::string){ - //brow-> +void Drukbox::toonText(std::string s){ + browser->append(QString::fromStdString(s)); + browser->update(); } void Drukbox::clearMedium(){ - + browser->clear(); } diff --git a/drukbox.h b/drukbox.h index af949b8..18a2391 100644 --- a/drukbox.h +++ b/drukbox.h @@ -3,12 +3,14 @@ #include "afdrukker.h" //#include - -class QTextBrowser; +#include +//class QTextBrowser; class Drukbox : public Afdrukker{ +private: + QTextBrowser *browser; public: - Drukbox(); + Drukbox(QTextBrowser*); virtual void toonText(std::string); virtual void clearMedium(); }; diff --git a/gebouw.pro.user b/gebouw.pro.user index f67802f..0d152ef 100644 --- a/gebouw.pro.user +++ b/gebouw.pro.user @@ -1,10 +1,10 @@ - + EnvironmentId - {d5e58b13-852b-4aba-9708-c119893ef783} + {0dcd33fb-ba0a-4445-b1c9-254de30c3957} ProjectExplorer.Project.ActiveTarget @@ -77,7 +77,7 @@ true true Builtin.DefaultTidyAndClazy - 4 + 6 @@ -94,14 +94,14 @@ Desktop Desktop Desktop - {86ebf10c-c997-4c55-b145-d0d809c0f0ea} + {8bc67a4c-d6ba-49c4-822f-185ca527795d} 0 0 0 0 - /home/shaquilles/Downloads/build-gebouw-Desktop-Debug - /home/shaquilles/Downloads/build-gebouw-Desktop-Debug + /home/shaquille/Git/build-gebouw-Desktop-Debug + /home/shaquille/Git/build-gebouw-Desktop-Debug true @@ -139,13 +139,13 @@ 2 - /home/shaquilles/Downloads/build-gebouw-Desktop-Release - /home/shaquilles/Downloads/build-gebouw-Desktop-Release + /home/shaquille/Git/build-gebouw-Desktop-Release + /home/shaquille/Git/build-gebouw-Desktop-Release true QtProjectManager.QMakeBuildStep - false + true @@ -180,13 +180,13 @@ 0 - /home/shaquilles/Downloads/build-gebouw-Desktop-Profile - /home/shaquilles/Downloads/build-gebouw-Desktop-Profile + /home/shaquille/Git/build-gebouw-Desktop-Profile + /home/shaquille/Git/build-gebouw-Desktop-Profile true QtProjectManager.QMakeBuildStep - false + true @@ -241,14 +241,14 @@ 2 - Qt4ProjectManager.Qt4RunConfiguration:/home/shaquilles/Downloads/gebouw/gebouw.pro - /home/shaquilles/Downloads/gebouw/gebouw.pro + Qt4ProjectManager.Qt4RunConfiguration:/home/shaquille/Git/Qt-Gebouw/gebouw.pro + /home/shaquille/Git/Qt-Gebouw/gebouw.pro false true true false true - /home/shaquilles/Downloads/build-gebouw-Desktop-Debug + /home/shaquille/Git/build-gebouw-Desktop-Debug 1 diff --git a/gebouw.pro.user.d5e58b1 b/gebouw.pro.user.d5e58b1 new file mode 100644 index 0000000..7f46cfa --- /dev/null +++ b/gebouw.pro.user.d5e58b1 @@ -0,0 +1,268 @@ + + + + + + EnvironmentId + {d5e58b13-852b-4aba-9708-c119893ef783} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + false + true + false + 0 + true + true + 0 + 8 + true + false + 1 + true + true + true + *.md, *.MD, Makefile + false + true + + + + ProjectExplorer.Project.PluginSettings + + + true + false + true + true + true + true + + + 0 + true + + true + Builtin.BuildSystem + + true + true + Builtin.DefaultTidyAndClazy + 4 + + + + true + + + true + + + + + ProjectExplorer.Project.Target.0 + + Desktop + Desktop + Desktop + {86ebf10c-c997-4c55-b145-d0d809c0f0ea} + 0 + 0 + 0 + + 0 + /home/shaquilles/Downloads/build-gebouw-Desktop-Debug + /home/shaquilles/Downloads/build-gebouw-Desktop-Debug + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + + + /home/shaquilles/Downloads/build-gebouw-Desktop-Release + /home/shaquilles/Downloads/build-gebouw-Desktop-Release + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + + + 0 + /home/shaquilles/Downloads/build-gebouw-Desktop-Profile + /home/shaquilles/Downloads/build-gebouw-Desktop-Profile + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + 0 + + 3 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + true + true + true + + 2 + + Qt4ProjectManager.Qt4RunConfiguration:/home/shaquilles/Downloads/gebouw/gebouw.pro + /home/shaquilles/Downloads/gebouw/gebouw.pro + false + true + true + false + true + /home/shaquilles/Downloads/build-gebouw-Desktop-Debug + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/herkenningsslot.cpp b/herkenningsslot.cpp index 30a099b..345783d 100644 --- a/herkenningsslot.cpp +++ b/herkenningsslot.cpp @@ -1,6 +1,7 @@ #include "herkenningsslot.h" +#include -HerkenningsSlot::HerkenningsSlot(Afdrukker* a): afdrukker(a){ +HerkenningsSlot::HerkenningsSlot(Afdrukker* a): kaartenbak(),afdrukker(a){ } @@ -26,5 +27,9 @@ void HerkenningsSlot::vergrendel(){ } void HerkenningsSlot::toonKaartenBak(){ - + afdrukker->clearMedium(); + for (auto &j:kaartenbak){ + afdrukker->toonText(j.first); + afdrukker->toonText(std::to_string(j.second)); + } } diff --git a/herkenningsslot.h b/herkenningsslot.h index 54e88dc..e49c8b4 100644 --- a/herkenningsslot.h +++ b/herkenningsslot.h @@ -3,8 +3,9 @@ #include "slot.h" #include +#include "afdrukker.h" -class Afdrukker; +//class Afdrukker; class HerkenningsSlot : public Slot { diff --git a/mainwindow.cpp b/mainwindow.cpp index a5ca4e5..f14d694 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -23,13 +23,14 @@ MainWindow::MainWindow(QWidget *parent) : //sleutelSlot0 = new SleutelSlot("cisco"); //sleutelSlot1 = new SleutelSlot("cisco"); deuren.emplace_back(std::shared_ptr (new Schuifdeur(503,250,80,s1))); - deuren[0]->addSlot(new HerkenningsSlot(new Drukbox())); - //deuren[0]->addSlot(new SleutelSlot("cisco2")); + //deuren[0]->addSlot(new HerkenningsSlot(new Drukbox(ui->textBrowser))); + deuren[0]->addSlot(new SleutelSlot("cisco2")); deuren.emplace_back(std::shared_ptr (new draaideur(248,140,40,false))); deuren[1]->addSlot(new CodeSlot(1234)); deuren[1]->addSlot(new CodeSlot(5678)); deuren.emplace_back(std::shared_ptr (new draaideur(295,290,30,true))); deuren[2]->addSlot(new CodeSlot(0000)); + deuren[2]->addSlot(new HerkenningsSlot(new Drukbox(ui->textBrowser))); } MainWindow::~MainWindow(){ @@ -41,7 +42,7 @@ void MainWindow::paintEvent(QPaintEvent *event){ QPainter painter(this); QPen pen; - QImage image("/home/shaquilles/Downloads/gebouw/Gebouw.png"); + QImage image("/home/shaquille/Git/Qt-Gebouw/Gebouw.png"); pen.setColor(Qt::green); pen.setWidth(4); @@ -113,15 +114,23 @@ void MainWindow::on_lineEdit_returnPressed(){ } void MainWindow::on_Allow_clicked(){ - Slot* a = deuren[0]->geefSleutel(0); + Slot* a = deuren[2]->geefSleutel(1); HerkenningsSlot* b = dynamic_cast(a); b->voegAutorisatieToe(ui->HerkenningAdd->text().toStdString(), true); + b->toonKaartenBak(); } void MainWindow::on_Deny_clicked(){ - Slot* a = deuren[0]->geefSleutel(0); + Slot* a = deuren[2]->geefSleutel(1); HerkenningsSlot* b = dynamic_cast(a); b->voegAutorisatieToe(ui->HerkenningAdd->text().toStdString(), false); + b->toonKaartenBak(); +} + +void MainWindow::on_HerkenningAdd_2_returnPressed(){ + Slot* a = deuren[2]->geefSleutel(1); + HerkenningsSlot* b = dynamic_cast(a); + b->ontgrendel(ui->HerkenningAdd_2->text().toStdString()); } diff --git a/mainwindow.h b/mainwindow.h index 69fcc5b..91c0227 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -31,9 +31,10 @@ private slots: void on_d2_clicked(); void on_lineEdit_returnPressed(); void on_Allow_clicked(); - void on_Deny_clicked(); + void on_HerkenningAdd_2_returnPressed(); + private: Ui::MainWindow *ui; Hallsensor *s1; diff --git a/mainwindow.ui b/mainwindow.ui index 64c30d8..8280148 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -134,6 +134,16 @@ Deny + + + + 810 + 110 + 114 + 30 + + + @@ -141,7 +151,7 @@ 0 0 1171 - 22 + 23