예제 #1
0
파일: main.cpp 프로젝트: dima1000/Gibui
int main(int argc, char *argv[])
{
	QApplication a(argc, argv);
	QFile styleSheetFile("C11.qss");
        if (styleSheetFile.open(QIODevice::ReadOnly))
          {
            QString ss = QLatin1String(styleSheetFile.readAll());
            a.setStyleSheet(ss);
          }
	ImageDraw w(argc, argv);
	w.show();
	return a.exec();
}
예제 #2
0
파일: inviwo.cpp 프로젝트: Ojaswi/inviwo
int main(int argc, char** argv) {
    std::string basePath = inviwo::filesystem::findBasePath();

    inviwo::LogCentral::init();
    inviwo::LogCentral::getPtr()->registerLogger(new inviwo::FileLogger(basePath));
    inviwo::InviwoApplicationQt inviwoApp("Inviwo v" + IVW_VERSION, basePath, argc, argv);
    inviwoApp.setWindowIcon(QIcon(":/icons/inviwo_light.png"));
    inviwoApp.setAttribute(Qt::AA_NativeWindows);
    QFile styleSheetFile(":/stylesheets/inviwo.qss");
    styleSheetFile.open(QFile::ReadOnly);
    QString styleSheet = QString::fromUtf8(styleSheetFile.readAll());
    inviwoApp.setStyleSheet(styleSheet);
    styleSheetFile.close();

    inviwo::InviwoMainWindow mainWin(&inviwoApp);
    // setup core application
    inviwoApp.setMainWindow(&mainWin);
    // initialize and show splash screen
    inviwo::InviwoSplashScreen splashScreen(
        &mainWin, inviwoApp.getCommandLineParser()->getShowSplashScreen());
    inviwoApp.setProgressCallback([&splashScreen](std::string s){splashScreen.showMessage(s);});

    splashScreen.show();
    splashScreen.showMessage("Loading application...");
    
    // Initialize application and register modules
    splashScreen.showMessage("Initializing modules...");
    inviwoApp.initialize(&inviwo::registerAllModules);
    inviwoApp.processEvents();
    // setup main window
    mainWin.initialize();
    inviwoApp.processEvents();
    splashScreen.showMessage("Loading workspace...");
    inviwoApp.processEvents();
    mainWin.showWindow();
    inviwoApp.processEvents();    // Make sure the gui is done loading before loading workspace
    mainWin.openLastWorkspace();  // open last workspace
    splashScreen.finish(&mainWin);

#if defined(REG_INVIWOUNITTESTSMODULE) && defined(IVW_RUN_UNITTEST_ON_STARTUP)
    inviwo::UnitTestsModule::runAllTests();
#endif

    // process last arguments
    if (mainWin.processCommandLineArgs()) {
        return inviwoApp.exec();
    } else {
        mainWin.exitInviwo();
        return 0;
    }
}
예제 #3
0
int main(int argc, char** argv) {
    std::string basePath = inviwo::filesystem::findBasePath();

    inviwo::LogCentral::init();
    auto filelogger = std::make_shared<inviwo::FileLogger>(basePath);
    inviwo::LogCentral::getPtr()->registerLogger(filelogger);
    inviwo::InviwoApplicationQt inviwoApp("Inviwo v" + IVW_VERSION, argc, argv);
    inviwoApp.setWindowIcon(QIcon(":/icons/inviwo_light.png"));
    inviwoApp.setAttribute(Qt::AA_NativeWindows);
    QFile styleSheetFile(":/stylesheets/inviwo.qss");
    styleSheetFile.open(QFile::ReadOnly);
    QString styleSheet = QString::fromUtf8(styleSheetFile.readAll());
    inviwoApp.setStyleSheet(styleSheet);
    styleSheetFile.close();

    auto& clp = inviwoApp.getCommandLineParser();

    inviwo::InviwoMainWindow mainWin(&inviwoApp);
    // setup core application
    inviwoApp.setMainWindow(&mainWin);
    // initialize and show splash screen
    inviwo::InviwoSplashScreen splashScreen(&mainWin, clp.getShowSplashScreen());
    inviwoApp.setProgressCallback([&splashScreen](std::string s) { splashScreen.showMessage(s); });

    splashScreen.show();
    splashScreen.showMessage("Loading application...");

    // Initialize application and register modules
    splashScreen.showMessage("Initializing modules...");
    inviwoApp.registerModules(&inviwo::registerAllModules);
    inviwoApp.processEvents();

    // Do this after registerModules if some arguments were added
    clp.parse(inviwo::CommandLineParser::Mode::Normal);

    // setup main window
    mainWin.initialize();
    inviwoApp.processEvents();
    splashScreen.showMessage("Loading workspace...");
    inviwoApp.processEvents();
    mainWin.showWindow();
    inviwoApp.processEvents();  // Make sure the gui is done loading before loading workspace

    mainWin.openLastWorkspace(clp.getWorkspacePath());  // open last workspace
    splashScreen.finish(&mainWin);

    inviwoApp.processEvents();
    clp.processCallbacks(); // run any command line callbacks from modules.
    inviwoApp.processEvents();

    inviwo::util::OnScopeExit clearNetwork([&](){
        inviwoApp.getProcessorNetwork()->clear();
    });

    // process last arguments
    if (!clp.getQuitApplicationAfterStartup()) {
        return inviwoApp.exec();
    }
    else {
        mainWin.exitInviwo(false);
        return 0;
    }
}