00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef OST_SEQUENCE_VIEWER_SEQUENCE_VIEWER
00020 #define OST_SEQUENCE_VIEWER_SEQUENCE_VIEWER
00021
00022
00023
00024
00025
00026 #include <QWidget>
00027 #include <QActionGroup>
00028 #include <QToolBar>
00029
00030 #include <ost/seq/alignment_handle.hh>
00031
00032 #include <ost/gfx/scene.hh>
00033 #include <ost/gfx/gfx_object.hh>
00034
00035 #include <ost/gui/widget.hh>
00036
00037 #include <ost/gui/module_config.hh>
00038
00039 #include "sequence_search_bar.hh"
00040 #include "sequence_model.hh"
00041 #include "sequence_table_view.hh"
00042
00043 namespace ost { namespace gui {
00044
00046 class DLLEXPORT_OST_GUI SequenceViewer : public Widget, public gfx::SceneObserver {
00047 Q_OBJECT
00048 public:
00049 SequenceViewer(bool stand_alone=true, QWidget* parent=NULL);
00050 ~SequenceViewer();
00051
00052 virtual void SelectionChanged(const gfx::GfxObjP& o, const mol::EntityView& view);
00053
00054 virtual void AddEntity(const gfx::EntityP& entity);
00055 virtual void RemoveEntity(const gfx::EntityP& entity);
00056
00057 virtual void AddAlignment(const seq::AlignmentHandle& alignment);
00058 virtual void RemoveAlignment(const seq::AlignmentHandle& alignment);
00059
00060 virtual bool Restore(const QString&){return true;};
00061 virtual bool Save(const QString&){return true;};
00062
00063 virtual const QStringList& GetDisplayModes();
00064 virtual const QStringList& GetDisplayModes(const seq::AlignmentHandle& alignment);
00065 virtual const QStringList& GetDisplayModes(const gfx::EntityP& entity);
00066
00067 virtual const QString& GetCurrentDisplayMode();
00068 virtual const QString& GetCurrentDisplayMode(const seq::AlignmentHandle& alignment);
00069 virtual const QString& GetCurrentDisplayMode(const gfx::EntityP& entity);
00070
00071 virtual ActionList GetActions();
00072
00073 public slots:
00074 void ChangeDisplayMode(const QString&);
00075 void ChangeDisplayMode(const seq::AlignmentHandle&, const QString&);
00076 void ChangeDisplayMode(const gfx::EntityP&, const QString&);
00077 void DisplayMenu();
00078
00079 void OnSearchBarUpdate(const QString&, bool, const QString&);
00080
00081 private:
00082 virtual void NodeAdded(const gfx::GfxNodeP& node);
00083 virtual void NodeRemoved(const gfx::GfxNodeP& node);
00084
00085 void InitActions();
00086 void InitView();
00087 void InitSearchBar();
00088 void InitMenuBar();
00089 void UpdateSearchBar();
00090 void SelectList(const QModelIndexList& list);
00091 QToolBar* toolbar_;
00092 SeqSearchBar* seq_search_bar_;
00093 SequenceModel* model_;
00094 SequenceTableView* seq_table_view_;
00095
00096 ActionList action_list_;
00097
00098 QActionGroup* display_mode_actions_;
00099
00100 private slots:
00101 void ChangeDisplayMode();
00102 void FindInSequence();
00103 void SelectionModelChanged(const QItemSelection&, const QItemSelection&);
00104 void DoubleClicked(const QModelIndex& index);
00105 void MouseWheelEvent(QWheelEvent* event);
00106 void CopyEvent(QKeyEvent* event);
00107
00108 };
00109
00110 }}
00111
00112 #endif