diff --git a/jceGrade.pro.user b/jceGrade.pro.user
index c29c631..f606ccd 100644
--- a/jceGrade.pro.user
+++ b/jceGrade.pro.user
@@ -1,7 +1,11 @@
-
+
+
+ EnvironmentId
+ {27d037c7-80c2-4adc-9ebd-7fcaa787aa69}
+
ProjectExplorer.Project.ActiveTarget
0
@@ -54,14 +58,14 @@
ProjectExplorer.Project.Target.0
- Desktop Qt 5.3.0 MinGW 32bit
- Desktop Qt 5.3.0 MinGW 32bit
- qt.53.win32_mingw482_kit
+ Desktop
+ Desktop
+ {5099a051-769d-496c-9c12-be2a0d9569cf}
0
0
0
- D:/Dropbox/cpp/jceConQT/build-jceGrade-Desktop_Qt_5_3_0_MinGW_32bit-Debug
+ /home/sagi/Development/SocialDev/build-jceGrade-Desktop-Debug
true
@@ -78,7 +82,10 @@
Make
Qt4ProjectManager.MakeStep
-
+
+ -w
+ -r
+
false
@@ -94,7 +101,10 @@
Make
Qt4ProjectManager.MakeStep
-
+
+ -w
+ -r
+
true
clean
@@ -114,7 +124,7 @@
true
- D:/Dropbox/cpp/jceConQT/build-jceGrade-Desktop_Qt_5_3_0_MinGW_32bit-Release
+ /home/sagi/Development/SocialDev/build-jceGrade-Desktop-Release
true
@@ -131,7 +141,10 @@
Make
Qt4ProjectManager.MakeStep
-
+
+ -w
+ -r
+
false
@@ -147,7 +160,10 @@
Make
Qt4ProjectManager.MakeStep
-
+
+ -w
+ -r
+
true
clean
@@ -220,7 +236,7 @@
jceGrade
- Qt4ProjectManager.Qt4RunConfiguration:D:/Dropbox/cpp/jceConQT/jceAverageCalculator/jceGrade.pro
+ Qt4ProjectManager.Qt4RunConfiguration:/home/sagi/Development/SocialDev/jceAverageCalculator/jceGrade.pro
jceGrade.pro
false
@@ -241,11 +257,11 @@
1
- ProjectExplorer.Project.Updater.EnvironmentId
- {f3f3b933-8225-47b3-aa78-fc5de0bd714b}
+ ProjectExplorer.Project.Updater.FileVersion
+ 16
- ProjectExplorer.Project.Updater.FileVersion
- 15
+ Version
+ 16
diff --git a/jceGrade.pro.user.3.2-pre1 b/jceGrade.pro.user.3.2-pre1
new file mode 100644
index 0000000..c29c631
--- /dev/null
+++ b/jceGrade.pro.user.3.2-pre1
@@ -0,0 +1,251 @@
+
+
+
+
+
+ ProjectExplorer.Project.ActiveTarget
+ 0
+
+
+ ProjectExplorer.Project.EditorSettings
+
+ true
+ false
+ true
+
+ Cpp
+
+ CppGlobal
+
+
+
+ QmlJS
+
+ QmlJSGlobal
+
+
+ 2
+ UTF-8
+ false
+ 4
+ false
+ 80
+ true
+ true
+ 1
+ true
+ false
+ 0
+ true
+ 0
+ 8
+ true
+ 1
+ true
+ true
+ true
+ false
+
+
+
+ ProjectExplorer.Project.PluginSettings
+
+
+
+ ProjectExplorer.Project.Target.0
+
+ Desktop Qt 5.3.0 MinGW 32bit
+ Desktop Qt 5.3.0 MinGW 32bit
+ qt.53.win32_mingw482_kit
+ 0
+ 0
+ 0
+
+ D:/Dropbox/cpp/jceConQT/build-jceGrade-Desktop_Qt_5_3_0_MinGW_32bit-Debug
+
+
+ true
+ qmake
+
+ QtProjectManager.QMakeBuildStep
+ false
+ true
+
+ false
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+
+ 2
+ Build
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+
+ 1
+ Clean
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Debug
+
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 2
+ true
+
+
+ D:/Dropbox/cpp/jceConQT/build-jceGrade-Desktop_Qt_5_3_0_MinGW_32bit-Release
+
+
+ true
+ qmake
+
+ QtProjectManager.QMakeBuildStep
+ false
+ true
+
+ false
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+
+ 2
+ Build
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+
+ 1
+ Clean
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Release
+
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ true
+
+ 2
+
+
+ 0
+ Deploy
+
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+ Deploy locally
+
+ ProjectExplorer.DefaultDeployConfiguration
+
+ 1
+
+
+
+ false
+ false
+ false
+ false
+ true
+ 0.01
+ 10
+ true
+ 1
+ 25
+
+ 1
+ true
+ false
+ true
+ valgrind
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+
+ 2
+
+ jceGrade
+
+ Qt4ProjectManager.Qt4RunConfiguration:D:/Dropbox/cpp/jceConQT/jceAverageCalculator/jceGrade.pro
+
+ jceGrade.pro
+ false
+ false
+
+ 3768
+ false
+ true
+ false
+ false
+ true
+
+ 1
+
+
+
+ ProjectExplorer.Project.TargetCount
+ 1
+
+
+ ProjectExplorer.Project.Updater.EnvironmentId
+ {f3f3b933-8225-47b3-aa78-fc5de0bd714b}
+
+
+ ProjectExplorer.Project.Updater.FileVersion
+ 15
+
+
diff --git a/main/mainscreen.cpp b/main/mainscreen.cpp
index 39a3925..3d29cf1 100644
--- a/main/mainscreen.cpp
+++ b/main/mainscreen.cpp
@@ -32,13 +32,14 @@ MainScreen::MainScreen(QWidget *parent) :QMainWindow(parent), ui(new Ui::MainScr
this->courseTableMgr = new coursesTableManager(ui->coursesTable,userLoginSetting);
this->loginHandel = new loginHandler(userLoginSetting);
this->calendar = new CalendarManager(ui->calendartext);
+ this->data = new SaveData();
//check login File
- SaveData::init();
- if (SaveData::isSaved())
+ //SaveData::init(); --> No need. constructor dose everything.
+ if (data->isSaved())
{
- ui->usrnmLineEdit->setText(SaveData::getUsername());
- ui->pswdLineEdit->setText(SaveData::getPassword());
+ ui->usrnmLineEdit->setText(data->getUsername());
+ ui->pswdLineEdit->setText(data->getPassword());
ui->keepLogin->setChecked(true);
}
}
@@ -48,6 +49,9 @@ MainScreen::~MainScreen()
delete userLoginSetting;
delete loginHandel;
delete ui;
+
+ //Delete save data
+ delete data;
}
void MainScreen::on_loginButton_clicked()
{
@@ -261,10 +265,12 @@ void MainScreen::on_actionExit_triggered()
void MainScreen::on_keepLogin_clicked()
{
if (ui->keepLogin->isChecked())
- SaveData::save(ui->usrnmLineEdit->text(),ui->pswdLineEdit->text());
-
+ {
+ data->setUsername(ui->usrnmLineEdit->text());
+ data->setPassword(ui->pswdLineEdit->text());
+ }
else
- SaveData::deleteData();
+ data->reset();
}
void MainScreen::on_actionHow_To_triggered()
diff --git a/main/mainscreen.h b/main/mainscreen.h
index ddf79c3..2ea31d2 100644
--- a/main/mainscreen.h
+++ b/main/mainscreen.h
@@ -68,7 +68,7 @@ private:
Ui::MainScreen *ui;
user *userLoginSetting;
-
+ SaveData *data;
CalendarManager * calendar;
coursesTableManager *courseTableMgr;
loginHandler *loginHandel;
diff --git a/src/appDatabase/savedata.cpp b/src/appDatabase/savedata.cpp
index 89900da..edb1815 100644
--- a/src/appDatabase/savedata.cpp
+++ b/src/appDatabase/savedata.cpp
@@ -1,200 +1,108 @@
-#include "savedata.h"
-
-
-
-/**
- * @brief Checks the status tag in the file
- * @return boolean the status
- */
-bool SaveData::isSaved()
-{
- QString status;
- QFile* file = new QFile(FILE_NAME);
- /* Opening file for read */
- if(file->open(QIODevice::ReadOnly|QIODevice::Text))
- {
- status = getValViaTag("status", file);
- if(status == "true")
- {
- file->close(); //close & return
- return true;
- }
- return false; //close & return
- file->close();
- }
- /* If Faild to open */
- std::cout << "Faild To Accsess file: " << FILE_NAME << std::endl;
- return false;
-}
-
-
-/**
- * @brief This Function will modify the file, and save the data.
- * @param username - QString
- * @param password - QString
- * @return true if saved - false if error
- */
-bool SaveData::save(QString username, QString password)
-{
- std::cout << "Trying to save data..." << std::endl;
- QFile file(FILE_NAME);
- if(!file.open(QIODevice::WriteOnly|QIODevice::Text))
- return false; /* IO Error! */
- QTextStream output(&file);
- QString hash_pass = hashPassword(password);
- output << "[status]true[/]\n[username]"<open(QIODevice::ReadOnly|QIODevice::Text))
- username = getValViaTag("username", file);
- file->close();
- return username;
-
-}
-
-/**
- * @brief getter for password
- * @return QString - password
- */
-QString SaveData::getPassword()
-{
- QString pass = "";
- QFile* file = new QFile(FILE_NAME);
- /* Opening file for read */
- if(file->open(QIODevice::ReadOnly|QIODevice::Text))
- pass = getValViaTag("password", file);
- file->close();
- pass = deHashPasword(pass);
- return pass;
-
-}
-
-/**
- * @brief This is A functions that will init the tags file.
- * if it exist - do nothing
- * if there is no file, it will create it and run the deleteData function
- * so tags will be set.
- */
-void SaveData::init()
-{
- QFile file(FILE_NAME);
- if(!file.exists())
- {
- file.open(QIODevice::ReadWrite | QIODevice::Text);
- file.close();
- deleteData();
- }
-}
-
-/**
- * @brief This function will return the vale of a given tag name.
- * NOTE: valid tag names are : "status", "username", "password"
- * if tag is invalid - will return "" - an empty QString!
- * @param tag - QString, the tag name
- * @param file - a QFile pointer
- * @return QString - the value in tag
- * NOTE: if NULL value, or an invalid tag name -> return "" (empty QString!)
- */
-QString SaveData::getValViaTag(QString tag, QFile* file)
-{
- QString val, line , tmpTag;
- QTextStream textStream( file);
- while((line = textStream.readLine()) != NULL)
- {
- std::cout << "DEBUG: line => " << line.toStdString() << std::endl;
- for(int i = 0 ; i< line.length() ;++i)
- {
- if(line[i] == '[' && line[i+1] != '/') //get open tag at begining of line and not end of tag ("[/")
- {
- i++;
- tmpTag = line.mid(i, tag.length());
- if(tmpTag == tag)
- {
- i+= tag.length()+1; // i is now right after '['
- int j = i;
- while(line[j] != '[')// put j at the end of the value
- j++;
- /* Then... the value is :*/
- val = line.mid(i, j-i);
- std::cout << "DEBUG: ["<> DB;
+ file.close();
+}
+
+void SaveData::save()
+{
+ QFile file(FILE_NAME);
+ file.open(QIODevice::WriteOnly);
+ QDataStream out(&file);
+ out << DB;
+ file.flush();
+ file.close();
+}
+
+void SaveData::createDB()
+{
+ DB.insert("username", "");
+ DB.insert("password", "");
+ DB.insert("local", "default");
+ DB.insert("calendar", "");
+}
diff --git a/src/appDatabase/savedata.h b/src/appDatabase/savedata.h
index 27015c9..3952e22 100644
--- a/src/appDatabase/savedata.h
+++ b/src/appDatabase/savedata.h
@@ -1,54 +1,58 @@
-#ifndef SAVEDATA_H
-#define SAVEDATA_H
-
-/**
- * SaveData Class
- * --------------------------------------
- *
- * all functions in this class are static!
- * no need to create an object!
- *
- * provides all the needed functions
- * for saving user data for JCE login.
- *
- * the class will enteract with a file formated by tags for storing the valus.
- * the file format is as sutch:
- *
- * [status]Status Value[/]
- * [username]usernaem vale[/]
- * [password]hashed(not really) password vale[/]
- *
- * the class will create a file if not exists by calling Save Data::init() function.
- *
- * for more info about functions - see implantation
- */
-
-/* QT libs */
-#include
-#include
-#include
-
-/* C/C++ libs */
-#include
-#include
-#include
-
-#define FILE_NAME "JAC_DB.dat"
-#define DEFAULT_DATA_EMPTY "[status]false[/]\n[username][/]\n[password][/]"
-
-class SaveData
-{
-public:
- bool static isSaved();
- bool static save(QString username, QString password);
- bool static deleteData();
- QString static getUsername();
- QString static getPassword();
- void static init();
-private:
- QString static getValViaTag(QString tag, QFile *file);
- QString static hashPassword(QString pass);
- QString static deHashPasword(QString pass);
-};
-
-#endif // SAVEDATA_H
+#ifndef SAVEDATA_H
+#define SAVEDATA_H
+
+/**
+ * SaveData Class
+ * --------------------------------------
+ *
+ * all functions in this class are static!
+ * no need to create an object!
+ *
+ * provides all the needed functions
+ * for saving user data for JCE login.
+ *
+ * the class will enteract with a file formated by tags for storing the valus.
+ * the file format is as sutch:
+ *
+ * [status]Status Value[/]
+ * [username]usernaem vale[/]
+ * [password]hashed(not really) password vale[/]
+ *
+ * the class will create a file if not exists by calling Save Data::init() function.
+ *
+ * for more info about functions - see implantation
+ */
+
+/* QT libs */
+#include
+#include
+#include
+#include
+#include
+
+#define FILE_NAME "JAC_DB.dat"
+
+class SaveData
+{
+public:
+ SaveData();
+ bool isSaved();
+ void reset();
+ void setUsername(QString username);
+ void setPassword(QString password);
+ void setCal(QString cal);
+ void setLocal(QString local);
+ QString getUsername();
+ QString getPassword();
+ QString getCal();
+ QString getLocal();
+
+private:
+ QMap DB;
+ void load();
+ void save();
+ void createDB();
+};
+
+#endif // SAVEDATA_H
+
diff --git a/src/jceData/Page.h b/src/jceData/page.h
similarity index 100%
rename from src/jceData/Page.h
rename to src/jceData/page.h