1 /* Copyright (c) 2015 Gerald Knizia 2 * 3 * This file is part of the IboView program (see: http://www.iboview.org) 4 * 5 * IboView is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, version 3. 8 * 9 * IboView is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with bfint (LICENSE). If not, see http://www.gnu.org/licenses/ 16 * 17 * Please see IboView documentation in README.txt for: 18 * -- A list of included external software and their licenses. The included 19 * external software's copyright is not touched by this agreement. 20 * -- Notes on re-distribution and contributions to/further development of 21 * the IboView software 22 */ 23 24 #ifndef IV_EDIT_FRAMES_FORM 25 #define IV_EDIT_FRAMES_FORM 26 27 #include <QDialog> 28 #include <QCloseEvent> 29 #include <QAbstractTableModel> 30 // #include "IvStatusBar.h" 31 32 namespace Ui{ 33 class EditFramesForm; 34 } 35 36 class FDocument; 37 class FFrameListModel; 38 39 typedef std::vector<int> 40 FFrameIndexList; 41 42 class FFrameListModel : public QAbstractTableModel 43 { 44 Q_OBJECT 45 public: 46 typedef QAbstractTableModel 47 FBase; 48 int rowCount(const QModelIndex &parent = QModelIndex()) const; 49 int columnCount(const QModelIndex &parent = QModelIndex()) const; 50 QVariant headerData(int section, Qt::Orientation orientation, int role) const; 51 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; 52 bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); 53 54 QModelIndex makeRowIndex(int iRow); 55 public: 56 FFrameListModel(FDocument *pDocument_, QObject *Parent_); 57 ~FFrameListModel(); 58 public slots: 59 // forwarded from FDocument 60 void parentLayoutAboutToBeChanged(); 61 void parentLayoutChanged(); 62 protected: 63 FDocument 64 *m_pDocument; 65 void ConnectForwardSignals(); 66 }; 67 68 69 class FEditFramesForm : public QDialog 70 { 71 Q_OBJECT 72 73 Ui::EditFramesForm *ui; 74 FDocument 75 *m_pDocument; 76 public: 77 explicit FEditFramesForm(FDocument *document, QWidget *parent=0); 78 ~FEditFramesForm(); 79 80 void DoPostProcessingOnClose(); 81 public slots: 82 void moveFramesUp(); 83 void moveFramesDown(); 84 void moveFramesToTop(); 85 void moveFramesToBottom(); 86 void reverseFrameOrder(); 87 void deleteFrames(); 88 89 void alignFrames(); 90 91 void UpdateExcludedAtoms(); 92 protected: 93 FFrameListModel 94 *m_pFrameList; 95 bool 96 // set if we changed the order or orientation of frames such that it 97 // may be required to re-link the orbital visual configurations 98 m_OrbitalRelinkNeeded; 99 100 void SetNewFrameOrder(FFrameIndexList const &NewIndices, bool UpdateSelection=true); 101 FFrameIndexList GetBaseFrameOrder(); 102 FFrameIndexList GetSelectedFrameIndices(); 103 104 // void closeEvent(QCloseEvent *event); // override 105 }; 106 107 108 #endif // IV_EDIT_FRAMES_FORM 109