diff options
author | Jan Darmochwal | 2010-10-02 18:50:09 +0200 |
---|---|---|
committer | Jan Darmochwal | 2010-10-02 18:50:09 +0200 |
commit | 6117049617df720fb744a90773a3580b3450b005 (patch) | |
tree | c3b605ab7a7c2e9fd9d14572e8c0e69432d6ac76 /src/userSession.cpp | |
parent | fixed bad copy & paste in CMakeLists.txt (diff) | |
download | vmchooser-6117049617df720fb744a90773a3580b3450b005.tar.gz vmchooser-6117049617df720fb744a90773a3580b3450b005.tar.xz vmchooser-6117049617df720fb744a90773a3580b3450b005.zip |
Qt port is almost complete (at least it compiles)
Major change:
* struct DataEntry has become class Session with sub-classes XSession and VSession
* functions from addInfo.cpp, addPrinters.cpp, addScanners.cpp, readLinSess.cpp, readXmlDir.cpp, runImage.cpp have been moved to XSession and VSession
Several minor changes:
* new files globals.h and globals.cpp for global variables (replaces constants.h and paths.h)
* replaced (all) libxml2, (much) std:: and (most) boost:: stuff by Qt stuff
Things left to do:
* remove tons of debug printfs
* show error messages on errors
* tidy up anyoption stuff in main()
* highlight session run previously
* readGroupXml stuff
* tree view (with "X Sessions" and "Virtual Sessions" sections) instead of list view for session selection
Diffstat (limited to 'src/userSession.cpp')
-rw-r--r-- | src/userSession.cpp | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/src/userSession.cpp b/src/userSession.cpp deleted file mode 100644 index 703235f..0000000 --- a/src/userSession.cpp +++ /dev/null @@ -1,90 +0,0 @@ - - - -#include "DataEntry.h" -#include "functions.h" - -#include <cstdlib> -#include <cstring> -#include <string> -#include <iostream> -#include <fstream> -#include<boost/filesystem/operations.hpp> - -namespace bfs=boost::filesystem; -using namespace std; - -/** - * @function saveSession: Saves chosen session to prechoose this session next time. - * - * @param dat: Pointer to the wanted Image/Linux Session - * @return void - * - */ -void saveSession(DataEntry* dat) { - - // get home folder - char* home = getenv("HOME"); - if(home == NULL) { - cout << "HOME is not set. Not storing session." << endl; - return; - } - - // build path - string fname = home; - string shome = home; - fname.append("/.openslx/vmchooser"); - if(!bfs::exists(fname) ) { - if(!bfs::exists(shome.append("/.openslx")) ) { - bfs::create_directory(shome); - } - } - - // write file with ofstream - ofstream fout(fname.c_str(),ios::trunc); // overwrite file - fout << dat->short_description << endl; -} - - - -/** - * @function readSession: Read predefined session from users home folder - * - * @return: if not found, return null, else description for Image XML/ Linux .desktop file - */ -char* readSession() { - - // read HOME variable - char* home = getenv("HOME"); - if(home==NULL) { - cout << "HOME is not set. Not reading session." << endl; - return NULL; - } - - // build file name - string fname = home; - fname.append("/.openslx/vmchooser"); - - // read presaved session with ifstream - if(!bfs::exists(fname)) { - return NULL; - } - ifstream fin(fname.c_str()); - if (!fin) { - cout << "some error occured reading file!" << endl; - return NULL; - } - - string sessname; - getline(fin,sessname); - char* blub = strdup(sessname.c_str()); - - if(!sessname.empty()) { - return blub; - } - else { - free(blub); - return NULL; - } - -} |