From 06a0b0ae4b4a0678122d1a4325c0aa66669246d0 Mon Sep 17 00:00:00 2001 From: stefan <stefan@5a81b35b-ba03-0410-adc8-b2c5c5119f08> Date: Tue, 8 Jun 2010 15:24:05 +0000 Subject: [PATCH] FileLoader, Informationmessage when no entities found in pdb git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2362 5a81b35b-ba03-0410-adc8-b2c5c5119f08 --- modules/gui/src/file_loader.cc | 12 ++++++++++-- modules/gui/src/file_loader.hh | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/modules/gui/src/file_loader.cc b/modules/gui/src/file_loader.cc index 059f661c3..31636340e 100644 --- a/modules/gui/src/file_loader.cc +++ b/modules/gui/src/file_loader.cc @@ -217,6 +217,12 @@ void FileLoader::HandleError(Message m, ErrorType type, const QString& filename, break; } } + else if(type==INFO){ + QMessageBox message_box(QMessageBox::Information, + "Information", m._mesg.c_str()); + message_box.setStandardButtons( QMessageBox::Ok); + message_box.exec(); + } } gfx::GfxObjP FileLoader::TryLoadEntity(const QString& filename, io::EntityIOHandlerP handler, const QString& selection) @@ -361,9 +367,11 @@ void FileLoader::LoadPDB(const QString& filename, const QString& selection) conop::Conopology::Instance().ConnectAll(builder,ent,0); entities.append(ent); } - QFileInfo file_info(filename); - if(entities.size()==1){ + if(entities.empty()){ + FileLoader::HandleError(Message(QString("No entities found in file: "+ filename).toStdString()),INFO,filename); + } + else if(entities.size()==1){ gfx::EntityP gfx_ent(new gfx::Entity(file_info.baseName().toStdString(),entities.first(),mol::Query(selection.toStdString()))); try{ gfx::Scene::Instance().Add(gfx_ent); diff --git a/modules/gui/src/file_loader.hh b/modules/gui/src/file_loader.hh index 4bf5a8ad1..ea2d63e2d 100644 --- a/modules/gui/src/file_loader.hh +++ b/modules/gui/src/file_loader.hh @@ -46,7 +46,8 @@ private: enum ErrorType { DEFAULT = 0, IO_LOADING, GFX_ADD, - GFX_MULTIPLE_ADD + GFX_MULTIPLE_ADD, + INFO }; FileLoader(); -- GitLab