comparison MainWindow.h @ 1:0b3630a29ad8

Initial version based on previous repository. Project was ported to QT6 and in now cmake based.
author Ideenmodellierer <tiefenrauscher@web.de>
date Thu, 27 Nov 2025 18:40:28 +0100
parents
children
comparison
equal deleted inserted replaced
0:76ccd6ce50c0 1:0b3630a29ad8
1 //////////////////////////////////////////////////////////////////////////////
2 /// \file MainWindow.h
3 /// \brief GUI for OSTC Companion.
4 /// \author JD Gascuel.
5 ///
6 /// \copyright (c) 2011-2014 JD Gascuel. All rights reserved.
7 /// $Id$
8 //////////////////////////////////////////////////////////////////////////////
9 //
10 // BSD 2-Clause License:
11 //
12 // Redistribution and use in source and binary forms, with or without
13 // modification, are permitted provided that the following conditions
14 // are met:
15 //
16 // 1. Redistributions of source code must retain the above copyright notice,
17 // this list of conditions and the following disclaimer.
18 //
19 // 2. Redistributions in binary form must reproduce the above copyright notice,
20 // this list of conditions and the following disclaimer in the documentation
21 // and/or other materials provided with the distribution.
22 //
23 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
33 // THE POSSIBILITY OF SUCH DAMAGE.
34 //
35 //////////////////////////////////////////////////////////////////////////////
36 // HISTORY
37 // 2013-03-17 : [jDG] Initial version.
38 // 2013-03-26 : [jDG] Added scan feature for HW factory programming.
39 // 2014-07-07 : [jDG] Cleanups for Subsurface google-summer-of-code.
40 // 2014-07-25 : [jDG] BSD 2-clause license.
41
42 #ifndef MAINWINDOW_H
43 #define MAINWINDOW_H
44
45 #include <QMainWindow>
46
47 namespace Ui {
48 class MainWindow;
49 }
50 class HardwareOperations;
51 class QProgressBar;
52
53 //////////////////////////////////////////////////////////////////////////////
54 /// \brief GUI for OSTC Companion.
55 ///
56 /// Implement the *Companion* user interface.
57 ///
58 class MainWindow : public QMainWindow
59 {
60 Q_OBJECT
61 Ui::MainWindow* _ui; ///< Compiled interface.
62 HardwareOperations* _op; ///< Driver for the connected dive computer.
63
64 //------------------------------------------------------------------------
65 /// \brief Update buttons enable/disable state.
66 /// According to connection status (not/normal/service), and high level
67 /// commands supported by a given computer model.
68 void updateStatus();
69
70 //------------------------------------------------------------------------
71 /// \brief Display a message on the embedded console.
72 ///
73 void statusMessage(const QString &msg);
74 friend class LogWindow;
75
76 //------------------------------------------------------------------------
77 /// \brief Manage asynchronous ProgressEvent events.
78 ///
79 bool event(QEvent *e) override;
80
81 public:
82 //////////////////////////////////////////////////////////////////////////
83 /// \brief Constructor.
84 ///
85 /// Starts everything, and instanciate the driver found in settings.
86 MainWindow();
87
88 //------------------------------------------------------------------------
89 /// \brief Destructor.
90 /// Release interface and driver.
91 ~MainWindow();
92
93 //------------------------------------------------------------------------
94 /// \brief Handle Language changes.
95 /// Re-apply translations to all interface elements.
96 void retranslate();
97
98 public slots:
99 /// \brief User changed computer model.
100 void changeTypeSlot();
101
102 /// \brief Pop SettingsDialog preferences interface.
103 void settingsSlot();
104
105 /// \brief Try to connect to the device.
106 void connectSlot();
107
108 /// \brief Try to set Date & Time on the connected device.
109 void dateSlot();
110
111 /// \brief Try to change custom text on the connected device.
112 void nameSlot();
113
114 /// \brief Try to set custom image on the connected device.
115 void iconSlot();
116
117 /// \brief Try to upgrade firmware of the connected device.
118 void upgradeSlot();
119
120 /// \brief Close current connection to the device.
121 void closeSlot();
122 private slots:
123 void on_signalButton_clicked();
124 void on_editLog_clicked();
125 };
126
127 #endif // MAINWINDOW_H