Skip to content
Snippets Groups Projects
Commit 8064f8e8 authored by stefan's avatar stefan
Browse files

FileTypeDialog, support for alignments

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2323 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent 4419676a
No related branches found
No related tags found
No related merge requests found
......@@ -103,7 +103,11 @@ void FileLoader::LoadObject(const QString& filename, const QString& selection)
obj=FileLoader::TryLoadSurface(filename);
}
if (!obj) {
obj=FileLoader::NoHandlerFound(filename);
try{
obj=FileLoader::NoHandlerFound(filename);
} catch (io::IOFileAlreadyLoadedException&) {
return;
}
}
if (!obj){
return;
......@@ -135,6 +139,9 @@ gfx::GfxObjP FileLoader::NoHandlerFound(const QString& filename)
if(dialog.GetEntityHandler()){
return TryLoadEntity(filename, dialog.GetEntityHandler());
}
if(dialog.GetSequenceHandler()){
return TryLoadAlignment(filename, dialog.GetSequenceHandler());
}
if(dialog.GetSurfaceHandler()){
return TryLoadSurface(filename,dialog.GetSurfaceHandler());
}
......
......@@ -30,7 +30,7 @@
namespace ost { namespace gui {
FileTypeDialog::FileTypeDialog(const QString& file_name, QWidget* parent):
QDialog(parent),entity_handler_(), surf_handler_()
QDialog(parent),entity_handler_(),seq_handler_(), surf_handler_()
#if OST_IMG_ENABLED
,map_handler_()
#endif
......@@ -66,6 +66,13 @@ FileTypeDialog::FileTypeDialog(const QString& file_name, QWidget* parent):
this->AddRow(list_->rowCount(),entity_handler[i]->GetFormatName().c_str(),entity_handler[i]->GetFormatDescription().c_str(),handler);
}
io::AlignmentIOFList alignment_handler = io::IOManager::Instance().GetAvailableAlignmentHandler();
for(unsigned int i = 0 ; i < alignment_handler.size() ; i++){
QVariant handler = QVariant();
handler.setValue(alignment_handler[i]);
this->AddRow(list_->rowCount(),alignment_handler[i]->GetFormatName().c_str(),alignment_handler[i]->GetFormatDescription().c_str(),handler);
}
#if OST_IMG_ENABLED
io::MapIOFList map_handler = io::IOManager::Instance().GetAvailableMapHandler();
for(unsigned int i = 0 ; i < map_handler.size() ; i++){
......@@ -106,6 +113,11 @@ void FileTypeDialog::accept(){
entity_handler_ = ent_handler_fac->Create();
break;
}
io::SequenceIOHandlerFactoryBasePtr seq_handler_fac = variant.value<io::SequenceIOHandlerFactoryBasePtr>();
if(seq_handler_fac){
seq_handler_ = seq_handler_fac->Create();
break;
}
io::SurfaceIOHandlerFactoryBasePtr surf_handler_fac = variant.value<io::SurfaceIOHandlerFactoryBasePtr>();
if(surf_handler_fac){
surf_handler_ = surf_handler_fac->Create();
......@@ -127,6 +139,9 @@ io::EntityIOHandlerP FileTypeDialog::GetEntityHandler(){
return entity_handler_;
}
io::SequenceIOHandlerPtr FileTypeDialog::GetSequenceHandler(){
return seq_handler_;
}
io::SurfaceIOHandlerPtr FileTypeDialog::GetSurfaceHandler(){
return surf_handler_;
......
......@@ -31,6 +31,7 @@
#include <QLabel>
#include <ost/io/entity_io_handler.hh>
#include <ost/io/sequence_io_handler.hh>
#include <ost/io/surface_io_handler.hh>
#if OST_IMG_ENABLED
#include <ost/io/map_io_handler.hh>
......@@ -44,6 +45,7 @@ class DLLEXPORT_OST_GUI FileTypeDialog : public QDialog {
public:
FileTypeDialog(const QString& file_name, QWidget* parent=NULL);
io::EntityIOHandlerP GetEntityHandler();
io::SequenceIOHandlerPtr GetSequenceHandler();
io::SurfaceIOHandlerPtr GetSurfaceHandler();
#if OST_IMG_ENABLED
io::MapIOHandlerPtr GetMapHandler();
......@@ -59,6 +61,7 @@ private:
QTableWidget* list_;
QLabel* label_;
io::EntityIOHandlerP entity_handler_;
io::SequenceIOHandlerPtr seq_handler_;
io::SurfaceIOHandlerPtr surf_handler_;
#if OST_IMG_ENABLED
io::MapIOHandlerPtr map_handler_;
......@@ -69,6 +72,7 @@ private:
}}
Q_DECLARE_METATYPE(ost::io::EntityIOHandlerFactoryBaseP);
Q_DECLARE_METATYPE(ost::io::SequenceIOHandlerFactoryBasePtr);
Q_DECLARE_METATYPE(ost::io::SurfaceIOHandlerFactoryBasePtr);
#if OST_IMG_ENABLED
Q_DECLARE_METATYPE(ost::io::MapIOHandlerFactoryBasePtr);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment