Commit Graph

36 Commits

Author SHA1 Message Date
Jarek Kobus
9dd3ab12f5 tst_settings.cpp: Get rid of Utils namespace specifier
We are already using namespace Utils in this file.

Change-Id: I6e2f431029bbc27f425be2ad618a98733b618222
Reviewed-by: hjk <hjk@qt.io>
2024-01-11 10:53:18 +00:00
Alessandro Portale
f96feadad0 Fix missing overrides and redundant virtual
Change-Id: Id2a247b6032602c2295d928067c2462d3f9b5221
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-11-14 14:27:45 +00:00
hjk
41184bc9fc Utils: Use numberedKey(Key, int) more wildly
Will ease transition to a key class that doen's have ::number()

Change-Id: Ib2f2957c916f41b0731a2033422bfbf7e429bcc8
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-08-30 09:57:23 +00:00
hjk
621a2850d0 Utils etc: More use of Key and Store
Change-Id: Idd2d70617f775d783aee93a2fe82544ad335a739
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-08-24 08:51:00 +00:00
hjk
3edc491b2a Utils: Simplify SettingsAccessor constructors
Use setters instead.

Change-Id: I912234fa832eeb80519740ca011921f1e71d70b4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-04-26 06:32:52 +00:00
hjk
aeac83af78 Utils: Collapse the two SettingsAccessor constructor hierarchies
Change-Id: I7b659c9e3c66700cfc92f9cfbd9df0535a1ca655
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-04-26 06:24:19 +00:00
hjk
b4a6af026e Utils: Remove displayName from SettingsAccessors
It was not used.

Change-Id: I7c0927698bf31548ec076c39881561d72e8495e6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-04-26 06:23:21 +00:00
Alessandro Portale
6138414813 Tests: Remove a couple of tr() calls
No need to have them translatable and to risk lupdating them.

Change-Id: I41c84240ed30ffb6e19ab133422f4e5fb3a97aa4
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-02-10 16:27:08 +00:00
Kai Köhne
56baf8c058 Remove GPL-3.0+ from license identifiers
Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0,
this applies only to a hypothetical newer version of GPL, that doesn't
exist yet. If such a version emerges, we can still decide to relicense...

While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only

Change was done by running

  find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \;

Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-06 11:15:13 +00:00
Eike Ziller
04e50438eb Utils: Remove Utils::optional
Since we are now requiring macOS 10.14 we can remove our local
implementation of optional and use std::optional for macOS too.

Change-Id: I2bd018261b68da64f7f031a812045dd7784697e1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2022-09-01 06:58:04 +00:00
Lucie Gérard
a7956df3ca Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.

Task-number: QTBUG-67283
Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-08-26 12:27:18 +00:00
Eike Ziller
737877984d Use QTEST_GUILESS_MAIN where applicable
instead of QTEST_MAIN. Reduces the initialization that is done by the Qt
test applications, and can also reduce interference with normal OS
operations like the current window loosing focus.

Change-Id: If88f289281aa1c8703ac7d4dbe0799d067c16588
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-06-13 06:06:44 +00:00
hjk
7c28c4f744 Utils: Introduce a FilePath constructor from char arrays
Similar to QT_RESTRICTED_CAST_FROM_ASCII to avoid the need for
decorations in user code.

At the same time, drop some convenience constructors and functions
in CommandLine and Icon essentially serving the same purpose.

Change-Id: Ida4e5ac19c2da0a4298a97b2a8e1511d56bbb79d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-17 05:34:10 +00:00
hjk
e109b731ad Utils: Rename FilePathList to simply FilePaths
The exact storage type does not really matter here.

Change-Id: Iefec40f0f5909c8e7ba3415db4a11962694e1b38
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-12-18 08:43:18 +00:00
Christian Stenger
39aa325245 Fix compile after FileName drop
Amends 44acfc0702.

Change-Id: I1bddb0642e181b0a02d4ecba7ff1ae282218338f
Reviewed-by: hjk <hjk@qt.io>
2019-07-24 09:47:26 +00:00
hjk
251287f0d3 Avoid warning on empty expressions
For some reason, Q_UNUSED includes already a semicolon, adding one
on the user side creates an additional empty statement.

Change-Id: I9c5e8fac381345a60792cb75e2938fd53958d3b0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-07-23 11:55:59 +00:00
hjk
473a741c9f Utils: Rename FileName to FilePath
More in line with QFileInfo terminonlogy which appears to be
best-of-breed within Qt.

Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-28 12:23:26 +00:00
Tobias Hunger
4786c5928a SettingsAccessor: Rename BasicSettingsAccessor to SettingsAccessor
Rename BasicSettingsAccessor to SettingsAccessor, now that the name
is available again.

Change-Id: I49473f0c701976f992209f06d48decf047ab19de
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-02-15 13:14:32 +00:00
Tobias Hunger
6445fb19bb Settings: Add test to pick right file if several exist
Test picking the expected file when several exist in
BackingUpSettingsAccessor.

Change-Id: I09d346a98a8df13d6cf3ee53ee20ce34e45e8d28
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-02-14 13:24:26 +00:00
Tobias Hunger
97cf4bb278 SettingsAccessor: Improve test by mocking out read/write operations
Change-Id: I4d4cf6ff0be3d4b8278a7613c26f2b1752304ad4
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-02-14 13:24:11 +00:00
Tobias Hunger
b95bbe1d57 SettingsAccessor: Extract functionality to merge settings
Move functionality related to merging settings into MergingSettingsAccessor,
move code specific to the .user-files into UserFileAccessor.

Remove SettingsAccessor class, now that all code has been moved out of it.

This patch changes the merge mechanism a bit: It used to upgrade
the user and tha shared file to the higher version of these two, merge,
and then upgrade the merged result to the newest version.

Now it upgrades both the user as well as the shared file to the newest
version and only merges afterwards.

Change-Id: I2a1605cbe9b9fb1404fcfa9954a9f3410da0abb1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-02-14 13:23:33 +00:00
Tobias Hunger
9ffd52f9c5 SettingsAccessor: Extract upgrading functionality
Extract upgrading functionality from SettingsAccessor into
UpgradingSettingsAccessor.

Fixes surprising behavior in test
ProjectExplorerPlugin::testUserFileAccessor_prepareToReadSettingsObsoleteVersionNewVersion
where the Version was thrown away.

Also adds a error/warning distinction to BasicSettingsAccessor::Issue,
so that the non-critical ones can be ignored later.

Change-Id: Ia38d074f91cd8d8f820f9bec96d3330d748564c7
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-02-14 13:23:25 +00:00
Tobias Hunger
23bb717101 SettingsAccessor: Extract handling of backups
Extract the code that handles backups from the SettingsAccessor into
a BackingUpSettingsAccessor.

Move code up from SettingsAccessor into UserFileAccessor where it belongs.
This became possible due to the extraction.

Change-Id: Icacaa4e7231b3c0c520154c76f9338227f96a614
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-02-13 12:21:33 +00:00
Tobias Hunger
21e7e9ea3b Settingsaccessor: Extract file access and error reporting
Move file access and error reporting out of SettingsAccessor and into
BasicSettingsAccessor.

Change-Id: If6cc9157c1a532f117c48b929c05f55d89a339eb
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-01-15 14:28:01 +00:00
Tobias Hunger
ee834b7e2f SettingsAccessor: Add setters to VersionUpgrader
Add setters to VersionUpgrader and use them. This shortens the
implementation classes a bit.

Change-Id: I5ffe6f085752bf39bbcb08c286844cc1088eeea5
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2017-11-30 10:40:53 +00:00
Christian Stenger
c2e92d3925 Tests: Fix compile with Qt5.6 + gcc4.9
Change-Id: Ic8d6c660cf4d5d185642dcad52753b4da9e70120
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-11-22 13:39:40 +00:00
Tobias Hunger
2e62690dcd SettingsAccessor: Do not hard-code document type
Change-Id: Ied886eac9fcb4a9c58f088c32ee5ba0646b94fbc
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2017-11-22 12:28:19 +00:00
Tobias Hunger
1aaed7477e SettingsAccessor: Add tests to save/load values
Change-Id: I08870a91c725eb6c5344545d8d829fc98a3231bc
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2017-11-22 12:28:13 +00:00
Tobias Hunger
0a202e4c29 SettingsAccessor: Use optional as return value of findIssues
Change-Id: Ib7ef8ec408f812a71735939514d98cf8755d292b
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2017-11-22 11:59:08 +00:00
Tobias Hunger
6044b84e14 SettingsAccessor: Add tests for findIssues
Change-Id: Ib78c2c93dc9404087efe485fdaaad69595aa0125
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2017-11-22 11:59:02 +00:00
Tobias Hunger
b8f2d746d0 SettingsAccessor: Add methods to upgrade to a specific version
Change-Id: If368f4a35d3702dbf680b1306ca6311070aa9bb5
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2017-11-22 11:58:56 +00:00
Tobias Hunger
5d6c2ca159 SettingsAccessor: Do not change data on invalid upgrade attempts
Make sure that the input data is returned unchanged if an invalid update
attempt is attempted.

Update tests accordingly.

Change-Id: If5c410bf1a757f984593bda871763af64d8dd972
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2017-11-22 11:58:50 +00:00
Tobias Hunger
9246a77a2f SettingsAccessor: Add tests for version upgrading
Change-Id: Ie41433b507bdd68b834a6fc1879f3f1b71f7b4ff
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2017-11-22 11:58:41 +00:00
Tobias Hunger
0269503dd8 SettingsAccessor: Improve SettingsAccessor::isBetterMatch
Improve the behavior of isBetterMatch, so that it now handles
invalid versions as well as invalid ids. Simplify code where possible.

Change-Id: I2e65c0cc01d32fa77df8b5ec0d62b765e6c458f7
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-11-22 10:16:25 +00:00
Tobias Hunger
cacab453f7 SettingsAccessor: Add test for version upgrader registration
Change-Id: I04195b84b551333ef34f0f193d5c2237ad1c86c6
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-11-22 08:59:48 +00:00
Tobias Hunger
eda0daec81 SettingsAccessor: Add test
Change-Id: I872dffb6489ba5dbb766e9a9a924eb199254b0cf
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-11-20 15:10:34 +00:00