Commit 98130734 authored by Oliver Bock's avatar Oliver Bock

i18n preparations

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