OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
sequence_viewer.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2020 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_SEQUENCE_VIEWER_SEQUENCE_VIEWER
20 #define OST_SEQUENCE_VIEWER_SEQUENCE_VIEWER
21 
22 /*
23  Author: Stefan Scheuber
24  */
25 
26 #ifndef Q_MOC_RUN
27 
29 
30 #include <ost/gfx/scene.hh>
31 #include <ost/gfx/gfx_object.hh>
32 #include <ost/gfx/entity.hh>
33 #include <ost/gui/widget.hh>
34 
35 #include <ost/gui/module_config.hh>
36 
37 
38 #include <QWidget>
39 #include <QActionGroup>
40 #include <QToolBar>
41 #include <QModelIndex>
42 #include <QItemSelection>
43 #endif
44 
45 namespace ost {
46 
47 namespace gui {
48 
49 class SeqSearchBar;
50 class SequenceModel;
51 class SequenceTableView;
52 
53 
56  Q_OBJECT
57 public:
58  SequenceViewer(bool stand_alone=true, bool observe_scene=false,
59  const QString& title="Sequence Viewer",
60  QWidget* parent=NULL);
61  ~SequenceViewer();
62 
63  virtual void SelectionChanged(const gfx::GfxObjP& o, const mol::EntityView& view);
64 
65  virtual void AddEntity(const gfx::EntityP& entity);
66  virtual void RemoveEntity(const gfx::EntityP& entity);
67  void SetObserveScene(bool flag) { observe_scene_=flag; }
68  bool IsObservingScene() const { return observe_scene_; }
69  virtual void AddAlignment(const seq::AlignmentHandle& alignment);
70 
71  void SetAlignment(const seq::AlignmentHandle& alignment);
72 
73  virtual void RemoveAlignment(const seq::AlignmentHandle& alignment);
74 
75  virtual bool Restore(const QString&){ return true; };
76  virtual bool Save(const QString&){ return true; };
77 
78  virtual const QStringList& GetDisplayModes();
79  virtual const QStringList& GetDisplayModes(const seq::AlignmentHandle& alignment);
80  virtual const QStringList& GetDisplayModes(const gfx::EntityP& entity);
81 
82  virtual const QString& GetCurrentDisplayMode();
83  virtual const QString& GetCurrentDisplayMode(const seq::AlignmentHandle& alignment);
84  virtual const QString& GetCurrentDisplayMode(const gfx::EntityP& entity);
85 
86  virtual ActionList GetActions();
87 signals:
88  void AlignmentChanged();
89 public slots:
90  void ChangeDisplayMode(const QString&);
91  void ChangeDisplayMode(const seq::AlignmentHandle&, const QString&);
92  void ChangeDisplayMode(const gfx::EntityP&, const QString&);
93  void DisplayMenu();
94  //internal
95  void OnSearchBarUpdate(const QString&, bool, const QString&);
96 
97 private:
98  virtual void NodeAdded(const gfx::GfxNodeP& node);
99  virtual void NodeRemoved(const gfx::GfxNodeP& node);
100  void FitToContents();
101  void InitActions();
102  void InitView();
103  void InitSearchBar();
104  void InitMenuBar();
105  void UpdateSearchBar();
106  void SelectList(const QModelIndexList& list);
107  QToolBar* toolbar_;
108  SeqSearchBar* seq_search_bar_;
109  SequenceModel* model_;
110  SequenceTableView* seq_table_view_;
111 
112  ActionList action_list_;
113 
114  QActionGroup* display_mode_actions_;
115  bool observe_scene_;
116 private slots:
117  void ChangeDisplayMode();
118  void FindInSequence();
119  void SelectionModelChanged(const QItemSelection&, const QItemSelection&);
120  void DoubleClicked(const QModelIndex& index);
121  void MouseWheelEvent(QWheelEvent* event);
122  void CopyEvent(QKeyEvent* event);
123 
124 };
125 
126 }}
127 
128 #endif
QTableView with first column not moving.
boost::shared_ptr< GfxObj > GfxObjP
void SetObserveScene(bool flag)
boost::shared_ptr< Entity > EntityP
Definition: entity_fw.hh:27
Interface for observing graphical objects.
#define DLLEXPORT_OST_GUI
QList< QAction * > ActionList
Definition: widget.hh:33
virtual bool Save(const QString &)
search bar to search in multiple sequence alignment
Base class for widgets.
Definition: widget.hh:40
bool IsObservingScene() const
virtual bool Restore(const QString &)
definition of EntityView
Definition: entity_view.hh:86
boost::shared_ptr< GfxNode > GfxNodeP
Definition: gfx_node_fw.hh:31
representation of a multiple sequence alignemnt consisting of two or more sequences ...
QTableView with first column not moving.