comparison SettingsDialog.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 SettingsDialog.h
3 /// \brief Preference dialog 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] Copyed and adapted from OSTC Planner.
38 // 2014-07-07 : [jDG] Cleanups for Subsurface google-summer-of-code.
39 // 2014-07-25 : [jDG] BSD 2-clause license.
40
41 //////////////////////////////////////////////////////////////////////////////
42 // Import Qt GUI
43
44 namespace Ui { class Settings; }
45
46 #include <QDialog>
47
48 class HardwareOperations;
49 class QAbstractButton;
50 class QSettings;
51
52 //////////////////////////////////////////////////////////////////////////////
53 /// \brief Implement preference dialog for OSTC Companion.
54 class Settings
55 : public QDialog
56 {
57 Q_OBJECT
58 Ui::Settings* _ui;
59 HardwareOperations* _op;
60
61 void changeEvent(QEvent *e);
62
63 public:
64 Settings(QWidget* parent, HardwareOperations *op);
65 ~Settings();
66
67 static QString language;
68 static QString port;
69 static QString currentPath;
70
71 /// Setup date and time when connecting.
72 static bool autoSetDateTime;
73
74 /// Skip version check to make development easier
75 static bool forceFirmwareUpdate;
76 static bool forceRTEUpdate;
77 static bool forceFontlibUpdate;
78 static bool useFastMode;
79
80 /// \brief restore preferences from settings
81 static void reload(Settings *);
82
83 /// \brief Save preferences to settings.
84 static void save();
85
86 /// \brief update Qt translators for language.
87 static void setLanguage();
88
89 public slots:
90 /// \brief dynamically change application's translation.
91 void languageSlot(int i);
92
93 /// \brief redo list of available ports.
94 void updatePortsSlot();
95
96 /// \brief save changes to settings.
97 void accept();
98
99 /// \brief restore saved preferences.
100 void reject();
101
102 /// \brief Reset all settings to default values
103 void resetSettingsSlot();
104 };