You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

127 lines
4.7 KiB

#include <stdio.h>
#ifdef _NO_STDIO_IOB_FUNC_
extern "C" { FILE __iob_func[3] = { *stdin,*stdout,*stderr }; }
#endif
#include "mainwindow.h"
#include <QApplication>
#include "../../components/base/basicSettingsProvider.h"
#include "../../components/base/basicEventHeap.h"
#include "../../data/media/mediaVideoSourceManager.h"
#include "../../components/object/objectFileLoggingService.h"
#include "../../components/object/objectSystemAnchor.h"
#include "../../data/media/video/videoAVLIBSource.h"
#include "../../data/net/onvifDeviceNode.h"
#include "../../components/object/objectEventReport.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[]){
QApplication a(argc, argv);
systemAnchor *ANCH;
ANCH = systemAnchor::getInstance();
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();
basicEventHeap *mpEventHeap = basicEventHeap::getInstance();
mediaVideoSourceManager *LS = mediaVideoSourceManager::getInstance();
//sprintf(tPath, "%s/data/storage", GUI->getApp()->applicationDirPath().toStdString().c_str());
sprintf(tPath, "data/storage");
//ToDO: Check Report Object!
//objectEventReport *mpReporter = objectEventReport::getInstance();
//storageProvider *mpStorPro = storageProvider::getInstance(tPath);
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");
MainWindow *window;
window = new MainWindow();// mainWinow::getInstance();
//Check Startup Mode
int gAppStartupMode;
config_setting_t *pSetting;
if (!config_setting_lookup_int(mpSettings, "STARTUP_WINDOW_MODE", &gAppStartupMode )){
gAppStartupMode = 0;
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 = 0;
pSetting = config_setting_lookup(mpSettings, "STARTUP_WINDOW_MODE");
config_setting_set_int(pSetting, gAppStartupMode);
mpSettingsProvider->compromise();
window->showMaximized();
};
joysticObject::getInstance();
//delete GUI;
a.exec();
delete window;
delete LS;
delete mpEventHeap;
delete mpSettingsProvider;
#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");
//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;
}
#undef LOG
#undef LOG_DEBUG
#undef LOG_ERROR