|
28 | 28 |
|
29 | 29 | from libqfieldsync.layer import LayerSource, SyncAction |
30 | 30 | from libqfieldsync.offline_converter import ExportType |
31 | | -from libqfieldsync.project_checker import ProjectChecker |
| 31 | +from libqfieldsync.project_checker import ( |
| 32 | + Feedback, |
| 33 | + FeedbackResult, |
| 34 | + ProjectChecker, |
| 35 | + ProjectCheckerFeedback, |
| 36 | +) |
32 | 37 | from libqfieldsync.utils.file_utils import get_unique_empty_dirname |
33 | 38 | from libqfieldsync.utils.qgis import get_qgis_files_within_dir |
34 | 39 | from qgis.core import Qgis, QgsApplication, QgsProject, QgsProviderRegistry |
|
56 | 61 | from qfieldsync.core.preferences import Preferences |
57 | 62 | from qfieldsync.gui.checker_feedback_table import CheckerFeedbackTable |
58 | 63 | from qfieldsync.gui.storage_widget import StorageWidget |
59 | | -from qfieldsync.utils.file_utils import filesizeformat10 |
| 64 | +from qfieldsync.utils.file_utils import filesizeformat10, open_qgis_file |
60 | 65 | from qfieldsync.utils.qt_utils import make_folder_selector, make_icon, make_pixmap |
61 | 66 |
|
62 | 67 | CloudTransferDialogUi, _ = loadUiType( |
@@ -267,6 +272,33 @@ def show_project_compatibility_page(self): |
267 | 272 | if self.cloud_project and self.cloud_project.is_current_qgis_project: |
268 | 273 | checker = ProjectChecker(QgsProject.instance()) |
269 | 274 | feedback = checker.check(ExportType.Cloud) |
| 275 | + elif ( |
| 276 | + self.cloud_project |
| 277 | + and self.cloud_project.local_project_file |
| 278 | + and self.cloud_project.local_project_file.local_path |
| 279 | + ): |
| 280 | + feedback = ProjectCheckerFeedback() |
| 281 | + is_qgis_version_4 = False |
| 282 | + with open_qgis_file( |
| 283 | + self.cloud_project.local_project_file.local_path |
| 284 | + ) as f: |
| 285 | + for _i in range(2): |
| 286 | + if 'version="4.' in str(f.readline().strip()): |
| 287 | + is_qgis_version_4 = True |
| 288 | + break |
| 289 | + |
| 290 | + if is_qgis_version_4: |
| 291 | + feedback.add( |
| 292 | + Feedback( |
| 293 | + Feedback.Level.ERROR, |
| 294 | + FeedbackResult( |
| 295 | + self.tr( |
| 296 | + "QFieldCloud does not yet support projects saved using QGIS >= 4.0. " |
| 297 | + "Please configure your projects using QGIS 3.44 until further notice." |
| 298 | + ) |
| 299 | + ), |
| 300 | + ) |
| 301 | + ) |
270 | 302 |
|
271 | 303 | if feedback and feedback.count > 0: |
272 | 304 | # check whether the widget has already been added the guard from adding twice due to repeated showEvent signal |
|
0 commit comments