Exemplo n.º 1
0
Arquivo: update.c Projeto: jxv/finite
bool update_guiFocusMenu(GUI *g, Controls *c)
{

    MenuWidget *m;

    NOT(g);
    NOT(c);

    m = &g->menu;

    updateMenuWidget(m, c);

    if (submitted(c)) {
        switch (m->focus) {
        case menuFocusPlay:
            g->next = guiFocusPlayMenu;
            break;
        case menuFocusSettings:
            g->next = guiFocusSettings;
            break;
        case menuFocusRules:
            g->next = guiFocusRules;
            break;
        case menuFocusExit:
            return true;
        default:
            break;
        }

    }
    if (goBack(c)) {
        toTransScreenFadeBlack(g, guiFocusTitle, 0.25f);
    }
    return false;
}
Exemplo n.º 2
0
void FlatTextarea::keyPressEvent(QKeyEvent *e) {
    bool shift = e->modifiers().testFlag(Qt::ShiftModifier);
    bool macmeta = (cPlatform() == dbipMac) && e->modifiers().testFlag(Qt::ControlModifier) && !e->modifiers().testFlag(Qt::MetaModifier) && !e->modifiers().testFlag(Qt::AltModifier);
    bool ctrl = e->modifiers().testFlag(Qt::ControlModifier) || e->modifiers().testFlag(Qt::MetaModifier), ctrlGood = (ctrl && _ctrlEnterSubmit) || (!ctrl && !shift && !_ctrlEnterSubmit) || (ctrl && shift);
    bool enter = (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return);

    if (macmeta && e->key() == Qt::Key_Backspace) {
        QTextCursor tc(textCursor()), start(tc);
        start.movePosition(QTextCursor::StartOfLine);
        tc.setPosition(start.position(), QTextCursor::KeepAnchor);
        tc.removeSelectedText();
    } else if (enter && ctrlGood) {
        emit submitted(ctrl && shift);
    } else if (e->key() == Qt::Key_Escape) {
        emit cancelled();
    } else if (e->key() == Qt::Key_Tab || (ctrl && e->key() == Qt::Key_Backtab)) {
        if (ctrl) {
            e->ignore();
        } else {
            emit tabbed();
        }
    } else if (e->key() == Qt::Key_Search || e == QKeySequence::Find) {
        e->ignore();
    } else {
        QTextCursor tc(textCursor());
        if (enter && ctrl) {
            e->setModifiers(e->modifiers() & ~Qt::ControlModifier);
        }
        bool spaceOrReturn = false;
        QString t(e->text());
        if (!t.isEmpty() && t.size() < 3) {
            if (t.at(0) == '\n' || t.at(0) == '\r' || t.at(0).isSpace() || t.at(0) == QChar::LineSeparator) {
                spaceOrReturn = true;
            }
        }
        QTextEdit::keyPressEvent(e);
        if (tc == textCursor()) {
            bool check = false;
            if (e->key() == Qt::Key_PageUp || e->key() == Qt::Key_Up) {
                tc.movePosition(QTextCursor::Start, e->modifiers().testFlag(Qt::ShiftModifier) ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor);
                check = true;
            } else if (e->key() == Qt::Key_PageDown || e->key() == Qt::Key_Down) {
                tc.movePosition(QTextCursor::End, e->modifiers().testFlag(Qt::ShiftModifier) ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor);
                check = true;
            }
            if (check) {
                if (tc == textCursor()) {
                    e->ignore();
                } else {
                    setTextCursor(tc);
                }
            }
        }
        if (spaceOrReturn) emit spacedReturnedPasted();
    }
}
Exemplo n.º 3
0
Arquivo: update.c Projeto: jxv/finite
void updateGameHotseatPause(GUI *g, Controls *c, game_t *gm)
{
    NOT(g);
    NOT(c);

    if (submitted(c)) {
        g->next = guiFocusGameGUI;
    }
    updateScoreBoard(&g->scoreBoard, gm, SPF);
}
Exemplo n.º 4
0
Arquivo: update.c Projeto: jxv/finite
void update_guiFocusGameMenu(GUI *g, Controls *c, game_t *gm)
{
    MenuWidget *m;

    NOT(g);
    NOT(c);
    NOT(gm);

    m = &g->gameMenu;

    updateMenuWidget(m, c);

    if (goBack(c)) {
        g->next = guiFocusGameGUI;
        return;
    }

    if (submitted(c)) {
        switch (m->focus) {
        case gameMenuFocusResume: {
            g->next = guiFocusGameGUI;
            break;
        }
        case gameMenuFocusSettings: {
            g->settings.previous = g->focus;
            g->next = guiFocusSettings;
            break;
        }
        case gameMenuFocusSkip: {
            g->transMove.type = transMoveSkipPlay;
            next_turn(gm);
            g->next = nextGUIFocusByplayer_tag_t(gm->player[gm->turn].type);
            break;
        }
        case gameMenuFocusQuit: {
            g->next = guiFocusGameAreYouSureQuit;
            break;
        }
        default:
            break;
        }
        return;
    }
}
Exemplo n.º 5
0
Arquivo: update.c Projeto: jxv/finite
void updatePlayMenu(GUI *g, Controls *c, game_t *gm)
{
    MenuWidget *m;

    NOT(g);
    NOT(c);
    NOT(gm);

    m = &g->playMenu;
    updateMenuWidget(m, c);

    if (goBack(c)) {
        g->next = guiFocusMenu;
        return;
    }

    if (submitted(c)) {
        switch (m->focus) {
        case playMenuFocusHumanVsHuman: {
            initGame1vs1Human(gm);
            initTextLog(&g->gameGui.textLog);
            resetNewGameGui(g, gm);
            initScoreBoard(&g->scoreBoard, gm);
            toTransScreenFadePausePixelate(g, guiFocusGameGUI, 1.0f);
            break;
        }
        case playMenuFocusHumanVsAI: {
            initGame1vs1HumanAI(gm);
            initTextLog(&g->gameGui.textLog);
            resetNewGameGui(g, gm);
            initScoreBoard(&g->scoreBoard, gm);
            toTransScreenFadePausePixelate(g, guiFocusGameGUI, 1.0f);
            break;
        }
        case playMenuFocusOptions: {
            g->next = guiFocusOptions;
            break;
        }
        default:
            break;
        }
    }
}
Exemplo n.º 6
0
void WebBrowser::createConnections() {
  connect(m_webView, &WebViewer::messageStatusChangeRequested, this, &WebBrowser::receiveMessageStatusChangeRequest);

  connect(m_txtLocation,SIGNAL(submitted(QString)), this, SLOT(loadUrl(QString)));
  connect(m_webView, SIGNAL(urlChanged(QUrl)), this, SLOT(updateUrl(QUrl)));

  // Connect this WebBrowser to global TabWidget.
  //TabWidget *tab_widget = qApp->mainForm()->tabWidget();
  //connect(m_webView, SIGNAL(newTabRequested()), tab_widget, SLOT(addEmptyBrowser()));
  //connect(m_webView, SIGNAL(linkMiddleClicked(QUrl)), tab_widget, SLOT(addLinkedBrowser(QUrl)));

  // Change location textbox status according to webpage status.
  connect(m_webView, SIGNAL(loadStarted()), this, SLOT(onLoadingStarted()));
  connect(m_webView, SIGNAL(loadProgress(int)), this, SLOT(onLoadingProgress(int)));
  connect(m_webView, SIGNAL(loadFinished(bool)), this, SLOT(onLoadingFinished(bool)));

  // Forward title/icon changes.
  connect(m_webView, SIGNAL(titleChanged(QString)), this, SLOT(onTitleChanged(QString)));
  connect(m_webView, SIGNAL(iconChanged(QIcon)), this, SLOT(onIconChanged(QIcon)));
}
Exemplo n.º 7
0
Arquivo: update.c Projeto: jxv/finite
void updateGameAreYouSureQuit(GUI *g, game_t *gm, Controls *c)
{
    updateMenuWidget(&g->gameAreYouSureQuit, c);
    if (submitted(c)) {
        g->next = guiFocusGameMenu;
        if (g->gameAreYouSureQuit.focus == yes) {
            move_t m;
            action_t a;
            g->next = guiFocusGameOver;
            m.type = MOVE_QUIT;
            m.playerIdx = gm->turn;
            mk_action(gm, &m, &a);
            assert(a.type == ACTION_QUIT);
            apply_action(&a, gm);
        }
        return;
    }
    if (goBack(c))
        g->next = guiFocusGameMenu;
}
Exemplo n.º 8
0
int FrmFrame::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = GenericTab::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: isLogBook((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 1: submitted((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break;
        case 2: onShowForm(); break;
        case 3: onHideFrameDetails(); break;
        case 4: onShowFrameDetails(); break;
        case 5: { bool _r = next();
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        case 6: apply(); break;
        default: ;
        }
        _id -= 7;
    }
    return _id;
}
Exemplo n.º 9
0
Arquivo: update.c Projeto: jxv/finite
void update_guiFocusSettings(GUI *g, Controls *c)
{
    Settings *s;

    NOT(g);
    NOT(c);

    s = &g->settings;

    updateMenuWidget(&s->menu, c);

    s->snd = false;
    if (goBack(c)) {
        g->next = s->previous;
        return;
    }

    switch (s->menu.focus) {
    case settingsFocusSfx: {
        int pvol;
        int idx = s->menu.focus - volMus;
        pvol = s->vol[idx];
        s->vol[idx] = updateVolumes(s->vol[idx], c);
        if (pvol != s->vol[idx]) {
            s->snd = true;
        }
        break;
    }
    case settingsFocusControls: {
        if (submitted(c)) {
            g->next =  guiFocusControls;
        }
        break;
    }
    default:
        break;
    }


}
Exemplo n.º 10
0
void FlatTextarea::keyPressEvent(QKeyEvent *e) {
	bool shift = e->modifiers().testFlag(Qt::ShiftModifier);
	bool ctrl = e->modifiers().testFlag(Qt::ControlModifier) || e->modifiers().testFlag(Qt::MetaModifier), ctrlGood = (ctrl && cCtrlEnter()) || (!ctrl && !shift && !cCtrlEnter()) || (ctrl && shift);
	bool enter = (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return);

	if (enter && ctrlGood) {
		emit submitted(ctrl && shift);
	} else if (e->key() == Qt::Key_Escape) {
		emit cancelled();
	} else if (e->key() == Qt::Key_Tab || (ctrl && e->key() == Qt::Key_Backtab)) {
		if (ctrl) {
			e->ignore();
		} else {
			emit tabbed();
		}
	} else {
		QTextCursor tc(textCursor());
		if (enter && ctrl) {
			e->setModifiers(e->modifiers() & ~Qt::ControlModifier);
		}
		QTextEdit::keyPressEvent(e);
		if (tc == textCursor()) {
			bool check = false;
			if (e->key() == Qt::Key_PageUp || e->key() == Qt::Key_Up) {
				tc.movePosition(QTextCursor::Start, e->modifiers().testFlag(Qt::ShiftModifier) ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor);
				check = true;
			} else if (e->key() == Qt::Key_PageDown || e->key() == Qt::Key_Down) {
				tc.movePosition(QTextCursor::End, e->modifiers().testFlag(Qt::ShiftModifier) ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor);
				check = true;
			}
			if (check) {
				if (tc == textCursor()) {
					e->ignore();
				} else {
					setTextCursor(tc);
				}
			}
		}
	}
}
Exemplo n.º 11
0
bool FrmFrame::next()
{
    //We force a submitted record on this session, unless its coming here later...

    if (m_curFrameTime==-1) return false;

    if (m_tabsDefined){
        emit forward(cmbPrexistent->currentText());
        return true;
    }

    if (m_submitted){

        emit submitted(m_index,true);
        emit isLogBook(m_sample->bLogBook);

        m_tabsDefined=true;
        emit forward(cmbPrexistent->currentText());
        return true;
    }
    emit showError(tr("It was not defined any time frame for this frame!"));
    return false;
}
Exemplo n.º 12
0
void FormField::formSubmitted() {
	lastResult = getFieldContent();

	emit submitted();
}
Exemplo n.º 13
0
void LevelWidget::submit()
{
	emit submitted(getLevelList());
}