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 #ifndef Q_MOC_RUN
00027
00028 #include <ost/seq/alignment_handle.hh>
00029
00030 #include <ost/gfx/scene.hh>
00031 #include <ost/gfx/gfx_object.hh>
00032 #include <ost/gfx/entity.hh>
00033 #include <ost/gui/widget.hh>
00034
00035 #include <ost/gui/module_config.hh>
00036
00037
00038 #include <QWidget>
00039 #include <QActionGroup>
00040 #include <QToolBar>
00041 #include <QModelIndex>
00042 #include <QItemSelection>
00043 #endif
00044
00045 namespace ost {
00046
00047 namespace gui {
00048
00049 class SeqSearchBar;
00050 class SequenceModel;
00051 class SequenceTableView;
00052
00053
00055 class DLLEXPORT_OST_GUI SequenceViewer : public Widget, public gfx::SceneObserver {
00056 Q_OBJECT
00057 public:
00058 SequenceViewer(bool stand_alone=true, bool observe_scene=false,
00059 const QString& title="Sequence Viewer",
00060 QWidget* parent=NULL);
00061 ~SequenceViewer();
00062
00063 virtual void SelectionChanged(const gfx::GfxObjP& o, const mol::EntityView& view);
00064
00065 virtual void AddEntity(const gfx::EntityP& entity);
00066 virtual void RemoveEntity(const gfx::EntityP& entity);
00067 void SetObserveScene(bool flag) { observe_scene_=flag; }
00068 bool IsObservingScene() const { return observe_scene_; }
00069 virtual void AddAlignment(const seq::AlignmentHandle& alignment);
00070
00071 void SetAlignment(const seq::AlignmentHandle& alignment);
00072
00073 virtual void RemoveAlignment(const seq::AlignmentHandle& alignment);
00074
00075 virtual bool Restore(const QString&){ return true; };
00076 virtual bool Save(const QString&){ return true; };
00077
00078 virtual const QStringList& GetDisplayModes();
00079 virtual const QStringList& GetDisplayModes(const seq::AlignmentHandle& alignment);
00080 virtual const QStringList& GetDisplayModes(const gfx::EntityP& entity);
00081
00082 virtual const QString& GetCurrentDisplayMode();
00083 virtual const QString& GetCurrentDisplayMode(const seq::AlignmentHandle& alignment);
00084 virtual const QString& GetCurrentDisplayMode(const gfx::EntityP& entity);
00085
00086 virtual ActionList GetActions();
00087 signals:
00088 void AlignmentChanged();
00089 public slots:
00090 void ChangeDisplayMode(const QString&);
00091 void ChangeDisplayMode(const seq::AlignmentHandle&, const QString&);
00092 void ChangeDisplayMode(const gfx::EntityP&, const QString&);
00093 void DisplayMenu();
00094
00095 void OnSearchBarUpdate(const QString&, bool, const QString&);
00096
00097 private:
00098 virtual void NodeAdded(const gfx::GfxNodeP& node);
00099 virtual void NodeRemoved(const gfx::GfxNodeP& node);
00100 void FitToContents();
00101 void InitActions();
00102 void InitView();
00103 void InitSearchBar();
00104 void InitMenuBar();
00105 void UpdateSearchBar();
00106 void SelectList(const QModelIndexList& list);
00107 QToolBar* toolbar_;
00108 SeqSearchBar* seq_search_bar_;
00109 SequenceModel* model_;
00110 SequenceTableView* seq_table_view_;
00111
00112 ActionList action_list_;
00113
00114 QActionGroup* display_mode_actions_;
00115 bool observe_scene_;
00116 private slots:
00117 void ChangeDisplayMode();
00118 void FindInSequence();
00119 void SelectionModelChanged(const QItemSelection&, const QItemSelection&);
00120 void DoubleClicked(const QModelIndex& index);
00121 void MouseWheelEvent(QWheelEvent* event);
00122 void CopyEvent(QKeyEvent* event);
00123
00124 };
00125
00126 }}
00127
00128 #endif