File: xyscanWindow.h

package info (click to toggle)
xyscan 4.68-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,660 kB
  • sloc: cpp: 4,079; xml: 65; makefile: 11
file content (181 lines) | stat: -rw-r--r-- 4,202 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
//-----------------------------------------------------------------------------
//  Copyright (C) 2002-2021 Thomas S. Ullrich
//
//  This file is part of "xyscan".
//
//  This file may be used under the terms of the GNU General Public License.
//  This project is free software; you can redistribute it and/or modify it
//  under the terms of the GNU General Public License.
//  
//  Author: Thomas S. Ullrich
//  Last update: Oct 11, 2021
//-----------------------------------------------------------------------------
#ifndef xyscanWindow_h
#define xyscanWindow_h

#include <ctime>
#include <utility>
#include <QSoundEffect>
#include <QString>
#include "xyscanUpdater.h"
#include "xyscanBaseWindow.h"

class QListWidget;
class QMenu;
class QLineEdit;
class QPushButton;
class QRadioButton;
class QComboBox;
class QGraphicsPixmapItem;
class QGraphicsLineItem;
class QGraphicsPathItem;
class QGraphicsSceneDragDropEvent;
class QDoubleSpinBox;
class QLabel;
class QToolBox;
class QCheckBox;
class QGridLayout;
class QShortcut;
class xyscanHelpBrowser;
class xyscanUpdater;
class xyscanGraphicsView;
class xyscanDataTable;
class xyscanErrorBarScanModeToolBox;
class xyscanScanTasksHandler;

using namespace std;

class xyscanWindow : public xyscanBaseWindow
{
    Q_OBJECT

public:
    xyscanWindow();
    ~xyscanWindow();
 
    void openFromFile(const QString&);

    friend xyscanScanTasksHandler;

protected:
    bool eventFilter(QObject*, QEvent*);
    void closeEvent(QCloseEvent*);

private slots:
    // File menu
    void open();
    void openRecent();
    void clearHistory();
    void save();
    void print();
    void finish();
    
    // Edit
    void editCrosshairColor();
    void editMarkerColor();
    void editPathColor();
    void editComment();
    void pasteImage(); 
    
    // View
    void showPrecision();
    
    // Help menu
    void checkForUpdates();
    void about();
    void help();
    
    // Setting markers and define their coordinates
    void setPlotCoordinateValueForMarker(int markerType);
    
    // Axis scale, image scale and rotation ange
    void rotateImage(double);
    void scaleImage(double);
    void zoomScale(double);
    void updateWhenAxisScaleChanged();

    // Drops
    void loadDroppedFile(QString);
    
    // Updater
    void userWasRemindedOfAvailableUpdate();
    void updateSignificantDigits(QAction*);
    
    // Transparency and screen scan
    void enableScreenScan(bool);
    
    // Measuring
    void enableMeasuring(bool);
    void enablePathMeasuring(bool);
    void updateMeasureDisplay();
    void measurementController(bool = false);
    void normalizeUserScale();
    void clearMeasuredPath();

    // Developer
    void loadCalibrationPlot(bool = false);

    // Histogramming
    void updateHistogramDisplay();

private:
    void connectMenuActions();
    void connectToolBoxActions();
    void connectDockingWidgets();
    void createSettingMarkerActions();

    void loadSettings();
    void writeSettings();
    
    void loadPixmap(QPixmap*);
    void updatePixelDisplay();
    void updateZoomDisplay();
    void updateStatusBarCoordinateDisplay();
    void updatePlotCoordinateDisplay();
    void enableSignificantDigitsMenu(bool);
    void ensureCursorVisible();
    void handleKeyEvent(QKeyEvent*);
    bool readyForScan();
    int  numberOfMarkersSet();
    void resetMarker();

    pair<double, double> measureDistance(QPointF&, QPointF&);

    bool checkForUnsavedData();

    QPointF scan(QPointF* = nullptr);

private:    
    QString mOpenFileDirectory;
    QString mSaveFileDirectory;
    QString mCurrentSource;
    
    QStringList mRecentFiles;
    
    QGraphicsPixmapItem *mCurrentPixmap;
    QImage *mCurrentShadowImage;

    QSoundEffect mSoundEffect;
    
    QShortcut *mCalibrationLinPlotShortcut;
    QShortcut *mCalibrationLogPlotShortcut;

    xyscanUpdater mUpdater;
    
    xyscanScanTasksHandler *mScanTasksHandler;

    QDateTime mLastReminderTime;

    const double mPointMarkerOffset = 0.5;

    double  mMarkerPixel[4];
    double  mMarkerPlotCoordinate[4];
    double  mMeasureUserScale;
    double  mMeasurePathLength;

    bool mScreenScanIsOn;
    bool mMeasuringIsOn; 
};

#endif