| 1 | |
| 2 | /**************************************************************************** |
| 3 | ** |
| 4 | ** Copyright (C) 2011 Christian B. Huebschle & George M. Sheldrick |
| 5 | ** All rights reserved. |
| 6 | ** Contact: [email protected] |
| 7 | ** |
| 8 | ** This file is part of the ShelXle |
| 9 | ** |
| 10 | ** This file may be used under the terms of the GNU Lesser |
| 11 | ** General Public License version 2.1 as published by the Free Software |
| 12 | ** Foundation and appearing in the file COPYING included in the |
| 13 | ** packaging of this file. Please review the following information to |
| 14 | ** ensure the GNU Lesser General Public License version 2.1 requirements |
| 15 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
| 16 | ** |
| 17 | ** |
| 18 | ****************************************************************************/ |
| 19 | #ifndef HISTORYWIDGET_H |
| 20 | #define HISTORYWIDGET_H |
| 21 | |
| 22 | #include <QWidget> |
| 23 | #if (QT_VERSION >= 0x050000) |
| 24 | #include <QtWidgets> |
| 25 | #endif |
| 26 | #include <QDateTime> |
| 27 | #include <QMap> |
| 28 | #include "itsme.h" |
| 29 | /*! \brief HistoryWidget is a widget which shows previous versions as bars with a height and color corresoponding to the R-value |
| 30 | * of the previous refinement. |
| 31 | * |
| 32 | * R-Values are read from the file and the remark there after HKLF statement. If this remarks are missing no bar shows up. |
| 33 | * Clicking on a bar loads that previous file version. Hovering a bar gives some mor details about the refinement. |
| 34 | * A short preview of the file version can be displayed. |
| 35 | * |
| 36 | */ |
| 37 | class HistoryWidget : public QWidget { |
| 38 | Q_OBJECT |
| 39 | public: |
| 40 | explicit HistoryWidget(QWidget *parent = 0); |
| 41 | QList<double> RWerte;//!< List of R1 values |
| 42 | QMap<int,double> FreeWerte;//!< List of R1Free values |
| 43 | QList<double> RallWerte;//!< List of Rall values |
| 44 | QList<int> gooddata;//!< Number of reflections above a sigma cutoff |
| 45 | QList<int> alldata;//!< Totol number of reflections |
| 46 | QList<int> parameters;//!< number of refined parameters |
| 47 | QStringList saveFilesList;//!< File name list of previous versions |
| 48 | QList<QDateTime> dateTimesList;//!< List of file dates |
| 49 | void setPath(QString dirName, int width);//!< sets the path to the resfile and the history sub directory. |
| 50 | QColor rwert_farbverlauf(double wrt); |
| 51 | signals: |
| 52 | void message(const QString &);//!< emitts a text to the status bar |
| 53 | void lofi(const QString &);//!< load a file version |
| 54 | void saveHist();//!< a more prominent place for the SaveHistory ... |
| 55 | public slots: |
| 56 | void preview();//!< previewv of the first 30 lines |
| 57 | void preview2();//!< preview the next 30 lines |
| 58 | void prune();//!< delete older file versions and keep only the newest ten |
| 59 | void deleteOne();//!< delete a individual file version from the list |
| 60 | protected: |
| 61 | void paintEvent(QPaintEvent *event); |
| 62 | bool event(QEvent *event); |
| 63 | void mousePressEvent ( QMouseEvent * event ); |
| 64 | void mouseMoveEvent ( QMouseEvent * event ); |
| 65 | // void wheelEvent ( QWheelEvent * event ); |
| 66 | private: |
| 67 | size_t gesamtGr; |
| 68 | int maxwid; |
| 69 | int fh;//font height |
| 70 | QString dirname; |
| 71 | }; |
| 72 | |
| 73 | #endif // HISTORYWIDGET_H |