示例#1
0
void KBounceGameWidget::onFillChanged( int fill )
{
    emit filledChanged( fill );
    if ( fill >= MIN_FILL_PERCENT )
    {
        closeLevel();
        m_level++;
        emit levelChanged( m_level );

        m_state = BetweenLevels;
        emit stateChanged( m_state );

        redraw();
    }
}
示例#2
0
void TetrisBoard::refreshGUI(){
    emit levelChanged(tetris.getLevel());
    emit linesRemovedChanged(tetris.getLinesRemoved());

    Vector parameters(zuckerAgent.getTheta());
    std::stringstream ss;
    ss << parameters;
    QString parametersString(ss.str().c_str());
    emit parametersChanged(parametersString);
    if(boris.getBoss()!=nullptr){
        emit totalMovesChanged(static_cast<int>(boris.getBoss()->getTotalMoves()));
    }

    update();
    showNextPiece();
}
int Game::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: scoreChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 1: levelChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 2: startTankGame(); break;
        case 3: startAssassinGame(); break;
        default: ;
        }
        _id -= 4;
    }
    return _id;
}
int BaconDemo::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QFrame::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: scoreChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 1: levelChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 2: start(); break;
        case 3: pause(); break;
        case 4: showInstructions(); break;
        }
        _id -= 5;
    }
    return _id;
}
int MultBoard::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QFrame::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: scoreChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 1: levelChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 2: linesRemovedChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 3: start(); break;
        case 4: pause(); break;
        default: ;
        }
        _id -= 5;
    }
    return _id;
}
示例#6
0
void Engine::onLoadCompleted(bool success) {
    Q_ASSERT_X(success, "Level load", "File not of correct format");
    if (success) {
        Level* level = qobject_cast<Level*>(mLevelLoader->property("item").value<QObject*>());

        // This is a workaround for a Qt Loader race condition bug whereby sometimes the Loader will
        // create an incorrect level using data long since deleted from a previous load -- even
        // though the source has been correctly set to the new level data. So, for now, we must
        // check that this is indeed the level we intended to load, and, if not, try to load it
        // again (which will cause the one just incorrectly created to be deleted).
        // TODO: Find the root cause of this problem.
        QFileInfo levelFileInfo(Util::getPathToLevel(mInFlightLevelInfo->getFileName()));
        if (level->getFileName() != levelFileInfo.baseName()) {
            qDebug() << "Warning: Loader has incorrectly loaded" << level->getFileName()
                    << "instead of" <<  levelFileInfo.baseName();
            loadLevel(mInFlightLevelInfo);
            return;
        }
        level->setName(mInFlightLevelInfo->getName());

        mLevel = level;

        b2World* world = mLevel->getWorld();
        world->SetContactListener(mContactListener.get());
        world->SetDestructionListener(mDestructionListener.get());
        world->SetDebugDraw(mDebugDraw.get());

        invalidateSceneGraphObjectCaches();
        forEach<Logic>([] (Logic* logic) { logic->init(); });

        int activationThreshold = (level->getPortal())
                ? level->getPortal()->property("activationThreshold").toInt() : 0;

        emit levelChanged(level->getName(), level->getCompletionThreshold(), activationThreshold);

        // If this is a timed level, set up timers and start them rolling.
        mSoundManager->setBGMTrack(SoundManager::EnvironmentalPriority,
                Util::getPathToSound(mInFlightLevelInfo->getEnvironment()->getBGMTrack()));

        // Mark level load complete.
        mLevelReady = true;
    }
}
示例#7
0
void OGLViewer::simplifyMesh()
{
	/*if (simp_lv >= 4)
	{
		int ret = QMessageBox::warning(this, tr("Warning"),
			tr("Current mesh is smoothed more than level 4!\n"
			"Do you still want to smooth it?"),
			QMessageBox::Yes | QMessageBox::Cancel);
		if (ret == QMessageBox::Cancel)
		{
			return;
		}
	}*/
	/*subd_mesh->subdivide();
	subd_lv = subd_mesh->getLevel();
	subd_mesh->exportIndexedVBO(subd_lv, &box_verts, nullptr, nullptr, &box_idxs);*/

	emit levelChanged(simp_lv);
	update();
}
//! [4]
void TetrixBoard::start()
{
    if (isPaused)
        return;

    isStarted = true;
    isWaitingAfterLine = false;
    numLinesRemoved = 0;
    numPiecesDropped = 0;
    score = 0;
    level = 1;
    clearBoard();

    emit linesRemovedChanged(numLinesRemoved);
    emit scoreChanged(score);
    emit levelChanged(level);

    newPiece();
    timer.start(timeoutTime(), this);
}
示例#9
0
void GameEngine::loadLevel()
{
    deleteAllObjects();
    m_remainingBricks = 0;
    
    m_levelLoader->loadLevel( m_bricks );
    if (m_bricks.isEmpty()) {
        if (m_levelLoader->level() == 1) {
            // No level in the levelset
            qDebug() << "Invalid levelset " << m_levelLoader->levelset() << endl;
        } else {
            // No more levels: game won
            m_gameWon = true;
            qDebug() << m_score;
            addScore( GAME_WON_SCORE + m_lives.size() * LIFE_SCORE );
            qDebug() << m_lives.size() << m_score;
            showMessage( "Well done! You won the game" );
            emit gameEnded(m_score, -1, m_elapsedTime);
            deleteMovingObjects();
        }
    }
    
    m_balls.append(new Ball);
    moveBar(m_bar.center());
    m_bar.reset();
    updateAttachedBalls();
    
    m_gameTimer.setInterval(REPAINT_INTERVAL);
    m_speed = 1.8;
    m_repaintInterval = 1;
    m_levelInfo.setLevel(m_level);
    if (gameIsPaused()) {
        resume();
    }
    showMessage(QString("Level %1").arg(m_level));
    QTimer::singleShot(2000, this, SLOT(hideMessage()));
    
    emit levelChanged();
}
示例#10
0
/* When there is a timer event, this method automatically moves each Object, checks for collisions, and then calls the repaint() method */
void ZomZomAttack::timerEvent(QTimerEvent *event) {
	int px = player->getRect().x();
	int py = player->getRect().y();
	for (int i = 0; i < zomzom.size(); i++) zomzom[i]->autoMove(px, py);
	for (int i = 0; i < zBullets.size(); i++) {
		zBullets[i]->autoMove(px, py);
		if (zBullets[i]->isDone()) zBullets.erase(zBullets.begin() + i);
	}
	for (int i = 0; i < pBullets.size(); i++) {
		pBullets[i]->autoMove(px, py);
		if (pBullets[i]->isDone()) pBullets.erase(pBullets.begin() + i);
	}
	checkCollision();
	repaint();
	
	if (level == 1 && points > 500000) levelIncrease();
	if (level == 2 && points > 1250000) levelIncrease();
	if (level == 3 && points > 5000000) levelIncrease();
	emit scoreChanged(points);
	emit healthChanged(health);
	emit levelChanged(level);
}
//! [22]
void TetrixBoard::pieceDropped(int dropHeight)
{
    for (int i = 0; i < 4; ++i) {
        int x = curX + curPiece.x(i);
        int y = curY - curPiece.y(i);
        shapeAt(x, y) = curPiece.shape();
    }

    ++numPiecesDropped;
    if (numPiecesDropped % 25 == 0) {
        ++level;
        timer.start(timeoutTime(), this);
        emit levelChanged(level);
    }

    score += dropHeight + 7;
    emit scoreChanged(score);
    removeFullLines();

    if (!isWaitingAfterLine)
        newPiece();
//! [22] //! [23]
}
示例#12
0
void LevelModel::reset ()
{
    emit levelChanged(_levels.at(_currentLevel));
}
示例#13
0
TB_TeamBody::TB_TeamBody(QWidget *parent, TeamHolder *team, int gen, QAbstractItemModel *pokeModel) :
    m_dockAdvanced(0), m_team(team), gen(gen), pokeModel(pokeModel), upParent(parent)
{
    QHBoxLayout *hh = new QHBoxLayout(this);
    hh->setMargin(0);
    splitter = new QSplitter();
    hh->addWidget(splitter);
    splitter->setChildrenCollapsible(false);

    QSettings s;
    QStringList itemList = s.value("show_all_items").toBool() ? ItemInfo::SortedNames(gen) : ItemInfo::SortedUsefulNames(gen);
    itemsModel = new QStringListModel(itemList, this);

    QStringList natures;
    for (int i = 0; i < NatureInfo::NumberOfNatures(); i++) {
        natures.push_back(NatureInfo::Name(i));
    }
    natureModel = new QStringListModel(natures, this);

    QWidget *props = new QWidget();
    QVBoxLayout *ml = new QVBoxLayout(props);

    ml->setMargin(0);

    /* Pokemon buttons */
    QHBoxLayout *buttonsl = new QHBoxLayout;
    buttonsl->setSpacing(1);
    ml->addLayout(buttonsl);
    for (int i = 0; i < 6; i++) {
        const PokeTeam &poke = team->team().poke(i);
        buttonsl->addWidget(pokeButtons[i] = new TeamPokeButton(i,poke.num(),poke.level(), poke.item()));
    }

    /* Body! */
    body = new QStackedWidget();
    ml->addWidget(body);
    for (int i = 0; i < 6; i++) {
        pokeBody[i] = new TB_PokemonBody(&trainerTeam()->team().poke(i), i);
    }

    PokeBodyWidget *widget = new PokeBodyWidget(parent,gen,itemsModel,pokeModel, natureModel);
    pokeBody[0]->setWidget(widget);

    body->addWidget(widget);
    connect(widget, SIGNAL(advanceMenuOpen(bool)), SLOT(advancedClicked(bool)));

    pokeButtons[0]->setChecked(true);
    for(int i = 0; i < 6; i++) {
        connect(pokeButtons[i], SIGNAL(clicked()), SLOT(changeIndex()));
        connect(pokeButtons[i], SIGNAL(changePokemonBase(int,Pokemon::uniqueId)), SLOT(changePokemonBase(int,Pokemon::uniqueId)));
        connect(pokeButtons[i], SIGNAL(changePokemonOrder(QPair<int,int>)), SLOT(changePokemonOrder(QPair<int,int>)));
        connect(pokeBody[i], SIGNAL(pokeChanged(Pokemon::uniqueId)), SLOT(updateButton()));
        connect(pokeBody[i], SIGNAL(itemChanged(int)), SLOT(updateButton()));
        connect(pokeBody[i], SIGNAL(levelChanged()), SLOT(updateButton()));
        connect(pokeBody[i], SIGNAL(pokeChanged(Pokemon::uniqueId)),SLOT(indexNumChanged(Pokemon::uniqueId)));
    }

    splitter->addWidget(props);

    restoreAdvancedState();
}
示例#14
0
void OGLViewer::keyPressEvent(QKeyEvent *e)
{
	if (e->key() == Qt::Key_W)
	{
		view_cam->zoom(0.0, 0.0, 0.10);
		view_cam->exportVBO(view_mat, nullptr, nullptr);

	}
	else if (e->key() == Qt::Key_S)
	{
		view_cam->zoom(0.0, 0.0, -0.10);
		view_cam->exportVBO(view_mat, nullptr, nullptr);
	}
	else if (e->key() == Qt::Key_Q)
	{
		view_cam->zoom(0.10, 0.0, 0.0);
		view_cam->exportVBO(view_mat, nullptr, nullptr);
	}
	else if (e->key() == Qt::Key_A)
	{
		view_cam->zoom(-0.10, 0.0, 0.0);
		view_cam->exportVBO(view_mat, nullptr, nullptr);
	}
	else if (e->key() == Qt::Key_E)
	{
		view_cam->zoom(0.0, 0.10, 0.0);
		view_cam->exportVBO(view_mat, nullptr, nullptr);
	}
	else if (e->key() == Qt::Key_D)
	{
		view_cam->zoom(0.0, -0.10, 0.0);
		view_cam->exportVBO(view_mat, nullptr, nullptr);
	}
	else if (e->key() == Qt::Key_Home)
	{
		initParas();
	}
	// Subdiv
	else if (e->key() == Qt::Key_Plus)
	{
		simp_lv = min(++simp_lv, (int)simp_mesh->getLevel());
		simp_mesh->exportIndexedVBO(simp_lv, &box_verts, nullptr, nullptr, &box_idxs);

		emit levelChanged(simp_lv);
	}
	else if (e->key() == Qt::Key_Minus)
	{
		simp_lv = max(--simp_lv, 0);
		simp_mesh->exportIndexedVBO(simp_lv, &box_verts, nullptr, nullptr, &box_idxs);

		emit levelChanged(simp_lv);
	}
	else if (e->key() == Qt::Key_Left)
	{
		offset = max(--offset, 0);
	}
	else if (e->key() == Qt::Key_Right)
	{
		offset = min(++offset, (int)box_idxs.size() / 3 - 1);
	}
	else if (e->key() == Qt::Key_L)
	{
		showPiece = !showPiece;
	}
	else if (e->key() == Qt::Key_P)
	{
		drawPoint = !drawPoint;
	}
	else if (e->key() == Qt::Key_O)
	{
		drawWireFrame = !drawWireFrame;
	}
	// Selection mode switch
	else if (e->key() == Qt::Key_F8)
	{
		m_selectMode = OBJECT_SELECT;
	}
	else if (e->key() == Qt::Key_F11)
	{
		m_selectMode = FACE_COMPONENT_SELECT;
	}
	// Save frame buffer
	/*else if (e->key() == Qt::Key_P && e->modifiers() == Qt::ControlModifier)
	{
	this->saveFrameBuffer();
	}*/
	//////////////////////////////////////////////////////////////////////////
	else
	{
		QOpenGLWidget::keyPressEvent(e);
	}
	update();
}
示例#15
0
void Game::paintEvent(QPaintEvent *event)
{
	if(gameStarted)
	{
		///*** Setup Painter ***///
		QPainter painter(this);
		QBrush normal(painter.brush());
		QBrush manaBar(Qt::blue,Qt::SolidPattern);
		QBrush healthBar(Qt::green,Qt::SolidPattern);
		
		///*** Prevent painter from drawing if the game is over ***///
		if (gameOver) 
		{
			painter.end();
			QPainter painter(this);
		
			QFont font("Courier", 15, QFont::DemiBold);
			QFontMetrics fm(font);
			int textWidth = fm.width("Game Over!");
			int textWidth2 = fm.width("Press ESC to close window");

			painter.setFont(font);

			painter.translate(QPoint(400, 300));
			painter.drawText(-textWidth/2, 0, "Game Over!");
			painter.drawText(-textWidth2/2, 15, "Press ESC to close window");
			killTimer(timerId);
			std::cout << "BLAHBLAHBLAH\n";
		}
	
		///*** Draw Player ***///
		if(player->getType() == TANK)
		{
			if(player->getCanAttack())
				painter.drawImage(player->getLocation().x()-9,player->getLocation().y()-5,player->getAttackFrame());
			if(player->getAttacking())
				painter.drawImage(player->getLocation().x()-10,player->getLocation().y()-10,player->getManaAttackFrame());
		} else if(player->getType() == ASSN) {
			if(player->getCanAttack())
			{
				painter.drawImage(player->getLocation().x()-20,player->getLocation().y()-17,player->getAttackFrame());
			}
			if(player->bombSet)
				painter.drawImage(player->bomb->getLocation().x()-20,player->bomb->getLocation().y()-17,player->getManaAttackFrame());
		}
	
		///*** Draw Enemies ***///
		for(int i=0;i<drones.size();i++)
		{
			painter.setBrush(healthBar);
			painter.drawRect(drones.at(i)->getLocation().x()-15,drones.at(i)->getLocation().y()-20,drones.at(i)->getHealth(), 4);
			painter.setBrush(normal);
			painter.drawImage(drones.at(i)->getLocation().x()-15,drones.at(i)->getLocation().y()-15,drones.at(i)->getAttackFrame());
		}
		if(canSpawnArcher)
		{
			for(int i=0;i<archers.size();i++)
			{
				painter.setBrush(normal);
				painter.drawImage(archers.at(i)->getLocation().x()-15,archers.at(i)->getLocation().y()-15,archers.at(i)->getAttackFrame());
				if(archers.at(i)->getAttacking())
				{
					painter.setBrush(manaBar);
					painter.drawEllipse(archers.at(i)->bullet->getLocation().x(),archers.at(i)->bullet->getLocation().y(),10,10);

				}
			}
		}
	
		///*** Draw Status Bars ***///
		painter.setBrush(healthBar);
		painter.drawRect(5,5,player->getHealth(),10);
		painter.setBrush(normal);
		painter.drawRect(5,5,player->getMaxHealth(),10);
		painter.setBrush(manaBar);
		painter.drawRect(5,20,player->getMana(),10);
		painter.setBrush(normal);
		painter.drawRect(5,20,player->getMaxMana(),10);
	
		///*** Give player tips at appropriate levels ***///
		if (player->getXP() < 1) 
		{
			if(player->getType() == TANK)
			{	
				QFont font("Courier", 15, QFont::DemiBold);
				QFontMetrics fm(font);
				int textWidth = fm.width("Left Click to 'Enrage', then run into an enemy!");

				painter.setFont(font);

				painter.translate(QPoint(400, 300));
				painter.drawText(-textWidth/2, 0, "Left Click to 'Enrage', then run into an enemy!");
			}
			else if(player->getType() == ASSN)
			{	
				QFont font("Courier", 15, QFont::DemiBold);
				QFontMetrics fm(font);
				int textWidth = fm.width("Left Click to Slash enemies, but don't get too close!");

				painter.setFont(font);

				painter.translate(QPoint(400, 300));
				painter.drawText(-textWidth/2, 0, "Left Click to Slash enemies, but don't get too close!");
			}
		}
		if (player->getXP() == 5) 
		{
			QFont font("Courier", 15, QFont::DemiBold);
			QFontMetrics fm(font);
			int textWidth = fm.width("Level Up!\nRight Click for New Skill");

			painter.setFont(font);

			painter.translate(QPoint(400, 300));
			painter.drawText(-textWidth/2, 0, "Level Up! Right Click for New Skill");
			level=2;
			emit levelChanged(level);
			canSpawnArcher = true;
		}
		if (player->getXP() == 10)
		{
			QFont font("Courier", 15, QFont::DemiBold);
			QFontMetrics fm(font);
			int textWidth = fm.width("Level Up!");

			painter.setFont(font);

			painter.translate(QPoint(400, 300));
			painter.drawText(-textWidth/2, 0, "Level Up!");
			canSpawnArcher = true;
			level=3;
			emit levelChanged(level);
		}
	}
}
示例#16
0
/*!
  \internal

  Construct a new CellModemManager with the appropriate \a parent.  Only one
  instance of CellModemManager may be constructed.
 */
CellModemManager::CellModemManager(QObject *parent)
: QAbstractCallPolicyManager(parent), d(new CellModemManagerPrivate)
{
    Q_ASSERT(!cellModemManagerInstance);
    cellModemManagerInstance = true;

    d->m_status = new QValueSpaceObject("/Telephony/Status", this);
    d->m_status->setAttribute("ModemStatus", "Initializing");

    QValueSpaceItem *simToolkitAvailable;
    simToolkitAvailable = new QValueSpaceItem
            ("/Telephony/Status/SimToolkit/Available", this);
    connect(simToolkitAvailable, SIGNAL(contentsChanged()),
            this, SLOT(simToolkitAvailableChange()));

    // Check for modem
    QServiceChecker checker("modem");
    if(!checker.isValid()) {
        d->m_aerialOn = false;
        d->m_state = NoCellModem;
        updateStatus();
        return;
    }

    d->m_netReg = new QNetworkRegistration("modem", this);
    d->m_regState = d->m_netReg->registrationState();
    d->m_operator = d->m_netReg->currentOperatorName();

    QObject::connect(d->m_netReg, SIGNAL(registrationStateChanged()),
                     this, SLOT(registrationStateChanged()));
    QObject::connect(d->m_netReg, SIGNAL(currentOperatorChanged()),
                     this, SLOT(currentOperatorChanged()));

    // Rename signal for QAbstractCallPolicyManager.
    QObject::connect(this, SIGNAL(registrationStateChanged(QTelephony::RegistrationState)),
                     this, SIGNAL(registrationChanged(QTelephony::RegistrationState)));

    d->m_pinManager = new QPinManager("modem", this);
    QObject::connect(d->m_pinManager,
                     SIGNAL(pinStatus(QString,QPinManager::Status,QPinOptions)),
                     this,
                     SLOT(pinStatus(QString,QPinManager::Status,QPinOptions)) );

    d->m_rfFunc = new QPhoneRfFunctionality("modem", this);
    QObject::connect(d->m_rfFunc,
                     SIGNAL(levelChanged()), this, SLOT(rfLevelChanged()));

    d->m_callForwarding = new QCallForwarding("modem", this);
    QObject::connect(d->m_callForwarding,
                     SIGNAL(forwardingStatus(QCallForwarding::Reason,QList<QCallForwarding::Status>)),
                     this,
                     SLOT(forwardingStatus(QCallForwarding::Reason,QList<QCallForwarding::Status>)));

    QSimInfo *simInfo = new QSimInfo( "modem", this );
    connect( simInfo, SIGNAL(removed()), this, SLOT(simRemoved()) );
    connect( simInfo, SIGNAL(inserted()), this, SLOT(simInserted()) );

    if(::profilesControlModem) {
        d->m_profiles = new QPhoneProfileManager(this);
        d->m_aerialOn = !d->m_profiles->planeMode();
        QObject::connect(d->m_profiles, SIGNAL(planeModeChanged(bool)),
                         this, SLOT(planeModeChanged(bool)));
    }

    // If plane mode isn't an option, then we have to fully initialize the modem
    // each time
    if(!planeModeSupported())
        d->m_aerialOn = true;

    setAerialEnabled(d->m_aerialOn);
    updateStatus();

    doInitialize();
}
示例#17
0
VCSlider::VCSlider(QWidget* parent, Doc* doc) : VCWidget(parent, doc)
{
    /* Set the class name "VCSlider" as the object name as well */
    setObjectName(VCSlider::staticMetaObject.className());

    m_hbox = NULL;
    m_topLabel = NULL;
    m_slider = NULL;
    m_bottomLabel = NULL;

    m_valueDisplayStyle = ExactValue;

    m_levelLowLimit = 0;
    m_levelHighLimit = UCHAR_MAX;

    m_levelValue = 0;
    m_levelValueChanged = false;
    m_monitorEnabled = false;
    m_monitorValue = 0;

    m_playbackFunction = Function::invalidId();
    m_playbackValue = 0;
    m_playbackValueChanged = false;

    m_widgetMode = WSlider;

    setType(VCWidget::SliderWidget);
    setCaption(QString());
    setFrameStyle(KVCFrameStyleSunken);

    /* Main VBox */
    new QVBoxLayout(this);

    /* Top label */
    m_topLabel = new QLabel(this);
    m_topLabel->setAlignment(Qt::AlignHCenter);

    layout()->addWidget(m_topLabel);

    /* Slider's HBox |stretch|slider|stretch| */
    m_hbox = new QHBoxLayout();

    /* Put stretchable space before the slider (to its left side) */
    m_hbox->addStretch();

    /* The slider */
    m_slider = new ClickAndGoSlider(this);

    m_hbox->addWidget(m_slider);
    m_slider->setRange(0, 255);
    m_slider->setPageStep(1);
    m_slider->setInvertedAppearance(false);
    m_slider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
    m_slider->setMinimumWidth(32);
    m_slider->setMaximumWidth(80);
    m_slider->setStyleSheet(CNG_DEFAULT_STYLE);

    connect(m_slider, SIGNAL(valueChanged(int)),
            this, SLOT(slotSliderMoved(int)));
    m_externalMovement = false;

    /* Put stretchable space after the slider (to its right side) */
    m_hbox->addStretch();

    layout()->addItem(m_hbox);

    /* Click & Go button */
    m_cngType = ClickAndGoWidget::None;

    m_cngButton = new QToolButton(this);
    m_cngButton->setFixedSize(48, 48);
    m_cngButton->setIconSize(QSize(42, 42));
    m_menu = new QMenu(this);
    QWidgetAction* action = new QWidgetAction(this);
    m_cngWidget = new ClickAndGoWidget();
    action->setDefaultWidget(m_cngWidget);
    m_menu->addAction(action);
    m_cngButton->setMenu(m_menu);
    m_cngButton->setPopupMode(QToolButton::InstantPopup);
    layout()->addWidget(m_cngButton);
    layout()->setAlignment(m_cngButton, Qt::AlignHCenter);
    m_cngButton->hide();

    connect(m_cngWidget, SIGNAL(levelChanged(uchar)),
            this, SLOT(slotClickAndGoLevelChanged(uchar)));
    connect(m_cngWidget, SIGNAL(colorChanged(QRgb)),
            this, SLOT(slotClickAndGoColorChanged(QRgb)));
    connect(m_cngWidget, SIGNAL(levelAndPresetChanged(uchar,QImage)),
            this, SLOT(slotClickAndGoLevelAndPresetChanged(uchar, QImage)));
    connect(this, SIGNAL(monitorDMXValueChanged(int)),
            this, SLOT(slotMonitorDMXValueChanged(int)));

    /* Bottom label */
    m_bottomLabel = new QLabel(this);
    layout()->addWidget(m_bottomLabel);
    m_bottomLabel->setAlignment(Qt::AlignCenter);
    m_bottomLabel->setWordWrap(true);
    m_bottomLabel->hide();

    setMinimumSize(20, 20);
    QSettings settings;
    QVariant var = settings.value(SETTINGS_SLIDER_SIZE);
    if (var.isValid() == true)
        resize(var.toSize());
    else
        resize(VCSlider::defaultSize);

    /* Initialize to playback mode by default */
    setInvertedAppearance(false);
    m_sliderMode = SliderMode(-1); // avoid use of uninitialized value
    setSliderMode(Playback);

    /* Update the slider according to current mode */
    slotModeChanged(m_doc->mode());
    setLiveEdit(m_liveEdit);

    /* Listen to fixture removals so that LevelChannels can be removed when
       they no longer point to an existing fixture->channel */
    connect(m_doc, SIGNAL(fixtureRemoved(quint32)),
            this, SLOT(slotFixtureRemoved(quint32)));
}
void QPhoneRfFunctionalityDummy::forceLevelRequest()
{
    setValue( "level", qVariantFromValue( Full ) );
    emit levelChanged();
}
示例#19
0
void PlayerWidget::timerLevel_timeOut()
{
    vuMeter->setValueLeft(player->levelLeft());
    vuMeter->setValueRight(player->levelRight());
    Q_EMIT levelChanged(player->levelOutLeft(), player->levelOutRight());
}
示例#20
0
void ConsoleChannel::initMenu()
{
    Fixture* fxi = m_doc->fixture(fixture());
    Q_ASSERT(fxi != NULL);

    const QLCChannel* ch = fxi->channel(m_channel);
    Q_ASSERT(ch != NULL);

    // Get rid of a possible previous menu
    if (m_menu != NULL)
    {
        delete m_menu;
        m_menu = NULL;
    }

    // Create a popup menu and set the channel name as its title
    m_menu = new QMenu(this);
    m_presetButton->setMenu(m_menu);
    m_presetButton->setPopupMode(QToolButton::InstantPopup);

    QString btnIconStr = ch->getIconNameFromGroup(ch->group());
    if (btnIconStr.startsWith(":"))
        m_presetButton->setStyleSheet("QToolButton { border-image: url(" + btnIconStr + ") 0 0 0 0 stretch stretch; }");
    else
    {
        m_presetButton->setStyleSheet("QToolButton { background: " + btnIconStr + "; }");
        setIntensityButton(ch);
    }

    switch(ch->group())
    {
    case QLCChannel::Colour:
        m_cngWidget = new ClickAndGoWidget();
        m_cngWidget->setType(ClickAndGoWidget::Preset, ch);
        break;
    case QLCChannel::Effect:
        m_cngWidget = new ClickAndGoWidget();
        m_cngWidget->setType(ClickAndGoWidget::Preset, ch);
        break;
    case QLCChannel::Gobo:
        m_cngWidget = new ClickAndGoWidget();
        m_cngWidget->setType(ClickAndGoWidget::Preset, ch);
        break;
    default:
        break;
    }

    if (m_cngWidget != NULL)
    {
        QWidgetAction* action = new QWidgetAction(this);
        action->setDefaultWidget(m_cngWidget);
        m_menu->addAction(action);
        connect(m_cngWidget, SIGNAL(levelChanged(uchar)),
                this, SLOT(slotClickAndGoLevelChanged(uchar)));
        connect(m_cngWidget, SIGNAL(levelAndPresetChanged(uchar,QImage)),
                this, SLOT(slotClickAndGoLevelAndPresetChanged(uchar, QImage)));
    }
    else
    {
        QAction* action = m_menu->addAction(m_presetButton->icon(), ch->name());
        m_menu->setTitle(ch->name());
        action->setEnabled(false);
        m_menu->addSeparator();

        // Initialize the preset menu only for intelligent fixtures
        if (fxi->isDimmer() == false)
            initCapabilityMenu(ch);
    }
}
示例#21
0
void PstnRfFunctionality::forceLevelRequest()
{
    // The only functionality level we support is "full".
    setValue( "level", qVariantFromValue( Full ) );
    emit levelChanged();
}
示例#22
0
void ODSSubRoom::setLevel(int level) {
	if (level != mLevel) {
		mLevel = level;
		emit levelChanged(level);
	}
}