Skip to content

Commit 7365301

Browse files
committed
Update project classes
1 parent 48b5f33 commit 7365301

File tree

9 files changed

+937
-24
lines changed

9 files changed

+937
-24
lines changed

src/plugins/coreplugin/project/DspxCheckerRegistry.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Core {
1313

1414
class DspxCheckerRegistryPrivate;
1515

16-
class DspxCheckerRegistry : public IDspxChecker {
16+
class CORE_EXPORT DspxCheckerRegistry : public IDspxChecker {
1717
Q_OBJECT
1818
Q_DECLARE_PRIVATE(DspxCheckerRegistry)
1919
public:

src/plugins/coreplugin/project/DspxDocument.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#include <QObject>
55
#include <qqmlintegration.h>
66

7+
#include <coreplugin/coreglobal.h>
8+
79
namespace dspx {
810
class Model;
911
}
@@ -12,7 +14,7 @@ namespace Core {
1214

1315
class DspxDocumentPrivate;
1416

15-
class DspxDocument : public QObject {
17+
class CORE_EXPORT DspxDocument : public QObject {
1618
Q_OBJECT
1719
QML_ELEMENT
1820
Q_DECLARE_PRIVATE(DspxDocument)

src/plugins/coreplugin/project/DspxInspectorDialog.cpp

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -141,23 +141,32 @@ namespace Core {
141141
d->problemTreeView->model()->deleteLater();
142142
d->problemTreeView->setModel(nullptr);
143143
}
144+
if (d->fileStructureTreeView->model()) {
145+
d->fileStructureTreeView->model()->deleteLater();
146+
d->fileStructureTreeView->setModel(nullptr);
147+
}
144148
auto problemModel = new QStandardItemModel(this);
145149
d->problemTreeView->setModel(problemModel);
146-
QFile f(d->path);
147-
if (!f.open(QIODevice::ReadOnly)) {
148-
addErrorItem(
149-
problemModel,
150-
tr("Fatal: Failed to open file"),
151-
{},
152-
style()->standardIcon(QStyle::SP_MessageBoxCritical),
153-
{
154-
{tr("Path"), d->path},
155-
{tr("Error code"), f.error()},
156-
{tr("Error text"), f.errorString()}
157-
}
158-
);
159-
} else {
150+
auto fileStructureModel = new QStandardItemModel(this);
151+
d->fileStructureTreeView->setModel(fileStructureModel);
152+
do {
153+
QFile f(d->path);
154+
if (!f.open(QIODevice::ReadOnly)) {
155+
addErrorItem(
156+
problemModel,
157+
tr("Fatal: Failed to open file"),
158+
{},
159+
style()->standardIcon(QStyle::SP_MessageBoxCritical),
160+
{
161+
{tr("Path"), d->path},
162+
{tr("Error code"), f.error()},
163+
{tr("Error text"), f.errorString()}
164+
}
165+
);
166+
break;
167+
}
160168
auto data = f.readAll();
169+
161170
QDspx::SerializationErrorList errors;
162171
auto dspxModel = QDspx::Serializer::deserialize(data, errors, QDspx::Serializer::CheckError | QDspx::Serializer::CheckWarning);
163172
for (const auto &error : errors) {
@@ -368,7 +377,8 @@ namespace Core {
368377
}
369378
}
370379
}
371-
380+
if (errors.containsFatal())
381+
break;
372382
if (dspxModel.content.global.editorId != CoreInterface::dspxEditorId()) {
373383
addErrorItem(
374384
problemModel,
@@ -406,11 +416,10 @@ namespace Core {
406416
);
407417
}
408418

409-
// TODO show file structure
410-
}
411-
419+
} while (false);
412420

413421
d->problemTreeView->resizeColumnToContents(0);
422+
d->fileStructureTreeView->resizeColumnToContents(0);
414423
if (problemModel->rowCount() != 0) {
415424
d->tabWidget->setCurrentIndex(1);
416425
}

src/plugins/coreplugin/project/DspxInspectorDialog.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
#include <QDialog>
55
#include <qqmlintegration.h>
66

7+
#include <coreplugin/coreglobal.h>
8+
79
namespace Core {
810

911
class DspxInspectorDialogPrivate;
1012

11-
class DspxInspectorDialog : public QDialog {
13+
class CORE_EXPORT DspxInspectorDialog : public QDialog {
1214
Q_OBJECT
1315
QML_ELEMENT
1416
Q_DECLARE_PRIVATE(DspxInspectorDialog)

0 commit comments

Comments
 (0)