Commit 98130734 authored by Oliver Bock's avatar Oliver Bock

i18n preparations

parent c5af9683
......@@ -27,20 +27,26 @@ PulsarAnimationWidget::PulsarAnimationWidget(QWidget *parent) :
m_frameTimer(),
m_pulseProfile(360, 0.0)
{
QString msgThis = tr("3D animation");
if(!format().directRendering()) {
qWarning("Sorry, no direct rendering support for animation...");
QString msg = tr("Sorry, no direct rendering support for %1...");
qWarning() << msg.arg(msgThis);
}
if(!format().doubleBuffer()) {
qWarning("Sorry, no double buffering support for animation...");
QString msg = tr("Sorry, no double buffering support for %1...");
qWarning() << msg.arg(msgThis);
}
if(!format().rgba()) {
qWarning("Sorry, no RGBA support for animation...");
QString msg = tr("Sorry, no RGBA support for %1...");
qWarning() << msg.arg(msgThis);
}
if(!format().alpha()) {
qWarning("Sorry, no alpha channel support for animation...");
QString msg = tr("Sorry, no alpha channel support for %1...");
qWarning() << msg.arg(msgThis);
}
if(!format().sampleBuffers()) {
qWarning("Sorry, no multisampling support for animation...");
QString msg = tr("Sorry, no multisampling support for %1...");
qWarning() << msg.arg(msgThis);
}
// connect primary rendering timer to local callback
......@@ -168,39 +174,44 @@ void PulsarAnimationWidget::initializeGL()
GLint maxTextureSize;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
// prepare local messages
QString msgShape = tr("%1 texture shape not quadratic!");
QString msgPower = tr("%1 texture dimensions not a power of 2!");
QString msgSize = tr("Maximum texture size exceeded! Scaling down %1 texture to %2x%3...");
// prepare and check pulsar texture
QImage pulsarTexture(":/textures/resources/texture_pulsar.png");
if(pulsarTexture.width() != pulsarTexture.height()) {
qWarning("Warning: pulsar texture shape not quadratic!");
qWarning() << msgShape.arg(tr("Pulsar"));
}
else {
double integer = 0.0;
double fraction = 0.0;
fraction = modf(log(pulsarTexture.width()) / log(2.0), &integer);
if(fraction > 0.0) {
qWarning("Warning: pulsar texture dimensions not a power of 2!");
qWarning() << msgPower.arg(tr("Pulsar"));
}
}
if(pulsarTexture.width() > maxTextureSize) {
qWarning("Warning: maximum texture size exceeded! Scaling down pulsar texture to %ix%i...", maxTextureSize, maxTextureSize);
qWarning() << msgSize.arg(tr("pulsar").arg(maxTextureSize).arg(maxTextureSize));
pulsarTexture = pulsarTexture.scaled(maxTextureSize, maxTextureSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
}
// prepare and check background texture
QImage backgroundTexture(":/textures/resources/texture_background_carina.jpg");
if(backgroundTexture.width() != backgroundTexture.height()) {
qWarning("Warning: invalid background texture shape!");
qWarning() << msgShape.arg(tr("Background"));
}
else {
double integer = 0.0;
double fraction = 0.0;
fraction = modf(log(backgroundTexture.width()) / log(2.0), &integer);
if(fraction > 0.0) {
qWarning("Warning: background texture dimensions not a power of 2!");
qWarning() << msgPower.arg(tr("Background"));
}
}
if(backgroundTexture.width() > maxTextureSize) {
qWarning("Warning: maximum texture size exceeded! Scaling down background texture to %ix%i...", maxTextureSize, maxTextureSize);
qWarning() << msgSize.arg(tr("background").arg(maxTextureSize).arg(maxTextureSize));
backgroundTexture = backgroundTexture.scaled(maxTextureSize, maxTextureSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
}
......
......@@ -26,6 +26,7 @@
#include <QGLWidget>
#include <QTimer>
#include <QMouseEvent>
#include <QDebug>
#define PI 3.14159265
......
......@@ -25,7 +25,7 @@ PulsatingScience::PulsatingScience(QWidget *parent) : QMainWindow(parent)
ui.setupUi(this);
QAction* animControl = ui.dockAnimControl->toggleViewAction();
animControl->setStatusTip("Toggle the animation control visibility");
animControl->setStatusTip(tr("Toggle the animation control visibility"));
animControl->setShortcut(QKeySequence(Qt::ALT + Qt::Key_A));
ui.menuView->addAction(animControl);
......@@ -350,15 +350,24 @@ void PulsatingScience::on_dockAnimControl_topLevelChanged(bool topLevel) {
void PulsatingScience::on_actionAbout_activated()
{
QMessageBox::about(this, "About",
"<b>Pulsating Science</b><br>"
"International Year of Astronomy 2009<br><br>"
"Authors: Oliver Bock, Benjamin Knispel<br><br>"
"Background image: The Carina Nebula<br>"
"(Courtesy of ESO/IDA/Danish 1.5 m/R.Gendler, J-E. Ovaldsen, C. Th&ouml;ne and C. Feron)<br><br>"
"License: GNU General Public License (Version 3)<br><br>"
"Copyright &copy; 2009 "
"<a href=\"http://www.aei.mpg.de\">Max-Planck-Institut f&uuml;r Gravitationsphysik</a>");
QString content = "<b>%1</b><br>"
"%2<br><br>"
"%3: Oliver Bock, Benjamin Knispel<br><br>"
"%4<br>"
"(%5 ESO/IDA/Danish 1.5 m/R.Gendler, J-E. Ovaldsen, C. Th&ouml;ne, C. Feron)<br><br>"
"%6: GNU General Public License (Version 3)<br><br>"
"Copyright &copy; 2009 "
"<a href=\"http://www.aei.mpg.de\">Max-Planck-Institut f&uuml;r Gravitationsphysik</a>";
content = content.arg(
tr("Pulsating Science"),
tr("International Year of Astronomy 2009"),
tr("Authors"),
tr("Background image: The Carina Nebula"),
tr("Courtesy of"),
tr("License"));
QMessageBox::about(this, tr("About \"Pulsating Science\""), content);
}
void PulsatingScience::updatePulsarSemiMajorAxisValue(double value)
......
......@@ -26,20 +26,27 @@ PulseScopeWidget::PulseScopeWidget(QWidget *parent) : QGraphicsView(parent),
{
setViewport(new QGLWidget(QGLFormat(QGL::AlphaChannel | QGL::SampleBuffers)));
QGLWidget *glScope = (QGLWidget*) viewport();
QString msgThis = tr("pulse profile");
if(!glScope->format().directRendering()) {
qWarning("Sorry, no direct rendering support for pulse scope...");
QString msg = tr("Sorry, no direct rendering support for %1...");
qWarning() << msg.arg(msgThis);
}
if(!glScope->format().doubleBuffer()) {
qWarning("Sorry, no double buffering support for pulse scope...");
QString msg = tr("Sorry, no double buffering support for %1...");
qWarning() << msg.arg(msgThis);
}
if(!glScope->format().rgba()) {
qWarning("Sorry, no RGBA support for pulse scope...");
QString msg = tr("Sorry, no RGBA support for %1...");
qWarning() << msg.arg(msgThis);
}
if(!glScope->format().alpha()) {
qWarning("Sorry, no alpha channel support for pulse scope...");
QString msg = tr("Sorry, no alpha channel support for %1...");
qWarning() << msg.arg(msgThis);
}
if(!glScope->format().sampleBuffers()) {
qWarning("Sorry, no multisampling support for pulse scope...");
QString msg = tr("Sorry, no multisampling support for %1...");
qWarning() << msg.arg(msgThis);
}
m_scopeSizeH = 360.0;
......
......@@ -28,6 +28,7 @@
#include <QGLContext>
#include <QGraphicsPathItem>
#include <QGraphicsLineItem>
#include <QDebug>
class PulseScopeWidget : public QGraphicsView
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment