idk
This commit is contained in:
		
							
								
								
									
										5
									
								
								afdrukker.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								afdrukker.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
#include "afdrukker.h"
 | 
			
		||||
 | 
			
		||||
Afdrukker::Afdrukker(){
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										16
									
								
								afdrukker.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								afdrukker.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
#ifndef AFDRUKKER_H
 | 
			
		||||
#define AFDRUKKER_H
 | 
			
		||||
 | 
			
		||||
#include <string>
 | 
			
		||||
 | 
			
		||||
class QTextBrowser;
 | 
			
		||||
 | 
			
		||||
class Afdrukker{
 | 
			
		||||
public:
 | 
			
		||||
    Afdrukker();
 | 
			
		||||
    QTextBrowser* brow;
 | 
			
		||||
    virtual void toonText(std::string)=0;
 | 
			
		||||
    virtual void clearMedium()=0;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // AFDRUKKER_H
 | 
			
		||||
							
								
								
									
										4
									
								
								deur.cpp
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								deur.cpp
									
									
									
									
									
								
							@@ -54,3 +54,7 @@ Slot* Deur::geefSleutel(int i){
 | 
			
		||||
    advance(it, i);
 | 
			
		||||
    return *it;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::list<Slot*> Deur::geefSlot(){
 | 
			
		||||
    return sloten;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								deur.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								deur.h
									
									
									
									
									
								
							@@ -28,6 +28,7 @@ public:
 | 
			
		||||
    void addSlot(Slot*);
 | 
			
		||||
    //std::list<Slot*> geefSleutel();
 | 
			
		||||
    Slot* geefSleutel(int);
 | 
			
		||||
    std::list<Slot*> geefSlot();
 | 
			
		||||
    //Deur(int, int, int, Slot*);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										13
									
								
								drukbox.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								drukbox.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
#include "drukbox.h"
 | 
			
		||||
 | 
			
		||||
Drukbox::Drukbox(){
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Drukbox::toonText(std::string){
 | 
			
		||||
    //brow->
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Drukbox::clearMedium(){
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										16
									
								
								drukbox.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								drukbox.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
#ifndef DRUKBOX_H
 | 
			
		||||
#define DRUKBOX_H
 | 
			
		||||
 | 
			
		||||
#include "afdrukker.h"
 | 
			
		||||
//#include <QMainWindow>
 | 
			
		||||
 | 
			
		||||
class QTextBrowser;
 | 
			
		||||
 | 
			
		||||
class Drukbox : public Afdrukker{
 | 
			
		||||
public:
 | 
			
		||||
    Drukbox();
 | 
			
		||||
    virtual void toonText(std::string);
 | 
			
		||||
    virtual void clearMedium();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // DRUKBOX_H
 | 
			
		||||
@@ -24,9 +24,11 @@ DEFINES += QT_DEPRECATED_WARNINGS
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
SOURCES += main.cpp\
 | 
			
		||||
    afdrukker.cpp \
 | 
			
		||||
    codeslot.cpp \
 | 
			
		||||
    deur.cpp \
 | 
			
		||||
    draaideur.cpp \
 | 
			
		||||
    drukbox.cpp \
 | 
			
		||||
    hallsensor.cpp \
 | 
			
		||||
    herkenningsslot.cpp \
 | 
			
		||||
        mainwindow.cpp \
 | 
			
		||||
@@ -36,9 +38,11 @@ SOURCES += main.cpp\
 | 
			
		||||
    slot.cpp
 | 
			
		||||
 | 
			
		||||
HEADERS  += mainwindow.h \
 | 
			
		||||
    afdrukker.h \
 | 
			
		||||
    codeslot.h \
 | 
			
		||||
    deur.h \
 | 
			
		||||
    draaideur.h \
 | 
			
		||||
    drukbox.h \
 | 
			
		||||
    hallsensor.h \
 | 
			
		||||
    herkenningsslot.h \
 | 
			
		||||
    schuifdeur.h \
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<!DOCTYPE QtCreatorProject>
 | 
			
		||||
<!-- Written by QtCreator 6.0.2, 2022-03-24T12:27:38. -->
 | 
			
		||||
<!-- Written by QtCreator 6.0.2, 2022-04-06T17:35:09. -->
 | 
			
		||||
<qtcreator>
 | 
			
		||||
 <data>
 | 
			
		||||
  <variable>EnvironmentId</variable>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,13 @@
 | 
			
		||||
#include "herkenningsslot.h"
 | 
			
		||||
 | 
			
		||||
HerkenningsSlot::HerkenningsSlot(){
 | 
			
		||||
HerkenningsSlot::HerkenningsSlot(Afdrukker* a): afdrukker(a){
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void HerkenningsSlot::voegAutorisatieToe(string naam, bool access){
 | 
			
		||||
    if (!kaartenbak.count(naam)){
 | 
			
		||||
        kaartenbak[naam] = access;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void HerkenningsSlot::ontgrendel(string naam){
 | 
			
		||||
@@ -23,6 +25,6 @@ void HerkenningsSlot::vergrendel(){
 | 
			
		||||
    vergrendeld = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void HerkenningsSlot::toonKaartenBack(){
 | 
			
		||||
void HerkenningsSlot::toonKaartenBak(){
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -13,11 +13,11 @@ private:
 | 
			
		||||
    bool vergrendeld;
 | 
			
		||||
    Afdrukker* afdrukker;
 | 
			
		||||
public:
 | 
			
		||||
    HerkenningsSlot();
 | 
			
		||||
    HerkenningsSlot(Afdrukker*);
 | 
			
		||||
    void vergrendel();
 | 
			
		||||
    bool isVergrendeld();
 | 
			
		||||
    void ontgrendel(string);
 | 
			
		||||
    void toonKaartenBack();
 | 
			
		||||
    void toonKaartenBak();
 | 
			
		||||
    void voegAutorisatieToe(string,bool);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -10,6 +10,10 @@
 | 
			
		||||
#include <QLineEdit>
 | 
			
		||||
#include <sleutelslot.h>
 | 
			
		||||
#include <codeslot.h>
 | 
			
		||||
#include "slot.h"
 | 
			
		||||
#include "herkenningsslot.h"
 | 
			
		||||
#include "afdrukker.h"
 | 
			
		||||
#include "drukbox.h"
 | 
			
		||||
 | 
			
		||||
MainWindow::MainWindow(QWidget *parent) :
 | 
			
		||||
    QMainWindow(parent),
 | 
			
		||||
@@ -19,8 +23,8 @@ MainWindow::MainWindow(QWidget *parent) :
 | 
			
		||||
    //sleutelSlot0 = new SleutelSlot("cisco");
 | 
			
		||||
    //sleutelSlot1 = new SleutelSlot("cisco");
 | 
			
		||||
    deuren.emplace_back(std::shared_ptr<Deur> (new Schuifdeur(503,250,80,s1)));
 | 
			
		||||
    deuren[0]->addSlot(new SleutelSlot("cisco"));
 | 
			
		||||
    deuren[0]->addSlot(new SleutelSlot("cisco2"));
 | 
			
		||||
    deuren[0]->addSlot(new HerkenningsSlot(new Drukbox()));
 | 
			
		||||
    //deuren[0]->addSlot(new SleutelSlot("cisco2"));
 | 
			
		||||
    deuren.emplace_back(std::shared_ptr<Deur> (new draaideur(248,140,40,false)));
 | 
			
		||||
    deuren[1]->addSlot(new CodeSlot(1234));
 | 
			
		||||
    deuren[1]->addSlot(new CodeSlot(5678));
 | 
			
		||||
@@ -91,20 +95,33 @@ void MainWindow::on_d2_clicked(){
 | 
			
		||||
 | 
			
		||||
void MainWindow::on_lineEdit_returnPressed(){
 | 
			
		||||
    string eenSleutel = ui->lineEdit->text().toStdString();
 | 
			
		||||
    Slot* sleutelSlot0 = deuren[0]->geefSleutel(0);
 | 
			
		||||
    Slot* sleutelSlot1 = deuren[0]->geefSleutel(1);
 | 
			
		||||
    Slot* codeSlot0 = deuren[1]->geefSleutel(0);
 | 
			
		||||
    Slot* codeSlot1 = deuren[1]->geefSleutel(1);
 | 
			
		||||
    Slot* codeSlot2 = deuren[2]->geefSleutel(0);
 | 
			
		||||
    sleutelSlot0->ontgrendel(eenSleutel);
 | 
			
		||||
    sleutelSlot1->ontgrendel(eenSleutel);
 | 
			
		||||
    codeSlot0->ontgrendel(eenSleutel);
 | 
			
		||||
    codeSlot1->ontgrendel(eenSleutel);
 | 
			
		||||
    codeSlot2->ontgrendel(eenSleutel);
 | 
			
		||||
 | 
			
		||||
//    Slot* sleutelSlot0 = deuren[0]->geefSleutel(0);
 | 
			
		||||
//    Slot* sleutelSlot1 = deuren[0]->geefSleutel(1);
 | 
			
		||||
//    Slot* codeSlot0 = deuren[1]->geefSleutel(0);
 | 
			
		||||
//    Slot* codeSlot1 = deuren[1]->geefSleutel(1);
 | 
			
		||||
//    Slot* codeSlot2 = deuren[2]->geefSleutel(0);
 | 
			
		||||
//    sleutelSlot0->ontgrendel(eenSleutel);
 | 
			
		||||
//    sleutelSlot1->ontgrendel(eenSleutel);
 | 
			
		||||
//    codeSlot0->ontgrendel(eenSleutel);
 | 
			
		||||
//    codeSlot1->ontgrendel(eenSleutel);
 | 
			
		||||
//    codeSlot2->ontgrendel(eenSleutel);
 | 
			
		||||
    for(ulong i = 0; i < deuren.size(); i++) {
 | 
			
		||||
        std::list<Slot*> slotenDeur = deuren[i]->geefSlot();
 | 
			
		||||
        for (auto &j:slotenDeur)
 | 
			
		||||
            (*j).ontgrendel(ui->lineEdit->text().toStdString());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWindow::on_textBrowser_textChanged(){
 | 
			
		||||
    update();
 | 
			
		||||
void MainWindow::on_Allow_clicked(){
 | 
			
		||||
    Slot* a = deuren[0]->geefSleutel(0);
 | 
			
		||||
    HerkenningsSlot* b = dynamic_cast<HerkenningsSlot*>(a);
 | 
			
		||||
    b->voegAutorisatieToe(ui->HerkenningAdd->text().toStdString(), true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void MainWindow::on_Deny_clicked(){
 | 
			
		||||
    Slot* a = deuren[0]->geefSleutel(0);
 | 
			
		||||
    HerkenningsSlot* b = dynamic_cast<HerkenningsSlot*>(a);
 | 
			
		||||
    b->voegAutorisatieToe(ui->HerkenningAdd->text().toStdString(), false);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -8,12 +8,14 @@
 | 
			
		||||
namespace Ui {
 | 
			
		||||
class MainWindow;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class Hallsensor;
 | 
			
		||||
class Sensor;
 | 
			
		||||
class Schuifdeur;
 | 
			
		||||
class draaideur;
 | 
			
		||||
class Deur;
 | 
			
		||||
class SleutelSlot;
 | 
			
		||||
class HerkenningsSlot;
 | 
			
		||||
class Slot;
 | 
			
		||||
class MainWindow : public QMainWindow{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
@@ -27,8 +29,10 @@ private slots:
 | 
			
		||||
    void on_vd_clicked();
 | 
			
		||||
    void on_d1_clicked();
 | 
			
		||||
    void on_d2_clicked();
 | 
			
		||||
 | 
			
		||||
    void on_lineEdit_returnPressed();
 | 
			
		||||
    void on_Allow_clicked();
 | 
			
		||||
 | 
			
		||||
    void on_Deny_clicked();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    Ui::MainWindow *ui;
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@
 | 
			
		||||
   <rect>
 | 
			
		||||
    <x>0</x>
 | 
			
		||||
    <y>0</y>
 | 
			
		||||
    <width>670</width>
 | 
			
		||||
    <width>1171</width>
 | 
			
		||||
    <height>431</height>
 | 
			
		||||
   </rect>
 | 
			
		||||
  </property>
 | 
			
		||||
@@ -88,14 +88,60 @@
 | 
			
		||||
     </rect>
 | 
			
		||||
    </property>
 | 
			
		||||
   </widget>
 | 
			
		||||
   <widget class="QLineEdit" name="HerkenningAdd">
 | 
			
		||||
    <property name="geometry">
 | 
			
		||||
     <rect>
 | 
			
		||||
      <x>810</x>
 | 
			
		||||
      <y>10</y>
 | 
			
		||||
      <width>114</width>
 | 
			
		||||
      <height>30</height>
 | 
			
		||||
     </rect>
 | 
			
		||||
    </property>
 | 
			
		||||
   </widget>
 | 
			
		||||
   <widget class="QTextBrowser" name="textBrowser">
 | 
			
		||||
    <property name="geometry">
 | 
			
		||||
     <rect>
 | 
			
		||||
      <x>740</x>
 | 
			
		||||
      <y>180</y>
 | 
			
		||||
      <width>256</width>
 | 
			
		||||
      <height>192</height>
 | 
			
		||||
     </rect>
 | 
			
		||||
    </property>
 | 
			
		||||
   </widget>
 | 
			
		||||
   <widget class="QPushButton" name="Allow">
 | 
			
		||||
    <property name="geometry">
 | 
			
		||||
     <rect>
 | 
			
		||||
      <x>810</x>
 | 
			
		||||
      <y>60</y>
 | 
			
		||||
      <width>47</width>
 | 
			
		||||
      <height>31</height>
 | 
			
		||||
     </rect>
 | 
			
		||||
    </property>
 | 
			
		||||
    <property name="text">
 | 
			
		||||
     <string>Allow</string>
 | 
			
		||||
    </property>
 | 
			
		||||
   </widget>
 | 
			
		||||
   <widget class="QPushButton" name="Deny">
 | 
			
		||||
    <property name="geometry">
 | 
			
		||||
     <rect>
 | 
			
		||||
      <x>874</x>
 | 
			
		||||
      <y>60</y>
 | 
			
		||||
      <width>47</width>
 | 
			
		||||
      <height>31</height>
 | 
			
		||||
     </rect>
 | 
			
		||||
    </property>
 | 
			
		||||
    <property name="text">
 | 
			
		||||
     <string>Deny</string>
 | 
			
		||||
    </property>
 | 
			
		||||
   </widget>
 | 
			
		||||
  </widget>
 | 
			
		||||
  <widget class="QMenuBar" name="menuBar">
 | 
			
		||||
   <property name="geometry">
 | 
			
		||||
    <rect>
 | 
			
		||||
     <x>0</x>
 | 
			
		||||
     <y>0</y>
 | 
			
		||||
     <width>670</width>
 | 
			
		||||
     <height>27</height>
 | 
			
		||||
     <width>1171</width>
 | 
			
		||||
     <height>22</height>
 | 
			
		||||
    </rect>
 | 
			
		||||
   </property>
 | 
			
		||||
  </widget>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user