Esempio n. 1
1
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    app.setApplicationName("objects");
    app.setApplicationVersion("0.1");

    QCommandLineParser parser;
    parser.setApplicationDescription("OpenGL objects");
    parser.addHelpOption();
    parser.addVersionOption();

    QCommandLineOption objectOption(QStringList() << "o" << "object",
            QCoreApplication::translate("main", "Use object <object>."),
            QCoreApplication::translate("main", "object"),
            QString::fromLatin1("earth.obj"));
    parser.addOption(objectOption);
    QCommandLineOption shaderOption(QStringList() << "s" << "shader",
            QCoreApplication::translate("main", "Use shaders <shader>.[fv].glsl."),
            QCoreApplication::translate("main", "shader"),
            QString::fromLatin1("simple"));
    parser.addOption(shaderOption);
    
    parser.process(app);

#ifndef QT_NO_OPENGL
    MainWidget widget;
    widget.setObject(parser.value(objectOption));
    widget.setShader(parser.value(shaderOption));
    widget.show();
#else
    QLabel note("OpenGL Support required");
    note.show();
#endif
    return app.exec();
}
Esempio n. 2
0
int main(int argc, char** argv)
{
    Q_INIT_RESOURCE(makaron);

    QApplication app(argc, argv);

    QIcon icon(":/images/makaron.jpg");

    app.setWindowIcon(icon);

    //QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
    //QTextCodec *codec = QTextCodec::codecForName("cp1251");
    //QTextCodec::setCodecForCStrings(codec);
    //QTextCodec::setCodecForTr(codec);

    MainWidget mw;
    mw.setWindowTitle("VerticalPermutations");

    QSize size;
    size.setWidth(1000);
    size.setHeight(300);



    mw.setMinimumSize(size);
    //mw.setMaximumSize(size);

    mw.show();


    return app.exec();
}
Esempio n. 3
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    a.setApplicationName("DoubanFM");
    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));

    //QResource::registerResource("icons.qrc");

    QTranslator translator;
    QLocale locale;
    translator.load(QString(":/lang/")
                    + QLocale::countryToString(locale.country())
                    + QString("_")
                    + QLocale::languageToString(locale.language()));
    qDebug() << QString("Load Language: ")
                + QLocale::countryToString(locale.country())
                + QString("_")
                + QLocale::languageToString(locale.language());

    a.installTranslator(&translator);

    MainWidget mw;
    mw.show();
    
    return a.exec();
}
Esempio n. 4
0
File: main.cpp Progetto: xtuer/Qt
int main(int argc, char *argv[]) {
    QApplication app(argc, argv);

    // 使系统对话框中文化
    QTranslator translator;
    translator.load("qt_zh_CN.qm");
    app.installTranslator(&translator);

    // 注册窗口:
    {
        RegisterDialog dialog;
        dialog.checkRegister();
    }

    {
        LoginDialog loginDialog;
        loginDialog.setWindowFlags(Qt::WindowCloseButtonHint);
        if (QDialog::Accepted != loginDialog.exec()) {
            return 1;
        }
    }

    // Backup the files.
    Global::backup();

    MainWidget w;
    w.show();

    int result = app.exec();
    Global::backup();
    Settings::release();

    return result;
}
Esempio n. 5
0
int main(int argc, char ** argv)
{
	QApplication app(argc, argv);
	MainWidget glWid;
	glWid.show();
	//glWid.start();
	return app.exec();
}
Esempio n. 6
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWidget w;
    w.show();
    
    return a.exec();
}
Esempio n. 7
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    MainWidget mainWidget;
    mainWidget.show();

    return app.exec();
}
Esempio n. 8
0
int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));

    MainWidget widget;
    widget.show();
    return app.exec();
}
Esempio n. 9
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF8"));
    MainWidget win;
    win.show();

    return app.exec();
}
Esempio n. 10
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    app.setApplicationName("Qt Multimedia spectrum analyzer");

    MainWidget w;
    w.show();

    return app.exec();
}
Esempio n. 11
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    DrawingModel model;

    MainWidget mainWidget;
    mainWidget.setDrawingModel(&model);
    mainWidget.show();

    return a.exec();
}
Esempio n. 12
0
QT_CHARTS_USE_NAMESPACE

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    MainWidget w;
    w.resize(720, 480);
    w.show();

    return a.exec();
}
Esempio n. 13
0
int main(int argc, char *argv[])
{
    QTextCodec *codec = QTextCodec::codecForName("utf-8");
    QTextCodec::setCodecForCStrings(codec);
    QTextCodec::setCodecForLocale(codec);
    QTextCodec::setCodecForTr(codec);


    QApplication a(argc, argv);
    MainWidget w;
    w.show();
    return a.exec();
}
Esempio n. 14
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    MainWidget w;
    w.show();

    if (QApplication::arguments().size() > 1)
        w.openDirectory(QApplication::arguments().at(1));
    else
        w.openDirectory(QFileDialog::getExistingDirectory(0, "Select image folder"));

    return app.exec();
}
Esempio n. 15
0
File: main.cpp Progetto: maxxant/qt
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QCoreApplication::setApplicationVersion(QT_VERSION_STR);
    QCoreApplication::setApplicationName(QLatin1String("imagegestures"));

    QStringList arguments = QApplication::arguments();

    QString directory;
    QList<Qt::GestureType> gestures;
    gestures << Qt::PanGesture << Qt::PinchGesture << Qt::SwipeGesture;
    for (int a = 1; a < arguments.size(); ++a) {
        const QString &argument = arguments.at(a);
        if (argument.startsWith(QLatin1Char('-'))) {
            if (argument == QLatin1String("--no-pan"))
                gestures.removeAll(Qt::PanGesture);
            else if (argument == QLatin1String("--no-pinch"))
                gestures.removeAll(Qt::PinchGesture);
            else if (argument == QLatin1String("--no-swipe"))
                gestures.removeAll(Qt::SwipeGesture);
            else if (argument == QLatin1String("--verbose"))
                ImageWidget::setVerbose(true);
            else if (argument == QLatin1String("-h") || argument == QLatin1String("--help")) {
                showHelp();
                return 0;
            } else {
                showHelp(QLatin1String("Invalid option: ") + argument);
                return 1;
            }
        } else
            directory = argument;
    }

    MainWidget w;
    w.grabGestures(gestures);
    w.show();

    if (directory.isEmpty()) {
        const QString picturesLocation = QDesktopServices::storageLocation(QDesktopServices::PicturesLocation);
        directory =
            QFileDialog::getExistingDirectory(&w, "Select image folder",
                                              picturesLocation.isEmpty() ? QString() : picturesLocation);
        if (directory.isEmpty())
            return 0;
    }

    w.openDirectory(directory);

    return app.exec();
}
Esempio n. 16
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QGLFormat glf = QGLFormat::defaultFormat();
    glf.setSampleBuffers(true);
    glf.setSamples(4);
    QGLFormat::setDefaultFormat(glf);
    QFile file("://style.css");
    file.open(QIODevice::ReadOnly);
    a.setStyleSheet(file.readAll());
    MainWidget w;
    w.show();
    
    return a.exec();
}
Esempio n. 17
0
int main(int argc, char * argv[])
{
    QApplication app(argc,argv);

    QTranslator translator;
    translator.load("pintu_zh");
    app.installTranslator(&translator);

    QTextCodec::setCodecForTr(QTextCodec::codecForName("utf-8"));

    MainWidget w;
    w.show();

    return app.exec();
}
Esempio n. 18
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    a.setApplicationName("cube");
    a.setApplicationVersion("0.1");
#ifndef QT_NO_OPENGL
    MainWidget w;
    w.resize(640, 480);
    w.show();
#else
    QLabel * notifyLabel = new QLabel("OpenGL Support required");
    notifyLabel->show();
#endif
    return a.exec();
}
Esempio n. 19
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    app.setApplicationName("ORF 2015");
    app.setApplicationVersion("0.1");
#ifndef QT_NO_OPENGL
    MainWidget widget;
    widget.show();
#else
    QLabel note("OpenGL Support required");
    note.show();
#endif
    return app.exec();
}
Esempio n. 20
0
File: main.cpp Progetto: xtuer/Qt
int main(int argc, char *argv[]) {
//    RunGuard guard("9F0FFF1A-77A0-4EF0-87F4-5494CA8181C7");

//    if (!guard.tryToRun()) {
//        return 0;
//    }

    SingleApplication app(argc, argv);
    //QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));

    Singleton<LogHandler>::getInstance().installMessageHandler(); // 安装消息处理函数
    Util::registerTypes();

    UiUtil::loadQss();

    // qDebug() << "创建 Window";
    MainWidget *w = new MainWidget();
    w->setWindowFlags(Qt::FramelessWindowHint);
    w->show();

    MagicWindow *window = new MagicWindow(w, QMargins(1, 1, 1, 1), QMargins(3, 3, 3, 3), ":/img/solid.png", true);
    window->resize(700, 500); // 显示摄像头拍照时的大小
    // window->resize(560, 500);
    window->setResizable(false);
    window->setTitle("");
    window->setTitleBarButtonsVisible(false, false, true);
    window->show();

    QObject::connect(
        &app,
        &SingleApplication::instanceStarted,
        [=] {
            window->show();
            window->raise();
            window->activateWindow();
            window->raise();
            QApplication::setActiveWindow(window);
            window->raise();
        }
    );

    int ret = app.exec();
    Singleton<ConfigUtil>::getInstance().release();
    Singleton<LogHandler>::getInstance().release();

    return ret;
}
Esempio n. 21
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    a.setOrganizationName("deepin");
    a.setApplicationName("dde-dock");
    a.setApplicationDisplayName("Dock");

    // install translators
    QTranslator translator;
    translator.load("/usr/share/dde-dock/translations/dde-dock_" + QLocale::system().name());
    a.installTranslator(&translator);

	// translations from dde-control-center, used by those plugins provided by dde-control-center,
	// but below lines should be moved to individual plugins in the future.
    QTranslator translator1;
    translator1.load("/usr/share/dde-control-center/translations/dde-control-center_" + QLocale::system().name());
    a.installTranslator(&translator1);

    LogManager::instance()->debug_log_console_on();
    LOG_INFO()<< "LogFile:" << LogManager::instance()->getlogFilePath();

    if (QDBusConnection::sessionBus().registerService(DBUS_NAME)) {
        QFile file("://qss/resources/dark/qss/dde-dock.qss");
        if (file.open(QFile::ReadOnly)) {
            QString styleSheet = QLatin1String(file.readAll());
            qApp->setStyleSheet(styleSheet);
            file.close();
        } else {
            qWarning() << "Dock Open  style file errr!";
        }

        MainWidget w;
        w.show();
        qWarning() << "Start Dock, The main window has been shown.............................................................";
        w.loadResources();

        RegisterDdeSession();

        initGtkThemeWatcher();
        return a.exec();
    } else {
        qWarning() << "Dock is running!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!";
        return 0;
    }
}
Esempio n. 22
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

#if QT_VERSION < 0x050000
    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
    QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
#endif

    //QTranslator qtTranslator;
    //qtTranslator.load("qt_ru", QLibraryInfo::location(QLibraryInfo::TranslationsPath));
    //app.installTranslator(&qtTranslator);

    MainWidget w;
    w.setMinimumSize(w.sizeHint());
    w.show();

    return app.exec();
}
Esempio n. 23
0
int main(int argc, char *argv[])
{
	QApplication a(argc, argv);
	
	qInstallMessageHandler(messageHandler);
	qDebug() << "start " << QDir::currentPath();

	QTranslator ts;
	if (ts.load("ru", ":")) {
		QApplication::installTranslator(&ts);
	}
	else {
		qWarning() << "don't load translations file";
	}

	MainWidget w;
	w.show();
	return a.exec();
}
Esempio n. 24
0
void LoginWidget::canDisplayHome(int error)
{
  MainWidget *widget;

  std::cout << error << std::endl;
  if (error == 1)
    {
      widget = new MainWidget();
      widget->setAttribute(Qt::WA_DeleteOnClose);
      widget->show();
      deleteLater();
    }
  else
    {
      this->clearLayout(_mainLayout);
      this->refreshUI();
      std::cout << "Login fail" << std::endl;
    }
  std::cout << "LOGIN WIDGET CAN DISPLAY HOME" << std::endl;
}
Esempio n. 25
0
int main(int argc, char *argv[]) {

	QApplication a(argc, argv);
    MainWidget w;
    w.resize(1100,750);

//    system ("pwd");

    QPixmap pixmap("splash_screen.jpg");
    pixmap.scaled(500,425);
    QSplashScreen splash(pixmap);
    splash.show();
    QString msg = "Loading...";
    splash.showMessage(msg, Qt::AlignLeft, Qt::white);
//    QTest::qWait (4000);
    a.processEvents();
    splash.finish(&w);

	w.show();
	return a.exec();
}
Esempio n. 26
0
int main(int argc, char **argv)
{
   QApplication app(argc, argv);

   QString directoryString("");
   if(argc > 1) {
      directoryString.append(argv[1]);
   } else {
      directoryString.append("./");
   }

   if(!directoryString.endsWith("/")) {
      directoryString.append("/");
   }

   MainWidget *mw = new MainWidget(directoryString);

   mw->show();

   return app.exec();
}
Esempio n. 27
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    KLocalizedString::setApplicationDomain("ktp-contactlist");

    KAboutData aboutData("ktpcontactlist", i18n("KDE Telepathy Contact List"), KTP_CONTACT_LIST_VERSION,
                         i18n("KDE Telepathy Contact List"), KAboutLicense::GPL,
                         i18n("(C) 2011, Martin Klapetek"));

    aboutData.addAuthor(i18nc("@info:credit", "Martin Klapetek"), i18n("Developer"),
                        "*****@*****.**");
    aboutData.setProductName("telepathy/contactlist"); //set the correct name for bug reporting
    QGuiApplication::setWindowIcon(QIcon::fromTheme("telepathy-kde"));
    KAboutData::setApplicationData(aboutData);

    KDBusService service(KDBusService::Unique);
    {
        QCommandLineParser parser;
        // Add --debug as commandline option
        parser.addOption(QCommandLineOption("debug", i18n("Show Telepathy debugging information")));

        aboutData.setupCommandLine(&parser);
        parser.addHelpOption();
        parser.addVersionOption();
        parser.process(app);
        aboutData.processCommandLine(&parser);

        Tp::registerTypes();
        Tp::enableDebug(parser.isSet("debug"));
        Tp::enableWarnings(true);
    }

    // Create the main widget and show it.
    MainWidget *mainWidget = new MainWidget(0);
    mainWidget->show();

    // Start event loop.
    app.exec();
}
Esempio n. 28
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QCoreApplication::setApplicationVersion(QT_VERSION_STR);
    QCoreApplication::setApplicationName(QStringLiteral("imagegestures"));
    QGuiApplication::setApplicationDisplayName(QStringLiteral("Image Gestures Example"));

    QCommandLineParser commandLineParser;
    const QCommandLineOption disablePanOption("no-pan", "Disable pan gesture");
    commandLineParser.addOption(disablePanOption);
    const QCommandLineOption disablePinchOption("no-pinch", "Disable pinch gesture");
    commandLineParser.addOption(disablePinchOption);
    const QCommandLineOption disableSwipeOption("no-swipe", "Disable swipe gesture");
    commandLineParser.addOption(disableSwipeOption);
    const QCommandLineOption helpOption = commandLineParser.addHelpOption();
    commandLineParser.addPositionalArgument(QStringLiteral("Directory"),
                                            QStringLiteral("Directory to display"));

    const QString description = QGuiApplication::applicationDisplayName()
        + QLatin1String("\n\nEnable \"debug\" on the logging category \"qt.examples.imagegestures\" in order to\n"
                        "in order to obtain verbose information about Qt's gesture event processing,\n"
                        "for example by setting the environment variables QT_LOGGING_RULES to\n"
                        "qt.examples.imagegestures.debug=true\n");
    commandLineParser.setApplicationDescription(description);

    commandLineParser.process(QCoreApplication::arguments());

    QStringList arguments = commandLineParser.positionalArguments();
    if (!arguments.isEmpty() && !QFileInfo(arguments.front()).isDir()) {
        showHelp(commandLineParser,
                 QLatin1Char('"') + QDir::toNativeSeparators(arguments.front())
                 + QStringLiteral("\" is not a directory."));
        return -1;
    }

    QList<Qt::GestureType> gestures;
    if (!commandLineParser.isSet(disablePanOption))
        gestures << Qt::PanGesture;
    if (!commandLineParser.isSet(disablePinchOption))
        gestures << Qt::PinchGesture;
    if (!commandLineParser.isSet(disableSwipeOption))
        gestures << Qt::SwipeGesture;

    MainWidget w;
    w.grabGestures(gestures);
    w.show();

    if (arguments.isEmpty()) {
        const QStringList picturesLocations = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation);
        const QString directory =
            QFileDialog::getExistingDirectory(&w, "Select image folder",
                                              picturesLocations.isEmpty() ? QString() : picturesLocations.front());
        if (directory.isEmpty())
            return 0;
        arguments.append(directory);
    }

    w.openDirectory(arguments.front());

    return app.exec();
}
Esempio n. 29
0
int main(int argc, char** argv)
{
  string localFilename = "";
  bool binary = false;

  for (char c; (c = getopt(argc, argv, "bol:h")) != -1; ) {
    switch (c) {
      case 'b':
        binary = true;
        break;
      case 'o':
        overrideCovariances = true;
        break;
      case 'l':
        localFilename = optarg;
        break;
      case 'h':
        printUsage(argv[0]);
        return 0;
      default:
        printUsage(argv[0]);
        return 1;
    }
  }
  if (optind != argc) {
    printUsage(argv[0]);
    return 1;
  }

  // starting up the QApplication
  QApplication qapp(argc, argv);
  MainWidget mw;
  QGLGraphViewer& viewer = *mw.viewer;
  viewer.graph.setUseDrawList(true);
  viewer.graph.setGraph(&graphs[0].graph);
  viewer.graph.setHirarchy(&graphs[0].hirarchy);
  mw.show();

  pthread_t stdinReadingThread;
  if (localFilename.size()) { // just load a graph and display this graph
    cout << "Loading file " << localFilename << " ... " << flush;
    ifstream ifs(localFilename.c_str());
    if (!ifs) {
      cerr << "Unable to open " << localFilename << endl;
      return 1;
    }
    if (!binary)
      graphs[0].graph.load(ifs);
    else
      graphs[0].graph.loadBinary(ifs);
    if (graphs[0].graph.vertices().size() == 0) {
      cerr << "\ttrying to load 2D graph ..." << endl;
      ifs.clear();
      ifs.seekg(0, ios::beg);
      PoseGraph2D auxGraph;
      auxGraph.load(ifs);
      if (auxGraph.vertices().size() > 0) { // now convert everything to 3D for displaying
        convert2DGraphTo3D(auxGraph, graphs[0].graph);
      }
    }
    cout << "done." << endl;
  } else {
    // start the thread that reads stdin
    int thread_status = pthread_create( &stdinReadingThread, NULL, readStdinThread, static_cast<void*>(&viewer.graph));
    if (thread_status != 0) {
      cerr << "unable to create stdin thread" << endl;
    }
  }

  while (mw.isVisible()) {
    pthread_mutex_lock( &graphMutex );
    if (s_drawNeeded) {
      s_drawNeeded = false;
      viewer.updateGL();
    }
    qapp.processEvents();
    pthread_mutex_unlock( &graphMutex );
    usleep(10000);
  }

  return 0;
}
int main(int argc, char *argv[])
{
    Q_INIT_RESOURCE(icons);

    QApplication a(argc, argv);

    // 系统图标
    if (!QSystemTrayIcon::isSystemTrayAvailable()) {
        QMessageBox::critical(0, QObject::tr("Systray"),
                              QObject::tr("I couldn't detect any system tray "
                                          "on this system."));
        return 1;
    }

    QApplication::setQuitOnLastWindowClosed(false);

    QApplication::addLibraryPath("./plugins");

    QTextCodec::setCodecForTr(QTextCodec::codecForName("GB2312"));//让显示的文字不乱码
    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("GB2312"));//让显示的文字不乱码
    QTextCodec::setCodecForLocale(QTextCodec::codecForName("GB2312"));//让显示的文字不乱码

    bool isrunning = CheckIfRunning("lz_master_gui.exe", false);
    if (isrunning)
    {
        return 1;
    }
    isrunning = CheckIfRunning("lz_master_monitor.exe", true);
    if (isrunning)
    {
        return 1;
    }

    QSplashScreen *splash = new QSplashScreen();
    splash->setPixmap(QPixmap(":/image/start.png"));
    QTimer::singleShot(3000, splash, SLOT(close()));
    splash->show();
    Qt::Alignment topRight = Qt::AlignRight | Qt::AlignTop;
    splash->showMessage(QObject::tr("正在初始化..."),topRight,Qt::yellow);

    // 加载本地文件存储目录
    QFile file("master_datastore_path.txt");
    if (!file.open(QIODevice::ReadOnly))
    {
        qDebug() << QObject::tr("无文件master_datastore_path.txt,无法加载主控机数据存储目录位置");
        return 1;
    }
    else
    {
        QString parentpath = file.readLine().trimmed();
        MasterSetting::getSettingInstance()->setParentPath(parentpath);
        file.close();
    }

    // 【标记2】此处作废-因为MasterProgram类的run函数作废
    // 【注意】顺序:先有masterProgramInstance,才run,能连接信号槽
    //MasterProgram::getMasterProgramInstance()->run();
    /*******************************/
    MainWidget *w = new MainWidget(true, Collecting);
    w->show();

    // 【注意】顺序:先有masterProgramInstance,才能连接信号槽
    MasterProgram::getMasterProgramInstance();
    // connect函数必在MasterProgram::getMasterProgramInstance()之后
    MasterProgram::getMasterProgramInstance()->init();

    splash->showMessage(QObject::tr("正在启动程序..."),topRight,Qt::yellow);

    splash->finish(w);
    delete splash;

    return a.exec();
}