Merge pull request #7 from sagidayan/master
Local changes according to users settings + CSV extention file is fixed
This commit is contained in:
commit
856974c144
5 changed files with 83 additions and 33 deletions
|
@ -2,13 +2,24 @@
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include "../src/appDatabase/savedata.h"
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
|
QString loco;
|
||||||
|
SaveData data;
|
||||||
|
loco = data.getLocal();
|
||||||
|
if(loco == "default")
|
||||||
|
{
|
||||||
QString locale = QLocale::system().name();
|
QString locale = QLocale::system().name();
|
||||||
translator.load("jce_"+locale , a.applicationDirPath());
|
translator.load("jce_"+locale , a.applicationDirPath());
|
||||||
|
}else if(loco == "he")
|
||||||
|
translator.load("jce_he" , a.applicationDirPath());
|
||||||
|
else
|
||||||
|
translator.load("jce_en" , a.applicationDirPath());
|
||||||
a.installTranslator(&translator);
|
a.installTranslator(&translator);
|
||||||
MainScreen w;
|
MainScreen w;
|
||||||
w.show();
|
w.show();
|
||||||
|
|
|
@ -46,6 +46,23 @@ MainScreen::MainScreen(QWidget *parent) :QMainWindow(parent), ui(new Ui::MainScr
|
||||||
ui->pswdLineEdit->setText(data->getPassword());
|
ui->pswdLineEdit->setText(data->getPassword());
|
||||||
ui->keepLogin->setChecked(true);
|
ui->keepLogin->setChecked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Local Check and ui setting.
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MainScreen::~MainScreen()
|
MainScreen::~MainScreen()
|
||||||
|
@ -240,6 +257,13 @@ void MainScreen::setLabelConnectionStatus(jceLogin::jceStatus statusDescription)
|
||||||
|
|
||||||
this->repaint();
|
this->repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainScreen::showMSG(QString msg)
|
||||||
|
{
|
||||||
|
QMessageBox msgBox;
|
||||||
|
msgBox.setText(msg);
|
||||||
|
msgBox.exec();
|
||||||
|
}
|
||||||
void MainScreen::on_actionCredits_triggered()
|
void MainScreen::on_actionCredits_triggered()
|
||||||
{
|
{
|
||||||
QMessageBox::about(this, "About", tr("CREDITS-ROOL-UP1") + " v1.0<br><br>"
|
QMessageBox::about(this, "About", tr("CREDITS-ROOL-UP1") + " v1.0<br><br>"
|
||||||
|
@ -318,39 +342,43 @@ void MainScreen::on_exportToCVSBtn_clicked()
|
||||||
|
|
||||||
void MainScreen::on_actionHebrew_triggered()
|
void MainScreen::on_actionHebrew_triggered()
|
||||||
{
|
{
|
||||||
if (ui->actionEnglish->isChecked())
|
if (ui->actionEnglish->isChecked() || ui->actionOS_Default->isChecked())
|
||||||
{
|
{
|
||||||
ui->actionEnglish->setChecked(false);
|
ui->actionEnglish->setChecked(false);
|
||||||
qDebug() << "Changed Language";
|
ui->actionOS_Default->setChecked(false);
|
||||||
|
qDebug() << "Changed Language to hebrew";
|
||||||
|
data->setLocal("he");
|
||||||
|
showMSG("ההגדרות שלך יכנסו לתוקף בהפעלה הבאה של התוכנית");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
ui->actionHebrew->setChecked(true);
|
ui->actionHebrew->setChecked(true);
|
||||||
qDebug() << "Set Hebrew Language: ";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainScreen::on_actionEnglish_triggered()
|
void MainScreen::on_actionEnglish_triggered()
|
||||||
{
|
{
|
||||||
if (ui->actionHebrew->isChecked())
|
if (ui->actionHebrew->isChecked() || ui->actionOS_Default->isChecked())
|
||||||
{
|
{
|
||||||
ui->actionHebrew->setChecked(false);
|
ui->actionHebrew->setChecked(false);
|
||||||
qDebug() << "Changed Language";
|
ui->actionOS_Default->setChecked(false);
|
||||||
|
qDebug() << "Changed Language to English";
|
||||||
|
data->setLocal("en");
|
||||||
|
showMSG("Your settings will take effect next time you start the program");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
ui->actionEnglish->setChecked(true);
|
ui->actionEnglish->setChecked(true);
|
||||||
qDebug() << "Set English Language: ";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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");
|
||||||
|
showMSG("Your settings will take effect next time you start the program");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ui->actionOS_Default->setChecked(true);
|
||||||
|
}
|
||||||
|
|
|
@ -66,6 +66,8 @@ private slots:
|
||||||
|
|
||||||
void on_actionEnglish_triggered();
|
void on_actionEnglish_triggered();
|
||||||
|
|
||||||
|
void on_actionOS_Default_triggered();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void uiSetDisconnectMode();
|
void uiSetDisconnectMode();
|
||||||
|
@ -83,6 +85,8 @@ private:
|
||||||
QLabel *ButtomStatusLabel;
|
QLabel *ButtomStatusLabel;
|
||||||
QLabel *statusLabel;
|
QLabel *statusLabel;
|
||||||
|
|
||||||
|
void showMSG(QString msg);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINSCREEN_H
|
#endif // MAINSCREEN_H
|
||||||
|
|
|
@ -61,7 +61,7 @@ background: qlineargradient(spread:pad, x1:0.496, y1:0, x2:0.508, y2:1, stop:0 r
|
||||||
<enum>QTabWidget::Rounded</enum>
|
<enum>QTabWidget::Rounded</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>2</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="documentMode">
|
<property name="documentMode">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
@ -626,7 +626,7 @@ font-size: 15px;
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>855</width>
|
<width>855</width>
|
||||||
<height>22</height>
|
<height>29</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuA_about">
|
<widget class="QMenu" name="menuA_about">
|
||||||
|
@ -637,6 +637,7 @@ font-size: 15px;
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Language</string>
|
<string>Language</string>
|
||||||
</property>
|
</property>
|
||||||
|
<addaction name="actionOS_Default"/>
|
||||||
<addaction name="actionHebrew"/>
|
<addaction name="actionHebrew"/>
|
||||||
<addaction name="actionEnglish"/>
|
<addaction name="actionEnglish"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -675,7 +676,7 @@ font-size: 15px;
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>hebrew</string>
|
<string>Hebrew</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionEnglish">
|
<action name="actionEnglish">
|
||||||
|
@ -686,6 +687,14 @@ font-size: 15px;
|
||||||
<string>English</string>
|
<string>English</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionOS_Default">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>OS Default</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
|
|
|
@ -40,16 +40,13 @@ bool CSV_Exporter::exportCalendar(calendarSchedule *calSched)
|
||||||
QString room = QString(coursePtr->getRoom().c_str());
|
QString room = QString(coursePtr->getRoom().c_str());
|
||||||
|
|
||||||
QString line = makeLine(name, day, startH, startM, endH, endM, lecturer, room, type);
|
QString line = makeLine(name, day, startH, startM, endH, endM, lecturer, room, type);
|
||||||
#ifndef _WIN32
|
|
||||||
if(line != NULL)
|
if(line != NULL)
|
||||||
out << line << char(0x0D) << " ";
|
{
|
||||||
#elif __APPLE__ && __MACH__
|
#ifndef Q_OS_WIN32
|
||||||
if(line != NULL)
|
out << line << char(0x0D) << " "; //Fucking M$ Special end line shit...
|
||||||
out << line << char(0x0D) << " ";
|
|
||||||
#elif __LINUX__
|
|
||||||
if(line != NULL)
|
|
||||||
out << line << char(0x0A);
|
|
||||||
#endif
|
#endif
|
||||||
|
out << line << char(0x0A);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,6 +64,7 @@ QString CSV_Exporter::getFileFath()
|
||||||
QString fileName = QFileDialog::getSaveFileName();
|
QString fileName = QFileDialog::getSaveFileName();
|
||||||
if(fileName == "")
|
if(fileName == "")
|
||||||
return NULL;
|
return NULL;
|
||||||
|
if(!fileName.contains(".csv", Qt::CaseInsensitive))
|
||||||
fileName.append(".csv");
|
fileName.append(".csv");
|
||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue