diff options
author | Samuel Ghinet <samuel.ghinet@qt.io> | 2022-09-14 15:14:17 +0300 |
---|---|---|
committer | Samuel Ghinet <samuel.ghinet@qt.io> | 2022-09-23 11:21:03 +0000 |
commit | e46431f7dffa7599ff1b3ff2ca817400eaaf6670 (patch) | |
tree | 6c3089786c4125d5236f41783e416c5d70f278c2 | |
parent | a7c15838e24514be4024ecc076978f91e1285559 (diff) | |
download | qt-creator-e46431f7dffa7599ff1b3ff2ca817400eaaf6670.tar.gz |
QDS New Project Dialog: Remove Warning that UserPresets.json was not read
Task-number: QDS-7679
Change-Id: I639a8323b3860f3dfb5f4287267a014aaa95dc63
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
-rw-r--r-- | src/plugins/studiowelcome/userpresets.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/plugins/studiowelcome/userpresets.cpp b/src/plugins/studiowelcome/userpresets.cpp index e32c010bd6..1a3a7feb6b 100644 --- a/src/plugins/studiowelcome/userpresets.cpp +++ b/src/plugins/studiowelcome/userpresets.cpp @@ -43,7 +43,14 @@ FileStoreIo::FileStoreIo(const QString &fileName) QByteArray FileStoreIo::read() const { - m_file->open(QFile::ReadOnly | QFile::Text); + if (!m_file->exists()) + return {}; + + if (!m_file->open(QFile::ReadOnly | QFile::Text)) { + qWarning() << "Cannot load User Preset(s)"; + return {}; + } + QByteArray data = m_file->readAll(); m_file->close(); @@ -52,7 +59,11 @@ QByteArray FileStoreIo::read() const void FileStoreIo::write(const QByteArray &data) { - m_file->open(QFile::WriteOnly | QFile::Text); + if (!m_file->open(QFile::WriteOnly | QFile::Text)) { + qWarning() << "Cannot save User Preset(s)"; + return; + } + m_file->write(data); m_file->close(); } |