Exemplo n.º 1
0
int main(int , char** ) { // force console output
#else
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { // prevent console output
#endif
    setlocale(LC_ALL, ".OCP"); // we set default locale for console output (useful only for debug)
#else
int main(int , char** ) {
#endif
    StOutPageFlip::initGlobalsAsync();
    if(!StVersionInfo::checkTimeBomb("sView")) {
        return 1;
    }

    // setup environment variables
    const StString ST_ENV_NAME_STCORE_PATH =
    #if defined(_WIN64) || defined(_LP64) || defined(__LP64__)
        "StCore64";
    #else
        "StCore32";
    #endif
    const StString aProcessPath = StProcess::getProcessFolder();
    StString aProcessUpPath = StFileNode::getFolderUp(aProcessPath);
    if(!aProcessUpPath.isEmpty()) {
        aProcessUpPath += SYS_FS_SPLITTER;
    }
    StProcess::setEnv(ST_ENV_NAME_STCORE_PATH, aProcessPath);
    if(StFolder::isFolder(aProcessPath + "textures")) {
        StProcess::setEnv("StShare", aProcessPath);
    } else if(StFolder::isFolder(aProcessUpPath + "textures")) {
        StProcess::setEnv("StShare", aProcessUpPath);
    }

    StString aResDir = StProcess::getStShareFolder();
    StProcess::setEnv("CSF_UnitsLexicon",          aResDir + "UnitsAPI" ST_FILE_SPLITTER "Lexi_Expr.dat");
    StProcess::setEnv("CSF_UnitsDefinition",       aResDir + "UnitsAPI" ST_FILE_SPLITTER "Units.dat");
    StProcess::setEnv("CSF_ShadersDirectory",      aResDir + "shaders" ST_FILE_SPLITTER "StCADViewer");
    StProcess::setEnv("CSF_SHMessage",             aResDir + "lang");
    StProcess::setEnv("CSF_MDTVTexturesDirectory", aResDir + "textures");

    StHandle<StOpenInfo> anInfo;
    if(anInfo.isNull()
    || (!anInfo->hasPath() && !anInfo->hasArgs())) {
        anInfo = StApplication::parseProcessArguments();
    }
    if(anInfo.isNull()) {
        // show help
        StString aShowHelpString = getAbout();
        st::cout << aShowHelpString;
        stInfo(aShowHelpString);
        return 0;
    }

    StHandle<StResourceManager> aResMgr = new StResourceManager();
    StHandle<StCADViewer> anApp  = new StCADViewer(aResMgr, NULL, anInfo);
    if(!anApp->open()) {
        return 1;
    }
    return anApp->exec();
}
Exemplo n.º 2
0
// Method to create the Main Menu
void Window::createMainMenu()
{
    // Creates the push button main menu
    QMenu *mainMenu = new QMenu();

    //Add ABout Scout Talker action to the menu
    QAction *aboutST = mainMenu->addAction(tr("About &Scout Talker"));
    // Connects the action to the stInfo slot
    connect(aboutST, SIGNAL(triggered()), this, SLOT(stInfo()));

    // Add About Qt action to the menu
    QAction *aboutQt = mainMenu->addAction(tr("About &Qt"));
    // Sets icon for the action
    aboutQt->setIcon(QIcon(":/icons/Qt_logo_2015.png"));
    // Connects the action to the qtInfo slot
    connect(aboutQt, SIGNAL(triggered()), this, SLOT(qtInfo()));

    // Add Exit action to the menu
    QAction *exitAction = mainMenu->addAction(tr("E&xit"));
    // Sets shortcut for the exit action
    exitAction->setShortcuts(QKeySequence::Quit);
    // Connects the exit action to the quit slot
    connect(exitAction, SIGNAL(triggered()), QApplication::instance(), SLOT(quit()));


    // Creates push button that will contain the main logo
    mainMenuButton = new QPushButton();

    // Sets button size
    mainMenuButton->setFixedSize(100, 100);

    // Sets button icon and size
    mainMenuButton->setIcon(QIcon(":/icons/Qt_logo_2015.png"));
    mainMenuButton->setIconSize(QSize(95, 95));

    // Changes button style sheet to remove the menu indicator and border
    mainMenuButton->setStyleSheet("QPushButton::menu-indicator {image: none;}"
                          "QPushButton {border: 0px solid #8f8f91;}");

    // Sets hovering cursor for the button
    mainMenuButton->setCursor(Qt::PointingHandCursor);

    // Adds the main menu to the push button
    mainMenuButton->setMenu(mainMenu);
}
Exemplo n.º 3
0
void StActiveXCtrl::AboutBox() {
    stInfo(StString("This is sView ") + SVIEW_SDK_VER_STRING + " ActiveX Control for Internet Explorer");
}