diff --git a/main/CalendarTab/CalendarManager.cpp b/main/CalendarTab/CalendarManager.cpp
index 3d6e043..174639b 100644
--- a/main/CalendarTab/CalendarManager.cpp
+++ b/main/CalendarTab/CalendarManager.cpp
@@ -3,28 +3,41 @@
CalendarManager::CalendarManager(calendarSchedule *ptr)
{
this->caliSchedPtr = ptr;
+ caliDialog = new CalendarDialog();
}
void CalendarManager::setCalendar(std::string html)
{
caliSchedPtr->setPage(html);
}
-void CalendarManager::exportCalendarCSV(CalendarDialog *calDialog)
+void CalendarManager::exportCalendarCSV()
{
- if(CSV_Exporter::exportCalendar(this->caliSchedPtr, calDialog))
+ QMessageBox msgBox;
+ int buttonClicked = caliDialog->exec();
+ if (buttonClicked == 0) //cancel?
+ return;
+ //calDialog.getStartDate(),calDialog.getEndDate()
+ if(caliDialog->ok())
{
- QMessageBox msgBox;
- msgBox.setText(QObject::tr("Exported Successfuly!"));
- msgBox.exec();
- }else
- {
- QMessageBox msgBox;
- msgBox.setIcon(QMessageBox::Critical);
- msgBox.setText(QObject::tr("
Something went wrong...
Maybe: - You Canceled
- Unable to save the File - try again
"
- "In case of a serious problem, please file a bug report.
thank you. OpenJCE teem"));
- msgBox.exec();
+ if(CSV_Exporter::exportCalendar(caliSchedPtr, caliDialog))
+ {
+ msgBox.setIcon(QMessageBox::Information);
+ msgBox.setText(QObject::tr("Exported Successfuly!"));
+ msgBox.exec();
+ }else
+ {
+ msgBox.setIcon(QMessageBox::Critical);
+ msgBox.setText(QObject::tr("Error on exporting. please check your file system."));
+ msgBox.exec();
+ }
}
+ else
+ {
+ msgBox.setIcon(QMessageBox::Critical);
+ msgBox.setText(QObject::tr("Dates not valid"));
+ msgBox.exec();
+ }
}
diff --git a/main/CalendarTab/CalendarManager.h b/main/CalendarTab/CalendarManager.h
index c9d56b8..20f4359 100644
--- a/main/CalendarTab/CalendarManager.h
+++ b/main/CalendarTab/CalendarManager.h
@@ -15,13 +15,15 @@ public:
~CalendarManager()
{
delete caliSchedPtr;
+ delete caliDialog;
}
- void exportCalendarCSV(CalendarDialog*);
+ void exportCalendarCSV();
void setCalendar(std::string html);
void resetTable() { if (caliSchedPtr != NULL) caliSchedPtr->clearTableItems(); }
private:
calendarSchedule * caliSchedPtr;
+ CalendarDialog * caliDialog;
};
diff --git a/main/mainscreen.cpp b/main/mainscreen.cpp
index 751e4b3..1d86a70 100644
--- a/main/mainscreen.cpp
+++ b/main/mainscreen.cpp
@@ -275,7 +275,9 @@ void MainScreen::on_getCalendarBtn_clicked()
void MainScreen::on_exportToCVSBtn_clicked()
{
if (loginHandel->isLoggedInFlag())
+ {
this->calendar->exportCalendarCSV();
+ }
}
//EVENTS ON MENU BAR
@@ -312,21 +314,7 @@ void MainScreen::on_actionHow_To_triggered()
}
-void MainScreen::on_exportToCVSBtn_clicked()
-{
- if (loginHandel->isLoggedInFlag())
- {
- CalendarDialog calDialog;
- int buttonClicked = calDialog.exec();
- if(buttonClicked == 0)
- return;
-//calDialog.getStartDate(),calDialog.getEndDate()
- if(calDialog.ok())
- this->calendar->exportCalendarCSV(&calDialog);
- else
- showMSG("Somthig was not right with the dates you have chosen... try again");
- }
-}
+
void MainScreen::on_actionHebrew_triggered()
{
diff --git a/main/mainscreen.cpp~ b/main/mainscreen.cpp~
deleted file mode 100644
index a18834a..0000000
--- a/main/mainscreen.cpp~
+++ /dev/null
@@ -1,408 +0,0 @@
-#include "mainscreen.h"
-#include "ui_mainscreen.h"
-
-
-MainScreen::MainScreen(QWidget *parent) :QMainWindow(parent), ui(new Ui::MainScreen)
-{
- ui->setupUi(this);
- //this->setFixedSize(this->size()); //main not resizeable
-
- //Login Tab
- QPixmap iconPix;
- iconPix.load(":/icons/iconX.png");
- ui->pswdLineEdit->setEchoMode((QLineEdit::Password));
- ui->labelUsrInputStatus->setVisible(false);
- ui->labelPswInputStatus->setVisible(false);
- ui->labelUsrInputStatus->setPixmap(iconPix);
- ui->labelPswInputStatus->setPixmap(iconPix);
-
- //Status Bar
- ui->statusBar->setStyleSheet("QStatusBar::item { border: 0px solid black };");
- ButtomStatusLabel = new QLabel(this);
- statusLabel = new QLabel(this);
- ui->statusBar->setMaximumSize(this->geometry().width(),StatusIconHeight);
- ui->statusBar->addPermanentWidget(ButtomStatusLabel,0);
- ui->statusBar->addPermanentWidget(statusLabel,1);
- setLabelConnectionStatus(jceLogin::jceStatus::JCE_NOT_CONNECTED);
-
- //Course, Setting, Calendar Tab
- calendarSchedule * calendarSchedulePtr = new calendarSchedule();
- ui->calendarGridLayoutMain->addWidget(calendarSchedulePtr);
- ui->CoursesTab->setDisabled(true);
- ui->avgLCD->setPalette(QPalette(QPalette::WindowText,Qt::blue));
-
- //Pointer allocating
- this->userLoginSetting = new user("","");
- this->courseTableMgr = new coursesTableManager(ui->coursesTable,userLoginSetting);
- this->loginHandel = new loginHandler(userLoginSetting);
- this->calendar = new CalendarManager(calendarSchedulePtr);
- this->data = new SaveData();
-
- //check login File
- if (data->isSaved())
- {
- ui->usrnmLineEdit->setText(data->getUsername());
- ui->pswdLineEdit->setText(data->getPassword());
- ui->keepLogin->setChecked(true);
- }
-
- //Local Check and ui setting.
- checkLocale();
-
-}
-
-MainScreen::~MainScreen()
-{
- delete ButtomStatusLabel;
- delete statusLabel;
- delete calendar;
- delete courseTableMgr;
- delete userLoginSetting;
- delete loginHandel;
- delete ui;
- delete data;
-}
-//EVENTS ON STATUS BAR
-void MainScreen::setLabelConnectionStatus(jceLogin::jceStatus statusDescription)
-{
- QPixmap iconPix;
- switch (statusDescription)
- {
- case jceLogin::jceStatus::JCE_START_VALIDATING_PROGRESS:
- iconPix.load(":/icons/blueStatusIcon.png");
- statusLabel->setText(tr("Connecting"));
- break;
- case jceLogin::jceStatus::JCE_YOU_ARE_IN:
- iconPix.load(":/icons/greenStatusIcon.png");
- statusLabel->setText(tr("Connected"));
- break;
- default:
- iconPix.load(":/icons/redStatusIcon.png");
- statusLabel->setText(tr("Disconnected"));
- break;
- }
- ButtomStatusLabel->setPixmap(iconPix);
-
- this->repaint();
-}
-//EVENTS ON LOGIN TAB
-void MainScreen::on_loginButton_clicked()
-{
- if (loginHandel->isLoggedInFlag())
- uiSetDisconnectMode();
- else
- uiSetConnectMode();
-}
-void MainScreen::on_keepLogin_clicked()
-{
- if (ui->keepLogin->isChecked())
- {
- data->setUsername(ui->usrnmLineEdit->text());
- data->setPassword(ui->pswdLineEdit->text());
- }
- else
- data->reset();
-}
-void MainScreen::on_usrnmLineEdit_editingFinished()
-{
- ui->usrnmLineEdit->setText(ui->usrnmLineEdit->text().toLower());
-}
-void MainScreen::uiSetDisconnectMode()
-{
- setLabelConnectionStatus(jceLogin::jceStatus::JCE_NOT_CONNECTED);
- ui->usrnmLineEdit->setText("");
- ui->pswdLineEdit->setText("");
- ui->usrnmLineEdit->setEnabled(true);
- ui->pswdLineEdit->setEnabled(true);
-
- loginHandel->makeDisconnectionRequest();
- ui->loginButton->setText(tr("&Login"));
- ui->getCalendarBtn->setDisabled(true);
- ui->exportToCVSBtn->setDisabled(true);
- ui->ratesButton->setDisabled(true);
- return;
-}
-void MainScreen::uiSetConnectMode()
-{
- string username;
- string password;
- if ((ui->usrnmLineEdit->text().isEmpty()) || (ui->pswdLineEdit->text().isEmpty()))
- {
- if (ui->usrnmLineEdit->text().isEmpty())
- {
- ui->labelUsrInputStatus->setVisible(true);
- qDebug() << "error, username input is empty";
- }
- else
- ui->labelUsrInputStatus->setVisible(false);
- if (ui->pswdLineEdit->text().isEmpty())
- {
- ui->labelPswInputStatus->setVisible(true);
- qDebug() << "error, password input is empty";
- }
- else
- ui->labelPswInputStatus->setVisible(false);
- return;
- }
- else
- {
- ui->labelUsrInputStatus->setVisible(false);
- ui->labelPswInputStatus->setVisible(false);
- }
- setLabelConnectionStatus(jceLogin::jceStatus::JCE_START_VALIDATING_PROGRESS);
-
- username = ui->usrnmLineEdit->text().toStdString();
- password = ui->pswdLineEdit->text().toStdString();
-
- ui->usrnmLineEdit->setDisabled(true);
- ui->pswdLineEdit->setDisabled(true);
-
- userLoginSetting->setUsername(username);
- userLoginSetting->setPassword(password);
-
- this->loginHandel->setPointers(statusLabel,ui->pswdLineEdit,ui->usrnmLineEdit);
- if (loginHandel->makeConnection() == true)
- {
- setLabelConnectionStatus(jceLogin::jceStatus::JCE_YOU_ARE_IN);
- ui->loginButton->setText(tr("&Logout"));
- ui->ratesButton->setEnabled(true);
- ui->CoursesTab->setEnabled(true);
- ui->exportToCVSBtn->setEnabled(true);
- ui->getCalendarBtn->setEnabled(true);
-
- }
- else
- {
- uiSetDisconnectMode();
- }
-}
-//EVENTS ON GPA TAB
-void MainScreen::on_ratesButton_clicked()
-{
- std::string pageString;
- int status = 0;
- if (loginHandel->isLoggedInFlag())
- {
- if ((status = loginHandel->makeGradeRequest(ui->spinBoxCoursesFromYear->value(),ui->spinBoxCoursesToYear->value(),ui->spinBoxCoursesFromSemester->value(),ui->spinBoxCoursesToSemester->value())) == jceLogin::JCE_GRADE_PAGE_PASSED)
- {
- pageString = loginHandel->getCurrentPageContect().toStdString();
- courseTableMgr->setCoursesList(pageString);
- courseTableMgr->insertJceCoursesIntoTable();
- }
- else if (status == jceLogin::JCE_NOT_CONNECTED)
- {
- QMessageBox::critical(this,tr("Error"),tr("Not Connected"));
- }
- }
-}
-void MainScreen::on_checkBoxCoursesInfluence_toggled(bool checked)
-{
- this->userLoginSetting->setInfluenceCourseOnly(checked);
- this->courseTableMgr->influnceCourseChanged(checked);
-}
-void MainScreen::on_spinBoxCoursesFromYear_editingFinished()
-{
- if (ui->spinBoxCoursesFromYear->value() > ui->spinBoxCoursesToYear->value())
- {
- ui->spinBoxCoursesFromYear->setValue(ui->spinBoxCoursesToYear->value());
- ui->spinBoxCoursesFromYear->setFocus();
- }
-
-}
-void MainScreen::on_spinBoxCoursesToYear_editingFinished()
-{
- if (ui->spinBoxCoursesFromYear->value() > ui->spinBoxCoursesToYear->value())
- {
- ui->spinBoxCoursesToYear->setValue(ui->spinBoxCoursesFromYear->value());
- ui->spinBoxCoursesToYear->setFocus();
-
- }
-}
-void MainScreen::on_spinBoxCoursesFromSemester_editingFinished()
-{
- if (ui->spinBoxCoursesFromYear->value() == ui->spinBoxCoursesToYear->value())
- {
- if (ui->spinBoxCoursesFromSemester->value() > ui->spinBoxCoursesToSemester->value())
- {
- ui->spinBoxCoursesFromSemester->setValue(ui->spinBoxCoursesToSemester->value());
- ui->spinBoxCoursesFromSemester->setFocus();
- }
- }
-}
-void MainScreen::on_spinBoxCoursesToSemester_editingFinished()
-{
- if (ui->spinBoxCoursesFromYear->value() == ui->spinBoxCoursesToYear->value())
- {
- if (ui->spinBoxCoursesFromSemester->value() > ui->spinBoxCoursesToSemester->value())
- {
- ui->spinBoxCoursesToSemester->setValue(ui->spinBoxCoursesFromSemester->value());
- ui->spinBoxCoursesToSemester->setFocus();
- }
- }
-}
-void MainScreen::on_coursesTable_itemChanged(QTableWidgetItem *item)
-{
- if (this->courseTableMgr->changes(item->text(),item->row(),item->column()))
- ui->avgLCD->display(courseTableMgr->getAvg());
- else
- QMessageBox::critical(this,tr("Error"),tr("Missmatching data"));
-}
-void MainScreen::on_clearTableButton_clicked()
-{
- courseTableMgr->clearTable();
- ui->avgLCD->display(courseTableMgr->getAvg());
-}
-//EVENTS ON CALENDAR TAB
-void MainScreen::on_getCalendarBtn_clicked()
-{
- int status = 0;
- if (loginHandel->isLoggedInFlag())
- {
- if ((status = loginHandel->makeCalendarRequest(ui->spinBoxYear->value(),ui->spinBoxSemester->value())) == jceLogin::JCE_GRADE_PAGE_PASSED)
- {
- //Use it for debug. add plain text and change the object name to 'plainTextEdit' so you will get the html request
- //ui->plainTextEdit->setPlainText(loginHandel->getCurrentPageContect());
- calendar->resetTable();
- calendar->setCalendar(loginHandel->getCurrentPageContect().toStdString());
- }
-
- else if (status == jceLogin::JCE_NOT_CONNECTED)
- {
- QMessageBox::critical(this,tr("Error"),tr("Not Connected"));
- }
- }
-}
-void MainScreen::on_exportToCVSBtn_clicked()
-{
- if (loginHandel->isLoggedInFlag())
- this->calendar->exportCalendarCSV();
-}
-
-//EVENTS ON MENU BAR
-void MainScreen::on_actionCredits_triggered()
-{
- QMessageBox::about(this, "About", tr("CREDITS-ROOL-UP1") + " v1.0
"
- + tr("CREDITS-ROOL-UP2")+"
GNU LESSER GENERAL PUBLIC LICENSE V2
"
- + tr("CREDITS-ROOL-UP3")+"
"
- "jceAverageCalculator Repository"
- "
"+tr("CREDITS-ROOL-UP4")+" Jce Connection
"
- +tr("DevBy")+":"
- "");
-}
-void MainScreen::on_actionExit_triggered()
-{
- exit(0);
-}
-void MainScreen::on_actionHow_To_triggered()
-{
- QMessageBox::information(this,"How To",
- "How To.."
- ""
- "
- "+tr("HELP1")+"
"
- "
- "+tr("HELP2")+"
"
- "
- "+tr("HELP3")+"
"
- "
- "+tr("HELP4")+"
"
- "
- "+tr("HELP5")+"
"
- "
"+tr("HELP6")+
- "
");
-
-}
-
-<<<<<<< HEAD
-//void MainScreen::on_pushButton_2_clicked()
-//{
-// if(CSV_Exporter::exportCalendar(this->calendar->getSch()))
-// {
-// QMessageBox msgBox;
-// msgBox.setText("Exported Successfuly!
HaazZaA!!");
-// msgBox.exec();
-// }else
-// {
-// QMessageBox msgBox;
-// msgBox.setIcon(QMessageBox::Critical);
-// msgBox.setText("Something went wrong...
Maybe: - You Canceled
- Unable to save the File - try again
"
-// "In case of a serious problem, please file a bug report.
thank you. OpenJCE teem");
-// msgBox.exec();
-// }
-//}
-
-void MainScreen::on_exportToCVSBtn_clicked()
-{
- if (loginHandel->isLoggedInFlag())
- {
- CalendarDialog calDialog;
- int buttonClicked = calDialog.exec();
- if(buttonClicked == 0)
- return;
-//calDialog.getStartDate(),calDialog.getEndDate()
- if(calDialog.ok())
- this->calendar->exportCalendarCSV(&calDialog);
- else
- showMSG("Somthig was not right with the dates you have chosen... try again");
- }
-}
-
-=======
->>>>>>> 834ee3469ee46960c2484d38ba86a00793de84cc
-void MainScreen::on_actionHebrew_triggered()
-{
- if (ui->actionEnglish->isChecked() || ui->actionOS_Default->isChecked())
- {
- ui->actionEnglish->setChecked(false);
- ui->actionOS_Default->setChecked(false);
- qDebug() << "Changed Language to hebrew";
- data->setLocal("he");
- QMessageBox::information(this,tr("Settings"),tr("Your settings will take effect next time you start the program"),QMessageBox::Ok);
- }
- else
- ui->actionHebrew->setChecked(true);
-}
-
-void MainScreen::on_actionEnglish_triggered()
-{
- if (ui->actionHebrew->isChecked() || ui->actionOS_Default->isChecked())
- {
- ui->actionHebrew->setChecked(false);
- ui->actionOS_Default->setChecked(false);
- qDebug() << "Changed Language to English";
- data->setLocal("en");
- QMessageBox::information(this,"Settings",tr("Your settings will take effect next time you start the program"),QMessageBox::Ok);
- }
- else
- ui->actionEnglish->setChecked(true);
-}
-
-
-void MainScreen::on_actionOS_Default_triggered()
-{
- if (ui->actionHebrew->isChecked() || ui->actionEnglish->isChecked())
- {
- ui->actionHebrew->setChecked(false);
- ui->actionEnglish->setChecked(false);
- qDebug() << "Changed Language to OS Default";
- data->setLocal("default");
- QMessageBox::information(this,tr("Settings"),tr("Your settings will take effect next time you start the program"),QMessageBox::Ok);
- }
- else
- ui->actionOS_Default->setChecked(true);
-}
-void MainScreen::checkLocale()
-{
- if(data->getLocal() == "en")
- {
- ui->actionHebrew->setChecked(false);
- ui->actionOS_Default->setChecked(false);
- ui->actionEnglish->setChecked(true);
- }else if(data->getLocal() == "he"){
- ui->actionHebrew->setChecked(true);
- ui->actionOS_Default->setChecked(false);
- ui->actionEnglish->setChecked(false);
- }else{
- ui->actionHebrew->setChecked(false);
- ui->actionOS_Default->setChecked(true);
- ui->actionEnglish->setChecked(false);
- }
-}
diff --git a/resources/AVG_LOGO.png b/resources/AVG_LOGO.png
deleted file mode 100644
index d315603..0000000
Binary files a/resources/AVG_LOGO.png and /dev/null differ
diff --git a/src/jceData/Calendar/calendardialog.cpp b/src/jceData/Calendar/calendardialog.cpp
index 75b6a26..7c4cd71 100644
--- a/src/jceData/Calendar/calendardialog.cpp
+++ b/src/jceData/Calendar/calendardialog.cpp
@@ -33,10 +33,6 @@ bool CalendarDialog::ok()
return this->isOK;
}
-
-
-
-
void CalendarDialog::on_calStart_clicked(const QDate &date)
{