dockwidget instead of menu

This commit is contained in:
liranbg 2014-10-14 02:45:11 +03:00
parent dd5f4fa9e9
commit d2d6495030
14 changed files with 481 additions and 151 deletions

View file

@ -87,3 +87,4 @@ SOURCES += \
src/jceData/Calendar/coursesSchedule/calendarPageCourse.cpp \
src/jceData/Calendar/coursesSchedule/calendarSchedule.cpp \
main/jceWidgets/jcestatusbar.cpp

View file

@ -20,16 +20,14 @@ int main(int argc, char *argv[])
QApplication a(argc, argv);
QTranslator translator;
QString loco;
SaveData data;
loco = data.getLocal();
//Loading Local (From Settings file (SaveData.cpp)
if(loco == "en")
if(data.getLocale() == "en")
{
translator.load("jce_" + loco , a.applicationDirPath());
translator.load("jce_" + data.getLocale() , a.applicationDirPath());
qDebug() << Q_FUNC_INFO << "Locale : English Local Loaded";
}else if(loco == "he"){
translator.load("jce_" + loco , a.applicationDirPath());
}else if(data.getLocale() == "he"){
translator.load("jce_" + data.getLocale() , a.applicationDirPath());
qDebug() << Q_FUNC_INFO << "Local : Hebrew Local Loaded";
}else{
translator.load("jce_en" , a.applicationDirPath());

View file

@ -45,6 +45,7 @@ MainScreen::MainScreen(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainSc
}
MainScreen::~MainScreen()
{
delete statusBar;
delete calendar;
delete courseTableMgr;
delete userLoginSetting;
@ -122,7 +123,6 @@ void MainScreen::on_keepLogin_clicked()
}
void MainScreen::on_usrnmLineEdit_editingFinished()
{
qDebug() << Q_FUNC_INFO << "in: " << ui->tabWidget->currentWidget()->objectName();
ui->usrnmLineEdit->setText(ui->usrnmLineEdit->text().toLower());
}
@ -244,7 +244,6 @@ void MainScreen::on_revertBtn_clicked()
}
}
//EVENTS ON CALENDAR TAB
void MainScreen::on_examsBtn_clicked()
{
@ -314,104 +313,48 @@ void MainScreen::on_exportToCVSBtn_clicked()
}
}
//EVENTS ON MENU BAR
void MainScreen::on_actionCredits_triggered()
{
qDebug() << Q_FUNC_INFO;
QMessageBox::about(this, "About",
"<a href='http://liranbg.github.io/JceManager/'>Jce Manager</a> v1.0.0<br><br>"
+tr("License:")+
"<br>GNU LESSER GENERAL PUBLIC LICENSE V2.1<br>"
+"<br>"+
"<a href='https://github.com/liranbg/JceManager'>JceManager Repository</a>"+
"<br><br>"
+tr("Powered By: ")+
"<a href='https://github.com/liranbg/jceConnection'> Jce Connection</a><br><br>"
+tr("Developed By")+
":<ul>"+
"<li><a href='mailto:liranbg@gmail.com'>"+tr("Liran")+"</a></li>"+
"<li><a href='mailto:sagidayan@gmail.com'>"+tr("Sagi")+"</a></li></ul>"
);
}
void MainScreen::on_actionExit_triggered()
{
qDebug() << Q_FUNC_INFO;
exit(0);
}
void MainScreen::on_actionHow_To_triggered()
{
qDebug() << Q_FUNC_INFO;
QMessageBox::information(this,"How To",
"<b>"
+tr("Help Guide")+
"</b><ul>"
+tr("<br><li>Login: <ul><li>Type your username and password and click Login.</li><li>Once you are connected, you will see a green ball in the right buttom panel.</li></ul></li>")
+tr("<br><li>Getting GPA sheet<ul><li>Click on GPA Tab</li><li> Select your dates and click on Add</li></ul></li>")
+tr("<br><li>Average Changing<ul><li>Change one of your grade and see the average in the buttom panel changing.</li></ul></li>")
+tr("<br><li>Getting Calendar<ul><li>Click on Calendar Tab</li><li> Select your dates and click on Get Calendar</li></ul></li>")
+tr("<br><li>For exporting your calendar to a .CSV file:<ul><li>Do previous step and continue to next step</li><li> Click on Export to CSV</li><li>Select your dates and click OK</li><li>Once you're Done, go on your calendar and import your csv file</li></li>")+
"<br><br>"
+tr("<b>For more information, please visit us at: <a href='http://liranbg.github.io/JceManager/'>Jce Manager site</a></b>"));
}
void MainScreen::on_actionHebrew_triggered()
{
qDebug() << Q_FUNC_INFO;
if (ui->actionEnglish->isChecked() || ui->actionOS_Default->isChecked())
{
ui->actionEnglish->setChecked(false);
ui->actionOS_Default->setChecked(false);
qDebug() << Q_FUNC_INFO << "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()
{
qDebug() << Q_FUNC_INFO;
if (ui->actionHebrew->isChecked() || ui->actionOS_Default->isChecked())
{
ui->actionHebrew->setChecked(false);
ui->actionOS_Default->setChecked(false);
qDebug() << Q_FUNC_INFO << "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()
{
qDebug() << Q_FUNC_INFO;
if (ui->actionHebrew->isChecked() || ui->actionEnglish->isChecked())
{
ui->actionHebrew->setChecked(false);
ui->actionEnglish->setChecked(false);
qDebug() << Q_FUNC_INFO << "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);
}
}
//void MainScreen::on_actionHebrew_triggered()
//{
// qDebug() << Q_FUNC_INFO;
// if (ui->actionEnglish->isChecked() || ui->actionOS_Default->isChecked())
// {
// ui->actionEnglish->setChecked(false);
// ui->actionOS_Default->setChecked(false);
// qDebug() << Q_FUNC_INFO << "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()
//{
// qDebug() << Q_FUNC_INFO;
// if (ui->actionHebrew->isChecked() || ui->actionOS_Default->isChecked())
// {
// ui->actionHebrew->setChecked(false);
// ui->actionOS_Default->setChecked(false);
// qDebug() << Q_FUNC_INFO << "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()
//{
// qDebug() << Q_FUNC_INFO;
// if (ui->actionHebrew->isChecked() || ui->actionEnglish->isChecked())
// {
// ui->actionHebrew->setChecked(false);
// ui->actionEnglish->setChecked(false);
// qDebug() << Q_FUNC_INFO << "Changed Language to OS Default";
// data->setLocal("default");
//
// }
// else
// ui->actionOS_Default->setChecked(true);
//}
//MAIN SCREEN
void MainScreen::on_labelMadeBy_linkActivated(const QString &link)
{
@ -436,3 +379,78 @@ bool MainScreen::isBusy()
return this->isBlocked;
}
void MainScreen::on_langButton_clicked()
{
qDebug() << Q_FUNC_INFO;
if (data->getLocale() == "en")
{
qDebug() << Q_FUNC_INFO << "Changed lang to he";
data->setLocale("he");
}else if(data->getLocale() == "he"){
qDebug() << Q_FUNC_INFO << "Changed lang to en";
data->setLocale("en");
}else{
qCritical() << Q_FUNC_INFO << "currupted data. reset to en";
data->reset();
data->setLocale("en");
}
checkLocale();
QMessageBox::information(this,tr("Settings"),tr("Your settings will take effect next time you start the program"),QMessageBox::Ok);
}
void MainScreen::on_creditButton_clicked()
{
qDebug() << Q_FUNC_INFO;
QMessageBox::about(this, "About",
"<a href='http://liranbg.github.io/JceManager/'>Jce Manager</a> v1.0.0<br><br>"
+tr("License:")+
"<br>GNU LESSER GENERAL PUBLIC LICENSE V2.1<br>"
+"<br>"+
"<a href='https://github.com/liranbg/JceManager'>JceManager Repository</a>"+
"<br><br>"
+tr("Powered By: ")+
"<a href='https://github.com/liranbg/jceConnection'> Jce Connection</a><br><br>"
+tr("Developed By")+
":<ul>"+
"<li><a href='mailto:liranbg@gmail.com'>"+tr("Liran")+"</a></li>"+
"<li><a href='mailto:sagidayan@gmail.com'>"+tr("Sagi")+"</a></li></ul>"
);
}
void MainScreen::on_howtoButton_clicked()
{
qDebug() << Q_FUNC_INFO;
QMessageBox::information(this,"How To",
"<b>"
+tr("Help Guide")+
"</b><ul>"
+tr("<br><li>Login: <ul><li>Type your username and password and click Login.</li><li>Once you are connected, you will see a green ball in the right buttom panel.</li></ul></li>")
+tr("<br><li>Getting GPA sheet<ul><li>Click on GPA Tab</li><li> Select your dates and click on Add</li></ul></li>")
+tr("<br><li>Average Changing<ul><li>Change one of your grade and see the average in the buttom panel changing.</li></ul></li>")
+tr("<br><li>Getting Calendar<ul><li>Click on Calendar Tab</li><li> Select your dates and click on Get Calendar</li></ul></li>")
+tr("<br><li>For exporting your calendar to a .CSV file:<ul><li>Do previous step and continue to next step</li><li> Click on Export to CSV</li><li>Select your dates and click OK</li><li>Once you're Done, go on your calendar and import your csv file</li></li>")+
"<br><br>"
+tr("<b>For more information, please visit us at: <a href='http://liranbg.github.io/JceManager/'>Jce Manager site</a></b>"));
}
void MainScreen::checkLocale()
{
qDebug() << Q_FUNC_INFO;
if (data->getLocale() == "en")
{
ui->langButton->setIcon(QIcon(":/icons/us.png"));
}else if(data->getLocale() == "he"){
ui->langButton->setIcon(QIcon(":/icons/il.png"));
}else{
qCritical() << Q_FUNC_INFO << "currupted data. reset eng";
data->reset();
ui->langButton->setIcon(QIcon(":/icons/us.png"));
}
}

View file

@ -36,6 +36,7 @@ private slots:
//GPA Tab slots
void on_ratesButton_clicked();
void on_graphButton_clicked();
void on_revertBtn_clicked();
void on_clearTableButton_clicked();
void on_coursesTable_itemChanged(QTableWidgetItem *item);
void on_checkBoxCoursesInfluence_toggled(bool checked);
@ -45,26 +46,21 @@ private slots:
void on_examsBtn_clicked();
void on_exportToCVSBtn_clicked();
//Menubar slots
void on_actionCredits_triggered();
void on_actionExit_triggered();
void on_actionHow_To_triggered();
void on_actionHebrew_triggered();
void on_actionEnglish_triggered();
void on_actionOS_Default_triggered();
//Main screen general slots
void on_spinBoxCoursesFromSemester_valueChanged(int arg1);
void on_spinBoxCoursesFromYear_valueChanged(int arg1);
void on_spinBoxCoursesToYear_valueChanged(int arg1);
void on_spinBoxCoursesToSemester_valueChanged(int arg1);
void on_labelMadeBy_linkActivated(const QString &link);
// void on_progressBar_valueChanged(int value);
void on_revertBtn_clicked();
//Setting dock
void on_langButton_clicked();
void on_creditButton_clicked();
void on_howtoButton_clicked();
private:
void checkLocale();
bool checkIfValidDates();

View file

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>1133</width>
<width>1137</width>
<height>623</height>
</rect>
</property>
@ -924,33 +924,346 @@ font-size: 15px;
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1133</width>
<height>22</height>
</rect>
<widget class="QDockWidget" name="dockWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QMenu" name="menuA_about">
<property name="title">
<string>&amp;File</string>
<property name="statusTip">
<string>Settings</string>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="styleSheet">
<string notr="true">#dockWidgetContents {
background: qlineargradient(spread:pad, x1:0.496, y1:0, x2:0.508, y2:1,
stop:0 rgba(180, 231, 224, 255),
stop:1 rgba(195, 231, 224, 218));
}
</string>
</property>
<property name="floating">
<bool>false</bool>
</property>
<property name="features">
<set>QDockWidget::DockWidgetMovable</set>
</property>
<property name="windowTitle">
<string/>
</property>
<attribute name="dockWidgetArea">
<number>4</number>
</attribute>
<widget class="QWidget" name="dockWidgetContents">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QMenu" name="menuLanguage">
<property name="title">
<string>Language</string>
</property>
<addaction name="actionOS_Default"/>
<addaction name="actionHebrew"/>
<addaction name="actionEnglish"/>
</widget>
<addaction name="menuLanguage"/>
<addaction name="actionHow_To"/>
<addaction name="actionCredits"/>
<addaction name="actionExit"/>
<layout class="QGridLayout" name="gridLayout_16">
<item row="0" column="0">
<widget class="QFrame" name="frameLanguage">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<layout class="QGridLayout" name="gridLayout_12">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QPushButton" name="langButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">QPushButton {
color: white;
border-radius: 16px;
padding: 1px;
padding-left: 1px;
padding-right: 1px;
min-width: 48px;
max-width: 48px;
min-height: 48px;
max-height: 48px;
}</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../resources/connectionstatus.qrc">
<normaloff>:/icons/us.png</normaloff>:/icons/us.png</iconset>
</property>
<property name="iconSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="2">
<widget class="QFrame" name="frameHelp">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<layout class="QGridLayout" name="gridLayout_14">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QPushButton" name="howtoButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QPushButton {
color: white;
border-radius: 16px;
padding: 1px;
padding-left: 1px;
padding-right: 1px;
min-width: 48px;
max-width: 48px;
min-height: 48px;
max-height: 48px;
}</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../resources/connectionstatus.qrc">
<normaloff>:/icons/help.png</normaloff>:/icons/help.png</iconset>
</property>
<property name="iconSize">
<size>
<width>40</width>
<height>36</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QFrame" name="frameTeam">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<layout class="QGridLayout" name="gridLayout_15">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QPushButton" name="creditButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QPushButton {
color: white;
border-radius: 16px;
padding: 1px;
padding-left: 1px;
padding-right: 1px;
min-width: 48px;
max-width: 48px;
min-height: 48px;
max-height: 48px;
}</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../resources/connectionstatus.qrc">
<normaloff>:/icons/team.png</normaloff>:/icons/team.png</iconset>
</property>
<property name="iconSize">
<size>
<width>36</width>
<height>36</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<addaction name="menuA_about"/>
</widget>
<action name="actionCredits">
<property name="text">

View file

@ -6,5 +6,9 @@
<file>icon.ico</file>
<file>iconX.png</file>
<file>iconV.png</file>
<file>il.png</file>
<file>us.png</file>
<file>help.png</file>
<file>team.png</file>
</qresource>
</RCC>

BIN
resources/flags/il.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
resources/flags/us.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
resources/help.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
resources/il.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
resources/team.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
resources/us.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View file

@ -39,7 +39,7 @@ bool SaveData::isSaved()
* # username
* # password
* # calendar
* # local
* # locale
*/
void SaveData::reset()
{
@ -82,11 +82,11 @@ void SaveData::setCal(QString cal)
}
/**
* @brief gest a local and saves it into the QMap.
* @brief gest a locale and saves it into the QMap.
* QMap then is saved to the file.
* @param local - QString (he, en, default)
* @param locale - QString (he, en)
*/
void SaveData::setLocal(QString local)
void SaveData::setLocale(QString local)
{
DB.insert("locale", local);
save();
@ -112,9 +112,9 @@ QString SaveData::getPassword()
/**
* @brief read from file
* @return local
* @return locale
*/
QString SaveData::getLocal()
QString SaveData::getLocale()
{
return DB.value("locale");
}

View file

@ -12,7 +12,7 @@
* Keys:
* "username"
* "password"
* "local"
* "locale"
* "calendar"
*
* Note that the password will be encrypted using the SimpleCrypt class!
@ -40,11 +40,11 @@ public:
void setUsername(QString username);
void setPassword(QString password);
void setCal(QString cal);
void setLocal(QString local);
void setLocale(QString locale);
QString getUsername();
QString getPassword();
QString getCal();
QString getLocal();
QString getLocale();
private:
QMap<QString, QString> DB;