Exemplo n.º 1
0
void MpcImportWindow::createDialogContent()
{
	ui->setupUi(dialog);

	//Signals
	connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
	connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
	connect(ui->TitleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint)));

	connect(ui->pushButtonAcquire, SIGNAL(clicked()),
	        this, SLOT(acquireObjectData()));
	connect(ui->pushButtonAbortDownload, SIGNAL(clicked()),
	        this, SLOT(abortDownload()));
	connect(ui->pushButtonAdd, SIGNAL(clicked()), this, SLOT(addObjects()));
	connect(ui->pushButtonDiscard, SIGNAL(clicked()),
	        this, SLOT(discardObjects()));

	connect(ui->pushButtonBrowse, SIGNAL(clicked()), this, SLOT(selectFile()));
	connect(ui->comboBoxBookmarks, SIGNAL(currentIndexChanged(QString)),
	        this, SLOT(bookmarkSelected(QString)));

	connect(ui->radioButtonFile, SIGNAL(toggled(bool)),
	        ui->frameFile, SLOT(setVisible(bool)));
	connect(ui->radioButtonURL, SIGNAL(toggled(bool)),
	        ui->frameURL, SLOT(setVisible(bool)));

	connect(ui->radioButtonAsteroids, SIGNAL(toggled(bool)),
	        this, SLOT(switchImportType(bool)));
	connect(ui->radioButtonComets, SIGNAL(toggled(bool)),
	        this, SLOT(switchImportType(bool)));

	connect(ui->pushButtonMarkAll, SIGNAL(clicked()),
	        this, SLOT(markAll()));
	connect(ui->pushButtonMarkNone, SIGNAL(clicked()),
	        this, SLOT(unmarkAll()));

	connect(ui->pushButtonSendQuery, SIGNAL(clicked()),
	        this, SLOT(sendQuery()));
	connect(ui->lineEditQuery, SIGNAL(returnPressed()),
		this, SLOT(sendQuery()));
	connect(ui->pushButtonAbortQuery, SIGNAL(clicked()),
	        this, SLOT(abortQuery()));
	connect(ui->lineEditQuery, SIGNAL(textEdited(QString)),
	        this, SLOT(resetNotFound()));
	//connect(ui->lineEditQuery, SIGNAL(editingFinished()), this, SLOT(sendQuery()));
	connect(countdownTimer, SIGNAL(timeout()), this, SLOT(updateCountdown()));

	QSortFilterProxyModel * filterProxyModel = new QSortFilterProxyModel(this);
	filterProxyModel->setSourceModel(candidateObjectsModel);
	filterProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
	ui->listViewObjects->setModel(filterProxyModel);
	connect(ui->lineEditSearch, SIGNAL(textChanged(const QString&)),
	        filterProxyModel, SLOT(setFilterFixedString(const QString&)));

	loadBookmarks();
	updateTexts();

	resetCountdown();
	resetDialog();
}
Aircraft::Aircraft(Type type, const TextureHolder& textures, const FontHolder& fonts)
: Entity(Table[type].hitpoints)
, mType(type)
, mFireCommand()
, mMissileCommand()
, mFireCountdown(sf::Time::Zero)
, mIsFiring(false)
, mIsLaunchingMissile(false)
, mShowExplosion(true)
, mSpawnedPickup(false)
, mSprite(textures.get(Table[type].texture), Table[type].textureRect)
, mExplosion(textures.get(Textures::Explosion))
, mFireRateLevel(1)
, mSpreadLevel(1)
, mMissileAmmo(2)
, mDropPickupCommand()
, mTravelledDistance(0.f)
, mDirectionIndex(0)
, mMissileDisplay(nullptr)
{
	mExplosion.setFrameSize(sf::Vector2i(256, 256));
	mExplosion.setNumFrames(16);
	mExplosion.setDuration(sf::seconds(1));

	centerOrigin(mSprite);
	centerOrigin(mExplosion);

	mFireCommand.category = Category::SceneAirLayer;
	mFireCommand.action   = [this, &textures] (SceneNode& node, sf::Time)
	{
		createBullets(node, textures);
	};

	mMissileCommand.category = Category::SceneAirLayer;
	mMissileCommand.action   = [this, &textures] (SceneNode& node, sf::Time)
	{
		createProjectile(node, Projectile::Missile, 0.f, 0.5f, textures);
	};

	mDropPickupCommand.category = Category::SceneAirLayer;
	mDropPickupCommand.action   = [this, &textures] (SceneNode& node, sf::Time)
	{
		createPickup(node, textures);
	};

	std::unique_ptr<TextNode> healthDisplay(new TextNode(fonts, ""));
	mHealthDisplay = healthDisplay.get();
	attachChild(std::move(healthDisplay));

	if (getCategory() == Category::PlayerAircraft)
	{
		std::unique_ptr<TextNode> missileDisplay(new TextNode(fonts, ""));
		missileDisplay->setPosition(0, 70);
		mMissileDisplay = missileDisplay.get();
		attachChild(std::move(missileDisplay));
	}

	updateTexts();
}
void MpcImportWindow::retranslate()
{
	if (dialog)
	{
		ui->retranslateUi(dialog);
		updateTexts();
	}
}
void SolarSystemManagerWindow::retranslate()
{
	if (dialog)
	{
		ui->retranslateUi(dialog);
		populateSolarSystemList();
		updateTexts();
	}
}
Exemplo n.º 5
0
void Aircraft::updateCurrent(sf::Time dt, CommandQueue& commands)
{
	// Entity has been destroyed: Possibly drop pickup, mark for removal
	if (isDestroyed())
	{
		checkPickupDrop(commands);

		mIsMarkedForRemoval = true;
		return;
	}

	// Check if bullets or missiles are fired
	checkProjectileLaunch(dt, commands);

	// Update enemy movement pattern; apply velocity
	updateMovementPattern(dt);
	Entity::updateCurrent(dt, commands);

	// Update texts
	updateTexts();
}
void SolarSystemManagerWindow::createDialogContent()
{
	ui->setupUi(dialog);

#ifdef Q_OS_WIN
	//Kinetic scrolling for tablet pc and pc
	QList<QWidget *> addscroll;
	addscroll << ui->listWidgetObjects;
	installKineticScrolling(addscroll);
#endif

	//Signals
	connect(&StelApp::getInstance(), SIGNAL(languageChanged()),
	        this, SLOT(retranslate()));
	connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
	connect(ui->TitleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint)));
	connect(ui->pushButtonCopyFile, SIGNAL(clicked()), this, SLOT(copyConfiguration()));
	connect(ui->pushButtonReplaceFile, SIGNAL(clicked()), this, SLOT(replaceConfiguration()));
	connect(ui->pushButtonRemove, SIGNAL(clicked()), this, SLOT(removeObject()));
	connect(ui->pushButtonImportMPC, SIGNAL(clicked()), this, SLOT(newImportMPC()));
	//connect(ui->pushButtonManual, SIGNAL(clicked()), this, SLOT(newImportManual()));

	connect(ssoManager, SIGNAL(solarSystemChanged()), this, SLOT(populateSolarSystemList()));
	connect(ui->pushButtonReset, SIGNAL(clicked()), ssoManager, SLOT(resetSolarSystemToDefault()));

	// bug #1350669 (https://bugs.launchpad.net/stellarium/+bug/1350669)
	connect(ui->listWidgetObjects, SIGNAL(currentRowChanged(int)), ui->listWidgetObjects, SLOT(repaint()));

	updateTexts();

	Q_ASSERT(mpcImportWindow);
	//Rebuild the list if any planets have been imported
	connect(mpcImportWindow, SIGNAL(objectsImported()), this, SLOT(populateSolarSystemList()));

	ui->lineEditUserFilePath->setText(ssoManager->getCustomSolarSystemFilePath());
	populateSolarSystemList();
}
Exemplo n.º 7
0
void LevelEditor::render()
{
	//Draw positions display
	updateTexts();
	m_window.draw(m_displayMousePos);
	m_window.draw(m_displayOffset);

	//Draw Editor
	for(auto &it : m_display)
	{
		m_window.draw(it);
	}

	//Draw last color

	if(m_drawMode == DrawMode::collisionBlock || m_drawMode == DrawMode::opticalBlock || m_drawMode == DrawMode::finishBlock)
	{
		for(auto &it : m_displayLastColors)
		{
			m_window.draw(it);
		}

	}


	// Draw overlays
	if(m_drawMode == DrawMode::collisionBlock || m_drawMode == DrawMode::finishBlock)
	{
		//Draw the overlay for collision and finish blocks!
		for(std::size_t i = 0; i < m_display.size(); i++)
		{
			int col = i;

			while(col >= 32)
			{
				col -= 32;
			}
		
			int row = static_cast<int>(i/32.f);

			if(m_lines[m_xOffset + col].getCollisionType(m_yOffset + row) == CollisionType::COLLISION)
			{
				sf::RectangleShape temp = m_display[i];
				temp.setFillColor(sf::Color(255,0,0,120));
				m_window.draw(temp);
			}
			else if(m_lines[m_xOffset + col].getCollisionType(m_yOffset + row) == CollisionType::FINISH)
			{
				sf::RectangleShape temp = m_display[i];
				temp.setFillColor(sf::Color(0,255,0,120));
				m_window.draw(temp);
			}
		}
	}
	else if(m_drawMode == DrawMode::scripts)
	{
		//Draw scripts overlay
		for(int i = m_xOffset; i < m_xOffset+32; i++)
		{
			if(i == m_selectedXPos)
				continue;

			if(m_scriptManager.isScriptAtXPos(i))
			{
				sf::RectangleShape overlay(sf::Vector2f(25,450));
				overlay.setPosition((i-m_xOffset)*25, 0);
				overlay.setFillColor(sf::Color(255, 255, 0, 120));
				m_window.draw(overlay);
			}

		}

		//Draw the selected Col overlay
		if(m_selectedXPos >= m_xOffset && m_selectedXPos < m_xOffset + 32)
		{
			sf::RectangleShape overlay(sf::Vector2f(25,450));
			overlay.setPosition((m_selectedXPos - m_xOffset) * 25, 0);
			overlay.setFillColor(sf::Color(0, 255, 255, 120));
			m_window.draw(overlay);
		}


	}


	

}
Exemplo n.º 8
0
void MainWindow::on_UTF8textEdit_textChanged()
{
        updateTexts();
}
Exemplo n.º 9
0
void MainWindow::on_ASCIItextEdit_textChanged()
{
        updateTexts();
}
Exemplo n.º 10
0
void MainWindow::on_textEdit_textChanged()
{
    QString text = ui->textEdit->toPlainText();
    myString.fromQString( text );
    updateTexts();
}
Exemplo n.º 11
0
void MainWindow::on_bit7TextEdit_textChanged()
{
    QString bit7text = ui->bit7TextEdit->toPlainText();
    myString.fromBit7( bit7text );
    updateTexts();
}