Пример #1
0
Game::Game() :  KTopLevelWidget()
{
    setCaption( kapp->getCaption() );

    setIcon(klocale->translate("Snake Race"));

    conf = kapp->getConfig();
    if(conf == NULL) {
	printf(klocale->translate("KConfig error ??\n"));
	kapp->quit();
    }

    levels = new Levels();
    score  = new Score;
    menu();
    checkMenuItems();

    View *view = new View(this);
    rattler = view->rattler;
    rattler->setFocus();

    connect(rattler, SIGNAL(setPoints(int)), view->lcd, SLOT(display(int)));
    connect(rattler, SIGNAL(setTrys(int)), view->trys, SLOT(set(int)));
    connect(rattler, SIGNAL(rewind()), view->pg, SLOT(rewind()));
    connect(rattler, SIGNAL(advance()), view->pg, SLOT(advance()));
    connect(view->pg, SIGNAL(restart()), rattler, SLOT(restartTimer()));

    connect(rattler, SIGNAL(togglePaused()), this, SLOT(togglePaused()));
    connect(rattler, SIGNAL(setScore(int)), score, SLOT(setScore(int)));

    menubar->show();
    setMenu(menubar);
    view->show();
    setView(view);
}
Пример #2
0
int main(int argc, char** argv) {
    QApplication app(argc, argv);

    weather::Taker weather_taker;
    cities::Taker cities_taker;

    weather::Formato weather_formato;
    cities::Formato cities_formato;

    View view;

    QObject::connect(&view, SIGNAL(desire_weather(const QString&)),
                     &weather_taker, SLOT(take(const QString&)));
    QObject::connect(&view, SIGNAL(desire_cities(const QString&)),
                     &cities_taker, SLOT(take(const QString&)));

    QObject::connect(&weather_taker, SIGNAL(give_back(const QDomDocument&)),
                     &weather_formato, SLOT(format(const QDomDocument)));
    QObject::connect(&cities_taker, SIGNAL(give_back(const QDomDocument&)),
                     &cities_formato, SLOT(format(const QDomDocument)));

    QObject::connect(&weather_formato, SIGNAL(done(const QString&)),
                     &view, SLOT(satisfy_weather(const QString&)));
    QObject::connect(&weather_formato, SIGNAL(shit_happens()),
                     &view, SLOT(damn()));

    QObject::connect(&cities_formato, SIGNAL(done(const QStringList&)),
                     &view, SLOT(satisfy_cities(const QStringList&)));

    view.show();

    return app.exec();
}
Пример #3
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    Model model;

    // create a scene
    QGraphicsScene* scene = new QGraphicsScene();

    // create an item to put into scene
    MovingBall* ball = new MovingBall(model.get_width()/2, model.get_height()/2);

    // make rect focusable

    // add item to scene
    scene->addItem(ball);


    View* view = new View(scene);
    view->show();

//    MainWindow w;
//    w.setCentralWidget(view);
//    w.setFixedSize(model.get_width(), model.get_height());
//    w.show();



    return a.exec();
}
Пример #4
0
int main(int argc, char *argv[])
{
  QApplication a(argc, argv);
  View w;
  w.show();

  return a.exec();
}
Пример #5
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    View view;
    view.show();

    return app.exec();
}
Пример #6
0
int main(int argc, char *argv[])
{
  QApplication App(argc, argv);

  View MyView;
  MyView.show();

  return App.exec();
}
Пример #7
0
/** void lui::View::show()
 * include/lui/View.h:95
 */
static int View_show(lua_State *L) {
  try {
    View *self = *((View **)dub::checksdata(L, 1, "lui.View"));
    self->show();
    return 0;
  } catch (std::exception &e) {
    lua_pushfstring(L, "show: %s", e.what());
  } catch (...) {
    lua_pushfstring(L, "show: Unknown exception");
  }
  return dub::error(L);
}
Пример #8
0
int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    QTextCodec *codec = QTextCodec::codecForName("gb2312");
    QTextCodec::setCodecForCStrings(codec);
    QTextCodec::setCodecForLocale(codec);
    QTextCodec::setCodecForTr(codec);

    app.setApplicationName("bowling");
    QPixmapCache::setCacheLimit(100 * 1024); // 100 MB
    if (!createConnection())
            return -1;

    const char *map =
            "#####=######"
            "#          #"
            "#          #"
            "#          #"
            "#          #"
            "#          #"
            "#          #"
            "#          #"
            "#          *"
            "#          #"
            "#          #"
            "#          #"
            "#          #"
            "#          #"
            "#          #"
            "#          #"
            "#          $"
            "#          #"
            "#          #"
            "#######(####";

    QVector<Light> lights;
    lights << Light(QPointF(3.5, 2.5), 1)
           << Light(QPointF(3.5, 6.5), 1)
           << Light(QPointF(1.5, 10.5), 0.3);

    MazeScene *scene = new MazeScene(lights, map, 12, 20);

    View view;
    view.resize(800, 600);
    view.setScene(scene);
    view.show();

    scene->toggleRenderer();

    return app.exec();
}
Пример #9
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    View widok;

    QDir d;
    d.mkpath(QDir::homePath() + QString("/.config/GetThingsDone/"));
    QString filestore = QDir::homePath()
                      + QString("/.config/GetThingsDone/storage.dat");

    Model storage(filestore, &widok);

    widok.show();
    return app.exec();
}
Пример #10
0
int main( int argc, char **argv )
{
    QApplication a( argc, argv );

    qInitNetworkProtocols();
    QNetworkProtocol::registerNetworkProtocol( "http", new QNetworkProtocolFactory<Http> );
    QNetworkProtocol::registerNetworkProtocol( "nntp", new QNetworkProtocolFactory<Nntp> );
    
    View v;
    v.resize( 600, 600 );
    v.setCaption("Qt Example - Network Protocols");
    v.show();
    a.setMainWidget( &v );
    
    return a.exec();
}
Пример #11
0
Towns::Towns(QObject *parent) : QObject(parent){
    //qsrand(QTime(0, 0, 0).secsTo(QTime::currentTime()));

    Scene *scene = new Scene();
    //QGraphicsScene scene;
    scene->setSceneRect(0, 0, 1024, 1024);
    scene->setItemIndexMethod(QGraphicsScene::NoIndex);

    avatar->setPos(512, 512);
    scene->addItem(avatar);

    //QGraphicsView view(&scene);
    View *view = new View();
    view->setScene(scene);
    view->setRenderHint(QPainter::Antialiasing);
    view->setBackgroundBrush(QPixmap("image1.jpg"));

    //QGraphicsItem test;
    //test;
    //scene.addItem();
    view->setCacheMode(QGraphicsView::CacheBackground);
    view->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
    //view.setDragMode(QGraphicsView::ScrollHandDrag);
    view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    view->setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "Towns"));
    view->resize(740, 580);
    view->setMinimumSize(740, 580);
    view->setMaximumSize(740, 580);
    view->centerOn(avatar);
    view->show();

    mainView = view;

    //QTimer timer;
    //QObject::connect(&timer, SIGNAL(timeout()), &scene, SLOT(advance()));
    //timer.start(1000 / 33);

    //qDebug() << scene;
    QTimer timer;
    QObject::connect(&timer, SIGNAL(timeout()), this, SLOT(update()));
    timer.start(1000 / 33);
}
Пример #12
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    View w;
    Model m;
    controller c(m);
    c.setplugdir(argv[0]);
    QObject::connect(&w, SIGNAL(ImageUpload(QString)), &c, SLOT(loadImage(QString)));
    QObject::connect(&m, SIGNAL(SayAboutEvent(string)), &w, SLOT(Log(string)));
    QObject::connect(&w, SIGNAL(on_repair_triggered()), &c, SLOT(repair()));
    QObject::connect(&m, SIGNAL(ResultsOfWork(tuple<int,vector<shared_ptr<IObject> >,Image>)),
                     &w, SLOT(print_results(tuple<int,vector<shared_ptr<IObject> >,Image>)));
    QObject::connect(&m, SIGNAL(Plugindone(Image)), &w, SLOT(refreshImage(Image)));
    QObject::connect(&w, SIGNAL(on_refresh_plugins_triggered()), &c, SLOT(refresh_plugins()));
    QObject::connect(&m, SIGNAL(newPlugin(const char*,int)), &w, SLOT(addPlugin(const char*,int)));
    QObject::connect(&w, SIGNAL(applyPlugin(int)), &c, SLOT(PluginCall(int)));
    QObject::connect(&m, SIGNAL(Pluginsdelete()), &w, SLOT(erasePluginAct()));
    w.setPlugin();
    w.show();
    return a.exec();
}
Пример #13
0
/**
 Main function
**/
int main(int argc, char **argv)
{

    showTime.start();
    
#ifdef Q_WS_QWS
    if(argc < 3) {qDebug() << USAGE_STRING; exit(-1);}
    QString configFileName = QString(argv[2]);
#else
    if(argc < 2) {qDebug() << USAGE_STRING; exit(-1);} 
    QString configFileName = QString(argv[1]);
#endif
    QFile file(configFileName);
    if (!file.open(QIODevice::ReadOnly)) {
        qDebug() << "  Xgxperf_launcher:: Couldn't open the config file (" << configFileName << ")";
        return -1;
    }
   
    QApplication app(argc, argv);
    int screenWidth = app.desktop()->screenGeometry().width();
    int screenHeight = app.desktop()->screenGeometry().height();    
    QLinearGradient backGradient(0,0,0,screenHeight);


    backGradient.setColorAt(0, QColor(35,143,192,255));
    backGradient.setColorAt(0.2, Qt::black );        
    backGradient.setColorAt(1, QColor(35,143,192,255));    

    QGraphicsScene scene(0, 0, 460, 620);

    QGraphicsItem *iconWidgetParent = new QGraphicsRectItem;

    //Add parent widget to scene
    scene.addItem(iconWidgetParent);
    iconWidgetParent->setScale(1.0);    
    iconWidgetParent->setPos(0,0);
    
    //Draw the text at top
    QGraphicsTextItem *pTextItem = new QGraphicsTextItem("XgxPerf Toolkit");
    QFont titleFont("Tahoma",36); 
    pTextItem->setFont(titleFont);
    pTextItem->setPos(50,10);
    pTextItem->setDefaultTextColor(Qt::white);
    scene.addItem(pTextItem);

    //Result/ notification at the bottom
    QFont textFont = QFont(QString("Tahoma"),14);        
    QGraphicsTextItem* pResultItem = new QGraphicsTextItem("Status Window: \n Click on an icon to start benchmarking...", 0);
    pResultItem->setFont(textFont);
    pResultItem->setDefaultTextColor(Qt::white);
    scene.addItem(pResultItem);
    pResultItem->moveBy(0, 500);

    QXmlStreamReader reader(&file);
    queryFromConfigStream(reader);
    screenFromQuery(iconWidgetParent, pResultItem);

    //Create final view    
    View *view = new View(&scene);
    view->setBackgroundBrush(backGradient);    
    view->setWindowTitle(QT_TRANSLATE_NOOP(QGraphicsView, "XgxPerf Benchmark Launcher"));
    //view->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
    //view->setCacheMode(QGraphicsView::CacheBackground);
    view->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
    view->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
    
    
    qDebug() << "showtime before view->show()" << showTime.elapsed();    
    view->show();
    return app.exec();
}
Пример #14
0
int main() {
	View gui;
	gui.show();
	return Fl::run();
}
Пример #15
0
int main(int argc, char** argv) {
   // GlobalOptions config = GlobalOptions::getInstance();

  GlobalOptions::getInstance().init();
#ifdef STANDALONE
  int quit = GlobalOptions::getInstance().parseCommandLine(argc, argv);
  if(quit) return quit;

  GlobalOptions::getInstance().printOptions();
#endif
  ParsedSVG * ps = new ParsedSVG();
  quit = ps->parseSVGFile(GlobalOptions::getInstance().filename);
  if(quit) return quit;

  VectorElementTree * vet = new VectorElementTree();
  vet->createAndSortTree(ps);
  PreProcessor * ppp = new PreProcessor(vet);
  ppp->process(
    GlobalOptions::getInstance().translate_playfield_x,
    GlobalOptions::getInstance().translate_playfield_y,
    GlobalOptions::getInstance().field_width,
    GlobalOptions::getInstance().field_height
  );
  if(GlobalOptions::getInstance().segmentation_on) {
    SegmentationPreProcessor * spp = new SegmentationPreProcessor(vet);
    spp->process();
  }
  // vet->print_tree();
  TSPConnector * segment_connector = new TSPConnector(vet);
  segment_connector->connect_segments();
  
  vet->fillPolys();

  auto t = &(vet->element_tree);
  int i = 0;
  int id1, id2;
  for(auto it = ++t->begin(); it != t->end(); ++it) {
    if(i == 2) {
      id1 = (*it)->id;
    }
    if(i == 3) {
      id2 = (*it)->id;
    }
    i++;
  }
  // cout << "Test connecting " << id1 << " at " << 0 << " and " << id2 << " at -1" << endl;
  // vet->enforceConnection(id1, 0, id2, -1);

  SimpleConnector * sc = new SimpleConnector(vet);
  sc->connect();
  // TSPConnector * sc = new TSPConnector(vet);
  // sc->create_distance_matrix();

  // if(GlobalOptions::getInstance().rounding_radius > 0) {
  //   ConnectionSmoother cs(vet);
  //   cs.smooth();
  // }

  // vet->clearFill();
  // vet->  drawConnections();


  PostProcessor *  psc = new PostProcessor(vet);
  psc->process();
  // cout << vet->toJSON() << endl;
  // std::string json = "var PolyJSON = '" + vet->toJSON();
  // json += "'";
  // std::ofstream of("PolyJSON.js");
  // of << json;
  // vet->writeToFile("out_tree.txt");
#ifdef WITH_GUI
  if(GlobalOptions::getInstance().display) {
    if(GlobalOptions::getInstance().scale_for_disp != 1) {
      ppp->process(GlobalOptions::getInstance().scale_for_disp);
    }
    QApplication app(argc, argv);
 
    View * window = new View();
    window->initWindow();
    window->show();
    vet->addWindow(window);
    vet->drawTreeOnCanvas();
    vet->drawConnections();
    return app.exec();
  }
#endif
  // delete spp;
  delete vet;
  delete sc;
  delete ps;
  return 0;
}