ScreenImageMgr.cpp   ScreenImageMgr.cpp 
skipping to change at line 88 skipping to change at line 88
if (tex!=NULL) if (tex!=NULL)
{ {
delete tex; delete tex;
tex = NULL; tex = NULL;
} }
moveTimer->stop(); moveTimer->stop();
delete anim; anim = NULL; delete anim; anim = NULL;
delete moveTimer; moveTimer = NULL; delete moveTimer; moveTimer = NULL;
} }
bool ScreenImage::draw(const StelCore* core) bool ScreenImage::draw(const StelCore*)
{ {
return true; return true;
} }
void ScreenImage::update(double deltaTime) void ScreenImage::update(double)
{ {
} }
void ScreenImage::setFadeDuration(float duration) void ScreenImage::setFadeDuration(float duration)
{ {
int fadeMs = duration * 1000; int fadeMs = duration * 1000;
if (fadeMs<=0) fadeMs=1; if (fadeMs<=0) fadeMs=1;
fadeTimer->setDuration(fadeMs); fadeTimer->setDuration(fadeMs);
} }
skipping to change at line 186 skipping to change at line 186
{ {
tex->setOpacity(alpha*maxAlpha); tex->setOpacity(alpha*maxAlpha);
} }
////////////////////////// //////////////////////////
// ScreenImageMgr class // // ScreenImageMgr class //
////////////////////////// //////////////////////////
ScreenImageMgr::ScreenImageMgr() ScreenImageMgr::ScreenImageMgr()
{ {
setObjectName("ScreenImageMgr"); setObjectName("ScreenImageMgr");
connect(this, SIGNAL(requestCreateScreenImage(const QString&, const
QString&, float, float, float, bool, float, float)),
this, SLOT(doCreateScreenImage(const QString&, const QString
&, float, float, float, bool, float, float)));
connect(this, SIGNAL(requestSetImageShow(const QString&, bool)),
this, SLOT(doSetImageShow(const QString&, bool)));
connect(this, SIGNAL(requestSetImageAlpha(const QString&, float)),
this, SLOT(doSetImageAlpha(const QString&, float)));
connect(this, SIGNAL(requestSetImageXY(const QString&, float, float,
float)),
this, SLOT(doSetImageXY(const QString&, float, float, float)
));
connect(this, SIGNAL(requestDeleteImage(const QString&)),
this, SLOT(doDeleteImage(const QString&)));
connect(this, SIGNAL(requestDeleteAllImages()),
this, SLOT(doDeleteAllImages()));
} }
ScreenImageMgr::~ScreenImageMgr() ScreenImageMgr::~ScreenImageMgr()
{ {
} }
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!=NULL)
m->draw(core); m->draw(core);
} }
void ScreenImageMgr::createScreenImage(const QString& id, void ScreenImageMgr::createScreenImage(const QString& id, const QString& fi
const QString& filename, lename, float x, float y,
float x, float scale, bool visible, float alpha, float fadeDuration)
float y,
float scale,
bool visible,
float alpha,
float fadeDuration)
{ {
emit(requestCreateScreenImage(id, filename, x, y, scale, visible, al // First check to see if there is already an image loaded with the
pha, fadeDuration)); // specified ID, and drop it if necessary
if (allScreenImages.contains(id))
deleteImage(id);
ScreenImage* i = new ScreenImage(filename, x, y, visible, scale, alp
ha, fadeDuration);
if (i==NULL)
return;
allScreenImages[id] = i;
} }
void ScreenImageMgr::deleteImage(const QString& id) void ScreenImageMgr::deleteImage(const QString& id)
{ {
emit(requestDeleteImage(id)); if (allScreenImages.contains(id))
{
if (allScreenImages[id]!=NULL)
{
delete allScreenImages[id];
allScreenImages[id] = NULL;
}
allScreenImages.remove(id);
}
} }
void ScreenImageMgr::deleteAllImages() void ScreenImageMgr::deleteAllImages()
{ {
emit(requestDeleteAllImages()); foreach(ScreenImage* m, allScreenImages)
{
if (m!=NULL)
{
delete m;
m = NULL;
}
}
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]!=NULL)
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]!=NULL)
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]!=NULL)
return allScreenImages[id]->imageHeight(); return allScreenImages[id]->imageHeight();
return 0; return 0;
} }
void ScreenImageMgr::showImage(const QString& id, bool show) void ScreenImageMgr::showImage(const QString& id, bool show)
{ {
emit(requestSetImageShow(id, show)); if (allScreenImages.contains(id))
if (allScreenImages[id]!=NULL)
allScreenImages[id]->setFlagShow(show);
} }
void ScreenImageMgr::setImageAlpha(const QString& id, float alpha) void ScreenImageMgr::setImageAlpha(const QString& id, float alpha)
{ {
emit(requestSetImageAlpha(id, alpha)); if (allScreenImages.contains(id))
if (allScreenImages[id]!=NULL)
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)
{ {
emit(requestSetImageXY(id, x, y, duration)); if (allScreenImages.contains(id))
if (allScreenImages[id]!=NULL)
allScreenImages[id]->setXY(x,y, duration);
} }
void ScreenImageMgr::update(double deltaTime) void ScreenImageMgr::update(double deltaTime)
{ {
foreach(ScreenImage* m, allScreenImages) foreach(ScreenImage* m, allScreenImages)
if (m!=NULL) if (m!=NULL)
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;
} }
void ScreenImageMgr::doCreateScreenImage(const QString& id,
const QString& filename,
float x,
float y,
float scale,
bool visible,
float alpha,
float fadeDuration)
{
// First check to see if there is already an image loaded with the
// specified ID, and drop it if necessary
if (allScreenImages.contains(id))
doDeleteImage(id);
ScreenImage* i = new ScreenImage(filename, x, y, visible, scale, alp
ha, fadeDuration);
if (i==NULL)
return;
allScreenImages[id] = i;
return;
}
void ScreenImageMgr::doSetImageShow(const QString& id, bool show)
{
if (allScreenImages.contains(id))
if (allScreenImages[id]!=NULL)
allScreenImages[id]->setFlagShow(show);
}
void ScreenImageMgr::doSetImageAlpha(const QString& id, float alpha)
{
if (allScreenImages.contains(id))
if (allScreenImages[id]!=NULL)
allScreenImages[id]->setAlpha(alpha);
}
void ScreenImageMgr::doSetImageXY(const QString& id, float x, float y, floa
t duration)
{
if (allScreenImages.contains(id))
if (allScreenImages[id]!=NULL)
allScreenImages[id]->setXY(x,y, duration);
}
void ScreenImageMgr::doDeleteImage(const QString& id)
{
if (allScreenImages.contains(id))
{
if (allScreenImages[id]!=NULL)
{
delete allScreenImages[id];
allScreenImages[id] = NULL;
}
allScreenImages.remove(id);
}
}
void ScreenImageMgr::doDeleteAllImages(void)
{
foreach(ScreenImage* m, allScreenImages)
{
if (m!=NULL)
{
delete m;
m = NULL;
}
}
allScreenImages.clear();
}
 End of changes. 14 change blocks. 
42 lines changed or deleted 43 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/