1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-10-02 16:22:00 +03:00
gmenu2x/src/selectordetector.cpp
Mirko Lindner cddcd72e33 initial commit - needs clean-up
Signed-off-by: Mirko Lindner <mirko@sharism.cc>
2010-02-04 12:33:47 +01:00

48 lines
1.1 KiB
C++

#include <iostream>
#include <fstream>
#include "selectordetector.h"
#include "utilities.h"
using namespace std;
SelectorDetector::SelectorDetector() {
//ctor
useSelectorBackground = false;
}
SelectorDetector::SelectorDetector(string config) {
useSelectorBackground = false;
readSelectorConfig(config);
}
SelectorDetector::~SelectorDetector() {
//dtor
}
bool SelectorDetector::readSelectorConfig(string config) {
if (fileExists(config)) {
ifstream inf(config.c_str(), ios_base::in);
if (inf.is_open()) {
string line;
while (getline(inf, line, '\n')) {
string::size_type pos = line.find("=");
string name = trim(line.substr(0,pos));
string value = trim(line.substr(pos+1,line.length()));
if (name=="cmdLine") application = value;
else if (name=="baseDir") filePath = value;
else if (name=="fileFilter"){
if(filters.empty())
filters = value;
else
filters += ("," + value);
}
}
inf.close();
return true;
}
}
return false;
}