ScreenImageMgr.cpp   ScreenImageMgr.cpp 
skipping to change at line 45 skipping to change at line 45
#include <QString> #include <QString>
#include <QDebug> #include <QDebug>
#include <QMap> #include <QMap>
#include <QTimeLine> #include <QTimeLine>
#include <QGraphicsItemAnimation> #include <QGraphicsItemAnimation>
/////////////////////// ///////////////////////
// ScreenImage class // // ScreenImage class //
/////////////////////// ///////////////////////
ScreenImage::ScreenImage(const QString& filename, float x, float y, bool sh ow, float scale, float alpha, float fadeDuration) ScreenImage::ScreenImage(const QString& filename, float x, float y, bool sh ow, float scale, float alpha, float fadeDuration)
: tex(NULL), maxAlpha(alpha) : tex(Q_NULLPTR), maxAlpha(alpha)
{ {
QPixmap pixmap(filename); QPixmap pixmap(filename);
tex = StelMainView::getInstance().scene()->addPixmap(pixmap.scaled(p ixmap.size()*scale)); tex = StelMainView::getInstance().scene()->addPixmap(pixmap.scaled(p ixmap.size()*scale));
tex->setPos(x, y); tex->setPos(x, y);
anim = new QGraphicsItemAnimation(); anim = new QGraphicsItemAnimation();
moveTimer = new QTimeLine(); moveTimer = new QTimeLine();
moveTimer->setCurveShape(QTimeLine::LinearCurve); moveTimer->setCurveShape(QTimeLine::LinearCurve);
anim->setTimeLine(moveTimer); anim->setTimeLine(moveTimer);
anim->setItem(tex); anim->setItem(tex);
skipping to change at line 83 skipping to change at line 83
tex->setOpacity(maxAlpha); tex->setOpacity(maxAlpha);
else else
tex->setOpacity(0.); tex->setOpacity(0.);
} }
ScreenImage::~ScreenImage() ScreenImage::~ScreenImage()
{ {
moveTimer->stop(); moveTimer->stop();
scaleTimer->stop(); scaleTimer->stop();
fadeTimer->stop(); fadeTimer->stop();
delete anim; anim = NULL; delete anim; anim = Q_NULLPTR;
delete scaleAnim; scaleAnim = NULL; delete scaleAnim; scaleAnim = Q_NULLPTR;
delete moveTimer; moveTimer = NULL; delete moveTimer; moveTimer = Q_NULLPTR;
delete scaleTimer; scaleTimer = NULL; delete scaleTimer; scaleTimer = Q_NULLPTR;
delete fadeTimer; fadeTimer = NULL; delete fadeTimer; fadeTimer = Q_NULLPTR;
if (tex!=NULL) if (tex!=Q_NULLPTR)
{ {
delete tex; delete tex;
tex = NULL; tex = Q_NULLPTR;
} }
} }
bool ScreenImage::draw(const StelCore*) bool ScreenImage::draw(const StelCore*)
{ {
return true; return true;
} }
void ScreenImage::update(double) void ScreenImage::update(double)
{ {
skipping to change at line 230 skipping to change at line 230
{ {
} }
void ScreenImageMgr::init() void ScreenImageMgr::init()
{ {
} }
void ScreenImageMgr::draw(StelCore* core) void ScreenImageMgr::draw(StelCore* core)
{ {
foreach(ScreenImage* m, allScreenImages) foreach(ScreenImage* m, allScreenImages)
if (m!=NULL) if (m!=Q_NULLPTR)
m->draw(core); m->draw(core);
} }
void ScreenImageMgr::createScreenImage(const QString& id, const QString& fi lename, float x, float y, void ScreenImageMgr::createScreenImage(const QString& id, const QString& fi lename, float x, float y,
float scale, bool visible, float alpha, float fadeDuration) float scale, bool visible, float alpha, float fadeDuration)
{ {
// First check to see if there is already an image loaded with the // First check to see if there is already an image loaded with the
// specified ID, and drop it if necessary // specified ID, and drop it if necessary
if (allScreenImages.contains(id)) if (allScreenImages.contains(id))
deleteImage(id); deleteImage(id);
QString path = StelFileMgr::findFile("scripts/" + filename); QString path = StelFileMgr::findFile("scripts/" + filename);
if (!path.isEmpty()) if (!path.isEmpty())
{ {
ScreenImage* i = new ScreenImage(path, x, y, visible, scale, alpha, fadeDuration); ScreenImage* i = new ScreenImage(path, x, y, visible, scale, alpha, fadeDuration);
if (i==NULL) if (i==Q_NULLPTR)
return; return;
allScreenImages[id] = i; allScreenImages[id] = i;
} }
else else
{ {
qWarning() << "Failed to create ScreenImage" << id << ": fil e not found: " << filename; qWarning() << "Failed to create ScreenImage" << id << ": fil e not found: " << filename;
} }
} }
void ScreenImageMgr::deleteImage(const QString& id) void ScreenImageMgr::deleteImage(const QString& id)
{ {
if (allScreenImages.contains(id)) if (allScreenImages.contains(id))
{ {
if (allScreenImages[id]!=NULL) if (allScreenImages[id]!=Q_NULLPTR)
{ {
delete allScreenImages[id]; delete allScreenImages[id];
allScreenImages[id] = NULL; allScreenImages[id] = Q_NULLPTR;
} }
allScreenImages.remove(id); allScreenImages.remove(id);
} }
} }
void ScreenImageMgr::deleteAllImages() void ScreenImageMgr::deleteAllImages()
{ {
foreach(ScreenImage* m, allScreenImages) foreach(ScreenImage* m, allScreenImages)
{ {
if (m!=NULL) if (m!=Q_NULLPTR)
{ {
delete m; delete m;
m = NULL; m = Q_NULLPTR;
} }
} }
allScreenImages.clear(); allScreenImages.clear();
} }
QStringList ScreenImageMgr::getAllImageIDs(void) QStringList ScreenImageMgr::getAllImageIDs(void)
{ {
return allScreenImages.keys(); return allScreenImages.keys();
} }
bool ScreenImageMgr::getShowImage(const QString& id) bool ScreenImageMgr::getShowImage(const QString& id)
{ {
if (allScreenImages.contains(id)) if (allScreenImages.contains(id))
if (allScreenImages[id]!=NULL) if (allScreenImages[id]!=Q_NULLPTR)
return allScreenImages[id]->getFlagShow(); return allScreenImages[id]->getFlagShow();
return false; return false;
} }
int ScreenImageMgr::getImageWidth(const QString& id) int ScreenImageMgr::getImageWidth(const QString& id)
{ {
if (allScreenImages.contains(id)) if (allScreenImages.contains(id))
if (allScreenImages[id]!=NULL) if (allScreenImages[id]!=Q_NULLPTR)
return allScreenImages[id]->imageWidth(); return allScreenImages[id]->imageWidth();
return 0; return 0;
} }
int ScreenImageMgr::getImageHeight(const QString& id) int ScreenImageMgr::getImageHeight(const QString& id)
{ {
if (allScreenImages.contains(id)) if (allScreenImages.contains(id))
if (allScreenImages[id]!=NULL) if (allScreenImages[id]!=Q_NULLPTR)
return allScreenImages[id]->imageHeight(); return allScreenImages[id]->imageHeight();
return 0; return 0;
} }
float ScreenImageMgr::getImageScaleX(const QString& id) float ScreenImageMgr::getImageScaleX(const QString& id)
{ {
if (allScreenImages.contains(id)) if (allScreenImages.contains(id))
if (allScreenImages[id]!=NULL) if (allScreenImages[id]!=Q_NULLPTR)
return allScreenImages[id]->imageScaleX(); return allScreenImages[id]->imageScaleX();
return 0; return 0;
} }
float ScreenImageMgr::getImageScaleY(const QString& id) float ScreenImageMgr::getImageScaleY(const QString& id)
{ {
if (allScreenImages.contains(id)) if (allScreenImages.contains(id))
if (allScreenImages[id]!=NULL) if (allScreenImages[id]!=Q_NULLPTR)
return allScreenImages[id]->imageScaleY(); return allScreenImages[id]->imageScaleY();
return 0; return 0;
} }
void ScreenImageMgr::showImage(const QString& id, bool show) void ScreenImageMgr::showImage(const QString& id, bool show)
{ {
if (allScreenImages.contains(id)) if (allScreenImages.contains(id))
if (allScreenImages[id]!=NULL) if (allScreenImages[id]!=Q_NULLPTR)
allScreenImages[id]->setFlagShow(show); allScreenImages[id]->setFlagShow(show);
} }
void ScreenImageMgr::setImageAlpha(const QString& id, float alpha) void ScreenImageMgr::setImageAlpha(const QString& id, float alpha)
{ {
if (allScreenImages.contains(id)) if (allScreenImages.contains(id))
if (allScreenImages[id]!=NULL) if (allScreenImages[id]!=Q_NULLPTR)
allScreenImages[id]->setAlpha(alpha); allScreenImages[id]->setAlpha(alpha);
} }
void ScreenImageMgr::setImageXY(const QString& id, float x, float y, float duration) void ScreenImageMgr::setImageXY(const QString& id, float x, float y, float duration)
{ {
if (allScreenImages.contains(id)) if (allScreenImages.contains(id))
if (allScreenImages[id]!=NULL) if (allScreenImages[id]!=Q_NULLPTR)
allScreenImages[id]->setXY(x, y, duration); allScreenImages[id]->setXY(x, y, duration);
} }
void ScreenImageMgr::addImageXY(const QString& id, float x, float y, float duration) void ScreenImageMgr::addImageXY(const QString& id, float x, float y, float duration)
{ {
if (allScreenImages.contains(id)) if (allScreenImages.contains(id))
if (allScreenImages[id]!=NULL) if (allScreenImages[id]!=Q_NULLPTR)
allScreenImages[id]->addXY(x, y, duration); allScreenImages[id]->addXY(x, y, duration);
} }
void ScreenImageMgr::setImageScale(const QString& id, float scaleX, float s caleY, float duration) void ScreenImageMgr::setImageScale(const QString& id, float scaleX, float s caleY, float duration)
{ {
if (allScreenImages.contains(id)) if (allScreenImages.contains(id))
if (allScreenImages[id]!=NULL) if (allScreenImages[id]!=Q_NULLPTR)
allScreenImages[id]->setScale(scaleX, scaleY, durati on); allScreenImages[id]->setScale(scaleX, scaleY, durati on);
} }
void ScreenImageMgr::update(double deltaTime) void ScreenImageMgr::update(double deltaTime)
{ {
foreach(ScreenImage* m, allScreenImages) foreach(ScreenImage* m, allScreenImages)
if (m!=NULL) if (m!=Q_NULLPTR)
m->update(deltaTime); m->update(deltaTime);
} }
double ScreenImageMgr::getCallOrder(StelModuleActionName actionName) const double ScreenImageMgr::getCallOrder(StelModuleActionName actionName) const
{ {
if (actionName==StelModule::ActionDraw) if (actionName==StelModule::ActionDraw)
return StelApp::getInstance().getModuleMgr().getModule("Land scapeMgr")->getCallOrder(actionName)+11; return StelApp::getInstance().getModuleMgr().getModule("Land scapeMgr")->getCallOrder(actionName)+11;
return 0; return 0;
} }
 End of changes. 20 change blocks. 
25 lines changed or deleted 25 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/