Added CSV on linux, mac, windows
This commit is contained in:
parent
4fa27283d9
commit
235354210b
|
@ -9,8 +9,22 @@ void CalendarManager::setCalendar(std::string html)
|
|||
{
|
||||
caliSchedPtr->setPage(html);
|
||||
}
|
||||
|
||||
calendarSchedule *CalendarManager::getSch()
|
||||
void CalendarManager::exportCalendarCSV()
|
||||
{
|
||||
return this->caliSchedPtr;
|
||||
if(CSV_Exporter::exportCalendar(this->caliSchedPtr))
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("<center>Exported Successfuly!<br><b>HaazZaA!!");
|
||||
msgBox.exec();
|
||||
}else
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setIcon(QMessageBox::Critical);
|
||||
msgBox.setText("<center>Something went wrong...<br></center>Maybe: <ul><li>You Canceled</li><li>Unable to save the File - try again</li></ul><br><br>"
|
||||
"<b><center>In case of a serious problem, please file a bug report.<br>thank you. OpenJCE teem");
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
|
||||
#include "./src/jceData/Calendar/calendarPage.h"
|
||||
#include "./src/jceData/Calendar/calendarSchedule.h"
|
||||
#include "./src/jceData/CSV/csv_exporter.h"
|
||||
#include <iostream>
|
||||
#include <QMessageBox>
|
||||
|
||||
class CalendarManager
|
||||
{
|
||||
|
@ -13,10 +15,10 @@ public:
|
|||
{
|
||||
delete caliSchedPtr;
|
||||
}
|
||||
|
||||
void exportCalendarCSV();
|
||||
void setCalendar(std::string html);
|
||||
void resetTable() { if (caliSchedPtr != NULL) caliSchedPtr->clearTableItems(); }
|
||||
calendarSchedule* getSch();
|
||||
|
||||
private:
|
||||
calendarSchedule * caliSchedPtr;
|
||||
};
|
||||
|
|
|
@ -85,7 +85,11 @@ bool loginHandler::makeConnection()
|
|||
|
||||
bool loginHandler::isLoggedInFlag()
|
||||
{
|
||||
if (jceLog->isLoginFlag()) //checking connection and then if logged in
|
||||
return this->logggedInFlag;
|
||||
else
|
||||
this->setLoginFlag(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
void loginHandler::setLoginFlag(bool flag)
|
||||
|
|
|
@ -13,6 +13,7 @@ MainScreen::MainScreen(QWidget *parent) :QMainWindow(parent), ui(new Ui::MainScr
|
|||
ui->pswdLineEdit->setEchoMode((QLineEdit::Password));
|
||||
|
||||
//Status Bar
|
||||
ui->actionEnglish->setChecked(true);
|
||||
ui->statusBar->setStyleSheet("QStatusBar::item { border: 0px solid black };");
|
||||
ButtomStatusLabel = new QLabel(this);
|
||||
statusLabel = new QLabel(this);
|
||||
|
@ -65,7 +66,7 @@ void MainScreen::on_loginButton_clicked()
|
|||
uiSetConnectMode();
|
||||
|
||||
}
|
||||
void MainScreen::on_pushButton_clicked()
|
||||
void MainScreen::on_getCalendarBtn_clicked()
|
||||
{
|
||||
int status = 0;
|
||||
if (loginHandel->isLoggedInFlag())
|
||||
|
@ -174,7 +175,9 @@ void MainScreen::uiSetDisconnectMode()
|
|||
|
||||
loginHandel->makeDisconnectionRequest();
|
||||
ui->loginButton->setText("&Login");
|
||||
this->ui->ratesButton->setDisabled(true);
|
||||
ui->getCalendarBtn->setDisabled(true);
|
||||
ui->exportToCVSBtn->setDisabled(true);
|
||||
ui->ratesButton->setDisabled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -203,8 +206,10 @@ void MainScreen::uiSetConnectMode() //fix before distrbute
|
|||
{
|
||||
setLabelConnectionStatus(jceLogin::jceStatus::JCE_YOU_ARE_IN);
|
||||
ui->loginButton->setText("&Logout");
|
||||
this->ui->ratesButton->setEnabled(true);
|
||||
ui->ratesButton->setEnabled(true);
|
||||
ui->CoursesTab->setEnabled(true);
|
||||
ui->exportToCVSBtn->setEnabled(true);
|
||||
ui->getCalendarBtn->setEnabled(true);
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -246,10 +251,6 @@ void MainScreen::on_actionCredits_triggered()
|
|||
"<ul>"
|
||||
"<li><a href='mailto:liranbg@gmail.com'>"+tr("Liran")+"</a></li>"
|
||||
"<li><a href='mailto:sagidayan@gmail.com'>"+tr("Sagi")+"</a></li>"
|
||||
"</ul>"
|
||||
+tr("Tnks")+ "... :"
|
||||
"<ul>"
|
||||
"<li><a href='mailto:nadav2051@gmail.com'>"+tr("Nadav")+"</a></li>"
|
||||
"</ul>");
|
||||
}
|
||||
|
||||
|
@ -292,19 +293,64 @@ void MainScreen::on_actionHow_To_triggered()
|
|||
|
||||
}
|
||||
|
||||
void MainScreen::on_pushButton_2_clicked()
|
||||
//void MainScreen::on_pushButton_2_clicked()
|
||||
//{
|
||||
// if(CSV_Exporter::exportCalendar(this->calendar->getSch()))
|
||||
// {
|
||||
// QMessageBox msgBox;
|
||||
// msgBox.setText("<center>Exported Successfuly!<br><b>HaazZaA!!");
|
||||
// msgBox.exec();
|
||||
// }else
|
||||
// {
|
||||
// QMessageBox msgBox;
|
||||
// msgBox.setIcon(QMessageBox::Critical);
|
||||
// msgBox.setText("<center>Something went wrong...<br></center>Maybe: <ul><li>You Canceled</li><li>Unable to save the File - try again</li></ul><br><br>"
|
||||
// "<b><center>In case of a serious problem, please file a bug report.<br>thank you. OpenJCE teem");
|
||||
// msgBox.exec();
|
||||
// }
|
||||
//}
|
||||
|
||||
void MainScreen::on_exportToCVSBtn_clicked()
|
||||
{
|
||||
if(CSV_Exporter::exportCalendar(this->calendar->getSch()))
|
||||
if (loginHandel->isLoggedInFlag())
|
||||
this->calendar->exportCalendarCSV();
|
||||
}
|
||||
|
||||
void MainScreen::on_actionHebrew_triggered()
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("<center>Exported Successfuly!<br><b>HaazZaA!!");
|
||||
msgBox.exec();
|
||||
}else
|
||||
if (ui->actionEnglish->isChecked())
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setIcon(QMessageBox::Critical);
|
||||
msgBox.setText("<center>Something went wrong...<br></center>Maybe: <ul><li>You Canceled</li><li>Unable to save the File - try again</li></ul><br><br>"
|
||||
"<b><center>In case of a serious problem, please file a bug report.<br>thank you. OpenJCE teem");
|
||||
msgBox.exec();
|
||||
ui->actionEnglish->setChecked(false);
|
||||
qDebug() << "Changed Language";
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->actionHebrew->setChecked(true);
|
||||
qDebug() << "Set Hebrew Language: ";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void MainScreen::on_actionEnglish_triggered()
|
||||
{
|
||||
if (ui->actionHebrew->isChecked())
|
||||
{
|
||||
ui->actionHebrew->setChecked(false);
|
||||
qDebug() << "Changed Language";
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->actionEnglish->setChecked(true);
|
||||
qDebug() << "Set English Language: ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "./CourseTab/coursestablemanager.h"
|
||||
#include "./LoginTab/loginhandler.h"
|
||||
#include "./CalendarTab/CalendarManager.h"
|
||||
#include "../src/jceData/CSV/csv_exporter.h"
|
||||
|
||||
|
||||
#define StatusIconHeight 35
|
||||
namespace Ui {
|
||||
|
@ -56,11 +56,15 @@ private slots:
|
|||
|
||||
void on_actionHow_To_triggered();
|
||||
|
||||
void on_pushButton_clicked();
|
||||
void on_getCalendarBtn_clicked();
|
||||
|
||||
void on_checkBoxCoursesInfluence_toggled(bool checked);
|
||||
|
||||
void on_pushButton_2_clicked();
|
||||
void on_exportToCVSBtn_clicked();
|
||||
|
||||
void on_actionHebrew_triggered();
|
||||
|
||||
void on_actionEnglish_triggered();
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -582,14 +582,14 @@ font-size: 15px;
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<widget class="QPushButton" name="getCalendarBtn">
|
||||
<property name="text">
|
||||
<string>Get Calendar</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<widget class="QPushButton" name="exportToCVSBtn">
|
||||
<property name="text">
|
||||
<string>Export to CSV</string>
|
||||
</property>
|
||||
|
@ -626,14 +626,21 @@ font-size: 15px;
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>855</width>
|
||||
<height>29</height>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuA_about">
|
||||
<property name="title">
|
||||
<string>&About</string>
|
||||
</property>
|
||||
<addaction name="actionHow_To"/>
|
||||
<widget class="QMenu" name="menuLanguage">
|
||||
<property name="title">
|
||||
<string>Language</string>
|
||||
</property>
|
||||
<addaction name="actionHebrew"/>
|
||||
<addaction name="actionEnglish"/>
|
||||
</widget>
|
||||
<addaction name="menuLanguage"/>
|
||||
<addaction name="actionCredits"/>
|
||||
<addaction name="actionExit"/>
|
||||
</widget>
|
||||
|
@ -663,9 +670,20 @@ font-size: 15px;
|
|||
<string>Exit</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionHow_To">
|
||||
<action name="actionHebrew">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>How-To</string>
|
||||
<string>hebrew</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEnglish">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>English</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
|
|
|
@ -40,8 +40,16 @@ bool CSV_Exporter::exportCalendar(calendarSchedule *calSched)
|
|||
QString room = QString(coursePtr->getRoom().c_str());
|
||||
|
||||
QString line = makeLine(name, day, startH, startM, endH, endM, lecturer, room, type);
|
||||
#ifndef _WIN32
|
||||
if(line != NULL)
|
||||
out << line << char(0x0D) << " ";
|
||||
#elif __APPLE__ && __MACH__
|
||||
if(line != NULL)
|
||||
out << line << char(0x0D) << " ";
|
||||
#elif __LINUX__
|
||||
if(line != NULL)
|
||||
out << line << char(0x0A);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ std::string calendarCourse::courseToString()
|
|||
courseText += " " + this->lecturer;
|
||||
courseText += " " + std::to_string(this->getPoints());
|
||||
courseText += " " + std::to_string(this->semesterHours);
|
||||
courseText += " " + this->day;
|
||||
courseText += " " + std::to_string(this->day);
|
||||
courseText += " " + std::to_string(this->hourBegin) + ":" + std::to_string(this->minutesBegin) + "-" + std::to_string(this->hourEnd) + ":" + std::to_string(this->minutesEnd);
|
||||
courseText += " " + this->room;
|
||||
courseText += "\n";
|
||||
|
|
|
@ -82,7 +82,7 @@ void jceLogin::makeConnection() throw (jceStatus)
|
|||
|
||||
}
|
||||
|
||||
bool jceLogin::checkConnection()
|
||||
bool jceLogin::checkConnection() const
|
||||
{
|
||||
if (JceConnector->isConnected())
|
||||
return true;
|
||||
|
@ -187,7 +187,10 @@ void jceLogin::setLoginFlag(bool x)
|
|||
}
|
||||
bool jceLogin::isLoginFlag() const
|
||||
{
|
||||
if (checkConnection())
|
||||
return this->loginFlag;
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
std::string jceLogin::getPage()
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
jceLogin(user* username);
|
||||
~jceLogin();
|
||||
void makeConnection() throw (jceStatus);
|
||||
bool checkConnection();
|
||||
bool checkConnection() const;
|
||||
void reConnect() throw (jceStatus);
|
||||
void closeAll();
|
||||
int getCalendar(int year, int semester);
|
||||
|
|
Loading…
Reference in a new issue