void CameraView::initCam(QSharedPointer<AbstractCamera> camera)
{
    if(camera_) {
        reset();
    }
    camera_ = camera;
    updateName(camera_->userDefinedName());
    viewStack_->addWidget(camera_->cameraStream());
    connect(camera_.data(), &AbstractCamera::imageSaved, [=] (QString filename) {
        updateRecordingStatus(QString("Image saved to: ") + filename);
    } );
    connect(camera_.data(), &AbstractCamera::recordingStarted, [=] (QString filename) {
        updateRecordingStatus(QString("Recording started - ") + filename);
    } );
    connect(camera_.data(), &AbstractCamera::recordingSaved, [=] (QString filename) {
        updateRecordingStatus(QString("Recording saved to: ") + filename);
    } );

    connect(camera_.data(), &AbstractCamera::statusChanged, this, &CameraView::updateStreamStatus);
    connect(camera_.data(), &AbstractCamera::cameraError, this, &CameraView::updateStreamStatus);
    connect(camera_.data(), &AbstractCamera::recordingError, this, &CameraView::updateStreamStatus);

    connect(camera_.data(), &AbstractCamera::userDefinedNameChanged, [=] {
        updateName(camera_->userDefinedName());
    } );
}
QHBoxLayout * LayoutAliasEditDialog::drawAlias(Alias * currentAlias) {

    QHBoxLayout * aliasLayout = new QHBoxLayout;

    QLineEdit * aliasName = new QLineEdit(currentAlias->name);
    aliasName->setProperty("ptr", qVariantFromValue((void *) currentAlias));
    QObject::connect(aliasName, SIGNAL(editingFinished()), this, SLOT(updateName()));
    aliasLayout->addWidget(aliasName, 1);

    QLineEdit * aliasMaths = new QLineEdit(currentAlias->maths->equation);
    aliasMaths->setProperty("ptr", qVariantFromValue((void *) currentAlias));
    QObject::connect(aliasMaths, SIGNAL(editingFinished()), this, SLOT(updateMaths()));
    aliasLayout->addWidget(aliasMaths, 3);

    QPushButton * aliasDelete = new QPushButton;
    aliasDelete->setIcon(QIcon(":/icons/toolbar/delShad.png"));
    aliasDelete->setProperty("ptr", qVariantFromValue((void *) currentAlias));
    aliasDelete->setProperty("layout", qVariantFromValue((void *) aliasLayout));
    aliasDelete->setFlat(true);
    aliasDelete->setMaximumWidth(28);
    aliasDelete->setMaximumHeight(28);
    aliasDelete->setFocusPolicy(Qt::NoFocus);
    QObject::connect(aliasDelete, SIGNAL(clicked()), this, SLOT(deleteAlias()));
    aliasLayout->addWidget(aliasDelete);

    return aliasLayout;

}
Exemple #3
0
void KDockSplitter::activate(QWidget *c0, QWidget *c1)
{
    if(c0)
        child0 = c0;
    if(c1)
        child1 = c1;

    setupMinMaxSize();

    if(divider)
        delete divider;
    divider = new QFrame(this, "pannerdivider");
    divider->setFrameStyle(QFrame::Panel | QFrame::Raised);
    divider->setLineWidth(1);
    divider->raise();

    if(m_orientation == Horizontal)
        divider->setCursor(QCursor(sizeVerCursor));
    else
        divider->setCursor(QCursor(sizeHorCursor));
    divider->installEventFilter(this);

    initialised = true;

    updateName();
    divider->show();

    // without this resize event, things will not work. why exactly? :(
    resizeEvent(0);


    KDockWidget *dw0 = (KDockWidget *)child0;
    KDockWidget *dw1 = (KDockWidget *)child1;

    // if fixed size is set, restore first, to restore xpos correctly
    if(fixedWidth0 != -1 || fixedHeight0 != -1)
        restoreFromForcedFixedSize(dw0);
    if(fixedWidth1 != -1 || fixedHeight1 != -1)
        restoreFromForcedFixedSize(dw1);


    // now force fixed sizes, if they are set.
    if(dw0->forcedFixedWidth() != -1)
    {
        setForcedFixedWidth(dw0, dw0->forcedFixedWidth());
    }
    else if(dw1->forcedFixedWidth() != -1)
    {
        setForcedFixedWidth(dw1, dw1->forcedFixedWidth());
    }

    if(dw0->forcedFixedHeight() != -1)
    {
        setForcedFixedHeight(dw0, dw0->forcedFixedHeight());
    }
    else if(dw1->forcedFixedHeight() != -1)
    {
        setForcedFixedHeight(dw1, dw1->forcedFixedHeight());
    }
}
bool RObject::updateStructure (RData *new_data) {
	RK_TRACE (OBJECTS);
	if (new_data->getDataLength () == 0) { // can happen, if the object no longer exists
		return false;
	}

	RK_ASSERT (new_data->getDataLength () >= 5);
	RK_ASSERT (new_data->getDataType () == RData::StructureVector);

	if (!canAccommodateStructure (new_data)) return false;

	bool properties_change = false;

	properties_change = updateName (new_data->getStructureVector ()[0]);
	properties_change = updateType (new_data->getStructureVector ()[1]);
	properties_change = updateClasses (new_data->getStructureVector ()[2]);
	properties_change = updateMeta (new_data->getStructureVector ()[3]);
	properties_change = updateDimensions (new_data->getStructureVector ()[4]);

	if (properties_change) RKGlobals::tracker ()->objectMetaChanged (this);
	if (type & NeedDataUpdate) updateDataFromR (0);
	if (isPending ()) type -= Pending;

	return true;
}
Exemple #5
0
void Client::updateState(xcb_ewmh_connection_t* ewmhConn)
{
    xcb_connection_t* conn = ewmhConn->connection;
    xcb_get_geometry_cookie_t geomCookie;
    if (!mOwned)
        geomCookie = xcb_get_geometry_unchecked(conn, mWindow);
    const xcb_get_property_cookie_t normalHintsCookie = xcb_icccm_get_wm_normal_hints(conn, mWindow);
    const xcb_get_property_cookie_t leaderCookie = xcb_get_property(conn, 0, mWindow, Atoms::WM_CLIENT_LEADER, XCB_ATOM_WINDOW, 0, 1);
    const xcb_get_property_cookie_t transientCookie = xcb_icccm_get_wm_transient_for(conn, mWindow);
    const xcb_get_property_cookie_t hintsCookie = xcb_icccm_get_wm_hints(conn, mWindow);
    const xcb_get_property_cookie_t classCookie = xcb_icccm_get_wm_class(conn, mWindow);
    const xcb_get_property_cookie_t nameCookie = xcb_icccm_get_wm_name(conn, mWindow);
    const xcb_get_property_cookie_t protocolsCookie = xcb_icccm_get_wm_protocols(conn, mWindow, Atoms::WM_PROTOCOLS);
    const xcb_get_property_cookie_t strutCookie = xcb_ewmh_get_wm_strut(ewmhConn, mWindow);
    const xcb_get_property_cookie_t partialStrutCookie = xcb_ewmh_get_wm_strut_partial(ewmhConn, mWindow);
    const xcb_get_property_cookie_t stateCookie = xcb_ewmh_get_wm_state(ewmhConn, mWindow);
    const xcb_get_property_cookie_t typeCookie = xcb_ewmh_get_wm_window_type(ewmhConn, mWindow);
    const xcb_get_property_cookie_t pidCookie = xcb_ewmh_get_wm_pid(ewmhConn, mWindow);

    if (!mOwned)
        updateSize(conn, geomCookie);
    updateNormalHints(conn, normalHintsCookie);
    updateLeader(conn, leaderCookie);
    updateTransient(conn, transientCookie);
    updateHints(conn, hintsCookie);
    updateClass(conn, classCookie);
    updateName(conn, nameCookie);
    updateProtocols(conn, protocolsCookie);
    updateStrut(ewmhConn, strutCookie);
    updatePartialStrut(ewmhConn, partialStrutCookie);
    updateEwmhState(ewmhConn, stateCookie);
    updateWindowTypes(ewmhConn, typeCookie);
    updatePid(ewmhConn, pidCookie);
}
void KDockSplitter::activate(QWidget *c0, QWidget *c1)
{
  if ( c0 ) child0 = c0;
  if ( c1 ) child1 = c1;

  setupMinMaxSize();

  if (divider) delete divider;
  divider = new QFrame(this, "pannerdivider");
  divider->setFrameStyle(QFrame::Panel | QFrame::Raised);
  divider->setLineWidth(1);
  divider->raise();

  if (orientation == Horizontal)
    divider->setCursor(QCursor(sizeVerCursor));
  else
    divider->setCursor(QCursor(sizeHorCursor));

  divider->installEventFilter(this);

  initialised= true;

  updateName();

  divider->show();
  resizeEvent(0);
}
void Device::ClearLog(void)
{
    m_log.clear();
    m_bit_details_model.bits.clear();
    m_bit_details_model.desc.clear();
    m_dev_reads_nb = 0;
    m_dev_writes_nb = 0;
    m_dev_irqs_nb = 0;
    m_dev_errs_nb = 0;
    m_background = QBrush();
    m_stats_changed = false;
    m_irq_act = false;
    m_writes_stat_dirty = false;
    m_reads_stat_dirty = false;
    m_irqs_stat_dirty = false;
    m_errs_stat_dirty = false;

    emit layoutChanged();
    m_bit_details_model.signalUpdate();
    updateName();
    blink_reset();

    m_record_dev = NULL;

    while (childCount()) {
        QTreeWidgetItem *item = child( childCount() - 1);
        Device *dev = static_cast<Device*>(item);
        removeChild(item);
        delete dev;
    }
}
void PackagePropertiesDialog::onDataChanged(TransferItem *package, int role) {
    switch (role) {
    case TransferItem::CategoryRole:
        updateCategory(package);
        break;
    case TransferItem::CreateSubfolderRole:
        updateCreateSubfolder(package);
        break;
    case TransferItem::NameRole:
        updateName(package);
        break;
    case TransferItem::PriorityRole:
        updatePriority(package);
        break;
    case TransferItem::ProgressRole:
    case TransferItem::RowCountRole:
        updateProgress(package);
        break;
    case TransferItem::StatusRole:
        updateStatus(package);
        break;
    default:
        break;
    }
}
Exemple #9
0
Player::Player(IGameDef *gamedef):
	touching_ground(false),
	in_water(false),
	liquid_viscosity(0),
	is_climbing(false),
	swimming_up(false),
	camera_barely_in_ceiling(false),
	inventory(gamedef->idef()),
	hp(PLAYER_MAX_HP),
	peer_id(PEER_ID_INEXISTENT),
// protected
	m_gamedef(gamedef),
	m_pitch(0),
	m_yaw(0),
	m_speed(0,0,0),
	m_position(0,0,0)
{
	updateName("<not set>");
	inventory.clear();
	inventory.addList("main", PLAYER_INVENTORY_SIZE);
	InventoryList *craft = inventory.addList("craft", 9);
	craft->setWidth(3);
	inventory.addList("craftpreview", 1);
	inventory.addList("craftresult", 1);

	// Can be redefined via Lua
	inventory_formspec =  "size[8,7.5]"
		//"image[1,0.6;1,2;player.png]"
		"list[current_player;main;0,3.5;8,4;]"
		"list[current_player;craft;3,0;3,3;]"
		"list[current_player;craftpreview;7,1;1,1;]";
}
//======================================================================
void HeaderComponent::setCurrentProject (Project* p) noexcept
{
    project = p;

    exportersTree = project->getExporters();
    exportersTree.addListener (this);
    updateExporters();

    project->addChangeListener (this);
    updateName();

    isBuilding = false;
    stopTimer();
    repaint();

    childProcess = ProjucerApplication::getApp().childProcessCache->getExisting (*project);
    if (childProcess != nullptr)
    {
        childProcess->activityList.addChangeListener (this);
        childProcess->errorList.addChangeListener (this);
    }

    if (childProcess != nullptr)
    {
        runAppButton->setTooltip ({});
        runAppButton->setEnabled (true);
    }
    else
    {
        runAppButton->setTooltip ("Enable live-build engine to launch application");
        runAppButton->setEnabled (false);
    }
}
Exemple #11
0
bool cc2DLabel::addPoint(ccGenericPointCloud* cloud, unsigned pointIndex)
{
	assert(cloud && cloud->size()>pointIndex);

	if (m_points.size() == 3)
		return false;

	try
	{
		m_points.resize(m_points.size()+1);
	}
	catch (const std::bad_alloc&)
	{
		//not enough memory
		return false;
	}

	m_points.back().cloud = cloud;
	m_points.back().index = pointIndex;

	updateName();

	//we want to be notified whenever an associated cloud is deleted (in which case
	//we'll automatically clear the label)
	cloud->addDependency(this,DP_NOTIFY_OTHER_ON_DELETE);
	//we must also warn the cloud whenever we delete this label
	//addDependency(cloud,DP_NOTIFY_OTHER_ON_DELETE); //DGM: automatically done by the previous call to addDependency!

	return true;
}
bool GameStateHandler::execute( GameNet::Box * box )
{
    auto message = box->getData();
    state = GameState();
    state.ParseFromString(message);
    
    CCLOG("Game state change:");
    CCLOG("===========");
    CCLOG("%s", state.DebugString().c_str());
    
    if( state.has_name() )
    {
        updateName();
    }
    
    if( state.has_pitchsize() )
    {
        updateSize();
    }
    
    if( state.has_duration() )
    {
        updateDuration();
    }
    
    if( state.has_state() )
    {
        updateMatchState();
    }
    
    return false;
}
Exemple #13
0
Player::Player(IGameDef *gamedef):
	touching_ground(false),
	in_liquid(false),
	in_liquid_stable(false),
	liquid_viscosity(0),
	is_climbing(false),
	swimming_vertical(false),
	camera_barely_in_ceiling(false),
	inventory(gamedef->idef()),
	hp(PLAYER_MAX_HP),
	breath(-1),
	peer_id(PEER_ID_INEXISTENT),
// protected
	m_gamedef(gamedef),
	m_pitch(0),
	m_yaw(0),
	m_speed(0,0,0),
	m_position(0,0,0),
	m_collisionbox(-BS*0.30,0.0,-BS*0.30,BS*0.30,BS*1.55,BS*0.30)
{
	updateName("<not set>");
	inventory.clear();
	inventory.addList("main", PLAYER_INVENTORY_SIZE);
	InventoryList *craft = inventory.addList("craft", 9);
	craft->setWidth(3);
	inventory.addList("craftpreview", 1);
	inventory.addList("craftresult", 1);

	// Can be redefined via Lua
	inventory_formspec = "size[8,7.5]"
		//"image[1,0.6;1,2;player.png]"
		"list[current_player;main;0,3.5;8,4;]"
		"list[current_player;craft;3,0;3,3;]"
		"list[current_player;craftpreview;7,1;1,1;]";

	// Initialize movement settings at default values, so movement can work if the server fails to send them
	movement_acceleration_default   = 3    * BS;
	movement_acceleration_air       = 2    * BS;
	movement_acceleration_fast      = 10   * BS;
	movement_speed_walk             = 4    * BS;
	movement_speed_crouch           = 1.35 * BS;
	movement_speed_fast             = 20   * BS;
	movement_speed_climb            = 2    * BS;
	movement_speed_jump             = 6.5  * BS;
	movement_liquid_fluidity        = 1    * BS;
	movement_liquid_fluidity_smooth = 0.5  * BS;
	movement_liquid_sink            = 10   * BS;
	movement_gravity                = 9.81 * BS;

	// Movement overrides are multipliers and must be 1 by default
	physics_override_speed   = 1;
	physics_override_jump    = 1;
	physics_override_gravity = 1;

	hud_flags = HUD_FLAG_HOTBAR_VISIBLE | HUD_FLAG_HEALTHBAR_VISIBLE |
			 HUD_FLAG_CROSSHAIR_VISIBLE | HUD_FLAG_WIELDITEM_VISIBLE |
			 HUD_FLAG_BREATHBAR_VISIBLE;

	hud_hotbar_itemcount = HUD_HOTBAR_ITEMCOUNT_DEFAULT;
}
Exemple #14
0
ObjectTextItem::ObjectTextItem(GraphElement *item, Object *object)
    : GraphElement(item, object)
    , object_(object)
{
    // Text //
    //
    textHandle_ = new TextHandle(object_->getName(), this);
    textHandle_->setBrush(QBrush(ODD::instance()->colors()->brightGrey()));
    textHandle_->setPen(QPen(ODD::instance()->colors()->darkGrey()));
    textHandle_->setFlag(QGraphicsItem::ItemIgnoresParentOpacity, false); // use highlighting of the road
    //	textHandle_->setFlag(QGraphicsItem::ItemIsSelectable, true);
    //	connect(textHandle_, SIGNAL(requestPositionChange(QPointF)), this, SLOT(handlePositionChange(QPointF)));
    //	connect(textHandle_, SIGNAL(selectionChanged(bool)), this, SLOT(handleSelectionChange(bool)));

    // Flags //
    //
    //	setSelectable();
    //	setFlag(QGraphicsItem::ItemSendsScenePositionChanges, true);
    setFlag(QGraphicsItem::ItemIgnoresParentOpacity, false); // use highlighting of the road

    // Path //
    //
    updatePosition();
	updateName();

    // Hide the text item on creation and show it only on mouse hover of the parent //
    //
    setVisible(false);
}
Exemple #15
0
void User::setName(QString name) {

    if(myName != name) {
        myName = name;
        updateName(name);
        emit nameChanged();
    }
}
void StaffBaseUnitPrivate::setDivisionName(const QString &divisionName)
{
    if( m_nameDivision != divisionName && !divisionName.isEmpty() )
    {
        m_nameDivision = staff_private::formatNameRight(divisionName);
        updateName();
    }
}
Exemple #17
0
void MidiController::loadSettings( const QDomElement & _this )
{
	Controller::loadSettings( _this );

	m_midiPort.loadSettings( _this );

	updateName();
}
void LLConversationItemSession::addParticipant(LLConversationItemParticipant* participant)
{
	addChild(participant);
	mIsLoaded = true;
	mNeedsRefresh = true;
	updateName(participant);
	postEvent("add_participant", this, participant);
}
Exemple #19
0
void SampleTrackWindow::modelChanged()
{
	m_track = castModel<SampleTrack>();

	m_nameLineEdit->setText(m_track->name());

	m_track->disconnect(SIGNAL(nameChanged()), this);

	connect(m_track, SIGNAL(nameChanged()),
			this, SLOT(updateName()));

	m_volumeKnob->setModel(&m_track->m_volumeModel);
	m_panningKnob->setModel(&m_track->m_panningModel);
	m_effectChannelNumber->setModel(&m_track->m_effectChannelModel);

	updateName();
}
bool ColumnEditorModel::setData(QModelIndex const &oIndex, QVariant const &oValue, int nRole)
{
	if(!oIndex.isValid())
		return QStandardItemModel::setData(oIndex, oValue, nRole);

	StdString s = oValue.value<StdString>();
	bool rc;
	bool update = true;

	int n = rowCount()-1;
	int ir = oIndex.row();
	int ic = oIndex.column();
	if(ir == n)
	{
		// Add new empty line at the end if the last item has got some text
		if(ic == COL_NAME && s.size() > 0)
		{
			updateName(n, s);
			insertRow(n+1);
		}
	}
	else
	{
		if(ic == COL_NAME)
		{
			if(s.size() == 0)
			{
				n = oIndex.row();
				deleteRow(n);
				update = false;
			}
			else
				updateName(ir, s);
		}
		else
			updateType(ir, s);
	}

	if(update)
		rc = QStandardItemModel::setData(oIndex, oValue, nRole);
	else
		rc = false;

	return rc;
}
Exemple #21
0
    UnixFileSystem::UnixFileSystem(bool ro, string charset, dev_t dev,string mountpoint,string fstype,string devicefile):BasicFsFileSystem(
						ro,charset,dev,mountpoint,fstype,devicefile
						) {
	updateTypeName("UnixFileSystem");
        updateName("unixfilesystem");
	ocfaLog(LOG_INFO,"Being constructed");
        misc::MetaValue *sv2=new misc::ScalarMetaValue(Scalar("unix"));
	addMetaValue(string("fs-type"),&sv2);
    }
void InstrumentTrackWindow::modelChanged()
{
	m_track = castModel<InstrumentTrack>();

	m_nameLineEdit->setText( m_track->name() );

	m_track->disconnect( SIGNAL( nameChanged() ), this );
	m_track->disconnect( SIGNAL( instrumentChanged() ), this );

	connect( m_track, SIGNAL( nameChanged() ),
			this, SLOT( updateName() ) );
	connect( m_track, SIGNAL( instrumentChanged() ),
			this, SLOT( updateInstrumentView() ) );

	m_volumeKnob->setModel( &m_track->m_volumeModel );
	m_panningKnob->setModel( &m_track->m_panningModel );
	m_effectChannelNumber->setModel( &m_track->m_effectChannelModel );
	m_pianoView->setModel( &m_track->m_piano );

	if( m_track->instrument() && m_track->instrument()->flags().testFlag( Instrument::IsNotBendable ) == false )
	{
		m_pitchKnob->setModel( &m_track->m_pitchModel );
		m_pitchRangeSpinBox->setModel( &m_track->m_pitchRangeModel );
		m_pitchKnob->show();
		m_pitchLabel->show();
		m_pitchRangeSpinBox->show();
		m_pitchRangeLabel->show();
	}
	else
	{
		m_pitchKnob->hide();
		m_pitchLabel->hide();
		m_pitchKnob->setModel( NULL );
		m_pitchRangeSpinBox->hide();
		m_pitchRangeLabel->hide();
	}

	m_ssView->setModel( &m_track->m_soundShaping );
	m_noteStackingView->setModel( &m_track->m_noteStacking );
	m_arpeggioView->setModel( &m_track->m_arpeggio );
	m_midiView->setModel( &m_track->m_midiPort );
	m_effectView->setModel( m_track->m_audioPort.effects() );
	updateName();
}
void Device::update_dev_stats(void)
{
    const log_entry entry = m_log.read_last();
    static const QBrush bcolor_irq_on = QBrush ( QColor(255, 192, 255) );
    static const QBrush bcolor_irq_off = QBrush ( QColor(192, 255, 255) );
    static const QBrush bcolor_err = QBrush ( Qt::red );
    static const QBrush bcolor_read = QBrush ( Qt::green );
    static const QBrush bcolor_wr_new_value = QBrush ( QColor(0xf4, 0xa7, 0) );
    static const QBrush bcolor_wr_no_upd = QBrush ( QColor(255, 255, 150) );

    if (m_is_host1x_item) {
        updateName();

        if (entry.is_irq) {
            if (entry.value) {
                m_background = bcolor_irq_on;
                setBackground( 0, bcolor_irq_on );
                goto LOG_FLUSH;
            } else {
                setBackground( 0, bcolor_irq_off );
            }
        } else if (entry.is_error)
            setBackground( 0, bcolor_err );
        else if (!entry.is_write)
            setBackground( 0, bcolor_read );
        else if (entry.value != entry.new_value)
            setBackground( 0, bcolor_wr_new_value );
        else
            setBackground( 0, bcolor_wr_no_upd );

        m_background = QBrush ( Qt::lightGray );
    } else {
        if (m_irqs_stat_dirty) {
            emit irqStatUpdated(this->id);
            m_irqs_stat_dirty = false;
        }

        if (m_errs_stat_dirty) {
            emit errorStatUpdated(this->id);
            m_errs_stat_dirty = false;
        }

        if (m_reads_stat_dirty) {
            emit readStatUpdated(this->id);
            m_reads_stat_dirty = false;
        }

        if (m_writes_stat_dirty) {
            emit writeStatUpdated(this->id);
            m_writes_stat_dirty = false;
        }
    }

LOG_FLUSH:
    m_log.flush();
}
Exemple #24
0
void DuctScreen::parm_changed( Parm* parm )
{
	if ( parm )
	{
		if ( parm->get_update_grp() == AF_UPDATE_GROUP )
		{
			updateName();
			glWin->redraw();
		}
	}
}
Exemple #25
0
void Player::deSerialize(std::istream &is, std::string playername)
{
	Settings args;
	
	for(;;)
	{
		if(is.eof())
			throw SerializationError
					(("Player::deSerialize(): PlayerArgsEnd of player \"" + playername + "\" not found").c_str());
		std::string line;
		std::getline(is, line);
		std::string trimmedline = trim(line);
		if(trimmedline == "PlayerArgsEnd")
			break;
		args.parseConfigLine(line);
	}

	//args.getS32("version"); // Version field value not used
	std::string name = args.get("name");
	updateName(name.c_str());
	setPitch(args.getFloat("pitch"));
	setYaw(args.getFloat("yaw"));
	setPosition(args.getV3F("position"));
	try{
		hp = args.getS32("hp");
	}catch(SettingNotFoundException &e){
		hp = 20;
	}
	try{
		m_breath = args.getS32("breath");
	}catch(SettingNotFoundException &e){
		m_breath = 11;
	}

	inventory.deSerialize(is);

	if(inventory.getList("craftpreview") == NULL)
	{
		// Convert players without craftpreview
		inventory.addList("craftpreview", 1);

		bool craftresult_is_preview = true;
		if(args.exists("craftresult_is_preview"))
			craftresult_is_preview = args.getBool("craftresult_is_preview");
		if(craftresult_is_preview)
		{
			// Clear craftresult
			inventory.getList("craftresult")->changeItem(0, ItemStack());
		}
	}

	// Set m_last_*
	checkModified();
}
Exemple #26
0
void Player::deSerialize(std::istream &is)
{
	Settings args;
	
	for(;;)
	{
		if(is.eof())
			throw SerializationError
					("Player::deSerialize(): PlayerArgsEnd not found");
		std::string line;
		std::getline(is, line);
		std::string trimmedline = trim(line);
		if(trimmedline == "PlayerArgsEnd")
			break;
		args.parseConfigLine(line);
	}

	//args.getS32("version");
	std::string name = args.get("name");
	updateName(name.c_str());
	/*std::string password = "";
	if(args.exists("password"))
		password = args.get("password");
	updatePassword(password.c_str());*/
	m_pitch = args.getFloat("pitch");
	m_yaw = args.getFloat("yaw");
	m_position = args.getV3F("position");
	try{
		craftresult_is_preview = args.getBool("craftresult_is_preview");
	}catch(SettingNotFoundException &e){
		craftresult_is_preview = true;
	}
	try{
		hp = args.getS32("hp");
	}catch(SettingNotFoundException &e){
		hp = 20;
	}
	/*try{
		std::string sprivs = args.get("privs");
		if(sprivs == "all")
		{
			privs = PRIV_ALL;
		}
		else
		{
			std::istringstream ss(sprivs);
			ss>>privs;
		}
	}catch(SettingNotFoundException &e){
		privs = PRIV_DEFAULT;
	}*/

	inventory.deSerialize(is);
}
PackagePropertiesDialog::PackagePropertiesDialog(TransferItem *package, QWidget *parent) :
    QDialog(parent),
    m_package(package),
    m_categoryModel(new CategorySelectionModel(this)),
    m_priorityModel(new TransferItemPriorityModel(this)),
    m_scrollArea(new QScrollArea(this)),
    m_container(new QWidget(m_scrollArea)),
    m_nameLabel(new QLabel(m_container)),
    m_statusLabel(new QLabel(m_container)),
    m_subfolderCheckBox(new QCheckBox(tr("Create subfolder"), m_container)),
    m_categorySelector(new ValueSelector(tr("Category"), m_container)),
    m_prioritySelector(new ValueSelector(tr("Priority"), m_container)),
    m_progressBar(new QProgressBar(m_container)),
    m_vbox(new QVBoxLayout(m_container)),
    m_layout(new QHBoxLayout(this))
{
    setWindowTitle(tr("Package properties"));
    setMinimumHeight(360);

    m_scrollArea->setWidget(m_container);
    m_scrollArea->setWidgetResizable(true);

    m_nameLabel->setWordWrap(true);

    m_statusLabel->setWordWrap(true);

    m_categorySelector->setModel(m_categoryModel);
    
    m_prioritySelector->setModel(m_priorityModel);

    m_progressBar->setRange(0, 100);

    updateCategory(package);
    updateCreateSubfolder(package);
    updateName(package);
    updatePriority(package);
    updateProgress(package);
    updateStatus(package);

    m_vbox->addWidget(m_nameLabel);
    m_vbox->addWidget(m_subfolderCheckBox);
    m_vbox->addWidget(m_categorySelector);
    m_vbox->addWidget(m_prioritySelector);
    m_vbox->addWidget(m_progressBar);
    m_vbox->addWidget(m_statusLabel);
    m_vbox->setContentsMargins(0, 0, 0, 0);

    m_layout->addWidget(m_scrollArea);

    connect(package, SIGNAL(dataChanged(TransferItem*, int)), this, SLOT(onDataChanged(TransferItem*, int)));
    connect(m_subfolderCheckBox, SIGNAL(clicked(bool)), this, SLOT(setCreateSubfolder(bool)));
    connect(m_categorySelector, SIGNAL(valueChanged(QVariant)), this, SLOT(setCategory(QVariant)));
    connect(m_prioritySelector, SIGNAL(valueChanged(QVariant)), this, SLOT(setPriority(QVariant)));
}
Exemple #28
0
MidiController::MidiController( Model * _parent ) :
	Controller( Controller::MidiController, _parent, tr( "MIDI Controller" ) ),
	MidiEventProcessor(),
	m_midiPort( tr( "unnamed_midi_controller" ),
			engine::mixer()->midiClient(), this, this, MidiPort::Input ),
	m_lastValue( 0.0f )
{
	setSampleExact( true );
	connect( &m_midiPort, SIGNAL( modeChanged() ),
			this, SLOT( updateName() ) );
}
void KeyframeItem::init(int row) {
  connect(txtName, SIGNAL(textChanged()), this, SLOT(updateName()));
  connect(spnFrames, SIGNAL(valueChanged(int)), this, SLOT(updateFrames(int)));
  connect(btnUp, SIGNAL(clicked()), this, SLOT(moveUp()));
  connect(btnDown, SIGNAL(clicked()), this, SLOT(moveDown()));
  updateKeyframe(keyframe_);
  
  list_ = static_cast<QListWidget*>(parent());
  item_ = createParentItem(row);
  
  deactivate();
}
Exemple #30
0
void CalibrateFlossDlg::on_ResetColor_clicked()
{
    m_sampleColor = m_item->data(Qt::DecorationRole).value<QColor>();

    if (m_calibratedColors[m_schemeName].contains(m_item->data(Qt::UserRole).toString())) {
        m_calibratedColors[m_schemeName].remove(m_item->data(Qt::UserRole).toString());
    }

    updateSample();
    updateName(false);
    m_item->setData(Qt::CheckStateRole, Qt::Unchecked);
}