From e869379b247ea4f8044c53a1999ff0d7143fcba0 Mon Sep 17 00:00:00 2001 From: Liran BN Date: Mon, 20 Oct 2014 14:16:45 +0300 Subject: [PATCH 1/2] fix day checking at schedule --- main/mainscreen.cpp | 2 +- .../Calendar/coursesSchedule/calendarPage.cpp | 3 +-- .../coursesSchedule/calendarPageCourse.cpp | 5 ++++- .../coursesSchedule/calendarPageCourse.h | 1 + .../coursesSchedule/calendarSchedule.cpp | 21 +++++++++++-------- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/main/mainscreen.cpp b/main/mainscreen.cpp index 4acb76a..aa018b1 100644 --- a/main/mainscreen.cpp +++ b/main/mainscreen.cpp @@ -271,7 +271,7 @@ void MainScreen::on_getCalendarBtn_clicked() page = loginHandel->getCurrentPageContect(); calendar->setCalendar(page); - qDebug() << Q_FUNC_INFO << "calendar is loaded"; + qDebug() << Q_FUNC_INFO << "calendar is loaded. getting exam schedule"; //auto getting exam if (loginHandel->isLoggedInFlag()) diff --git a/src/jceData/Calendar/coursesSchedule/calendarPage.cpp b/src/jceData/Calendar/coursesSchedule/calendarPage.cpp index afc89f6..26e701f 100644 --- a/src/jceData/Calendar/coursesSchedule/calendarPage.cpp +++ b/src/jceData/Calendar/coursesSchedule/calendarPage.cpp @@ -6,10 +6,9 @@ */ void CalendarPage::setPage(QString html) { - courses.clear(); + courses.clear(); tempHtml = getString(html); calendarListInit(tempHtml); - } /** * @brief CalendarPage::calendarListInit - make an object from each line of course diff --git a/src/jceData/Calendar/coursesSchedule/calendarPageCourse.cpp b/src/jceData/Calendar/coursesSchedule/calendarPageCourse.cpp index b6b7fe8..f9e3026 100644 --- a/src/jceData/Calendar/coursesSchedule/calendarPageCourse.cpp +++ b/src/jceData/Calendar/coursesSchedule/calendarPageCourse.cpp @@ -113,7 +113,7 @@ int calendarCourse::getDay() const */ void calendarCourse::setDay(const QString &value) { - std::string dayTemp = value.toStdString().substr(0,2); //recieving two characters respresting days + QString dayTemp = value.mid(0,1); //recieving two characters respresting days if (dayTemp.compare("\u05D0") == 0) //alef day = 1; else if (dayTemp.compare("\u05D1") == 0) //bet @@ -127,7 +127,10 @@ void calendarCourse::setDay(const QString &value) else if (dayTemp.compare("\u05D5") == 0) //vav day = 6; else + { + qDebug() << "error on parsing day!"; day= -1; + } } QString calendarCourse::getRoom() const { diff --git a/src/jceData/Calendar/coursesSchedule/calendarPageCourse.h b/src/jceData/Calendar/coursesSchedule/calendarPageCourse.h index 35fb2d9..6f1f534 100644 --- a/src/jceData/Calendar/coursesSchedule/calendarPageCourse.h +++ b/src/jceData/Calendar/coursesSchedule/calendarPageCourse.h @@ -3,6 +3,7 @@ #include "../../course.h" #include +#include #define CALENDAR_COURSE_FIELDS 8 diff --git a/src/jceData/Calendar/coursesSchedule/calendarSchedule.cpp b/src/jceData/Calendar/coursesSchedule/calendarSchedule.cpp index 99afda7..ab89187 100644 --- a/src/jceData/Calendar/coursesSchedule/calendarSchedule.cpp +++ b/src/jceData/Calendar/coursesSchedule/calendarSchedule.cpp @@ -28,8 +28,9 @@ calendarSchedule::calendarSchedule(QWidget *parent) : QTableWidget(parent) setHorizontalHeaderLabels(days); setVerticalHeaderLabels(hours); setEditTriggers(QAbstractItemView::NoEditTriggers); - horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); - verticalHeader()->setSectionResizeMode(QHeaderView::Stretch); + + this->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); + this->resizeRowsToContents(); } @@ -47,8 +48,8 @@ void calendarSchedule::clearTableItems() for (j = 0; j < columnCount(); j++) if (this->takeItem(i,j) != NULL) delete this->takeItem(i,j); - horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); - verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); + this->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); + this->resizeRowsToContents(); } void calendarSchedule::insertCourseIntoTable() @@ -82,20 +83,22 @@ void calendarSchedule::insertCourseIntoTable() item = new QTableWidgetItem(courseString); + item->setToolTip(coursePtr->toString()); + if (this->takeItem(row,col) != NULL) + { delete this->takeItem(row,col); + } + this->setItem(row,col,item); +// qDebug() << "set row,col,item" << row << "," << col << "," << coursePtr->getSerialNum(); currentHour++; --blocksNumber; } - horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); - verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); } - - horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive); - verticalHeader()->setSectionResizeMode(QHeaderView::Interactive); + this->resizeRowsToContents(); } From 1eec1a9d5d9ba04a027c205a1d5a6dffb3d2d560 Mon Sep 17 00:00:00 2001 From: Liran BN Date: Tue, 21 Oct 2014 18:44:23 +0300 Subject: [PATCH 2/2] fixed hebrew character day bug on x64 --- .../coursesSchedule/calendarPageCourse.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/jceData/Calendar/coursesSchedule/calendarPageCourse.cpp b/src/jceData/Calendar/coursesSchedule/calendarPageCourse.cpp index f9e3026..0338057 100644 --- a/src/jceData/Calendar/coursesSchedule/calendarPageCourse.cpp +++ b/src/jceData/Calendar/coursesSchedule/calendarPageCourse.cpp @@ -113,18 +113,19 @@ int calendarCourse::getDay() const */ void calendarCourse::setDay(const QString &value) { - QString dayTemp = value.mid(0,1); //recieving two characters respresting days - if (dayTemp.compare("\u05D0") == 0) //alef + QString dayTemp = value.mid(0,1); //recieving character's respresting the day + QChar letter = (QString::fromWCharArray(&dayTemp.toStdWString().at(0)).at(0)); + if (letter.unicode() == 1488) //alef day = 1; - else if (dayTemp.compare("\u05D1") == 0) //bet + else if (letter.unicode() == 1489) //bet day = 2; - else if (dayTemp.compare("\u05D2") == 0) //gimel + else if (letter.unicode() == 1490) //gimel day = 3; - else if (dayTemp.compare("\u05D3") == 0) //dalet + else if (letter.unicode() == 1491) //dalet day = 4; - else if (dayTemp.compare("\u05D4") == 0) //hey + else if (letter.unicode() == 1492) //hey day = 5; - else if (dayTemp.compare("\u05D5") == 0) //vav + else if (letter.unicode() == 1493) //vav day = 6; else {