-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Qsettings #828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Qsettings #828
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
214a368
Add QSettings ReadFunc and WriteFunc
kain88-de 0e54d44
Add MixxxSettings as QSettings wrapper
kain88-de d06af6b
Enable MixxxSettings with wrong configFile.
kain88-de 538d973
Use windows friendly qsettings filename
kain88-de c8ba85c
Enable Fallback-mode everytime
kain88-de f77c242
Rename MixxxSettings to UserSettings
kain88-de File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| #include <gmock/gmock.h> | ||
| #include <gtest/gtest.h> | ||
| #include <QFile> | ||
| #include <QTemporaryFile> | ||
|
|
||
| #include "test/mixxxtest.h" | ||
|
|
||
| #include "util/config-parser.h" | ||
|
|
||
| const QString kConfigLocation(QDir::currentPath() + | ||
| "/src/test/settings-dummy-data/mixxx.cfg"); | ||
|
|
||
| TEST(QSETTINGS, readConfigtest) { | ||
| QSettings::SettingsMap map; | ||
| QFile configFile(kConfigLocation); | ||
| EXPECT_TRUE(configFile.open(QIODevice::ReadOnly)); | ||
| EXPECT_TRUE(readConfig(configFile, map)); | ||
| EXPECT_EQ(265, map.size()); | ||
| } | ||
|
|
||
| TEST(QSETTINGS, writeConfigtest) { | ||
| QSettings::SettingsMap map; | ||
| QFile configFile(kConfigLocation); | ||
| EXPECT_TRUE(configFile.open(QIODevice::ReadOnly)); | ||
| EXPECT_TRUE(readConfig(configFile, map)); | ||
|
|
||
| QTemporaryFile saveFile; | ||
| saveFile.open(); | ||
| writeConfig(saveFile, map); | ||
| saveFile.close(); | ||
|
|
||
| auto map2 = QSettings::SettingsMap(); | ||
| saveFile.open(); | ||
| readConfig(saveFile, map2); | ||
|
|
||
| EXPECT_EQ(map.size(), map2.size()); | ||
|
|
||
| for (const auto& key : map.keys()) { | ||
| EXPECT_QSTRING_EQ(map[key].toString(), map2[key].toString()); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
qsettings is unused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a proof of concept. No setting has been switched so far. It should only show how qsettings can be used to replace the old system and still be backwards compatible.