Local changes according to users settings + CSV extention file is fixed

This commit is contained in:
Sagi Dayan 2014-09-08 20:07:42 +03:00
parent 235354210b
commit d73dc6bb9e
5 changed files with 83 additions and 33 deletions

View file

@ -2,13 +2,24 @@
#include <QApplication>
#include <QTranslator>
#include <QDebug>
#include "../src/appDatabase/savedata.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QTranslator translator;
QString locale = QLocale::system().name();
translator.load("jce_"+locale , a.applicationDirPath());
QString loco;
SaveData data;
loco = data.getLocal();
if(loco == "default")
{
QString locale = QLocale::system().name();
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);
MainScreen w;
w.show();

View file

@ -46,6 +46,23 @@ MainScreen::MainScreen(QWidget *parent) :QMainWindow(parent), ui(new Ui::MainScr
ui->pswdLineEdit->setText(data->getPassword());
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()
@ -240,6 +257,13 @@ void MainScreen::setLabelConnectionStatus(jceLogin::jceStatus statusDescription)
this->repaint();
}
void MainScreen::showMSG(QString msg)
{
QMessageBox msgBox;
msgBox.setText(msg);
msgBox.exec();
}
void MainScreen::on_actionCredits_triggered()
{
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()
{
if (ui->actionEnglish->isChecked())
if (ui->actionEnglish->isChecked() || ui->actionOS_Default->isChecked())
{
ui->actionEnglish->setChecked(false);
qDebug() << "Changed Language";
ui->actionOS_Default->setChecked(false);
qDebug() << "Changed Language to hebrew";
data->setLocal("he");
showMSG("ההגדרות שלך יכנסו לתוקף בהפעלה הבאה של התוכנית");
}
else
{
ui->actionHebrew->setChecked(true);
qDebug() << "Set Hebrew Language: ";
}
}
void MainScreen::on_actionEnglish_triggered()
{
if (ui->actionHebrew->isChecked())
if (ui->actionHebrew->isChecked() || ui->actionOS_Default->isChecked())
{
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
{
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);
}

View file

@ -66,6 +66,8 @@ private slots:
void on_actionEnglish_triggered();
void on_actionOS_Default_triggered();
private:
void uiSetDisconnectMode();
@ -83,6 +85,8 @@ private:
QLabel *ButtomStatusLabel;
QLabel *statusLabel;
void showMSG(QString msg);
};
#endif // MAINSCREEN_H

View file

@ -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>
</property>
<property name="currentIndex">
<number>2</number>
<number>0</number>
</property>
<property name="documentMode">
<bool>false</bool>
@ -626,7 +626,7 @@ font-size: 15px;
<x>0</x>
<y>0</y>
<width>855</width>
<height>22</height>
<height>29</height>
</rect>
</property>
<widget class="QMenu" name="menuA_about">
@ -637,6 +637,7 @@ font-size: 15px;
<property name="title">
<string>Language</string>
</property>
<addaction name="actionOS_Default"/>
<addaction name="actionHebrew"/>
<addaction name="actionEnglish"/>
</widget>
@ -675,7 +676,7 @@ font-size: 15px;
<bool>true</bool>
</property>
<property name="text">
<string>hebrew</string>
<string>Hebrew</string>
</property>
</action>
<action name="actionEnglish">
@ -686,6 +687,14 @@ font-size: 15px;
<string>English</string>
</property>
</action>
<action name="actionOS_Default">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>OS Default</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<tabstops>

View file

@ -40,16 +40,13 @@ 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)
{
#ifndef Q_OS_WIN32
out << line << char(0x0D) << " "; //Fucking M$ Special end line shit...
#endif
out << line << char(0x0A);
#endif
}
}
@ -67,7 +64,8 @@ QString CSV_Exporter::getFileFath()
QString fileName = QFileDialog::getSaveFileName();
if(fileName == "")
return NULL;
fileName.append(".csv");
if(!fileName.contains(".csv", Qt::CaseInsensitive))
fileName.append(".csv");
return fileName;
}