using refs, change exam qdate format
This commit is contained in:
parent
65c23138e5
commit
054237a667
|
@ -21,9 +21,9 @@ void CalendarManager::setExamsSchedule(QString html)
|
||||||
examDialogPtr->initializingDataIntoTable();
|
examDialogPtr->initializingDataIntoTable();
|
||||||
examDialogPtr->show();
|
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;
|
return;
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
int buttonClicked = caliDialog->exec();
|
int buttonClicked = caliDialog->exec();
|
||||||
|
|
|
@ -23,7 +23,7 @@ bool CSV_Exporter::exportCalendar(calendarSchedule *calSched, CalendarDialog *ca
|
||||||
if ((cal == NULL) || (calSched == NULL)) //pointers checking!
|
if ((cal == NULL) || (calSched == NULL)) //pointers checking!
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (calSched->getCourses() == NULL)
|
if (calSched->getCourses().isEmpty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
qDebug() << Q_FUNC_INFO << "Getting path for csv file from user...";
|
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
|
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
|
// Getting course info - store in vars for easy access
|
||||||
int day = coursePtr->getDay();
|
int day = coursePtr->getDay();
|
||||||
|
|
|
@ -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");
|
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->setColumnCount(EXAM_SCHEDULE_FIELDS);
|
||||||
ui->tableWidget->setHorizontalHeaderLabels(headLine);
|
ui->tableWidget->setHorizontalHeaderLabels(headLine);
|
||||||
ui->tableWidget->setLayoutDirection(Qt::LayoutDirection::RightToLeft);
|
ui->tableWidget->setLayoutDirection(Qt::LayoutDirection::RightToLeft);
|
||||||
|
@ -29,7 +31,6 @@ void examDialog::initializingDataIntoTable()
|
||||||
QTimeEdit *firstHourbegin;
|
QTimeEdit *firstHourbegin;
|
||||||
QDateEdit *secondDate;
|
QDateEdit *secondDate;
|
||||||
QTimeEdit *secondHourbegin;
|
QTimeEdit *secondHourbegin;
|
||||||
|
|
||||||
for (calendarExamCourse * tempExam: *exams->getExams())
|
for (calendarExamCourse * tempExam: *exams->getExams())
|
||||||
{
|
{
|
||||||
j=0;
|
j=0;
|
||||||
|
@ -44,8 +45,10 @@ void examDialog::initializingDataIntoTable()
|
||||||
field = new QTableWidgetItem();
|
field = new QTableWidgetItem();
|
||||||
field->setData(Qt::EditRole, tempExam->getField());
|
field->setData(Qt::EditRole, tempExam->getField());
|
||||||
firstDate = new QDateEdit();
|
firstDate = new QDateEdit();
|
||||||
|
firstDate->setDisplayFormat("d/M/yy");
|
||||||
firstDate->setDate(tempExam->getFirstDate());
|
firstDate->setDate(tempExam->getFirstDate());
|
||||||
secondDate = new QDateEdit();
|
secondDate = new QDateEdit();
|
||||||
|
secondDate->setDisplayFormat("d/M/yy");
|
||||||
secondDate->setDate(tempExam->getSecondDate());
|
secondDate->setDate(tempExam->getSecondDate());
|
||||||
firstHourbegin = new QTimeEdit();
|
firstHourbegin = new QTimeEdit();
|
||||||
firstHourbegin->setTime(tempExam->getFirstHourbegin());
|
firstHourbegin->setTime(tempExam->getFirstHourbegin());
|
||||||
|
@ -66,6 +69,8 @@ void examDialog::initializingDataIntoTable()
|
||||||
ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||||
ui->tableWidget->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
ui->tableWidget->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||||
|
|
||||||
|
this->setMinimumHeight(ui->tableWidget->height());
|
||||||
|
this->setMinimumWidth(ui->tableWidget->width());
|
||||||
|
|
||||||
}
|
}
|
||||||
examDialog::~examDialog()
|
examDialog::~examDialog()
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>Dialog</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item>
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||||
|
@ -27,10 +27,10 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="1" column="0">
|
||||||
<widget class="QTableWidget" name="tableWidget"/>
|
<widget class="QTableWidget" name="tableWidget"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="2" column="0">
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
|
|
@ -18,6 +18,17 @@ namespace Ui {
|
||||||
class CalendarDialog;
|
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
|
class CalendarDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
|
@ -6,11 +6,7 @@
|
||||||
*/
|
*/
|
||||||
void CalendarPage::setPage(QString html)
|
void CalendarPage::setPage(QString html)
|
||||||
{
|
{
|
||||||
if (courses == NULL)
|
courses.clear();
|
||||||
courses = new QList<calendarCourse*>();
|
|
||||||
else
|
|
||||||
courses->clear();
|
|
||||||
|
|
||||||
tempHtml = getString(html);
|
tempHtml = getString(html);
|
||||||
calendarListInit(tempHtml);
|
calendarListInit(tempHtml);
|
||||||
|
|
||||||
|
@ -33,7 +29,7 @@ void CalendarPage::calendarListInit(QString &linesTokinzedString)
|
||||||
{
|
{
|
||||||
calendarCourse *cTemp = lineToCourse(tempToken);
|
calendarCourse *cTemp = lineToCourse(tempToken);
|
||||||
if (cTemp != NULL)
|
if (cTemp != NULL)
|
||||||
this->courses->push_back(cTemp);
|
this->courses.push_back(cTemp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,17 +8,25 @@
|
||||||
#define ROOM_DEFAULT_STRING "nullRoom"
|
#define ROOM_DEFAULT_STRING "nullRoom"
|
||||||
#define LECTURER_DEFAULT_STRING "nullLecturer"
|
#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
|
class CalendarPage : public Page
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
QList<calendarCourse*> *getCourses() { return courses; }
|
QList<calendarCourse*> getCourses() { return courses; }
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void setPage(QString html);
|
virtual void setPage(QString html);
|
||||||
CalendarPage() { courses = NULL; }
|
CalendarPage() { }
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -27,7 +35,7 @@ private:
|
||||||
calendarCourse * lineToCourse(QString line);
|
calendarCourse * lineToCourse(QString line);
|
||||||
|
|
||||||
QString tempHtml;
|
QString tempHtml;
|
||||||
QList<calendarCourse*> *courses;
|
QList<calendarCourse*> courses;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,17 @@
|
||||||
|
|
||||||
#define CALENDAR_COURSE_FIELDS 8
|
#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
|
class calendarCourse : public Course
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -59,7 +59,7 @@ void calendarSchedule::insertCourseIntoTable()
|
||||||
QString courseString;
|
QString courseString;
|
||||||
int currentHour,currentDay,blocksNumber;
|
int currentHour,currentDay,blocksNumber;
|
||||||
int row,col;
|
int row,col;
|
||||||
for (calendarCourse *coursePtr: *getCourses())
|
for (calendarCourse *coursePtr: getCourses())
|
||||||
{
|
{
|
||||||
courseString = "";
|
courseString = "";
|
||||||
currentHour = coursePtr->getHourBegin();
|
currentHour = coursePtr->getHourBegin();
|
||||||
|
|
|
@ -12,6 +12,14 @@
|
||||||
#define HOURS_END 20
|
#define HOURS_END 20
|
||||||
#define ACADEMIN_HOUR 45
|
#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
|
class calendarSchedule : public QTableWidget, public CalendarPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
Loading…
Reference in a new issue