// the principal program sequence void PortVideoSDL::run() { if( !setupCamera() ) { if( !setupWindow() ) return; showError("No camera found!"); teardownWindow(); return; } if( !setupWindow() ) return; allocateBuffers(); initFrameProcessors(); bool success = camera_->startCamera(); if( success ){ SDL_FillRect(window_,0,0); SDL_Flip(window_); // add the help message from all FrameProcessors for (frame = processorList.begin(); frame!=processorList.end(); frame++) { std::vector<std::string> processor_text = (*frame)->getOptions(); if (processor_text.size()>0) help_text.push_back(""); for(std::vector<std::string>::iterator processor_line = processor_text.begin(); processor_line!=processor_text.end(); processor_line++) { help_text.push_back(*processor_line); } } //print the help message for(std::vector<std::string>::iterator help_line = help_text.begin(); help_line!=help_text.end(); help_line++) { std::cout << *help_line << std::endl; } std::cout << std::endl; running_=true; cameraThread = SDL_CreateThread(getFrameFromCamera,this); controlThread= SDL_CreateThread(getControlMessage,this); mainLoop(); SDL_KillThread(cameraThread); SDL_KillThread(controlThread); teardownCamera(); } else { showError("Could not start camera!"); } teardownWindow(); freeBuffers(); }
bool Application::Setup() { // Make the window setupWindow(); // Setup System Time _systemTime->Setup(); // Setup containters _timerContainer->Setup(); _physicsContainer->Setup(); _rendererContainer->Setup(); _gameObjectContainer->Setup(); // Setup the registries _meshRegistry->Load(); _shaderRegistry->Load(); _meshRegistry->SetupAllVertexFormats(); _textureRegistry->Load(); _materialRegistry->Load(); _audioRegistry->Load(); _fontRegistry->Load(); _prefabRegistry->Load(); _sceneRegistry->Load(); // Setup camera setupCamera(); return true; }
//======================================================================= //protected bool Application::init ( HINSTANCE hInstance, DWORD style ) { myInstanceMonitor.create( resourceClassName() ); if ( !myInstanceMonitor.isThisTheOnlyInstance() ) { Logger::message( _T("More then one type of this application is running.") ); return false; } if ( !preInit( hInstance ) ) { return false; } if ( !ourClassIsRegistered ) { Application::ourHInstance = hInstance; ourClassIsRegistered = registerClass(); } if ( !preWindow() || !setupWindow( style ) || !postInit() ) { return false; } return (GetWindowLongPtr( myHWnd, GWLP_USERDATA ) == (LONG)this); }
View::View(QGraphicsScene *scene) : QGraphicsView(scene), m_timer(this) ,m_delay(30){ qDebug()<<"in View now"; QPixmap bgPix(":/images/koskipuisto_pieni.jpg"); m_pix = bgPix; setupWindow(); int h = height(); int y = qAbs(m_imageHeight-h)/2; setSceneRect(0, y, width(), h); m_sensors.append(InputController::QACCELEROMETER); m_sensors.append(InputController::QORIENTATIONSENSOR); m_sensors.append(InputController::QMAGNETOMETER); m_sensors.append(InputController::QROTATIONSENSOR); m_sensors.append(InputController::QTAPSENSOR); m_sensors.append(InputController::QCOMPASS); m_sensors.append(InputController::QKEYS); m_menu = new QMenu(this); createActions(); handleAction(NULL,InputController::QACCELEROMETER); m_timer.setSingleShot(false); m_timer.start(m_delay); connect(&m_timer, SIGNAL(timeout()), this, SLOT(update())); connect(this,SIGNAL(sceneRectChanged(QRectF)), this, SLOT(checkSensors(QRectF))); }
Draw::Draw() : window(NULL), width(600), height(400) { setupWindow(); }
DeliveryWindow::DeliveryWindow(_dataStructs * _structs, QWidget *parent) : QDialog(parent), ui(new Ui::DeliveryWindow) { dataStructs = _structs; ui->setupUi(this); setupWindow(); }
Game::Game(RenderWindow &w, Font &fo) : win(w), f(fo), pl(Vector2f(0.0f, 0.0f)), running(false) { setupWindow(); }
int main( int argc, char** argv ) { // Initialize GLFW glfwInit(); if( !setupWindow( appWidth, appHeight, fullScreen ) ) return -1; // Initalize application and engine app = new Application( generatePath( argv[0], "../Content" ) ); if ( !app->init() ) { // Fake message box glfwCloseWindow(); glfwOpenWindow( 800, 16, 8, 8, 8, 8, 24, 8, GLFW_WINDOW ); glfwSetWindowTitle( "Unable to initalize engine - Make sure you have an OpenGL 2.0 compatible graphics card" ); glfwSleep( 5 ); std::cout << "Unable to initalize engine" << std::endl; std::cout << "Make sure you have an OpenGL 2.0 compatible graphics card"; glfwTerminate(); return -1; } app->resize( appWidth, appHeight ); TwWindowSize( appWidth, appHeight ); //glfwDisable( GLFW_MOUSE_CURSOR ); int frames = 0; float fps = 30.0f; t0 = glfwGetTime(); running = true; // Game loop while( running ) { // Calc FPS ++frames; if( frames >= 3 ) { double t = glfwGetTime(); fps = frames / (float)(t - t0); frames = 0; t0 = t; } // Render app->mainLoop( fps ); TwDraw(); glfwSwapBuffers(); } glfwEnable( GLFW_MOUSE_CURSOR ); // Quit app->release(); delete app; glfwTerminate(); return 0; }
void ScreenshotGrabber::reInit() { scene = new QGraphicsScene; window = new QGraphicsView (scene); // Top-level widget setupWindow(); setupScene(scene); showGrabber(); blocked = false; }
ScreenshotGrabber::ScreenshotGrabber(QObject* parent) : QObject(parent) { scene = new QGraphicsScene; window = new QGraphicsView (scene); // Top-level widget setupWindow(); setupScene(scene); installEventFilter(this); }
errWindow::errWindow( struct errorStruct * _err, QWidget *parent) : QDialog(parent), ui(new Ui::errWindow) { currErr = _err; ui->setupUi(this); setupWindow(); }
specHistoryWidget::specHistoryWidget(QUndoStack* stack, QWidget* parent) : specDockWidget(tr("History"), parent), undoView(new QUndoView(stack, this)) { setWhatsThis("Undo history. Click on any command to forward/rewind to that particular state."); toggleViewAction()->setIcon(QIcon::fromTheme("view-history")) ; toggleViewAction()->setWhatsThis(tr("Shows and hides the undo history.")); setObjectName(tr("History window")); toggleViewAction()->setText(tr("Toggle undo window")); setupWindow(0); }
BasicApp::BasicApp(int width, int height) : viewportWidth(width), viewportHeight(height) { glfwInit(); // Instantiate GLFW glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); // Tell GLFW that we want to use version 3.3 of OpenGL glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); // Use the core profile glfwWindowHint(GLFW_RESIZABLE, GL_FALSE); // Don't let the user resize the window glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); glfwWindowHint(GLFW_SAMPLES, 4); setupWindow(); }
void keyPressListener( int key, int action ) { if( !running ) return; if( action == GLFW_PRESS ) { int width = appWidth, height = appHeight; switch (key) { case GLFW_KEY_ESC: running = false; break; case GLFW_KEY_SPACE: app->keyPress( key, true ); break; case GLFW_KEY_F1: app->release(); glfwCloseWindow(); // Toggle fullscreen mode fullScreen = !fullScreen; if( fullScreen ) { GLFWvidmode mode; glfwGetDesktopMode( &mode ); // Use desktop resolution width = mode.Width; height = mode.Height; } if( !setupWindow( width, height, fullScreen ) ) { glfwTerminate(); exit( -1 ); } app->init(sceneFile); app->resize( width, height ); t0 = glfwGetTime(); break; default: app->keyPress( key, true ); } } if( key >= 0 ) app->keyPress( key, action == GLFW_PRESS ); }
PickupWindow::PickupWindow(_dataStructs * _structs, QWidget *parent) : QDialog(parent), ui(new Ui::PickupWindow) { dataStructs = _structs; ui->setupUi(this); QStringList tableHeaders; tableHeaders << "Item" << "Barcode"; ui->invItemsTable->setColumnCount(2); ui->invItemsTable->setHorizontalHeaderLabels(tableHeaders); ui->invItemsTable->setColumnWidth(0, 200); ui->invItemsTable->setColumnWidth(1, 194); setupWindow(); }
Renderer::Renderer(int width, int height) { if (setupGL() == 1) { exit(1); } _window = setupWindow(width,height); if (!_window) { std::cout << "ERROR: Falied to initialize glfw window." << std::endl; exit(1); } vertexShaderPath = ""; fragmentShaderPath = ""; setCenterX = 0; setCenterY = 0; updateFunctions = new vector<void (*)(int)>(); }
/* * Main method */ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR cmdLine, int showCmd) { ghAppInst = hInstance; OutputDebugString("loading resources..."); loadResources(); OutputDebugString("starting window..."); // setup WNDCLASS wndClass = setupWindow(); // register RegisterClass(&wndClass); // create window ghMainWnd = CreateWindow(wndClass.lpszClassName, wndClass.lpszClassName, WS_OVERLAPPEDWINDOW, 200, 200, windowWidth, windowHeight, 0, gHMenu, ghAppInst, 0); if(ghMainWnd == 0) { ::MessageBox(0, "Couldn't instantiate window", "ERROR", MB_OK); return false; } // show and update ShowWindow(ghMainWnd, SW_SHOW); UpdateWindow(ghMainWnd); // Message Loop MSG msg; ZeroMemory(&msg, sizeof(MSG)); while(GetMessage(&msg, 0, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return (int) msg.wParam; }
void mainLoop() { try { while (running) { setupWindow(width, height, "raycar"); Asset::init(GLContext::context()); SceneGraph::init(GLContext::context()); loadScene("content/raycar.scn"); resetTimer(); double now = 0; while (sceneRunning && running) { pollInput(); double next = timer(); if (active) { if (next > now + maxStepTime) { // falling behind now = next - maxStepTime; } while (now < next) { stepScene(); now += stepTime; } } else { now = next; } renderWindow(); } } } catch (std::exception const &x) { error(x.what()); } }
void VulkanApp::v_run() { setupWindow(); v_init(); MSG msg; ZeroMemory(&msg, sizeof(MSG)); while (TRUE) { auto tStart = std::chrono::high_resolution_clock::now(); if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } if (msg.message == WM_QUIT) { break; } v_update(); v_render(); auto tEnd = std::chrono::high_resolution_clock::now(); auto tDiff = std::chrono::duration<double, std::milli>(tEnd - tStart).count(); frameTimer = (float)tDiff / 1000.0f; // Convert to clamped timer value if (!paused) { timer += timerSpeed * frameTimer; if (timer > 1.0) { timer -= 1.0f; } } } }
int main() { srand(time(NULL)); // Setup window and give pointer GLFWwindow *window = setupWindow(); // Initialise tree variables node *treeRoot; bounds *initial = malloc(sizeof(bounds)); // Setup initial bounds initial->centerX = 0; initial->centerY = 0; initial->halfDistance = squareSize / 2; // Create tree root treeRoot = createNode(initial); glfwSetWindowUserPointer(window, treeRoot); while (!glfwWindowShouldClose(window)) { glClear(GL_COLOR_BUFFER_BIT); drawTree(treeRoot, 0); glfwSwapBuffers(window); glfwPollEvents(); } // Free tree memory delTree(treeRoot); glfwDestroyWindow(window); glfwTerminate(); return 0; }
void GLFWCALL keyPressListener( int key, int action ) { if( !running ) return; if( action == GLFW_PRESS ) { int width = appWidth, height = appHeight; switch (key) { case GLFW_KEY_ESC: running = false; break; case GLFW_KEY_SPACE: app->keyPressEvent( key ); break; case GLFW_KEY_F1: app->release(); glfwCloseWindow(); // Toggle fullscreen mode fullScreen = !fullScreen; if( fullScreen ) { GLFWvidmode mode; glfwGetDesktopMode( &mode ); float aspect = mode.Width / (float)mode.Height; if( (int)(aspect * 100) == 133 || (int)(aspect * 100) == 125 ) // Standard { width = 1280; height = 1024; } else if( (int)(aspect * 100) == 160 ) // Widescreen { width = 1280; height = 800; } else // Unknown { // Use desktop resolution width = mode.Width; height = mode.Height; } } if( !setupWindow( width, height, fullScreen ) ) { glfwTerminate(); exit( -1 ); } app->init(); app->resize( width, height ); t0 = glfwGetTime(); break; default: app->keyPressEvent( key ); break; } } if( key >= 0 ) app->keyStateChange( key, action == GLFW_PRESS ); }
int main(int argc, char ** argv) { auto pathToRom = std::string(); if (argc == 2) { pathToRom = argv[1]; } else { printf("Chip8 Error: Wrong number of arguments\n"); return -1; } sf::SoundBuffer beepSnd; if (! beepSnd.loadFromFile("data/sounds/beep.wav")) { printf("Chip8 Error: Can't load the beeping sound.\n"); return -1; } sf::Sound sndSrc; sndSrc.setBuffer(beepSnd); sndSrc.setLoop(false); auto window = setupWindow(WIDTH, HEIGHT, TITLE); cee::Chip8 chip; chip.loadProgram(readAllBytes(pathToRom.c_str())); constexpr GLfloat pxVerts[] = { -1.0f, 1.0f, 0.0f, // Top Left 1.0f, 1.0f, 0.0f, // Top Right -1.0f, -1.0f, 0.0f, // Bottom Left 1.0f, -1.0f, 0.0f // Bottom Right }; constexpr GLuint pxIndices[] = { 0, 1, 2, 2, 1, 3 }; // Initialize the VAO and other buffers associated // with drawing an emulated pixel. GLuint vao, vbo, ibo; glGenVertexArrays(1, &vao); glBindVertexArray(vao); { glGenBuffers(1, &vbo); glGenBuffers(1, &ibo); // VBO glBindBuffer(GL_ARRAY_BUFFER, vbo); glBufferData(GL_ARRAY_BUFFER, sizeof(pxVerts), &pxVerts, GL_STATIC_DRAW); // IBO glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo); glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(pxIndices), &pxIndices, GL_STATIC_DRAW); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(GLfloat), nullptr); glEnableVertexAttribArray(0); } glBindVertexArray(0); // Current Vertex Shader const auto pxVertexSrc = readAllChars("data/shaders/px_vertex.glsl"); const auto pxVertex = makeShader(GL_VERTEX_SHADER, pxVertexSrc); // Current Fragment Shader const auto pxFragmentSrc = readAllChars("data/shaders/px_fragment.glsl"); const auto pxFragment = makeShader(GL_FRAGMENT_SHADER, pxFragmentSrc); // Current Shader Program const auto pxProgram = makeProgram({pxVertex, pxFragment}); glUseProgram(pxProgram); glfwShowWindow(window); while (! glfwWindowShouldClose(window)) { chip.updateKeys(getKeyStates(window)); chip.updateCycle(); if (chip.isBeeping() && sndSrc.getStatus() != sf::SoundSource::Playing) sndSrc.play(); // Clear back buffer and background color. glClear(GL_COLOR_BUFFER_BIT); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glBindVertexArray(vao); const auto gfx = chip.getGfx(); for (int i = 0; i < 32; ++i) { // Maps the width resolution [0-HEIGHT] to [-1.0-1.0] auto y = - mapRangeHeight(i); auto l = i * 64; for (int j = 0; j < 64; ++j) { if (gfx[l + j] == 1) { // Maps the width resolution [0-WIDTH] to [-1.0-1.0] auto x = mapRangeWidth(j); auto ident = glGetUniformLocation(pxProgram, "PxModel"); auto model = glm::mat4(1.0f); model = glm::translate(model, glm::vec3(x, y, 0.0f)); model = glm::scale(model, glm::vec3(PX_WIDTH, PX_HEIGHT, 1.0f)); glUniformMatrix4fv(ident, 1, GL_FALSE, glm::value_ptr(model)); glDrawElements(GL_TRIANGLES, sizeof(pxIndices), GL_UNSIGNED_INT, nullptr); } } } glBindVertexArray(0); glfwSwapBuffers(window); glfwPollEvents(); } // Cleanup resources glDeleteProgram(pxProgram); glDeleteShader(pxVertex); glDeleteShader(pxFragment); glDeleteVertexArrays(1, &vao); glDeleteBuffers(1, &ibo); glDeleteBuffers(1, &vbo); glfwTerminate(); return 0; }
DnssecSystemTrayPrefs::DnssecSystemTrayPrefs(QWidget *parent) : QDialog(parent) { readLogFiles(); setupWindow(); }
int main(int argc, char** argv) { if ( argc < 2 ) { std::cout << " No GameEngine File specified " << std::endl; return -1; } // Initialize GLFW glfwInit(); if( !setupWindow( appWidth, appHeight, fullScreen ) ) return -1; GLFWvidmode desktopMode; glfwGetDesktopMode( &desktopMode ); sceneFile = argv[1]; // Initalize application and engine app = new NetworkApp(/*desktopMode.Width, desktopMode.Height*/); if ( !app->init(sceneFile) ) { // Fake message box glfwCloseWindow(); glfwOpenWindow( 800, 16, 8, 8, 8, 8, 24, 8, GLFW_WINDOW ); glfwSetWindowTitle( "Unable to initalize engine - Make sure you have an OpenGL 2.0 compatible " "graphics card and have specified a valid GameEngine scene" ); double startTime = glfwGetTime(); while( glfwGetTime() - startTime < 5.0 ) {} // Sleep std::cout << "Unable to initalize engine" << std::endl; std::cout << "Make sure you have an OpenGL 2.0 compatible graphics card"; glfwTerminate(); return -1; } app->resize( appWidth, appHeight ); // hide mouse cursor glfwDisable( GLFW_MOUSE_CURSOR ); int frames = 0; float fps = 30.0f; t0 = glfwGetTime(); running = true; // Game loop while( running ) { // Calc FPS ++frames; if( frames >= 3 ) { double t = glfwGetTime(); fps = frames / (float)(t - t0); frames = 0; t0 = t; } // Render app->render(); glfwSwapBuffers(); } glfwEnable( GLFW_MOUSE_CURSOR ); // Quit app->release(); delete app; glfwTerminate(); return 0; }
int main(int argc, char** argv) { parseConfigXml(); if (sceneFile.empty() && argc >= 2) { sceneFile = argv[1]; } if (sceneFile.empty()) { std::cerr << "No Scenefile given. Please configure config.xml or pass an argument!" << std::endl; glfwOpenWindow( 640, 16, 8, 8, 8, 8, 24, 8, GLFW_WINDOW ); glfwSetWindowTitle( "No Scenefile given. Please configure config.xml or pass an argument!" ); double startTime = glfwGetTime(); while( glfwGetTime() - startTime < 5.0 ) {} glfwTerminate(); return -1; } // Initialize GLFW glfwInit(); if( !setupWindow( width, height, fullScreen ) ) return -1; GLFWvidmode desktopMode; glfwGetDesktopMode( &desktopMode ); // Initalize application and engine app = new DemoApp(); if ( !app->init(sceneFile.c_str()) ) { std::cout << "Unable to initalize engine" << std::endl; std::cout << "Make sure you have an OpenGL 2.0 compatible graphics card"; // Fake message box glfwCloseWindow(); glfwOpenWindow( 800, 16, 8, 8, 8, 8, 24, 8, GLFW_WINDOW ); glfwSetWindowTitle( "Unable to initalize engine - Make sure you have an OpenGL 2.0 compatible " "graphics card and have specified a valid GameEngine scene" ); double startTime = glfwGetTime(); while( glfwGetTime() - startTime < 5.0 ) {} // Sleep glfwTerminate(); return -1; } app->resize( width, height ); //glfwDisable( GLFW_MOUSE_CURSOR ); int frames = 0; float fps = 30.0f; t0 = glfwGetTime(); running = true; // Game loop while( running ) { // Calc FPS ++frames; if( frames >= 3 ) { double t = glfwGetTime(); fps = frames / (float)(t - t0); frames = 0; t0 = t; } // Render app->render(); glfwSwapBuffers(); } glfwEnable( GLFW_MOUSE_CURSOR ); // Quit app->release(); delete app; glfwTerminate(); return 0; }
void Game::start() { setupWindow(); gameLoop(); }
void initGlut(int argc, char** argv) { glutInit(&argc, argv); setupWindow(); setupCallbacks(); }
void App::onInit() { setupWindow(GAME_WIDTH, GAME_HEIGHT, "SDL Engine Example Game", "../../assets/", 2); setFps(60); }
int main( int argc, char* args[] ){ unsigned int i; argcHold = argc; argsHold = *args; string input, buffer, filename; ofstream myfile; cout << "Welcome to skyGesture Application.\nThis program requires a .cvs file.\nPlease note that it has to be in the same directory as this executable.\n"<<endl; short col = 0; // Which column am i in max 4: x, y, z, classification string temp; // to hold and devide the lines from the file char *tempArr; char *pch; // for spliting the // x, y, & z coordinates will be read in from a file and stored in a vector cout << "Trying to open file" << endl; ifstream file; //file.open("C:/Users/Juan/Downloads/lidar.csv"); // need to make this general cout << "Name of your .csv file: "; cin >> filename; filename += ".csv"; cout << "Filename: " << filename << endl; file.open(filename); if(file.is_open()) { cout << "File is open" << endl; getline(file,temp); // get the header out of the way //while(point_count <5) while(file.good()) { getline(file,temp); //cout << temp << endl; tempArr = new char[temp.size()+1]; tempArr[temp.size()] = 0; memcpy(tempArr, temp.c_str(), temp.size()); //cout << tempArr << endl; pch = strtok(tempArr,","); col = 0; while(pch != NULL) { switch(col) { case 0: xcor.push_back(atof(pch)); break; case 1: ycor.push_back(atof(pch)); break; case 2: zcor.push_back(atof(pch)); break; case 3: classification.push_back(atoi(pch)); break; default: cout << "Don't print this out" << endl; } pch = strtok(NULL, ","); col++; } point_count++; } cout << "Read in " << point_count << " points" << endl; file.close(); cout << "File has been closed" << endl; /* // print out the points cout << "X-coor\tY-coor\t\tZ-coor\tClass" << endl; for(int i=0; i<classification.size(); i++) { cout << xcor[i] << '\t' << ycor[i] << '\t' << zcor[i] << '\t' << classification[i] << endl; } */ } else cout << "Unable to open file" << endl; g_vertex_LIDAR = new GLdouble[point_count*3]; int counter = 0; for(int k =0; k<point_count*3-3;k+=3){ cout<<"Loop is at: " << k << "counter is at: "<<counter<<endl; cout<<xcor[counter]<<","<<ycor[counter]<<","<<zcor[counter]<<endl; g_vertex_LIDAR[k] =xcor[counter] ; g_vertex_LIDAR[k+1] = ycor[counter]; g_vertex_LIDAR[k+1] = zcor[counter]; counter++; } cout << "Type in 'glut' to start using GLUT Library or 'glfw' to use GLFW Library"<< endl; do{ cout << ">>"; getline(cin, input); if(input.compare("glut")==0){ setupWindow(argc,args); } if(input.compare("glfw")==0){ Draw *glfwWindow = new Draw(); glfwWindow->draw(Draw::test); //glfwWindow->drawLIDAR(&g_vertex_LIDAR); glfwTerminate(); } } while(input.compare("quit") != 0); delete g_vertex_LIDAR; return 0; }
MainWindow::MainWindow(CommandLineParser parser, QWidget *parent) : QMainWindow(parent) { // set windows size, title and icon image setupWindow(); versionLabel = new QLabel(this); plugins = Utilities::readAllPlugins(":/Plugins"); qDebug() << "Number of Plugins : " << plugins.size(); createActions(); createTrayIcon(); welcomeWidget = new WelcomeWidget; optionWidget = new OptionsWidget(plugins); scheduleWidget = new ScheduleWidget ; shredWidget = new ShredWidget; aboutWidget = new AboutWidget; scanWidget = new ScanWidget; resultWidget = new ResultWidget; stackedWidget = new QStackedWidget(this); stackedWidget->addWidget(welcomeWidget); stackedWidget->addWidget(optionWidget); stackedWidget->addWidget(scheduleWidget); stackedWidget->addWidget(shredWidget); stackedWidget->addWidget(aboutWidget); stackedWidget->addWidget(scanWidget); stackedWidget->addWidget(resultWidget); this->setCentralWidget(stackedWidget); // Automatic registerat the application with license // quick fix for application lifetime for GPL version aboutWidget->validateKey("OTkwR-lVHQ0-w2NTg-3MTJ9"); trayIcon->show(); createDockWidget(); createStatusBar(); setStatusBarText(); retranslate(); this->setMaximumSize(QSize(this->width(), this->height())); connect(welcomeWidget, SIGNAL(scanProgressSignal()), this, SLOT(scanProgressSlot())); connect(scanWidget, SIGNAL(showWelcomeWidgetSignal()), this, SLOT(showWelcomeWidgetSlot())); connect(scanWidget, SIGNAL(finishScanProcessSignal()), this, SLOT(finishScanProcessSlot())); connect(resultWidget, SIGNAL(showWelcomeWidgetSignal()), this, SLOT(showWelcomeWidgetSlot())); connect(optionWidget, SIGNAL(selectItemSignal(int)), this, SLOT(selectItemSlot(int))); connect(aboutWidget, SIGNAL(updateSignal(bool)), this, SLOT(updateSlot(bool))); connect(&thread, SIGNAL(finishUpdateSignal(bool)), this, SLOT(finishUpdateSlot(bool))); connect(&thread, SIGNAL(errorUpdateSignal()), this, SLOT(errorUpdateSlot())); connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason))); // lunch schedule if its not work SettingsHandler::writeApplicationInfo(); Utilities::addScheduleInStartup(); Utilities::lunchScheduleNow(); if ( SettingsHandler::isFreeVersion() ) { if ( SettingsHandler::isExpireVersion() ) { //Utilities:: promptForFreeVersion(); bool ok; QString text = QInputDialog::getText(0, tr("Trial Version Expired"),tr("Please Enter CPC Serial Number"), QLineEdit::Normal,"", &ok); if (!ok || text.isEmpty()) exit(1); if ( !aboutWidget->validateKey(text) ) exit(1); } } readSettings(); handleCommandLineOptions(parser); }