00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include "mmstools/mmstools.h"
00034 #include "mmsconfig/mmsconfigdata.h"
00035 #include <string.h>
00036
00037
00038 MMSConfigDataGlobal MMSConfigData::global;
00039 MMSConfigDataDB MMSConfigData::configdb;
00040 MMSConfigDataDB MMSConfigData::datadb;
00041 MMSConfigDataGraphics MMSConfigData::graphics;
00042 MMSConfigDataLanguage MMSConfigData::language;
00043
00044 MMSConfigData::MMSConfigData(MMSConfigDataGlobal global,
00045 MMSConfigDataDB configdb,
00046 MMSConfigDataDB datadb,
00047 MMSConfigDataGraphics graphics,
00048 MMSConfigDataLanguage language) {
00049 this->global = global;
00050 this->configdb = configdb;
00051 this->datadb = datadb;
00052 this->graphics = graphics;
00053 this->language = language;
00054 #ifdef HARD_PREFIX
00055 this->global.prefix = HARD_PREFIX;
00056 #endif
00057 }
00058
00059 MMSConfigData::MMSConfigData() {
00060 #ifdef HARD_PREFIX
00061 this->global.prefix = HARD_PREFIX;
00062 #endif
00063 }
00064
00065 MMSConfigData::~MMSConfigData() {
00066 }
00067
00068
00069 const string MMSConfigData::getLogfile() {
00070 return this->global.logfile;
00071 }
00072
00073 const string MMSConfigData::getInputMap() {
00074 return this->global.inputmap;
00075 }
00076
00077 const string MMSConfigData::getPrefix() {
00078 if(!this->global.prefix.empty())
00079 return this->global.prefix;
00080
00081 FILE *stream;
00082 char prefix[1024];
00083 memset(prefix,0,1024);
00084
00085
00086 stream = popen("pkg-config --variable=prefix disko","r");
00087 if(stream!=NULL) {
00088 if(fgets(prefix,1024,stream)!=NULL) {
00089 prefix[strlen(prefix)-1]='/';
00090 pclose(stream);
00091 this->global.prefix = prefix;
00092 return this->global.prefix;
00093 }
00094 pclose(stream);
00095 }
00096
00097
00098 stream = popen("pkg-config --variable=prefix mmstools","r");
00099 if(stream!=NULL) {
00100 if(fgets(prefix,1024,stream)!=NULL) {
00101 prefix[strlen(prefix)-1]='/';
00102 pclose(stream);
00103 this->global.prefix = prefix;
00104 return this->global.prefix;
00105 }
00106 pclose(stream);
00107 }
00108
00109
00110 stream = fopen("./bin/diskoappctrl","r");
00111 if(stream != NULL) {
00112 sprintf(prefix,"./");
00113 fclose(stream);
00114 this->global.prefix = prefix;
00115 return this->global.prefix;
00116 }
00117
00118 return this->global.prefix;
00119 }
00120
00121 const string MMSConfigData::getTheme() {
00122 return this->global.theme;
00123 }
00124
00125 const string MMSConfigData::getSysConfig(){
00126 return this->global.sysconfig;
00127 }
00128
00129 const string MMSConfigData::getData(){
00130 return this->global.data;
00131 }
00132
00133 const bool MMSConfigData::getStdout() {
00134 return this->global.stdout;
00135 }
00136
00137 const int MMSConfigData::getInputInterval() {
00138 return this->global.inputinterval;
00139 }
00140
00141 const string MMSConfigData::getFirstPlugin() {
00142 return this->global.firstplugin;
00143 }
00144
00145 const bool MMSConfigData::getShutdown() {
00146 return this->global.shutdown;
00147 }
00148
00149 const string MMSConfigData::getShutdownCmd() {
00150 return this->global.shutdowncmd;
00151 }
00152
00153 const string MMSConfigData::getInputMode() {
00154 return this->global.inputmode;
00155 }
00156
00157 const string MMSConfigData::getActMonAddress() {
00158 return this->global.actmonaddress;
00159 }
00160
00161 const unsigned int MMSConfigData::getActMonPort() {
00162 return this->global.actmonport;
00163 }
00164
00165
00166 const string MMSConfigData::getConfigDBDBMS() {
00167 return this->configdb.dbms;
00168 }
00169
00170 const string MMSConfigData::getConfigDBAddress() {
00171 return this->configdb.address;
00172 }
00173
00174 const unsigned int MMSConfigData::getConfigDBPort() {
00175 return this->configdb.port;
00176 }
00177
00178 const string MMSConfigData::getConfigDBUser() {
00179 return this->configdb.user;
00180 }
00181
00182 const string MMSConfigData::getConfigDBPassword() {
00183 return this->configdb.password;
00184 }
00185
00186 const string MMSConfigData::getConfigDBDatabase() {
00187 return this->configdb.database;
00188 };
00189
00190 const string MMSConfigData::getDataDBDBMS() {
00191 return this->datadb.dbms;
00192 }
00193
00194 const string MMSConfigData::getDataDBAddress() {
00195 return this->datadb.address;
00196 }
00197
00198 const unsigned int MMSConfigData::getDataDBPort() {
00199 return this->datadb.port;
00200 }
00201
00202 const string MMSConfigData::getDataDBUser() {
00203 return this->datadb.user;
00204 }
00205
00206 const string MMSConfigData::getDataDBPassword() {
00207 return this->datadb.password;
00208 }
00209 const string MMSConfigData::getDataDBDatabase() {
00210 return this->datadb.database;
00211 };
00212
00213
00214 const MMSConfigDataLayer MMSConfigData::getVideoLayer() {
00215 return this->graphics.videolayer;
00216 }
00217
00218 const MMSConfigDataLayer MMSConfigData::getGraphicsLayer() {
00219 return this->graphics.graphicslayer;
00220 }
00221
00222 const MMSFBBackend MMSConfigData::getBackend() {
00223 return this->graphics.backend;
00224 }
00225
00226 const MMSFBRectangle MMSConfigData::getVRect() {
00227 return this->graphics.vrect;
00228 }
00229
00230 const MMSFBRectangle MMSConfigData::getTouchRect() {
00231 return this->graphics.touchrect;
00232 }
00233
00234 const MMSFBPointerMode MMSConfigData::getPointer() {
00235 return this->graphics.pointer;
00236 }
00237
00238 const MMSFBSurfacePixelFormat MMSConfigData::getGraphicsWindowPixelformat() {
00239 return this->graphics.graphicswindowpixelformat;
00240 }
00241
00242 const MMSFBSurfacePixelFormat MMSConfigData::getGraphicsSurfacePixelformat() {
00243 return this->graphics.graphicssurfacepixelformat;
00244 }
00245
00246 const bool MMSConfigData::getExtendedAccel() {
00247 return this->graphics.extendedaccel;
00248 }
00249
00250 const string MMSConfigData::getAllocMethod() {
00251 return this->graphics.allocmethod;
00252 }
00253
00254 const MMSFBFullScreenMode MMSConfigData::getFullScreen() {
00255 return this->graphics.fullscreen;
00256 }
00257
00258 const int MMSConfigData::getRotateScreen() {
00259 return this->graphics.rotatescreen;
00260 }
00261
00262 const bool MMSConfigData::getHideApplication() {
00263 return this->graphics.hideapplication;
00264 }
00265
00266 const bool MMSConfigData::getInitialLoad() {
00267 return this->graphics.initialload;
00268 }
00269
00270 const bool MMSConfigData::getDebugFrames() {
00271 return this->graphics.debugframes;
00272 }
00273
00274 const bool MMSConfigData::getTouchSwapX() {
00275 return this->graphics.touchSwapX;
00276 }
00277
00278 const bool MMSConfigData::getTouchSwapY() {
00279 return this->graphics.touchSwapY;
00280 }
00281
00282 const bool MMSConfigData::getTouchSwapXY() {
00283 return this->graphics.touchSwapXY;
00284 }
00285
00286
00287
00288 void MMSConfigData::setVideoLayer(MMSConfigDataLayer layer) {
00289 this->graphics.videolayer = layer;
00290 }
00291
00292 void MMSConfigData::setGraphicsLayer(MMSConfigDataLayer layer) {
00293 this->graphics.graphicslayer = layer;
00294 }
00295
00296 void MMSConfigData::setFullScreen(MMSFBFullScreenMode fsm) {
00297 this->graphics.fullscreen = fsm;
00298 }
00299
00300 void MMSConfigData::setRotateScreen(int rs) {
00301 this->graphics.rotatescreen = rs;
00302 }
00303
00304 void MMSConfigData::setHideApplication(bool hideapplication) {
00305 this->graphics.hideapplication = hideapplication;
00306 }
00307
00308 void MMSConfigData::setInitialLoad(bool initialload) {
00309 this->graphics.initialload = initialload;
00310 }
00311
00312 void MMSConfigData::setDebugFrames(bool debugframes) {
00313 this->graphics.debugframes = debugframes;
00314 }
00315
00316
00317 const MMSLanguage MMSConfigData::getSourceLang() {
00318 return this->language.sourcelang;
00319 }
00320
00321 const MMSLanguage MMSConfigData::getDefaultTargetLang() {
00322 return this->language.defaulttargetlang;
00323 }
00324
00325 const bool MMSConfigData::getAddTranslations() {
00326 return this->language.addtranslations;
00327 }
00328
00329 const string MMSConfigData::getLanguagefileDir() {
00330 return this->language.languagefiledir;
00331 }
00332
00333
00334
00335