2014-06-18 23:44:46 +00:00
|
|
|
#include "mainscreen.h"
|
|
|
|
#include "ui_mainscreen.h"
|
|
|
|
|
|
|
|
|
|
|
|
MainScreen::MainScreen(QWidget *parent) :QMainWindow(parent), ui(new Ui::MainScreen)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
2014-08-31 09:33:27 +00:00
|
|
|
//this->setFixedSize(this->size()); //main not resizeable
|
2014-06-18 23:44:46 +00:00
|
|
|
|
|
|
|
//Login Tab
|
2014-09-09 08:20:58 +00:00
|
|
|
QPixmap iconPix;
|
|
|
|
iconPix.load(":/icons/iconX.png");
|
2014-06-18 23:44:46 +00:00
|
|
|
ui->pswdLineEdit->setEchoMode((QLineEdit::Password));
|
2014-09-09 08:20:58 +00:00
|
|
|
ui->labelUsrInputStatus->setVisible(false);
|
|
|
|
ui->labelPswInputStatus->setVisible(false);
|
|
|
|
ui->labelUsrInputStatus->setPixmap(iconPix);
|
|
|
|
ui->labelPswInputStatus->setPixmap(iconPix);
|
2014-06-18 23:44:46 +00:00
|
|
|
|
|
|
|
//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);
|
|
|
|
|
2014-08-31 09:33:27 +00:00
|
|
|
//Course, Setting, Calendar Tab
|
2014-09-01 22:19:24 +00:00
|
|
|
calendarSchedule * calendarSchedulePtr = new calendarSchedule();
|
|
|
|
ui->calendarGridLayoutMain->addWidget(calendarSchedulePtr);
|
2014-06-18 23:44:46 +00:00
|
|
|
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);
|
2014-06-20 02:59:33 +00:00
|
|
|
this->loginHandel = new loginHandler(userLoginSetting);
|
2014-09-01 22:19:24 +00:00
|
|
|
this->calendar = new CalendarManager(calendarSchedulePtr);
|
2014-08-31 21:27:15 +00:00
|
|
|
this->data = new SaveData();
|
2014-06-18 23:44:46 +00:00
|
|
|
|
|
|
|
//check login File
|
2014-08-31 21:27:15 +00:00
|
|
|
if (data->isSaved())
|
2014-06-18 23:44:46 +00:00
|
|
|
{
|
2014-08-31 21:27:15 +00:00
|
|
|
ui->usrnmLineEdit->setText(data->getUsername());
|
|
|
|
ui->pswdLineEdit->setText(data->getPassword());
|
2014-06-18 23:44:46 +00:00
|
|
|
ui->keepLogin->setChecked(true);
|
|
|
|
}
|
2014-09-08 17:07:42 +00:00
|
|
|
|
|
|
|
//Local Check and ui setting.
|
2014-09-09 08:20:58 +00:00
|
|
|
checkLocale();
|
2014-09-08 17:07:42 +00:00
|
|
|
|
2014-06-18 23:44:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MainScreen::~MainScreen()
|
|
|
|
{
|
2014-09-09 08:20:58 +00:00
|
|
|
delete ButtomStatusLabel;
|
|
|
|
delete statusLabel;
|
|
|
|
delete calendar;
|
|
|
|
delete courseTableMgr;
|
2014-06-18 23:44:46 +00:00
|
|
|
delete userLoginSetting;
|
|
|
|
delete loginHandel;
|
|
|
|
delete ui;
|
2014-08-31 21:27:15 +00:00
|
|
|
delete data;
|
2014-06-18 23:44:46 +00:00
|
|
|
}
|
2014-09-09 08:20:58 +00:00
|
|
|
//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
|
2014-06-20 17:13:21 +00:00
|
|
|
void MainScreen::on_loginButton_clicked()
|
2014-06-18 23:44:46 +00:00
|
|
|
{
|
2014-06-20 17:13:21 +00:00
|
|
|
if (loginHandel->isLoggedInFlag())
|
|
|
|
uiSetDisconnectMode();
|
|
|
|
else
|
|
|
|
uiSetConnectMode();
|
2014-09-09 08:20:58 +00:00
|
|
|
}
|
|
|
|
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);
|
2014-06-20 17:13:21 +00:00
|
|
|
|
2014-09-09 08:20:58 +00:00
|
|
|
loginHandel->makeDisconnectionRequest();
|
2014-09-11 03:24:52 +00:00
|
|
|
ui->loginButton->setText(tr("&Login"));
|
2014-09-09 08:20:58 +00:00
|
|
|
ui->getCalendarBtn->setDisabled(true);
|
|
|
|
ui->exportToCVSBtn->setDisabled(true);
|
|
|
|
ui->ratesButton->setDisabled(true);
|
|
|
|
return;
|
2014-06-20 17:13:21 +00:00
|
|
|
}
|
2014-09-09 08:20:58 +00:00
|
|
|
void MainScreen::uiSetConnectMode()
|
2014-08-27 10:49:15 +00:00
|
|
|
{
|
2014-09-09 08:20:58 +00:00
|
|
|
string username;
|
|
|
|
string password;
|
|
|
|
if ((ui->usrnmLineEdit->text().isEmpty()) || (ui->pswdLineEdit->text().isEmpty()))
|
2014-08-31 09:33:27 +00:00
|
|
|
{
|
2014-09-09 08:20:58 +00:00
|
|
|
if (ui->usrnmLineEdit->text().isEmpty())
|
2014-08-31 09:33:27 +00:00
|
|
|
{
|
2014-09-09 08:20:58 +00:00
|
|
|
ui->labelUsrInputStatus->setVisible(true);
|
|
|
|
qDebug() << "error, username input is empty";
|
2014-08-31 09:33:27 +00:00
|
|
|
}
|
2014-09-09 08:20:58 +00:00
|
|
|
else
|
|
|
|
ui->labelUsrInputStatus->setVisible(false);
|
|
|
|
if (ui->pswdLineEdit->text().isEmpty())
|
2014-08-31 09:33:27 +00:00
|
|
|
{
|
2014-09-09 08:20:58 +00:00
|
|
|
ui->labelPswInputStatus->setVisible(true);
|
|
|
|
qDebug() << "error, password input is empty";
|
2014-08-31 09:33:27 +00:00
|
|
|
}
|
2014-09-09 08:20:58 +00:00
|
|
|
else
|
|
|
|
ui->labelPswInputStatus->setVisible(false);
|
|
|
|
return;
|
2014-08-31 09:33:27 +00:00
|
|
|
}
|
2014-09-09 08:20:58 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
ui->labelUsrInputStatus->setVisible(false);
|
|
|
|
ui->labelPswInputStatus->setVisible(false);
|
|
|
|
}
|
|
|
|
setLabelConnectionStatus(jceLogin::jceStatus::JCE_START_VALIDATING_PROGRESS);
|
2014-08-31 09:33:27 +00:00
|
|
|
|
2014-09-09 08:20:58 +00:00
|
|
|
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);
|
2014-09-11 03:24:52 +00:00
|
|
|
ui->loginButton->setText(tr("&Logout"));
|
2014-09-09 08:20:58 +00:00
|
|
|
ui->ratesButton->setEnabled(true);
|
|
|
|
ui->CoursesTab->setEnabled(true);
|
|
|
|
ui->exportToCVSBtn->setEnabled(true);
|
|
|
|
ui->getCalendarBtn->setEnabled(true);
|
2014-08-31 09:33:27 +00:00
|
|
|
|
2014-09-09 08:20:58 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
uiSetDisconnectMode();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//EVENTS ON GPA TAB
|
2014-06-20 17:13:21 +00:00
|
|
|
void MainScreen::on_ratesButton_clicked()
|
|
|
|
{
|
2014-06-18 23:44:46 +00:00
|
|
|
std::string pageString;
|
2014-06-20 02:59:33 +00:00
|
|
|
int status = 0;
|
|
|
|
if (loginHandel->isLoggedInFlag())
|
2014-06-18 23:44:46 +00:00
|
|
|
{
|
2014-08-31 09:33:27 +00:00
|
|
|
if ((status = loginHandel->makeGradeRequest(ui->spinBoxCoursesFromYear->value(),ui->spinBoxCoursesToYear->value(),ui->spinBoxCoursesFromSemester->value(),ui->spinBoxCoursesToSemester->value())) == jceLogin::JCE_GRADE_PAGE_PASSED)
|
2014-06-18 23:44:46 +00:00
|
|
|
{
|
2014-06-20 02:59:33 +00:00
|
|
|
pageString = loginHandel->getCurrentPageContect().toStdString();
|
|
|
|
courseTableMgr->setCoursesList(pageString);
|
|
|
|
courseTableMgr->insertJceCoursesIntoTable();
|
|
|
|
}
|
|
|
|
else if (status == jceLogin::JCE_NOT_CONNECTED)
|
|
|
|
{
|
|
|
|
QMessageBox::critical(this,tr("Error"),tr("Not Connected"));
|
2014-06-18 23:44:46 +00:00
|
|
|
}
|
|
|
|
}
|
2014-08-27 10:49:15 +00:00
|
|
|
}
|
2014-08-31 09:33:27 +00:00
|
|
|
void MainScreen::on_checkBoxCoursesInfluence_toggled(bool checked)
|
2014-08-27 10:49:15 +00:00
|
|
|
{
|
2014-08-31 09:33:27 +00:00
|
|
|
this->userLoginSetting->setInfluenceCourseOnly(checked);
|
|
|
|
this->courseTableMgr->influnceCourseChanged(checked);
|
2014-06-18 23:44:46 +00:00
|
|
|
}
|
2014-08-31 09:33:27 +00:00
|
|
|
void MainScreen::on_spinBoxCoursesFromYear_editingFinished()
|
2014-06-18 23:44:46 +00:00
|
|
|
{
|
2014-08-31 09:33:27 +00:00
|
|
|
if (ui->spinBoxCoursesFromYear->value() > ui->spinBoxCoursesToYear->value())
|
2014-06-18 23:44:46 +00:00
|
|
|
{
|
2014-08-31 09:33:27 +00:00
|
|
|
ui->spinBoxCoursesFromYear->setValue(ui->spinBoxCoursesToYear->value());
|
|
|
|
ui->spinBoxCoursesFromYear->setFocus();
|
2014-06-18 23:44:46 +00:00
|
|
|
}
|
2014-08-31 09:33:27 +00:00
|
|
|
|
2014-06-18 23:44:46 +00:00
|
|
|
}
|
2014-08-31 09:33:27 +00:00
|
|
|
void MainScreen::on_spinBoxCoursesToYear_editingFinished()
|
2014-06-18 23:44:46 +00:00
|
|
|
{
|
2014-08-31 09:33:27 +00:00
|
|
|
if (ui->spinBoxCoursesFromYear->value() > ui->spinBoxCoursesToYear->value())
|
2014-06-18 23:44:46 +00:00
|
|
|
{
|
2014-08-31 09:33:27 +00:00
|
|
|
ui->spinBoxCoursesToYear->setValue(ui->spinBoxCoursesFromYear->value());
|
|
|
|
ui->spinBoxCoursesToYear->setFocus();
|
|
|
|
|
2014-06-18 23:44:46 +00:00
|
|
|
}
|
|
|
|
}
|
2014-08-31 09:33:27 +00:00
|
|
|
void MainScreen::on_spinBoxCoursesFromSemester_editingFinished()
|
2014-06-18 23:44:46 +00:00
|
|
|
{
|
2014-08-31 09:33:27 +00:00
|
|
|
if (ui->spinBoxCoursesFromYear->value() == ui->spinBoxCoursesToYear->value())
|
2014-06-18 23:44:46 +00:00
|
|
|
{
|
2014-08-31 09:33:27 +00:00
|
|
|
if (ui->spinBoxCoursesFromSemester->value() > ui->spinBoxCoursesToSemester->value())
|
2014-06-18 23:44:46 +00:00
|
|
|
{
|
2014-08-31 09:33:27 +00:00
|
|
|
ui->spinBoxCoursesFromSemester->setValue(ui->spinBoxCoursesToSemester->value());
|
|
|
|
ui->spinBoxCoursesFromSemester->setFocus();
|
2014-06-18 23:44:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-08-31 09:33:27 +00:00
|
|
|
void MainScreen::on_spinBoxCoursesToSemester_editingFinished()
|
2014-06-18 23:44:46 +00:00
|
|
|
{
|
2014-08-31 09:33:27 +00:00
|
|
|
if (ui->spinBoxCoursesFromYear->value() == ui->spinBoxCoursesToYear->value())
|
2014-06-18 23:44:46 +00:00
|
|
|
{
|
2014-08-31 09:33:27 +00:00
|
|
|
if (ui->spinBoxCoursesFromSemester->value() > ui->spinBoxCoursesToSemester->value())
|
2014-06-18 23:44:46 +00:00
|
|
|
{
|
2014-08-31 09:33:27 +00:00
|
|
|
ui->spinBoxCoursesToSemester->setValue(ui->spinBoxCoursesFromSemester->value());
|
|
|
|
ui->spinBoxCoursesToSemester->setFocus();
|
2014-06-18 23:44:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-08-31 09:33:27 +00:00
|
|
|
void MainScreen::on_coursesTable_itemChanged(QTableWidgetItem *item)
|
2014-06-18 23:44:46 +00:00
|
|
|
{
|
2014-08-31 09:33:27 +00:00
|
|
|
if (this->courseTableMgr->changes(item->text(),item->row(),item->column()))
|
|
|
|
ui->avgLCD->display(courseTableMgr->getAvg());
|
|
|
|
else
|
2014-09-11 03:24:52 +00:00
|
|
|
QMessageBox::critical(this,tr("Error"),tr("Missmatching data"));
|
2014-06-18 23:44:46 +00:00
|
|
|
}
|
2014-09-09 08:20:58 +00:00
|
|
|
void MainScreen::on_clearTableButton_clicked()
|
2014-06-18 23:44:46 +00:00
|
|
|
{
|
2014-09-09 08:20:58 +00:00
|
|
|
courseTableMgr->clearTable();
|
|
|
|
ui->avgLCD->display(courseTableMgr->getAvg());
|
2014-06-18 23:44:46 +00:00
|
|
|
}
|
2014-09-09 08:20:58 +00:00
|
|
|
//EVENTS ON CALENDAR TAB
|
|
|
|
void MainScreen::on_getCalendarBtn_clicked()
|
2014-06-18 23:44:46 +00:00
|
|
|
{
|
2014-09-09 08:20:58 +00:00
|
|
|
int status = 0;
|
|
|
|
if (loginHandel->isLoggedInFlag())
|
2014-06-18 23:44:46 +00:00
|
|
|
{
|
2014-09-09 08:20:58 +00:00
|
|
|
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());
|
|
|
|
}
|
2014-06-20 17:13:21 +00:00
|
|
|
|
2014-09-09 08:20:58 +00:00
|
|
|
else if (status == jceLogin::JCE_NOT_CONNECTED)
|
|
|
|
{
|
|
|
|
QMessageBox::critical(this,tr("Error"),tr("Not Connected"));
|
|
|
|
}
|
2014-06-18 23:44:46 +00:00
|
|
|
}
|
|
|
|
}
|
2014-09-09 08:20:58 +00:00
|
|
|
void MainScreen::on_exportToCVSBtn_clicked()
|
2014-06-18 23:44:46 +00:00
|
|
|
{
|
2014-09-09 08:20:58 +00:00
|
|
|
if (loginHandel->isLoggedInFlag())
|
|
|
|
this->calendar->exportCalendarCSV();
|
2014-06-18 23:44:46 +00:00
|
|
|
}
|
2014-09-08 17:07:42 +00:00
|
|
|
|
2014-09-09 08:20:58 +00:00
|
|
|
//EVENTS ON MENU BAR
|
2014-06-18 23:44:46 +00:00
|
|
|
void MainScreen::on_actionCredits_triggered()
|
|
|
|
{
|
2014-06-28 03:36:10 +00:00
|
|
|
QMessageBox::about(this, "About", tr("CREDITS-ROOL-UP1") + " v1.0<br><br>"
|
|
|
|
+ tr("CREDITS-ROOL-UP2")+"<br>GNU LESSER GENERAL PUBLIC LICENSE V2<br>"
|
|
|
|
+ tr("CREDITS-ROOL-UP3")+"<br>"
|
2014-06-18 23:44:46 +00:00
|
|
|
"<a href='https://github.com/liranbg/jceAverageCalculator'>jceAverageCalculator Repository</a>"
|
2014-06-28 03:36:10 +00:00
|
|
|
"<br><br>"+tr("CREDITS-ROOL-UP4")+"<a href='https://github.com/liranbg/jceConnection'> Jce Connection</a><br><br>"
|
|
|
|
+tr("DevBy")+":"
|
2014-06-18 23:44:46 +00:00
|
|
|
"<ul>"
|
2014-06-28 03:36:10 +00:00
|
|
|
"<li><a href='mailto:liranbg@gmail.com'>"+tr("Liran")+"</a></li>"
|
|
|
|
"<li><a href='mailto:sagidayan@gmail.com'>"+tr("Sagi")+"</a></li>"
|
2014-06-18 23:44:46 +00:00
|
|
|
"</ul>");
|
|
|
|
}
|
|
|
|
void MainScreen::on_actionExit_triggered()
|
|
|
|
{
|
|
|
|
exit(0);
|
|
|
|
}
|
2014-06-22 12:43:31 +00:00
|
|
|
void MainScreen::on_actionHow_To_triggered()
|
|
|
|
{
|
|
|
|
QMessageBox::information(this,"How To",
|
|
|
|
"<b>How To..</b>"
|
|
|
|
"<ul>"
|
2014-06-28 04:15:19 +00:00
|
|
|
"<br><li>"+tr("HELP1")+"</li>"
|
|
|
|
"<br><li>"+tr("HELP2")+"</li>"
|
|
|
|
"<br><li>"+tr("HELP3")+"</li>"
|
|
|
|
"<br><li>"+tr("HELP4")+"</li>"
|
|
|
|
"<br><li>"+tr("HELP5")+"</li>"
|
|
|
|
"<br><br>"+tr("HELP6")+
|
|
|
|
"</ul>");
|
2014-06-22 12:43:31 +00:00
|
|
|
|
|
|
|
}
|
2014-09-07 19:57:01 +00:00
|
|
|
|
2014-09-08 15:54:52 +00:00
|
|
|
|
|
|
|
void MainScreen::on_exportToCVSBtn_clicked()
|
|
|
|
{
|
|
|
|
if (loginHandel->isLoggedInFlag())
|
2014-09-09 11:40:11 +00:00
|
|
|
{
|
|
|
|
CalendarDialog calDialog;
|
|
|
|
int buttonClicked = calDialog.exec();
|
|
|
|
if(buttonClicked == 0)
|
|
|
|
return;
|
|
|
|
//calDialog.getStartDate(),calDialog.getEndDate()
|
2014-09-09 18:24:53 +00:00
|
|
|
if(calDialog.ok())
|
|
|
|
this->calendar->exportCalendarCSV(&calDialog);
|
|
|
|
else
|
2014-09-09 20:31:48 +00:00
|
|
|
showMSG("Somthig was not right with the dates you have chosen... try again");
|
2014-09-09 11:40:11 +00:00
|
|
|
}
|
2014-09-08 15:54:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainScreen::on_actionHebrew_triggered()
|
|
|
|
{
|
2014-09-08 17:07:42 +00:00
|
|
|
if (ui->actionEnglish->isChecked() || ui->actionOS_Default->isChecked())
|
2014-09-08 15:54:52 +00:00
|
|
|
{
|
|
|
|
ui->actionEnglish->setChecked(false);
|
2014-09-08 17:07:42 +00:00
|
|
|
ui->actionOS_Default->setChecked(false);
|
|
|
|
qDebug() << "Changed Language to hebrew";
|
|
|
|
data->setLocal("he");
|
2014-09-11 03:24:52 +00:00
|
|
|
QMessageBox::information(this,tr("Settings"),tr("Your settings will take effect next time you start the program"),QMessageBox::Ok);
|
2014-09-08 15:54:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
ui->actionHebrew->setChecked(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainScreen::on_actionEnglish_triggered()
|
2014-09-07 19:57:01 +00:00
|
|
|
{
|
2014-09-08 17:07:42 +00:00
|
|
|
if (ui->actionHebrew->isChecked() || ui->actionOS_Default->isChecked())
|
2014-09-07 20:14:04 +00:00
|
|
|
{
|
2014-09-08 15:54:52 +00:00
|
|
|
ui->actionHebrew->setChecked(false);
|
2014-09-08 17:07:42 +00:00
|
|
|
ui->actionOS_Default->setChecked(false);
|
|
|
|
qDebug() << "Changed Language to English";
|
|
|
|
data->setLocal("en");
|
2014-09-11 03:24:52 +00:00
|
|
|
QMessageBox::information(this,"Settings",tr("Your settings will take effect next time you start the program"),QMessageBox::Ok);
|
2014-09-08 15:54:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
ui->actionEnglish->setChecked(true);
|
2014-09-07 19:57:01 +00:00
|
|
|
}
|
2014-09-08 15:54:52 +00:00
|
|
|
|
|
|
|
|
2014-09-08 17:07:42 +00:00
|
|
|
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");
|
2014-09-11 03:24:52 +00:00
|
|
|
QMessageBox::information(this,tr("Settings"),tr("Your settings will take effect next time you start the program"),QMessageBox::Ok);
|
2014-09-08 17:07:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
ui->actionOS_Default->setChecked(true);
|
|
|
|
}
|
2014-09-09 08:20:58 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|