-
Notifications
You must be signed in to change notification settings - Fork 0
Absence edit #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Absence edit #76
Changes from 17 commits
b93524a
cc46e0d
1bebf2f
ea44a02
94b33e5
f0c14c0
2b4fee6
57b7545
8189d49
8334c6f
f3aed82
a9c3fd3
854351e
d2b97c3
df1aada
40bad53
f927f81
9fec5b9
615953d
1998022
7c90652
11c90fc
c1a0f2b
2d864d6
b318dfd
c005cfa
1d6bc3e
69d97f7
c51de3b
103fde3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,129 +1,81 @@ | ||
#include "coordinator.hpp" | ||
#include "absencewindow.hpp" | ||
#include "BackendlessQt/StandardNetworkManager.hpp" | ||
#include "httpclient.hpp" | ||
#include "menubar.hpp" | ||
#include <QObject> | ||
|
||
Coordinator::Coordinator(QObject *parent) : QObject(parent) { | ||
myWindow = new SignInScreen(); | ||
myWindow2 = new registerscreen(); | ||
myWindow3 = new Schedule(); | ||
signInWindow = new SignInScreen(); | ||
registerWindow = new registerscreen(); | ||
popUpWindow = new settingsWindow(); | ||
menuWin = new menuWindow(); | ||
gradeWin = new gradesWindow(); | ||
abscWin = new absenceWindow(); | ||
//abscWin = QSharedPointer<absenceWindow>(new absenceWindow, &QObject::deleteLater); | ||
absencePopUp = new inputAbsence(); | ||
|
||
QObject::connect(abscWin, &absenceWindow::scheduleAbsenceOpened, this, [&](){ | ||
emit scheduleAbsenceSend(); | ||
}); | ||
windows[Screen::SignIn] = signInWindow; | ||
windows[Screen::Register] = registerWindow; | ||
windows[Screen::Settings] = popUpWindow; | ||
windows[Screen::Absence] = abscWin; | ||
windows[Screen::Grades] = gradeWin; | ||
windows[Screen::InputAbsence] = absencePopUp; | ||
|
||
QObject::connect(abscWin.get(), &absenceWindow::scheduleAbsenceOpened, this, &Coordinator::sendScheduleAbsence); | ||
} | ||
|
||
Coordinator::~Coordinator() {} | ||
|
||
void Coordinator::showSignInScreen() { | ||
/*if (!signInScreen) { | ||
signInScreen = new SignInScreen(); | ||
QObject::connect(signInScreen, &SignInScreen::goToMenu, this, []() { | ||
auto coordinator = static_cast<Coordinator*>(QObject::sender()->parent()); | ||
coordinator->showMenuWindow(); | ||
coordinator->signInScreen->hide(); | ||
}); | ||
}*/ | ||
myWindow->show(); | ||
hideAllScreens(Screen::SignIn); | ||
} | ||
|
||
|
||
void Coordinator::showMenuWindow() { | ||
if (!menuWin) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @VWasser Found out that this code was never called. Why? Because |
||
menuWin = new ::menuWindow(); | ||
QObject::connect(menuWin, &menuWindow::absencePressed, this, [this]() { | ||
auto coordinator = static_cast<Coordinator*>(QObject::sender()->parent()); | ||
coordinator->showAbsenceWindow(); | ||
coordinator->menuWin->hide(); | ||
}); | ||
QObject::connect(menuWin, &menuWindow::gradesPressed, this, [this]() { | ||
auto coordinator = static_cast<Coordinator*>(QObject::sender()->parent()); | ||
coordinator->showGradesWindow(); | ||
coordinator->menuWin->hide(); | ||
}); | ||
QObject::connect(menuWin, &menuWindow::settingsPressed, this, [this]() { | ||
auto coordinator = static_cast<Coordinator*>(QObject::sender()->parent()); | ||
coordinator->showSettingsWindow(); | ||
coordinator->menuWin->hide(); | ||
}); | ||
menuWin = new menuWindow(); | ||
windows[Screen::Menu] = menuWin; | ||
} | ||
menuWin->show(); | ||
hideAllScreens(Screen::Menu); | ||
} | ||
|
||
void Coordinator::showAbsenceWindow() { | ||
/*if (!absenceWindow) { | ||
absenceWindow = new ::absenceWindow(); | ||
QObject::connect(absenceWindow, &AbsenceWindow::goBackToMenu, this, [this]() { | ||
auto coordinator = static_cast<Coordinator*>(QObject::sender()->parent()); | ||
coordinator->showMenuWindow(); | ||
coordinator->absenceWindow->hide(); | ||
}); | ||
}*/ | ||
abscWin->show(); | ||
hideAllScreens(Screen::Absence); | ||
} | ||
|
||
void Coordinator::showGradesWindow() { | ||
/*if (!gradesWindow) { | ||
gradesWindow = new GradesWindow(); | ||
QObject::connect(gradesWindow, &GradesWindow::goBackToMenu, this, []() { | ||
auto coordinator = static_cast<Coordinator*>(QObject::sender()->parent()); | ||
coordinator->showMenuWindow(); | ||
coordinator->gradesWindow->hide(); | ||
}); | ||
}*/ | ||
gradeWin->show(); | ||
hideAllScreens(Screen::Grades); | ||
} | ||
|
||
void Coordinator::showInputAbsence() { | ||
/*if (!inputAbsence) { | ||
inputAbsence = new InputAbsence(); | ||
QObject::connect(inputAbsence, &InputAbsence::goBackToAbsence, this, []() { | ||
auto coordinator = static_cast<Coordinator*>(QObject::sender()->parent()); | ||
coordinator->showAbsenceWindow(); | ||
coordinator->inputAbsence->hide(); | ||
}); | ||
}*/ | ||
absencePopUp->show(); | ||
hideAllScreens(Screen::InputAbsence); | ||
} | ||
|
||
void Coordinator::showRegisterScreen() { | ||
/*if (!registerScreen) { | ||
registerScreen = new RegisterScreen(); | ||
QObject::connect(registerScreen, &RegisterScreen::goBackToSignIn, this, []() { | ||
auto coordinator = static_cast<Coordinator*>(QObject::sender()->parent()); | ||
coordinator->showSignInScreen(); | ||
coordinator->registerScreen->hide(); | ||
}); | ||
}*/ | ||
myWindow2->show(); | ||
hideAllScreens(Screen::Register); | ||
} | ||
|
||
void Coordinator::showSettingsWindow() { | ||
/*if (!settingsWindow) { | ||
settingsWindow = new SettingsWindow(); | ||
QObject::connect(settingsWindow, &SettingsWindow::goBackToMenu, this, []() { | ||
auto coordinator = static_cast<Coordinator*>(QObject::sender()->parent()); | ||
coordinator->showMenuWindow(); | ||
coordinator->settingsWindow->hide(); | ||
}); | ||
}*/ | ||
popUpWindow->show(); | ||
hideAllScreens(Screen::Settings); | ||
} | ||
|
||
void Coordinator::showSchedule() { | ||
/*if (!schedule) { | ||
schedule = new Schedule(); | ||
QObject::connect(schedule, &Schedule::goBackToMenu, this, []() { | ||
auto coordinator = static_cast<Coordinator*>(QObject::sender()->parent()); | ||
coordinator->showMenuWindow(); | ||
coordinator->schedule->hide(); | ||
}); | ||
}*/ | ||
myWindow3->show(); | ||
if (!scheduleWindow) { | ||
scheduleWindow = new Schedule(); | ||
windows[Screen::Schedule] = scheduleWindow; | ||
} | ||
hideAllScreens(Screen::Schedule); | ||
} | ||
void Coordinator::hideAllScreens(Screen exeption){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @VWasser Any questions regarding this function? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. well, nor really, just maybe if there is a way to print out the name of enum elemet so i dont have to print out its adress in the debug SHOWING/HIDING. |
||
for(auto i = windows.begin(); i != windows.end(); ++i ){ | ||
if(i.key() == exeption){ | ||
i.value()->show(); | ||
qDebug() << "SHOWING" << &i.key(); | ||
}else if(i.key() != exeption){ | ||
i.value()->hide(); | ||
qDebug()<< "HIDING" << &i.key(); | ||
} | ||
} | ||
} | ||
void Coordinator::implementMenuBar(QBoxLayout *layout){ | ||
auto bar = new menuBar(); | ||
bar->menuBarStup(layout); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
#include "gradeswindow.hpp" | ||
#include "coordinator.hpp" | ||
|
||
gradesWindow::gradesWindow(QWidget *parent):QWidget(parent) {} | ||
extern Coordinator *coordinator; | ||
|
||
gradesWindow::gradesWindow(QWidget *parent):QWidget(parent) { | ||
coordinator->implementMenuBar(mainLayout); | ||
setLayout(mainLayout); | ||
|
||
} | ||
|
||
|
||
gradesWindow::~gradesWindow(){} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,33 @@ | ||
#include "inputabsence.hpp" | ||
#include "coordinator.hpp" | ||
|
||
inputAbsence::inputAbsence(QWidget *parent): QWidget(parent) {} | ||
extern Coordinator *coordinator; | ||
|
||
inputAbsence::inputAbsence(QWidget *parent): QWidget(parent) { | ||
|
||
QObject::connect(addAbsence, &QPushButton::clicked,this, [](){ | ||
coordinator->showSchedule(); | ||
}); | ||
|
||
setLayout(mainLayout); | ||
nameLine->addWidget(nameLabel); | ||
nameLine->addWidget(nameBox); | ||
|
||
dateLine->addWidget(dateLabel); | ||
dateLine->addWidget(dateBox); | ||
|
||
classLine->addWidget(classLabel); | ||
classLine->addWidget(classBox); | ||
|
||
dayAndHourLine->addWidget(dayAndHourLabel); | ||
dayAndHourLine->addWidget(dayBox); | ||
dayAndHourLine->addWidget(hourBox); | ||
|
||
mainLayout->addLayout(nameLine); | ||
mainLayout->addLayout(dateLine); | ||
mainLayout->addLayout(classLine); | ||
mainLayout->addLayout(dayAndHourLine); | ||
mainLayout->addWidget(addAbsence); | ||
|
||
} | ||
inputAbsence::~inputAbsence(){} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, looks cool