Exemplo n.º 1
0
//-----------------------------------------------------------------------------
void MainWindow::makeMenu()
{
	QAction *a;
	QMenu *o;

	// file menu
	{
	o = menuBar()->addMenu(_("File"));
	a = new QAction(QPixmap(":/png/document-new.png"), _("New script"), this);
	connect(a, SIGNAL(triggered()), this, SLOT(newDoc()));
	a->setToolTip(_("Create new empty script window (Ctrl+N)."));
	a->setShortcut(Qt::CTRL+Qt::Key_N);	o->addAction(a);

	o->addAction(aload);
	o->addAction(asave);

	a = new QAction(_("Save as ..."), this);
	connect(a, SIGNAL(triggered()), this, SLOT(saveAs()));
	o->addAction(a);

	o->addSeparator();
	o->addAction(_("Print script"), edit, SLOT(printText()));
	a = new QAction(QPixmap(":/png/document-print.png"), _("Print graphics"), this);
	connect(a, SIGNAL(triggered()), graph->mgl, SLOT(print()));
	a->setToolTip(_("Open printer dialog and print graphics (Ctrl+P)"));
	a->setShortcut(Qt::CTRL+Qt::Key_P);	o->addAction(a);
	o->addSeparator();
	fileMenu = o->addMenu(_("Recent files"));
	o->addSeparator();
	o->addAction(_("Quit"), qApp, SLOT(closeAllWindows()));
	}

	menuBar()->addMenu(edit->menu);
	menuBar()->addMenu(graph->menu);

	// settings menu
	{
	o = menuBar()->addMenu(_("Settings"));
	a = new QAction(QPixmap(":/png/preferences-system.png"), _("Properties"), this);
	connect(a, SIGNAL(triggered()), this, SLOT(properties()));
	a->setToolTip(_("Show dialog for UDAV properties."));	o->addAction(a);
	o->addAction(_("Set arguments"), createArgsDlg(this), SLOT(exec()));

	o->addAction(acalc);
	o->addAction(ainfo);
	o->addAction(ahide);
	}

	menuBar()->addSeparator();
	o = menuBar()->addMenu(_("Help"));
	a = new QAction(QPixmap(":/png/help-contents.png"), _("MGL help"), this);
	connect(a, SIGNAL(triggered()), this, SLOT(showHelp()));
	a->setToolTip(_("Show help on MGL commands (F1)."));
	a->setShortcut(Qt::Key_F1);	o->addAction(a);
	a = new QAction(QPixmap(":/png/help-faq.png"), _("Hints"), this);
	connect(a, SIGNAL(triggered()), this, SLOT(showHint()));
	a->setToolTip(_("Show hints of MGL usage."));	o->addAction(a);
	o->addAction(_("About"), this, SLOT(about()));
	o->addAction(_("About Qt"), this, SLOT(aboutQt()));
}
Exemplo n.º 2
0
void Hero::tick(float dt)
{
    bool pressed(false);
    int key;
    while (Input::getKey(key))
    {
        pressed = true;
    }

    Input::setPause(m_state != State::InGame);

    switch (m_state)
    {
    case State::InGame:
        handleStateInGame(pressed, key);
        break;

    case State::Status:
        handleStateStatus(pressed, key);
        break;

    case State::Equip:
        handleStateEquip(pressed, key);
        break;

    case State::Drop:
        handleStateDrop(pressed, key);
        break;
    }

    if (pressed)
    {
        // always
        switch (key)
        {
        case 'Q':
            Input::setQuit();
            break;

        case '`':
            Debugger::get().cycleDebugLevel();
        }
    }

    showHint();

    Character::tick(dt);
}
Exemplo n.º 3
0
bool GameScene::init()
{
    screenSize = CCDirector::sharedDirector()->getWinSize();
    
    int r = CCRANDOM_0_1() * 10;
    
    CCSprite* bg = NULL;
    if (r >= 5) {
        bg = CCSprite::createWithSpriteFrameName("bg_day.png");
    } else {
        bg = CCSprite::createWithSpriteFrameName("bg_night.png");
    }
    bg->setAnchorPoint(ccp(0, 0));
    bg->setPosition(ccp(0, 0));
    addChild(bg, 0);
    
    CCSprite* land0 = CCSprite::createWithSpriteFrameName("land.png");
    land0->setAnchorPoint(ccp(0, 0));
    land0->setPosition(ccp(0, 0));
    addChild(land0, 3, TAG_LAND);
    CCMoveBy* move = CCMoveBy::create(1.0f, ccp(-land0->getContentSize().width * 0.25f, 0));
    CCCallFuncN* call = CCCallFuncN::create(this, callfuncN_selector(GameScene::removeNodeSelf));
    CCSequence* seq = CCSequence::create(move, call, NULL);
    land0->runAction(seq);
    
    randomValue = 0;
    gameScore = 0;
    isGameOver = false;
    isShowingHint = true;
    
    pipeArray = CCArray::create();
    CC_SAFE_RETAIN(pipeArray);
    hitCheckArray = CCArray::create();
    CC_SAFE_RETAIN(hitCheckArray);
    
    createBird();
    showHint();
    
    CCMenuItemSprite* pauseItem = CCMenuItemSprite::create(CCSprite::createWithSpriteFrameName("button_pause.png"), NULL, this, menu_selector(GameScene::touchPauseCallBack));
    pauseItem->setPosition(ccp(screenSize.width * 0.92f, screenSize.height * 0.95f));
    pauseItem->setScale(2.0f);
    CCMenu* m = CCMenu::create(pauseItem, NULL);
    m->setPosition(CCPointZero);
    addChild(m, 10);
    
    M3AudioManager::shareInstance();
    return true;
}
Exemplo n.º 4
0
void MainWindow::startGame(KDiamond::Mode mode)
{
	//delete old board
	delete m_game;
	//start new game
	m_gameState->startNewGame();
	m_gameState->setMode(mode);
	m_game = new Game(m_gameState);
	connect(m_gameState, SIGNAL(stateChanged(KDiamond::State)), m_game, SLOT(stateChange(KDiamond::State)));
	connect(m_gameState, SIGNAL(message(QString)), m_game, SLOT(message(QString)));
	connect(m_game, SIGNAL(numberMoves(int)), m_infoBar, SLOT(updateMoves(int)));
	connect(m_game, SIGNAL(pendingAnimationsFinished()), this, SLOT(gameIsOver()));
	connect(m_hintAct, SIGNAL(triggered()), m_game, SLOT(showHint()));
	m_view->setScene(m_game);
	//reset status bar
	m_infoBar->setUntimed(mode == KDiamond::UntimedGame);
	m_infoBar->updatePoints(0);
	m_infoBar->updateRemainingTime(KDiamond::GameDuration);
}
Exemplo n.º 5
0
void EndlessGameWidget::dealReleased(QPointF mousePos, Qt::MouseButton button)
{
  if (itemAtPressPos != NULL)
  {
    if (itemAtPressPos == flame && flame->notEmpty())
    {
      int index = gameboardInfo->indexOfPosition(mousePos);
      if (index != -1)
      {
        // Add sound effect
        PublicGameSounds::addSound(PublicGameSounds::UseFlame);

        // Tell the controller to eliminate the balls
        controller->flameAt(index);

        // Add effects to effect painter
        effectPainter->explodeAt(index);
        effectPainter->flash();

        // Minus the value of the flame
        flame->minusOne();

        statistic.changeStatistic(Statistic::FlameUsedCount, 1, true);
      }
    }
    else if (itemAtPressPos == star && star->notEmpty())
    {
      int index = gameboardInfo->indexOfPosition(mousePos);
      if (index != -1)
      {
        // Add sound effect
        PublicGameSounds::addSound(PublicGameSounds::UseStar);

        // Tell the controller to eliminate the balls
        controller->starAt(index);

        // Add effects to effect painter
        effectPainter->lightningAt(index);
        effectPainter->flash();

        // Minus the value of the flame
        star->minusOne();

        statistic.changeStatistic(Statistic::StarUsedCount, 1, true);
      }
    }
    else if (itemAtPressPos == hint &&
             hint->in(mousePos,
                      gameboardInfo->width(),
                      gameboardInfo->height()))
    {
      // Reduce the score
      int score = qMax(progressBar->getCurrent() - 10,
                       progressBar->getMin());
      progressBar->setCurrent(score);

      // Show the hint
      showHint();
    }
    else if (itemAtPressPos == resetItem &&
             resetItem->in(mousePos,
                           gameboardInfo->width(),
                           gameboardInfo->height()))
    {
      // Create the reset widget
      ResetWidget *w = new ResetWidget();

      // Connect
      connect(w, SIGNAL(confirm()), this, SLOT(reset()));

      // Give control to it
      emit giveControlTo(w, false);
    }
    else if (itemAtPressPos == exitItem &&
             exitItem->in(mousePos,
                          gameboardInfo->width(),
                          gameboardInfo->height()))
    {
      // Quit game
      quitGame();
      return;
    }
  }

  // Clear user moving elimination hints
  effectPainter->clearUserMovingEliminationHints();
  itemAtPressPos = NULL;

  // Let the gesture controller to deal the release event
  gestureController->dealReleased(mousePos);
}
Exemplo n.º 6
0
Window::Window() {
    m_board = new Board(this);
    connect(m_board, &Board::finished, this, &Window::gameFinished);
    connect(m_board, &Board::started, this, &Window::gameStarted);
    connect(m_board, &Board::pauseChanged, this, &Window::gamePauseChanged);

    QWidget* contents = new QWidget(this);
    setCentralWidget(contents);

    View* view = new View(m_board, contents);

    m_scores = new ScoreBoard(this);

    m_definitions = new Definitions(m_board->words(), this);
    connect(m_board, &Board::wordAdded, m_definitions, &Definitions::addWord);
    connect(m_board, &Board::wordSolved, m_definitions, &Definitions::solveWord);
    connect(m_board, &Board::wordSelected, m_definitions, &Definitions::selectWord);
    connect(m_board, &Board::loading, m_definitions, &Definitions::clear);

    // Create success message
    m_success = new QLabel(contents);
    m_success->setAttribute(Qt::WA_TransparentForMouseEvents);

    QFont f = font();
    f.setPointSize(24);
    QFontMetrics metrics(f);
    int width = metrics.width(tr("Success"));
    int height = metrics.height();
    int ratio = devicePixelRatio();
    QPixmap pixmap(QSize(width + height, height * 2) * ratio);
    pixmap.setDevicePixelRatio(ratio);
    pixmap.fill(QColor(0, 0, 0, 0));
    {
        QPainter painter(&pixmap);

        painter.setPen(Qt::NoPen);
        painter.setBrush(QColor(0, 0, 0, 200));
        painter.setRenderHint(QPainter::Antialiasing, true);
        painter.drawRoundedRect(0, 0, width + height, height * 2, 10, 10);

        painter.setFont(f);
        painter.setPen(Qt::white);
        painter.setRenderHint(QPainter::TextAntialiasing, true);
        painter.drawText(height / 2, height / 2 + metrics.ascent(), tr("Success"));
    }
    m_success->setPixmap(pixmap);
    m_success->hide();
    connect(m_board, &Board::loading, m_success, &QLabel::hide);

    // Create overlay background
    QLabel* overlay = new QLabel(this);

    f = font();
    f.setPixelSize(20);
    metrics = QFontMetrics(f);
    width = std::max(metrics.width(tr("Loading")), metrics.width(tr("Paused")));
    for (int i = 0; i < 10; ++i) {
        QString test(6, QChar(i + 48));
        test.insert(4, QLatin1Char(':'));
        test.insert(2, QLatin1Char(':'));
        width = std::max(width, metrics.width(test));
    }
    pixmap = QPixmap(QSize(width + 82, 32) * ratio);
    pixmap.setDevicePixelRatio(ratio);
    pixmap.fill(Qt::transparent);
    {
        QPainter painter(&pixmap);

        painter.setPen(Qt::NoPen);
        painter.setBrush(QColor(0, 0, 0, 200));
        painter.setRenderHint(QPainter::Antialiasing, true);
        painter.drawRoundedRect(0, -32, width + 82, 64, 5, 5);
    }
    overlay->setPixmap(pixmap);

    // Create overlay buttons
    m_definitions_button = new QLabel(overlay);
    m_definitions_button->setPixmap(QIcon(":/definitions.png").pixmap(24,24));
    m_definitions_button->setCursor(Qt::PointingHandCursor);
    m_definitions_button->setToolTip(tr("Definitions"));
    m_definitions_button->installEventFilter(this);

    m_hint_button = new QLabel(overlay);
    m_hint_button->setPixmap(QIcon(":/hint.png").pixmap(24,24));
    m_hint_button->setCursor(Qt::PointingHandCursor);
    m_hint_button->setToolTip(tr("Hint"));
    m_hint_button->setDisabled(true);
    m_hint_button->installEventFilter(this);
    connect(m_board, &Board::hintAvailable, m_hint_button, &QLabel::setEnabled);

    // Create clock
    m_clock = new Clock(overlay);
    m_clock->setDisabled(true);
    connect(m_clock, &Clock::togglePaused, m_board, &Board::togglePaused);
    connect(m_board, &Board::loading, m_clock, &Clock::setLoading);

    QHBoxLayout* overlay_layout = new QHBoxLayout(overlay);
    overlay_layout->setMargin(0);
    overlay_layout->setSpacing(0);
    overlay_layout->addSpacing(10);
    overlay_layout->addWidget(m_definitions_button);
    overlay_layout->addStretch();
    overlay_layout->addWidget(m_clock, 0, Qt::AlignCenter);
    overlay_layout->addStretch();
    overlay_layout->addWidget(m_hint_button);
    overlay_layout->addSpacing(10);

    // Lay out board
    QGridLayout* layout = new QGridLayout(contents);
    layout->setMargin(0);
    layout->setSpacing(0);
    layout->addWidget(view, 0, 0);
    layout->addWidget(m_success, 0, 0, Qt::AlignCenter);
    layout->addWidget(overlay, 0, 0, Qt::AlignHCenter | Qt::AlignTop);

    // Create menus
    QMenu* menu = menuBar()->addMenu(tr("&Game"));
    menu->addAction(tr("&New"), this, SLOT(newGame()), QKeySequence::New);
    menu->addAction(tr("&Choose..."), this, SLOT(chooseGame()));
    menu->addSeparator();
    m_pause_action = menu->addAction(tr("&Pause"), m_board, SLOT(togglePaused()), tr("P"));
    m_pause_action->setDisabled(true);
    QAction* action = menu->addAction(tr("&Hint"), m_board, SLOT(showHint()), tr("H"));
    action->setDisabled(true);
    connect(m_board, &Board::hintAvailable, action, &QAction::setEnabled);
    menu->addAction(tr("D&efinitions"), m_definitions, SLOT(selectWord()), tr("D"));
    menu->addSeparator();
    menu->addAction(tr("&Details"), this, SLOT(showDetails()));
    menu->addAction(tr("&Scores"), m_scores, SLOT(exec()));
    menu->addSeparator();
    action = menu->addAction(tr("&Quit"), qApp, SLOT(quit()), QKeySequence::Quit);
    action->setMenuRole(QAction::QuitRole);

    menu = menuBar()->addMenu(tr("&Settings"));
    menu->addAction(tr("Application &Language..."), this, SLOT(setLocale()));

    menu = menuBar()->addMenu(tr("&Help"));
    action = menu->addAction(tr("&About"), this, SLOT(about()));
    action->setMenuRole(QAction::AboutRole);
    action = menu->addAction(tr("About &Qt"), qApp, SLOT(aboutQt()));
    action->setMenuRole(QAction::AboutQtRole);

    // Restore window geometry
    QSettings settings;
    resize(800, 600);
    restoreGeometry(settings.value("Geometry").toByteArray());

    // Continue previous or start new game
    show();
    if (settings.contains("Current/Words") && (settings.value("Current/Version" ).toInt() == 4)) {
        m_board->openGame();
    } else {
        settings.remove("Current");
        newGame();
    }
}
Exemplo n.º 7
0
int main(int argc, char *argv[])
{
    QCoreApplication::setOrganizationName("SRFGames");
    QCoreApplication::setOrganizationDomain("sol-online.org"),
    QCoreApplication::setApplicationName("TrackYourTime");

#ifdef Q_OS_MAC
    QDir dir(argv[0]);
    dir.cdUp();
    QString currentDir = dir.absolutePath();
    dir.cdUp();
    dir.cd("PlugIns");
    QCoreApplication::setLibraryPaths(QStringList(dir.absolutePath()));
#endif

    QApplication a(argc, argv);
    QApplication::setQuitOnLastWindowClosed(false);

#ifdef Q_OS_MAC
    QDir::setCurrent(currentDir);
#endif



    QSettings settings;
    QString Language = QLocale::system().name();
    Language.truncate(Language.lastIndexOf('_'));
    Language = settings.value(cDataManager::CONF_LANGUAGE_ID,Language).toString();
    if (settings.value(cDataManager::CONF_FIRST_LAUNCH_ID,true).toBool()){
        settings.setValue(cDataManager::CONF_FIRST_LAUNCH_ID,false);
        settings.setValue(cDataManager::CONF_LANGUAGE_ID,Language);
        settings.setValue(cDataManager::CONF_AUTORUN_ID,true);
        setAutorun();
        settings.sync();
    }

    QTranslator translator;
    translator.load("lang_" + Language,QDir::currentPath()+"/data/languages");
    QApplication::installTranslator(&translator);

    cDataManager datamanager;

    cTrayIcon trIcon(&datamanager);
    QObject::connect(&datamanager, SIGNAL(trayActive()), &trIcon, SLOT(setActive()));
    QObject::connect(&datamanager, SIGNAL(traySleep()), &trIcon, SLOT(setInactive()));
    QObject::connect(&datamanager, SIGNAL(trayShowHint(QString)), &trIcon, SLOT(showHint(QString)));
    QObject::connect(&datamanager, SIGNAL(profilesChanged()), &trIcon, SLOT(onProfilesChange()));

    ApplicationsWindow applicationsWindow(&datamanager);
    QObject::connect(&trIcon, SIGNAL(showApplications()), &applicationsWindow, SLOT(show()));
    QObject::connect(&datamanager, SIGNAL(profilesChanged()), &applicationsWindow, SLOT(onProfilesChange()));
    QObject::connect(&datamanager, SIGNAL(applicationsChanged()), &applicationsWindow, SLOT(onApplicationsChange()));

    ProfilesWindow profilesWindow(&datamanager);
    QObject::connect(&applicationsWindow, SIGNAL(showProfiles()), &profilesWindow, SLOT(show()));

    App_SettingsWindow app_settingsWindow(&datamanager);
    QObject::connect(&applicationsWindow, SIGNAL(showAppSettings(int)), &app_settingsWindow, SLOT(showApp(int)));
    QObject::connect(&datamanager, SIGNAL(debugScriptResult(QString,sSysInfo)), &app_settingsWindow, SLOT(onScriptResult(QString,sSysInfo)));

    SettingsWindow settingsWindow(&datamanager);
    QObject::connect(&trIcon, SIGNAL(showSettings()), &settingsWindow, SLOT(show()));
    QObject::connect(&settingsWindow, SIGNAL(preferencesChange()), &datamanager, SLOT(onPreferencesChanged()));

    StatisticWindow statisticWindow(&datamanager);
    QObject::connect(&trIcon, SIGNAL(showStatistic()), &statisticWindow, SLOT(show()));

    AboutWindow aboutWindow;
    QObject::connect(&trIcon, SIGNAL(showAbout()), &aboutWindow, SLOT(show()));

    int result = a.exec();

    return result;
}
Exemplo n.º 8
0
int main(int argc, char *argv[])
{
    QCoreApplication::setOrganizationName("SRFGames");
    QCoreApplication::setOrganizationDomain("sol-online.org"),
    QCoreApplication::setApplicationName("TrackYourTime");

#ifdef Q_OS_MAC
    QDir dir(argv[0]);
    dir.cdUp();
    QString currentDir = dir.absolutePath();
    dir.cdUp();
    dir.cd("PlugIns");
    QCoreApplication::setLibraryPaths(QStringList(dir.absolutePath()));
#endif

    QApplication a(argc, argv);
    QApplication::setQuitOnLastWindowClosed(false);

#ifdef Q_OS_MAC
    QDir::setCurrent(currentDir);
#endif


    qDebug() << "application start\n";

    cSettings settings;
    QString Language = QLocale::system().name();
    Language.truncate(Language.lastIndexOf('_'));
    Language = settings.db()->value(cDataManager::CONF_LANGUAGE_ID,Language).toString();
    if (settings.db()->value(cDataManager::CONF_FIRST_LAUNCH_ID,true).toBool()){
        settings.db()->setValue(cDataManager::CONF_FIRST_LAUNCH_ID,false);
        settings.db()->setValue(cDataManager::CONF_LANGUAGE_ID,Language);
        settings.db()->setValue(cDataManager::CONF_AUTORUN_ID,true);
        setAutorun();
        settings.db()->sync();
    }

    qDebug() << "laod translation\n";
    QTranslator translator;
    translator.load("lang_" + Language,QDir::currentPath()+"/data/languages");
    QApplication::installTranslator(&translator);

    qDebug() << "init datamanager\n";
    cDataManager datamanager;
    qDebug() << "init schedule\n";
    cSchedule schedule(&datamanager);
    qDebug() << "init updater\n";
    cUpdater updater;
    QObject::connect(&schedule,SIGNAL(checkUpdates()),&updater,SLOT(checkUpdates()));

    qDebug() << "init tray icon\n";
    cTrayIcon trIcon(&datamanager);
    QObject::connect(&datamanager, SIGNAL(trayActive()), &trIcon, SLOT(setActive()));
    QObject::connect(&datamanager, SIGNAL(traySleep()), &trIcon, SLOT(setInactive()));
    QObject::connect(&datamanager, SIGNAL(trayShowHint(QString)), &trIcon, SLOT(showHint(QString)));
    QObject::connect(&datamanager, SIGNAL(profilesChanged()), &trIcon, SLOT(onProfilesChange()));

    qDebug() << "init applications window\n";
    ApplicationsWindow applicationsWindow(&datamanager);
    QObject::connect(&trIcon, SIGNAL(showApplications()), &applicationsWindow, SLOT(showNormal()));
    QObject::connect(&datamanager, SIGNAL(profilesChanged()), &applicationsWindow, SLOT(onProfilesChange()));
    QObject::connect(&datamanager, SIGNAL(applicationsChanged()), &applicationsWindow, SLOT(onApplicationsChange()));

    qDebug() << "init profiles window\n";
    ProfilesWindow profilesWindow(&datamanager);
    QObject::connect(&applicationsWindow, SIGNAL(showProfiles()), &profilesWindow, SLOT(showNormal()));

    qDebug() << "init app settings window\n";
    App_SettingsWindow app_settingsWindow(&datamanager);
    QObject::connect(&applicationsWindow, SIGNAL(showAppSettings(int)), &app_settingsWindow, SLOT(showApp(int)));
    QObject::connect(&datamanager, SIGNAL(debugScriptResult(QString,sSysInfo)), &app_settingsWindow, SLOT(onScriptResult(QString,sSysInfo)));

    qDebug() << "init settings window\n";
    SettingsWindow settingsWindow(&datamanager);
    QObject::connect(&trIcon, SIGNAL(showSettings()), &settingsWindow, SLOT(showNormal()));
    QObject::connect(&settingsWindow, SIGNAL(preferencesChange()), &datamanager, SLOT(onPreferencesChanged()));

    qDebug() << "init schedule window\n";
    ScheduleWindow scheduleWindow(&datamanager,&schedule);
    QObject::connect(&datamanager, SIGNAL(profilesChanged()), &scheduleWindow, SLOT(rebuild()));
    QObject::connect(&trIcon, SIGNAL(showSchedule()), &scheduleWindow, SLOT(showNormal()));

    qDebug() << "init statistic window\n";
    StatisticWindow statisticWindow(&datamanager);
    QObject::connect(&trIcon, SIGNAL(showStatistic()), &statisticWindow, SLOT(showNormal()));

    qDebug() << "init about window\n";
    AboutWindow aboutWindow;
    QObject::connect(&trIcon, SIGNAL(showAbout()), &aboutWindow, SLOT(showNormal()));

    qDebug() << "init update window\n";
    UpdateAvailableWindow updateAvailableWindow;
    QObject::connect(&updater, SIGNAL(newVersionAvailable(QString)), &updateAvailableWindow, SLOT(showUpdate(QString)));
    QObject::connect(&updateAvailableWindow, SIGNAL(ignoreUpdate()), &updater, SLOT(ignoreNewVersion()));

    qDebug() << "init notification window\n";
    NotificationWindow notificationWindow(&datamanager);
    QObject::connect(&settingsWindow, SIGNAL(preferencesChange()), &notificationWindow, SLOT(onPreferencesChanged()));
    QObject::connect(&datamanager, SIGNAL(showNotification()), &notificationWindow, SLOT(onShow()));

    qDebug() << "start schedule\n";
    schedule.start();

    qDebug() << "start app loop\n";
    int result = a.exec();
    qDebug() << "application close\n";
    return result;
}