Ejemplo n.º 1
0
LockScreen::LockScreen(NotificationsModel *notificationsModel, QGraphicsWidget *parent):
    QGraphicsProxyWidget(parent)
{
    LockScreenManager *manager = new LockScreenManager(this);

    QCoreApplication::instance()->setOrganizationName("SfietKonstantin");
    QCoreApplication::instance()->setApplicationName("Widgets");

    SettingsManager *settingsManager = new SettingsManager(this);

    QDBusConnection::sessionBus().registerService("org.SfietKonstantin.widgets");
    QDBusConnection::sessionBus().registerObject("/org/SfietKonstantin/widgets", settingsManager,
                                                 QDBusConnection::ExportAllSlots);

    view = new QDeclarativeView();
    view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
    view->rootContext()->setContextProperty("LockScreenManager", manager);
    view->rootContext()->setContextProperty("NotificationsModel", notificationsModel);
    view->rootContext()->setContextProperty("SettingsManagerInstance", settingsManager);
    view->setSource(QUrl("/opt/widgets/lockscreen/qml/main.qml"));

    setWidget(view);

    connect(manager, SIGNAL(unlocked()), this , SIGNAL(unlocked()));
}
Ejemplo n.º 2
0
bool ClingoPropagator::Control::propagate() {
	ScopedUnlock unlocked(lock(), ctx_);
	if (solver().hasConflict())    { return false; }
	if (solver().queueSize() == 0) { return true;  }
	ClingoPropagator::size_t epoch = ctx_->epoch_;
	return (state_ & state_prop) != 0u && solver().propagateUntil(unlocked.obj_) && epoch == ctx_->epoch_;
}
Ejemplo n.º 3
0
/**
 * @details
 * Decreases the lock counter, and emits the unlocked signal when
 * count returns to 0.
 */
void AbstractLockable::unlock()
{
    QMutexLocker locker(&_mutex);
    --_lock;
    if ( _lock <= 0 )
       emit unlocked();
}
Ejemplo n.º 4
0
 void lock() {
     Node::Ptr unlocked(nullptr, 0);
     if (!tail_.compare_exchange_strong(unlocked, Node::Ptr(nullptr, 1),
                                        std::memory_order_acquire)) {
         slowpathLock(unlocked);
     }
 }
Ejemplo n.º 5
0
void CWindowMain::on_execut(const QList<CExecutObject *> &lstObj)
{
    if (!lstObj.isEmpty() && m_executThread == NULL) {

        m_executThread = new CExecutThread(this,lstObj);

        connect(m_executThread,SIGNAL(executOperation(QString)),
                m_widgetConsol,SLOT(executingOperation(QString)));

        connect(m_executThread,SIGNAL(message(QString)),
                m_widgetConsol,SLOT(messageAppend(QString)));

        connect(m_executThread,SIGNAL(started()),
                this,SIGNAL(locked()));

        connect(m_executThread,SIGNAL(timerWork(uint)),
                this,SLOT(on_timerWork(uint)));

        connect(this,SIGNAL(terminated()),
                m_executThread,SLOT(on_terminated()));

        connect(m_executThread,SIGNAL(finished()),
                this,SIGNAL(unlocked()));

        connect(m_executThread,SIGNAL(finished()),
                this,SLOT(on_finished()));

        m_executThread->start();
    }
}
Ejemplo n.º 6
0
void Player::unlock()
{
    lockCount -= 1;
    if (lockCount >= 0)
        emit unlocked();
    else
        lockCount = 0;
}
void Ut_LockScreenWithPadlockView::testInitialState()
{
    QVERIFY(!m_subject->dragAndDropOverlay.isVisible());
    QVERIFY(!m_subject->notificationArea->isVisible());
    QVERIFY(disconnect(m_subject->notificationArea, SIGNAL(needToShow(bool)), m_subject, SLOT(showHideNotifications(bool))));
    QVERIFY(disconnect(m_subject, SIGNAL(unlocked()), m_subject->controller, SLOT(unlock())));
    QVERIFY(disconnect(m_subject->controller, SIGNAL(resetRequested()), m_subject, SLOT(resetState())));
}
Ejemplo n.º 8
0
 void lock() {
     XEDGE(lock, out);
     Node::Ptr unlocked(nullptr, 0);
     if (!L(lock,
            tail_.compare_exchange_strong(unlocked, Node::Ptr(nullptr, 1)))){
         LS(lock, slowpathLock(unlocked));
     }
     LPOST(out);
 }
Ejemplo n.º 9
0
void SSql::unlock()
{
    if( locked() && lock_obj != this )
    {
        qDebug() << "Error on SSql::unlock(): Can't unlock SSql, this object is not owner of lock.";
        return;
    }
    if( unlocked() )
        return;

    lock_obj = 0;
}
Ejemplo n.º 10
0
Player::Player(const GenericSocket &sock, int id) : myid(id)
{
    myrelay = new Analyzer(sock, id);
    lockCount = 0;
    battleSearch() = false;
    myip = relay().ip();
    rating() = -1;
    waiting_team = NULL;
    server_pass_sent = false;

    m_state = NotLoggedIn;
    myauth = 0;

    connect(&relay(), SIGNAL(disconnected()), SLOT(disconnected()));
    connect(&relay(), SIGNAL(loggedIn(TeamInfo&,bool,bool,QColor)), SLOT(loggedIn(TeamInfo&,bool,bool,QColor)));
    connect(&relay(), SIGNAL(serverPasswordSent(const QString&)), SLOT(serverPasswordSent(const QString&)));
    connect(&relay(), SIGNAL(messageReceived(int, QString)), SLOT(recvMessage(int, QString)));
    connect(&relay(), SIGNAL(teamReceived(TeamInfo&)), SLOT(recvTeam(TeamInfo&)));
    connect(&relay(), SIGNAL(challengeStuff(ChallengeInfo)), SLOT(challengeStuff(ChallengeInfo)));
    connect(&relay(), SIGNAL(forfeitBattle(int)), SLOT(battleForfeited(int)));
    connect(&relay(), SIGNAL(battleMessage(int,BattleChoice)), SLOT(battleMessage(int,BattleChoice)));
    connect(&relay(), SIGNAL(battleChat(int,QString)), SLOT(battleChat(int,QString)));
    connect(&relay(), SIGNAL(sentHash(QString)), SLOT(hashReceived(QString)));
    connect(&relay(), SIGNAL(wannaRegister()), SLOT(registerRequest()));
    connect(&relay(), SIGNAL(kick(int)), SLOT(playerKick(int)));
    connect(&relay(), SIGNAL(ban(int)), SLOT(playerBan(int)));
    connect(&relay(), SIGNAL(banRequested(QString)), SLOT(CPBan(QString)));
    connect(&relay(), SIGNAL(tempBanRequested(QString,int)), SLOT(CPTBan(QString,int)));
    connect(&relay(), SIGNAL(unbanRequested(QString)), SLOT(CPUnban(QString)));
    connect(&relay(), SIGNAL(PMsent(int,QString)), SLOT(receivePM(int,QString)));
    connect(&relay(), SIGNAL(getUserInfo(QString)), SLOT(userInfoAsked(QString)));
    connect(&relay(), SIGNAL(tbanListRequested()), SLOT(giveTBanList()));
    connect(&relay(), SIGNAL(banListRequested()), SLOT(giveBanList()));
    connect(&relay(), SIGNAL(awayChange(bool)), SLOT(awayChange(bool)));
    connect(&relay(), SIGNAL(battleSpectateRequested(int)), SLOT(spectatingRequested(int)));
    connect(&relay(), SIGNAL(battleSpectateEnded(int)), SLOT(quitSpectating(int)));
    connect(&relay(), SIGNAL(battleSpectateChat(int,QString)), SLOT(spectatingChat(int,QString)));
    connect(&relay(), SIGNAL(ladderChange(bool)), SLOT(ladderChange(bool)));
    connect(&relay(), SIGNAL(showTeamChange(bool)), SLOT(showTeamChange(bool)));
    connect(&relay(), SIGNAL(tierChanged(QString)), SLOT(changeTier(QString)));
    connect(&relay(), SIGNAL(findBattle(FindBattleData)), SLOT(findBattle(FindBattleData)));
    connect(&relay(), SIGNAL(showRankings(QString,int)), SLOT(getRankingsByPage(QString, int)));
    connect(&relay(), SIGNAL(showRankings(QString,QString)), SLOT(getRankingsByName(QString, QString)));
    connect(&relay(), SIGNAL(joinRequested(QString)), SLOT(joinRequested(QString)));
    connect(&relay(), SIGNAL(leaveChannel(int)), SLOT(leaveRequested(int)));
    connect(&relay(), SIGNAL(ipChangeRequested(QString)), SLOT(ipChangeRequested(QString)));
    /* To avoid threading / simulateneous calls problems, it's queued */
    connect(this, SIGNAL(unlocked()), &relay(), SLOT(undelay()),Qt::QueuedConnection);

    /* Autokick after 3 minutes if still not logged in */
    QTimer::singleShot(1000*180, this, SLOT(autoKick()));
}
Ejemplo n.º 11
0
void Player::doConnections()
{
    /* The reason for Queued Connection is that for example a disconnect signal could be received when
      a script sends a message to the client.

      If that happens we want the disconnect signal to happen after the script function*/
    connect(&relay(), SIGNAL(disconnected()), SLOT(disconnected()), Qt::QueuedConnection);
    connect(&relay(), SIGNAL(loggedIn(LoginInfo*)), SLOT(loggedIn(LoginInfo*)));
    connect(&relay(), SIGNAL(logout()), SLOT(logout()));
    connect(&relay(), SIGNAL(serverPasswordSent(const QByteArray&)), SLOT(serverPasswordSent(const QByteArray&)));
    connect(&relay(), SIGNAL(messageReceived(int, QString)), SLOT(recvMessage(int, QString)));
    connect(&relay(), SIGNAL(playerDataRequested(int)), SLOT(recvPlayerDataRequest(int)));
    connect(&relay(), SIGNAL(teamChanged(const ChangeTeamInfo&)), SLOT(recvTeam(const ChangeTeamInfo&)));
    connect(&relay(), SIGNAL(challengeStuff(ChallengeInfo)), SLOT(challengeStuff(ChallengeInfo)));
    connect(&relay(), SIGNAL(forfeitBattle(int)), SLOT(battleForfeited(int)));
    connect(&relay(), SIGNAL(battleMessage(int,BattleChoice)), SLOT(battleMessage(int,BattleChoice)));
    connect(&relay(), SIGNAL(battleChat(int,QString)), SLOT(battleChat(int,QString)));
    connect(&relay(), SIGNAL(sentHash(QByteArray)), SLOT(hashReceived(QByteArray)));
    connect(&relay(), SIGNAL(wannaRegister()), SLOT(registerRequest()));
    connect(&relay(), SIGNAL(kick(int)), SLOT(playerKick(int)));
    connect(&relay(), SIGNAL(ban(int)), SLOT(playerBan(int)));
    connect(&relay(), SIGNAL(tempBan(int,int)), SLOT(playerTempBan(int,int)));
    connect(&relay(), SIGNAL(banRequested(QString,int)), SLOT(CPBan(QString,int)));
    connect(&relay(), SIGNAL(unbanRequested(QString)), SLOT(CPUnban(QString)));
    connect(&relay(), SIGNAL(PMsent(int,QString)), SLOT(receivePM(int,QString)));
    connect(&relay(), SIGNAL(getUserInfo(QString)), SLOT(userInfoAsked(QString)));
    connect(&relay(), SIGNAL(banListRequested()), SLOT(giveBanList()));
    connect(&relay(), SIGNAL(awayChange(bool)), SLOT(awayChange(bool)));
    connect(&relay(), SIGNAL(battleSpectateRequested(int)), SLOT(spectatingRequested(int)));
    connect(&relay(), SIGNAL(battleSpectateEnded(int)), SLOT(quitSpectating(int)));
    connect(&relay(), SIGNAL(battleSpectateChat(int,QString)), SLOT(spectatingChat(int,QString)));
    connect(&relay(), SIGNAL(ladderChange(bool)), SLOT(ladderChange(bool)));
    connect(&relay(), SIGNAL(tierChanged(quint8,QString)), SLOT(changeTier(quint8,QString)));
    connect(&relay(), SIGNAL(findBattle(FindBattleData)), SLOT(findBattle(FindBattleData)));
    connect(&relay(), SIGNAL(showRankings(QString,int)), SLOT(getRankingsByPage(QString, int)));
    connect(&relay(), SIGNAL(showRankings(QString,QString)), SLOT(getRankingsByName(QString, QString)));
    connect(&relay(), SIGNAL(showRankings(int)), SLOT(getRankingsForPlayer(int)));
    connect(&relay(), SIGNAL(joinRequested(QString)), SLOT(joinRequested(QString)));
    connect(&relay(), SIGNAL(leaveChannel(int)), SLOT(leaveRequested(int)));
    connect(&relay(), SIGNAL(ipChangeRequested(QString)), SLOT(ipChangeRequested(QString)));
    connect(&relay(), SIGNAL(endCommand()), SLOT(sendUpdatedIfNeeded()));
    connect(&relay(), SIGNAL(reconnect(int,QByteArray)), SLOT(onReconnect(int,QByteArray)));
    connect(&relay(), SIGNAL(showRankings(int)), SLOT(getRankingsForPlayer(int)));

    /* To avoid threading / simulateneous calls problems, it's queued */
    connect(this, SIGNAL(unlocked()), &relay(), SLOT(undelay()),Qt::QueuedConnection);
}
Ejemplo n.º 12
0
void ClingoPropagator::Control::addWatch(Lit_t lit) {
	ScopedUnlock unlocked(lock(), ctx_);
	POTASSCO_REQUIRE(assignment_.hasLit(lit), "Invalid literal");
	Literal p = decodeLit(lit);
	Solver& s = solver();
	if (!s.hasWatch(p, ctx_)) {
		s.addWatch(p, ctx_);
		if ((state_ & state_init) != 0u && s.isTrue(p)) {
			// are we too late?
			bool inQ = std::find(s.trail().begin() + s.assignment().front, s.trail().end(), p) != s.trail().end();
			if (!inQ && !ctx_->inTrail(p)) {
				uint32 ignore = 0;
				ctx_->propagate(s, p, ignore);
			}
		}
	}
}
Ejemplo n.º 13
0
bool SSql::locked()
{
    return !unlocked();
}
Ejemplo n.º 14
0
void ClingoPropagator::Control::removeWatch(Lit_t lit) {
	ScopedUnlock unlocked(lock(), ctx_);
	if (assignment_.hasLit(lit)) {
		solver().removeWatch(decodeLit(lit), ctx_);
	}
}
Ejemplo n.º 15
0
bool ClingoPropagator::Control::hasWatch(Lit_t lit) const {
	ScopedUnlock unlocked(lock(), ctx_);
	return assignment_.hasLit(lit) && solver().hasWatch(decodeLit(lit), ctx_);
}
Ejemplo n.º 16
0
 void unlock()
 {
     emit unlocked();
 }
Ejemplo n.º 17
0
CWindowMain::CWindowMain(QWidget *parent)
    : QMainWindow(parent),
      m_executThread(NULL)
{
    m_widgetBFGenerate  = new CWidgetBFGenerate(this);
    m_widgetBFList      = new CWidgetBFList(this);
    m_widgetBFView      = new CWidgetBFView(this);
    m_widgetConsol      = new CWidgetConsol(this);
    m_widgetConsol->setVisible(false);
    m_widgetPanelMode   = new CWidgetPanelMode(this);
    m_widgetTreeSat     = new CWidgetTreeSat(this);

    QWidget *wBFViewBFGenerate = new QWidget();
    QVBoxLayout *boxBFViewBFGenerate = new QVBoxLayout();
    boxBFViewBFGenerate->addWidget(m_widgetBFGenerate);
    boxBFViewBFGenerate->addWidget(m_widgetBFView);
    boxBFViewBFGenerate->setMargin(0);
    boxBFViewBFGenerate->setSpacing(0);
    boxBFViewBFGenerate->setStretch(1,100);
    wBFViewBFGenerate->setLayout(boxBFViewBFGenerate);

    QSplitter *spListBFTreeAlg = new QSplitter(Qt::Vertical);
    spListBFTreeAlg->addWidget(m_widgetBFList);
    spListBFTreeAlg->addWidget(m_widgetTreeSat);

    QSplitter *spTreeView = new QSplitter(Qt::Horizontal);
    spTreeView->addWidget(spListBFTreeAlg);
    spTreeView->addWidget(wBFViewBFGenerate);
    spTreeView->setStretchFactor(1,100);

    QSplitter *spMain = new QSplitter(Qt::Vertical);
    spMain->addWidget(spTreeView);
    spMain->addWidget(m_widgetConsol);
    spMain->setStretchFactor(0,100);

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

    QHBoxLayout *hbox = new QHBoxLayout();
    centralWidget()->setLayout(hbox);

    hbox->addWidget(m_widgetPanelMode);
    hbox->addWidget(spMain);
    hbox->setMargin(0);
    hbox->setSpacing(0);
    hbox->setStretch(1,100);

    m_actOpen = new QAction(QIcon(":/ico/main_open.png"),tr("&Открыть"),this);
    m_actOpen->setShortcut(QKeySequence::Open);
    connect(m_actOpen,SIGNAL(triggered()),this,SLOT(on_open()));

    m_actSave = new QAction(QIcon(":/ico/main_save.png"),tr("&Сохранить"),this);
    m_actSave->setShortcut(QKeySequence::Save);
    connect(m_actSave,SIGNAL(triggered()),this,SLOT(on_save()));

    m_actSaveAs = new QAction(QIcon(":/ico/main_save_as.png"),tr("&Сохранить как"),this);
    m_actSaveAs->setShortcut(QKeySequence::SaveAs);
    connect(m_actSaveAs,SIGNAL(triggered()),this,SLOT(on_save_as()));

    m_actQuit = new QAction(QIcon("://ico/main_quit.png"),tr("Выйти"),this);
    m_actQuit->setShortcut(QKeySequence::Close);
    m_actQuit->setStatusTip(tr("Выйти из приложения"));
    connect(m_actQuit, SIGNAL(triggered()), this, SLOT(close()));

    mainMenu = menuBar()->addMenu(tr("Файл"));
    mainMenu->addAction(m_actOpen);
    mainMenu->addAction(m_actSave);
    mainMenu->addAction(m_actSaveAs);
    mainMenu->addSeparator();
    mainMenu->addAction(m_actQuit);

    mainMenu = menuBar()->addMenu(tr("Вид"));
    mainMenu->addAction(m_widgetBFGenerate->actVisible());
    mainMenu->addAction(m_widgetConsol->actVisible());

    // m_widgetPanelMode
    connect(m_widgetPanelMode,SIGNAL(run()),
            m_widgetTreeSat,SLOT(on_runChecked()));

    connect(m_widgetPanelMode,SIGNAL(run()),
            m_widgetBFGenerate,SLOT(on_resetTriggered()));

    connect(m_widgetPanelMode,SIGNAL(runLog()),
            m_widgetTreeSat,SLOT(on_runLogChecked()));

    connect(m_widgetPanelMode,SIGNAL(runLog()),
            m_widgetBFGenerate,SLOT(on_resetTriggered()));

    connect(m_widgetPanelMode,SIGNAL(terminate()),
            this,SIGNAL(terminated()));

    connect(m_widgetPanelMode,SIGNAL(toggledRand(bool)),
            m_widgetBFList,SLOT(setVisible(bool)));
    connect(m_widgetPanelMode,SIGNAL(toggledRand(bool)),
            m_widgetBFList,SLOT(on_disabledHide(bool)));

    connect(m_widgetPanelMode,SIGNAL(toggledRand(bool)),
            m_widgetBFGenerate,SLOT(setVisible(bool)));
    connect(m_widgetPanelMode,SIGNAL(toggledRand(bool)),
            m_widgetBFGenerate->actVisible(),SLOT(setChecked(bool)));
    connect(m_widgetPanelMode,SIGNAL(toggledRand(bool)),
            m_widgetBFGenerate->actVisible(),SLOT(setEnabled(bool)));

    connect(m_widgetPanelMode,SIGNAL(toggledRand(bool)),
            m_widgetTreeSat,SLOT(setVisible(bool)));
    connect(m_widgetPanelMode,SIGNAL(toggledRand(bool)),
            m_widgetTreeSat,SLOT(on_disabledHide(bool)));

    // m_widgetBFView
    connect(m_widgetBFView,SIGNAL(message(QString)),
            this,SIGNAL(messageAppend(QString)));

    connect(m_widgetBFView,SIGNAL(getLogSelectSat(bool)),
            m_widgetTreeSat,SLOT(on_returnLogSelectSat(bool)));

    // m_widgetBFList
    connect(m_widgetBFList,SIGNAL(generate()),
            m_widgetBFGenerate,SLOT(on_generate()));

    connect(m_widgetBFList,SIGNAL(selected(QString,CBoolFormula*)),
            m_widgetBFGenerate,SLOT(on_set(QString,CBoolFormula*)));

    connect(m_widgetBFList,SIGNAL(selected(QString,CBoolFormula*)),
            m_widgetTreeSat,SLOT(on_set(QString,CBoolFormula*)));

    connect(m_widgetBFList,SIGNAL(selected(QString,CBoolFormula*)),
            m_widgetBFView,SLOT(on_set(QString,CBoolFormula*)));

    connect(m_widgetBFList,SIGNAL(message(QString)),
            this,SIGNAL(messageAppend(QString)));

    // m_widgetBFGenerate
    connect(m_widgetBFGenerate,SIGNAL(append(QString,CBoolFormula*)),
            m_widgetBFList,SIGNAL(appendgen(QString,CBoolFormula*)));

    connect(m_widgetBFGenerate,SIGNAL(append(QString,CBoolFormula*)),
            m_widgetPanelMode,SLOT(on_resetTriggered()));

    connect(m_widgetBFGenerate,SIGNAL(execut(QList<CExecutObject*>)),
            this,SLOT(on_execut(QList<CExecutObject*>)));

    connect(m_widgetBFGenerate,SIGNAL(replace(QString,CBoolFormula*)),
            m_widgetBFList,SIGNAL(replace(QString,CBoolFormula*)));

    connect(m_widgetBFGenerate,SIGNAL(replace(QString,CBoolFormula*)),
            m_widgetPanelMode,SLOT(on_resetTriggered()));

    connect(m_widgetBFGenerate,SIGNAL(remove(QString)),
            m_widgetBFList,SIGNAL(remove(QString)));

    connect(m_widgetBFGenerate,SIGNAL(terminated()),
            this,SIGNAL(terminated()));

    // m_widgetTreeSat
    connect(m_widgetTreeSat,SIGNAL(execut(QList<CExecutObject*>)),
            this,SLOT(on_execut(QList<CExecutObject*>)));

    connect(m_widgetTreeSat,SIGNAL(logSelectSat(QString)),
            m_widgetBFView,SIGNAL(setText(QString)));

    // main
    connect(this,SIGNAL(messageAppend(QString)),
            m_widgetConsol,SLOT(messageAppend(QString)));

    connect(this,SIGNAL(messageSet(QString)),
            m_widgetConsol,SLOT(messageSet(QString)));

    connect(this,SIGNAL(executingOperation(QString)),
            m_widgetConsol,SLOT(executingOperation(QString)));

    connect(this,SIGNAL(append(QString,CBoolFormula*)),
            m_widgetBFList,SIGNAL(append(QString,CBoolFormula*)));

    connect(this,SIGNAL(locked()),m_widgetPanelMode,SLOT(on_locked()));
    connect(this,SIGNAL(unlocked()),m_widgetPanelMode,SLOT(on_unlocked()));

    connect(this,SIGNAL(locked()),m_widgetBFGenerate,SLOT(on_locked()));
    connect(this,SIGNAL(unlocked()),m_widgetBFGenerate,SLOT(on_unlocked()));

    connect(this,SIGNAL(updateView()),m_widgetBFView,SLOT(on_viewUpdate()));

    m_widgetPanelMode->on_checkedRand();  // set checked Random bool formula state for start application
}
void Ut_LockScreenWithPadlockView::testDraggableIconMovement()
{
    QFETCH(int, layoutDirection);

    QSKIP("This test method currently fails", SkipSingle);

    QSignalSpy unlockSpy(m_subject, SIGNAL(unlocked()));
    m_subject->lockScreenHeader->setLayoutDirection((Qt::LayoutDirection)layoutDirection);
    m_subject->lockScreenHeader->setPreferredSize(100, 10);

    // send three mouse events that ultimately will send the unlocked signal from the window.
    QGraphicsSceneMouseEvent *pressEvent = new QGraphicsSceneMouseEvent(QEvent::GraphicsSceneMousePress);
    pressEvent->setPos(QPointF(layoutDirection == Qt::LeftToRight ?
                               m_subject->lockScreenHeader->preferredWidth() : 0,
                               m_subject->lockScreenHeader->pos().y()));

    QGraphicsSceneMouseEvent *moveEvent = new QGraphicsSceneMouseEvent(QEvent::GraphicsSceneMouseMove);
    moveEvent->setPos(QPointF(400, 240));

    QGraphicsSceneMouseEvent *moveEventNotActive = new QGraphicsSceneMouseEvent(QEvent::GraphicsSceneMouseMove);
    moveEventNotActive->setPos(QPointF(400, 0));

    QGraphicsSceneMouseEvent *releaseEvent = new QGraphicsSceneMouseEvent(QEvent::GraphicsSceneMouseRelease);

    // sending a press event the place where it should activate the draggable icon.
    m_subject->mousePressEvent(pressEvent);
    QTest::qWait(50);
    QCoreApplication::processEvents();

    QCOMPARE(m_subject->dragAndDropState, (int)LockScreenWithPadlockView::STATE_MOVING);
    QVERIFY(nameOfLastFeedback == "start-dragndrop");
    checkOverlayPos(pressEvent->pos());
    QVERIFY(m_subject->dragAndDropIcon != 0);
    QCOMPARE(m_subject->dragAndDropOverlay.widget(), static_cast<MWidget*>(m_subject->dragAndDropIcon));
    QCOMPARE(gAppearSceneWindowList.count(), 1);
    QCOMPARE(gAppearSceneWindowList.at(0), &m_subject->dragAndDropOverlay);
    QCOMPARE(m_subject->dragAndDropIcon->objectName(), QString("LockScreenDnDIcon"));
    QVERIFY(m_subject->dragAndDropOverlay.isVisible());
    QCOMPARE(m_subject->lockScreenHeader->objectName(), QString("LockLiftArea"));
    QVERIFY(gUnlockAreaStub->stubLastCallTo("setEnabled").parameter<bool>(0));

    // move the mouse right into the middle of the screen
    m_subject->mouseMoveEvent(moveEvent);
    QCOMPARE(m_subject->dragAndDropState, (int)LockScreenWithPadlockView::STATE_MOVING_ACTIVE);
    QVERIFY(nameOfLastFeedback == "enter-dragndrop-dropzone");
    checkOverlayPos(moveEvent->pos());
    QCOMPARE(m_subject->dragAndDropIcon->objectName(), QString("LockScreenDnDIconActive"));
    QVERIFY(gUnlockAreaStub->stubLastCallTo("setActive").parameter<bool>(0));

    // move back to some non-active place
    m_subject->mouseMoveEvent(moveEventNotActive);
    QCOMPARE(m_subject->dragAndDropState, (int)LockScreenWithPadlockView::STATE_MOVING);
    QVERIFY(nameOfLastFeedback == "exit-dragndrop-dropzone");
    QCOMPARE(m_subject->dragAndDropIcon->objectName(), QString("LockScreenDnDIcon"));
    QVERIFY(!gUnlockAreaStub->stubLastCallTo("setActive").parameter<bool>(0));

    // again move to active area
    m_subject->mouseMoveEvent(moveEvent);
    QCOMPARE(m_subject->dragAndDropState, (int)LockScreenWithPadlockView::STATE_MOVING_ACTIVE);
    QVERIFY(nameOfLastFeedback == "enter-dragndrop-dropzone");
    QVERIFY(gUnlockAreaStub->stubLastCallTo("setActive").parameter<bool>(0));

    // when the mouse is released, the unlocked signal should be sent
    m_subject->mouseReleaseEvent(releaseEvent);
    QCOMPARE(unlockSpy.count(), 1);
    QVERIFY(nameOfLastFeedback == "release-inside-dragndrop-dropzone");
    QCOMPARE(m_subject->dragAndDropIcon->objectName(), QString("LockScreenDnDIcon"));
    QVERIFY(!m_subject->dragAndDropOverlay.isVisible());
    QCOMPARE(m_subject->lockScreenHeader->objectName(), QString("LockLiftAreaWithPadlock"));
    QVERIFY(!gUnlockAreaStub->stubLastCallTo("setEnabled").parameter<bool>(0));
}
Ejemplo n.º 19
0
void Mutex::setUnlocked() {
  m_isLocked = false;
  emit unlocked();
}
Ejemplo n.º 20
0
Potassco::Lit_t ClingoPropagator::Control::addVariable() {
	POTASSCO_REQUIRE(!assignment_.hasConflict(), "Invalid addVariable() on conflicting assignment");
	ScopedUnlock unlocked(lock(), ctx_);
	return encodeLit(posLit(solver().pushAuxVar()));
}