diff --git a/main/CalendarTab/CalendarManager.cpp b/main/CalendarTab/CalendarManager.cpp index ac408a3..ec2816d 100644 --- a/main/CalendarTab/CalendarManager.cpp +++ b/main/CalendarTab/CalendarManager.cpp @@ -21,9 +21,9 @@ void CalendarManager::setExamsSchedule(QString html) examDialogPtr->initializingDataIntoTable(); examDialogPtr->show(); } -void CalendarManager::exportCalendarCSV() //need to add fix to the null pointer bug +void CalendarManager::exportCalendarCSV() { - if (this->caliSchedPtr->getCourses() == NULL) + if (this->caliSchedPtr->getCourses().isEmpty()) return; QMessageBox msgBox; int buttonClicked = caliDialog->exec(); diff --git a/src/jceData/CSV/csv_exporter.cpp b/src/jceData/CSV/csv_exporter.cpp index a79385c..aaa01f1 100644 --- a/src/jceData/CSV/csv_exporter.cpp +++ b/src/jceData/CSV/csv_exporter.cpp @@ -23,7 +23,7 @@ bool CSV_Exporter::exportCalendar(calendarSchedule *calSched, CalendarDialog *ca if ((cal == NULL) || (calSched == NULL)) //pointers checking! return false; - if (calSched->getCourses() == NULL) + if (calSched->getCourses().isEmpty()) return false; qDebug() << Q_FUNC_INFO << "Getting path for csv file from user..."; @@ -53,7 +53,7 @@ bool CSV_Exporter::exportCalendar(calendarSchedule *calSched, CalendarDialog *ca out << CSV_CALENDAR_HEADER << "\n"; // macro in header file - for (calendarCourse *coursePtr: *(calSched->getCourses())) //main loop - running though all courses + for (calendarCourse *coursePtr: (calSched->getCourses())) //main loop - running though all courses { // Getting course info - store in vars for easy access int day = coursePtr->getDay(); diff --git a/src/jceData/Calendar/Exams/examDialog.cpp b/src/jceData/Calendar/Exams/examDialog.cpp index eb7d076..a51a264 100644 --- a/src/jceData/Calendar/Exams/examDialog.cpp +++ b/src/jceData/Calendar/Exams/examDialog.cpp @@ -11,6 +11,8 @@ examDialog::examDialog(QWidget *parent, calendarExam *calSchedPtr) : QDialog(par headLine << tr("Serial") << tr("Course") << tr("Lecturer") << tr("Field") << tr("Type") << tr("First") << tr("Begin") << tr("Second") << tr("Begin"); + ui->tableWidget->verticalHeader()->setVisible(false); + ui->tableWidget->horizontalHeader()->setVisible(false); ui->tableWidget->setColumnCount(EXAM_SCHEDULE_FIELDS); ui->tableWidget->setHorizontalHeaderLabels(headLine); ui->tableWidget->setLayoutDirection(Qt::LayoutDirection::RightToLeft); @@ -29,7 +31,6 @@ void examDialog::initializingDataIntoTable() QTimeEdit *firstHourbegin; QDateEdit *secondDate; QTimeEdit *secondHourbegin; - for (calendarExamCourse * tempExam: *exams->getExams()) { j=0; @@ -44,8 +45,10 @@ void examDialog::initializingDataIntoTable() field = new QTableWidgetItem(); field->setData(Qt::EditRole, tempExam->getField()); firstDate = new QDateEdit(); + firstDate->setDisplayFormat("d/M/yy"); firstDate->setDate(tempExam->getFirstDate()); secondDate = new QDateEdit(); + secondDate->setDisplayFormat("d/M/yy"); secondDate->setDate(tempExam->getSecondDate()); firstHourbegin = new QTimeEdit(); firstHourbegin->setTime(tempExam->getFirstHourbegin()); @@ -66,6 +69,8 @@ void examDialog::initializingDataIntoTable() ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); ui->tableWidget->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); + this->setMinimumHeight(ui->tableWidget->height()); + this->setMinimumWidth(ui->tableWidget->width()); } examDialog::~examDialog() diff --git a/src/jceData/Calendar/Exams/examDialog.ui b/src/jceData/Calendar/Exams/examDialog.ui index 06fe26e..b35f23b 100644 --- a/src/jceData/Calendar/Exams/examDialog.ui +++ b/src/jceData/Calendar/Exams/examDialog.ui @@ -13,8 +13,8 @@ Dialog - - + + @@ -27,10 +27,10 @@ - + - + diff --git a/src/jceData/Calendar/coursesSchedule/calendarDialog.h b/src/jceData/Calendar/coursesSchedule/calendarDialog.h index 8d26ba0..52ca03f 100644 --- a/src/jceData/Calendar/coursesSchedule/calendarDialog.h +++ b/src/jceData/Calendar/coursesSchedule/calendarDialog.h @@ -18,6 +18,17 @@ namespace Ui { class CalendarDialog; } +/** + * @brief The CalendarDialog class + * + * This class preseting a Dialog with selection of dates + * The user has to choose between a starting point of semester to the end. + * + * This dialog main goal is to let the user an option to export his CSV + * containing data of his schedule. + * + * Made By Sagi Dayan, sagidayan@gmail.com On 22/09/2014 + */ class CalendarDialog : public QDialog { Q_OBJECT diff --git a/src/jceData/Calendar/coursesSchedule/calendarPage.cpp b/src/jceData/Calendar/coursesSchedule/calendarPage.cpp index 245912e..afc89f6 100644 --- a/src/jceData/Calendar/coursesSchedule/calendarPage.cpp +++ b/src/jceData/Calendar/coursesSchedule/calendarPage.cpp @@ -6,11 +6,7 @@ */ void CalendarPage::setPage(QString html) { - if (courses == NULL) - courses = new QList(); - else - courses->clear(); - + courses.clear(); tempHtml = getString(html); calendarListInit(tempHtml); @@ -33,7 +29,7 @@ void CalendarPage::calendarListInit(QString &linesTokinzedString) { calendarCourse *cTemp = lineToCourse(tempToken); if (cTemp != NULL) - this->courses->push_back(cTemp); + this->courses.push_back(cTemp); } } } diff --git a/src/jceData/Calendar/coursesSchedule/calendarPage.h b/src/jceData/Calendar/coursesSchedule/calendarPage.h index 65d5b0d..de1cf1e 100644 --- a/src/jceData/Calendar/coursesSchedule/calendarPage.h +++ b/src/jceData/Calendar/coursesSchedule/calendarPage.h @@ -8,17 +8,25 @@ #define ROOM_DEFAULT_STRING "nullRoom" #define LECTURER_DEFAULT_STRING "nullLecturer" +/** + * @brief The CalendarPage class + * + * This class generating html string to a list of calendarCourses + * Each item in a list is a course with its information (hour, day, name, serial and etc) + * + * Made By liran ben gida, LiranBG@gmail.com On 31/8/2014 + */ class CalendarPage : public Page { public: - QList *getCourses() { return courses; } + QList getCourses() { return courses; } protected: virtual void setPage(QString html); - CalendarPage() { courses = NULL; } + CalendarPage() { } private: @@ -27,7 +35,7 @@ private: calendarCourse * lineToCourse(QString line); QString tempHtml; - QList *courses; + QList courses; }; diff --git a/src/jceData/Calendar/coursesSchedule/calendarPageCourse.h b/src/jceData/Calendar/coursesSchedule/calendarPageCourse.h index 1a2929b..9cf4f18 100644 --- a/src/jceData/Calendar/coursesSchedule/calendarPageCourse.h +++ b/src/jceData/Calendar/coursesSchedule/calendarPageCourse.h @@ -6,6 +6,17 @@ #define CALENDAR_COURSE_FIELDS 8 +/** + * @brief The calendarCourse class + * + * This class holds each scheduled course + * the course scheme can be found below, inside the enum CourseScheme + * + * The class's constructor gets the data and manipulate it into an object + * with its relevant information. + * + * Made By liran ben gida, LiranBG@gmail.com On 31/8/2014 + */ class calendarCourse : public Course { public: diff --git a/src/jceData/Calendar/coursesSchedule/calendarSchedule.cpp b/src/jceData/Calendar/coursesSchedule/calendarSchedule.cpp index 7850984..89f6216 100644 --- a/src/jceData/Calendar/coursesSchedule/calendarSchedule.cpp +++ b/src/jceData/Calendar/coursesSchedule/calendarSchedule.cpp @@ -59,7 +59,7 @@ void calendarSchedule::insertCourseIntoTable() QString courseString; int currentHour,currentDay,blocksNumber; int row,col; - for (calendarCourse *coursePtr: *getCourses()) + for (calendarCourse *coursePtr: getCourses()) { courseString = ""; currentHour = coursePtr->getHourBegin(); diff --git a/src/jceData/Calendar/coursesSchedule/calendarSchedule.h b/src/jceData/Calendar/coursesSchedule/calendarSchedule.h index cf6f948..ddaa48b 100644 --- a/src/jceData/Calendar/coursesSchedule/calendarSchedule.h +++ b/src/jceData/Calendar/coursesSchedule/calendarSchedule.h @@ -12,6 +12,14 @@ #define HOURS_END 20 #define ACADEMIN_HOUR 45 +/** + * @brief The calendarSchedule class + * + * This class combining the courses schedule with each course into a table + * setpage -> insertingIntoTable -> showing data + * + * Made By liran ben gida, LiranBG@gmail.com On 31/8/2014 + */ class calendarSchedule : public QTableWidget, public CalendarPage { Q_OBJECT