|
|
#include <winsock2.h>
#include "main_window.h"
#include "../../components/base/basicSettingsProvider.h"
#include "../../components/object/objectFileLoggingService.h"
#define LOG(X) mpLog->Log( "Main", NULL, X )
#define LOG_DEBUG( X ) mpLog->Log( "Main", NULL, _LOG_DEBUG, X )
#define LOG_ERROR( X ) mpLog->Log( "Main", NULL, _LOG_ERROR, X )
//int main(int argc, char *argv[]) {
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow){ //Beep(512, 512);
//Beep(256, 256);
//Beep(128, 128);
guiClass *GUI; GUI = guiClass::getInstance(); GUI->init(0, NULL);//argc, argv);
basicLogCollection *mpLog = basicLogCollection::getInstance(); objectFileLoggingService *fLog; char tPath[1024]; char *ttPtz=NULL; //ttPtz = (char *)GUI->getApp()->applicationDirPath().toStdString().c_str();
if( ttPtz!= NULL ){ sprintf(tPath, "%s/my.log", ttPtz); } else { sprintf(tPath, "my.log" ); }; fLog = new objectFileLoggingService(tPath); mpLog->addHandler((basicLoggingService *)fLog); printf("From now - refer to log file\n"); LOG_DEBUG("ENTER APPLICATION"); basicSettingsProvider *mpSettingsProvider = basicSettingsProvider::getInstance(); config_setting_t *mpSettings; //mpStorPro->startNewSeries(); // Each prog start starts new Series
#ifdef __linux__
LOG_DEBUG("SS Disabled");#else
UINT lActiveFlag = 0; SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, lActiveFlag, NULL, NULL); SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, lActiveFlag, NULL, NULL); UINT timeoutLowPower; UINT timeoutPowerOff; UINT timeoutScreenSave; { SystemParametersInfo(SPI_GETLOWPOWERTIMEOUT, 0, &(timeoutLowPower), 0); SystemParametersInfo(SPI_GETPOWEROFFTIMEOUT, 0, &(timeoutPowerOff), 0); SystemParametersInfo(SPI_GETSCREENSAVETIMEOUT, 0, &(timeoutScreenSave), 0); SystemParametersInfo(SPI_SETLOWPOWERTIMEOUT, 0, NULL, 0); SystemParametersInfo(SPI_SETPOWEROFFTIMEOUT, 0, NULL, 0); SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, 0, NULL, 0); } LOG_DEBUG("SS Disabled"); #endif
mpSettings = mpSettingsProvider->getSubNode(NULL, "APPLICATION_GUI");
mainWinow *window; window = mainWinow::getInstance(); //Check Startup Mode
int gAppStartupMode; config_setting_t *pSetting;
if (!config_setting_lookup_int(mpSettings, "STARTUP_WINDOW_MODE", &gAppStartupMode )){ gAppStartupMode = 1; pSetting = config_setting_add(mpSettings, "STARTUP_WINDOW_MODE", CONFIG_TYPE_INT); config_setting_set_int(pSetting, gAppStartupMode); mpSettingsProvider->compromise(); };
switch( gAppStartupMode ){ case 0: window->show(); break; case 1: window->showMaximized(); break; case 2: window->showFullScreen(); break; default: gAppStartupMode = 1; pSetting = config_setting_lookup(mpSettings, "STARTUP_WINDOW_MODE"); config_setting_set_int(pSetting, gAppStartupMode); mpSettingsProvider->compromise(); window->showMaximized(); };#ifdef __linux__
LOG_DEBUG("SS Enabled");#else
{ SystemParametersInfo(SPI_SETLOWPOWERTIMEOUT, timeoutLowPower, NULL, 0); SystemParametersInfo(SPI_SETPOWEROFFTIMEOUT, timeoutPowerOff, NULL, 0); SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, timeoutScreenSave, NULL, 0); } LOG_DEBUG("SS Enabled");#endif
delete GUI; delete window; delete mpSettingsProvider;#ifdef __linux__
#else
lActiveFlag = 1; SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, lActiveFlag, 0, 0); lActiveFlag = 20; SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, lActiveFlag, NULL, NULL); LOG_DEBUG("SS Enabled");#endif
LOG_DEBUG("EXIT APPLICATION"); delete mpLog; return 0;};
#undef LOG
#undef LOG_DEBUG
#undef LOG_ERROR
/*---------------------------------------*//* A sample program to play C major *//* through a PC speaker *//*---------------------------------------*//* This won't work if standard output is *//* re-directed to a non-tty device, or *//* PC speaker wave output is active *//*---------------------------------------*//* M.G. 27-Nov-99 *//*---------------------------------------*/
/*
#include <sys/ioctl.h>
#include <unistd.h>
#include <linux/kd.h>
int main(void){ int freq[] = { // C D E F G A B C
523, 587, 659, 698, 784, 880, 988, 1046 }; int i;
for (i = 0; i<8; i++) { ioctl(STDOUT_FILENO, KIOCSOUND, 1193180 / freq[i]); usleep(500000); } ioctl(STDOUT_FILENO, KIOCSOUND, 0); // Stop silly sound
return 0;}
*/
|