void FileService::save(const QString& path, const QString& ext) { if(path == "") { this->saveAs(); } else { try { WindowService* ws = dynamic_cast<WindowService*>(_gi->getService(GenericInterface::WINDOW_SERVICE)); if(ws != NULL) { StandardImageWindow* imw = dynamic_cast<StandardImageWindow*>(ws->getCurrentImageWindow()); if(imw != NULL) { try { imw->getImage()->save(path.toStdString()); } catch(const UnknownFormatException& e) { if(ext == "") throw e; imw->getImage()->save((path+ext).toStdString()); } } else { QMessageBox::critical(_gi, "Bad object type", "Only images can be saved at the moment."); } } } catch(const char* s) { QMessageBox::information(_gi, "plop", s); } } }
void UtilityService::showPixelsGrid() { WindowService* ws = dynamic_cast<WindowService*>(_gi->getService(GenericInterface::WINDOW_SERVICE)); StandardImageWindow* curWindow = NULL; if(ws && (curWindow = dynamic_cast<StandardImageWindow*>(ws->getCurrentImageWindow()))) { curWindow->showPixelsGrid(); } }