forked from qt-creator/qt-creator
Android: Merge androidmanifestdocument.* into androidmanifesteditor.cpp
Change-Id: I09ef23d740cefbc49d9c24f0d32cb185029abef0 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -16,7 +16,6 @@ add_qtc_plugin(Android
|
||||
androidextralibrarylistmodel.cpp androidextralibrarylistmodel.h
|
||||
androidglobal.h
|
||||
androidmanager.cpp androidmanager.h
|
||||
androidmanifestdocument.cpp androidmanifestdocument.h
|
||||
androidmanifesteditor.cpp androidmanifesteditor.h
|
||||
androidmanifesteditoriconwidget.cpp androidmanifesteditoriconwidget.h
|
||||
androidmanifesteditoriconcontainerwidget.cpp androidmanifesteditoriconcontainerwidget.h
|
||||
|
@@ -38,8 +38,6 @@ QtcPlugin {
|
||||
"androidglobal.h",
|
||||
"androidmanager.cpp",
|
||||
"androidmanager.h",
|
||||
"androidmanifestdocument.cpp",
|
||||
"androidmanifestdocument.h",
|
||||
"androidmanifesteditoriconwidget.cpp",
|
||||
"androidmanifesteditoriconwidget.h",
|
||||
"androidmanifesteditoriconcontainerwidget.cpp",
|
||||
|
@@ -1,46 +0,0 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "androidmanifestdocument.h"
|
||||
#include "androidmanifesteditor.h"
|
||||
#include "androidconstants.h"
|
||||
|
||||
#include <coreplugin/editormanager/ieditor.h>
|
||||
#include <coreplugin/idocument.h>
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
using namespace Android;
|
||||
using namespace Android::Internal;
|
||||
|
||||
AndroidManifestDocument::AndroidManifestDocument(AndroidManifestEditorWidget *editorWidget)
|
||||
: m_editorWidget(editorWidget)
|
||||
{
|
||||
setId(Constants::ANDROID_MANIFEST_EDITOR_ID);
|
||||
setMimeType(QLatin1String(Constants::ANDROID_MANIFEST_MIME_TYPE));
|
||||
setSuspendAllowed(false);
|
||||
connect(editorWidget, &AndroidManifestEditorWidget::guiChanged,
|
||||
this, &Core::IDocument::changed);
|
||||
}
|
||||
|
||||
bool AndroidManifestDocument::saveImpl(QString *errorString,
|
||||
const Utils::FilePath &filePath,
|
||||
bool autoSave)
|
||||
{
|
||||
m_editorWidget->preSave();
|
||||
bool result = TextDocument::saveImpl(errorString, filePath, autoSave);
|
||||
m_editorWidget->postSave();
|
||||
return result;
|
||||
}
|
||||
|
||||
bool AndroidManifestDocument::isModified() const
|
||||
{
|
||||
return TextDocument::isModified() || m_editorWidget->isModified();
|
||||
}
|
||||
|
||||
bool AndroidManifestDocument::isSaveAsAllowed() const
|
||||
{
|
||||
return false;
|
||||
}
|
@@ -1,31 +0,0 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <texteditor/textdocument.h>
|
||||
|
||||
namespace Android {
|
||||
namespace Internal {
|
||||
|
||||
class AndroidManifestEditorWidget;
|
||||
|
||||
class AndroidManifestDocument : public TextEditor::TextDocument
|
||||
{
|
||||
public:
|
||||
explicit AndroidManifestDocument(AndroidManifestEditorWidget *editorWidget);
|
||||
|
||||
bool isModified() const override;
|
||||
bool isSaveAsAllowed() const override;
|
||||
|
||||
protected:
|
||||
bool saveImpl(QString *errorString,
|
||||
const Utils::FilePath &filePath,
|
||||
bool autoSave = false) override;
|
||||
|
||||
private:
|
||||
AndroidManifestEditorWidget *m_editorWidget;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Android
|
@@ -6,7 +6,6 @@
|
||||
#include "androidconfigurations.h"
|
||||
#include "androidconstants.h"
|
||||
#include "androidmanager.h"
|
||||
#include "androidmanifestdocument.h"
|
||||
#include "androidmanifesteditoriconcontainerwidget.h"
|
||||
#include "androidtr.h"
|
||||
#include "splashscreencontainerwidget.h"
|
||||
@@ -25,6 +24,7 @@
|
||||
#include <projectexplorer/projectwindow.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <texteditor/textdocument.h>
|
||||
#include <texteditor/texteditor.h>
|
||||
#include <texteditor/texteditorconstants.h>
|
||||
|
||||
@@ -1421,6 +1421,41 @@ int PermissionsModel::rowCount(const QModelIndex &parent) const
|
||||
return m_permissions.count();
|
||||
}
|
||||
|
||||
// AndroidManifestDocument
|
||||
|
||||
class AndroidManifestDocument : public TextEditor::TextDocument
|
||||
{
|
||||
public:
|
||||
explicit AndroidManifestDocument(AndroidManifestEditorWidget *editorWidget)
|
||||
: m_editorWidget(editorWidget)
|
||||
{
|
||||
setId(Constants::ANDROID_MANIFEST_EDITOR_ID);
|
||||
setMimeType(QLatin1String(Constants::ANDROID_MANIFEST_MIME_TYPE));
|
||||
setSuspendAllowed(false);
|
||||
connect(editorWidget, &AndroidManifestEditorWidget::guiChanged,
|
||||
this, &Core::IDocument::changed);
|
||||
}
|
||||
|
||||
private:
|
||||
bool isModified() const override
|
||||
{
|
||||
return TextDocument::isModified() || m_editorWidget->isModified();
|
||||
}
|
||||
|
||||
bool isSaveAsAllowed() const override { return false; }
|
||||
|
||||
bool saveImpl(QString *errorString, const FilePath &filePath, bool autoSave = false) override
|
||||
{
|
||||
m_editorWidget->preSave();
|
||||
bool result = TextDocument::saveImpl(errorString, filePath, autoSave);
|
||||
m_editorWidget->postSave();
|
||||
return result;
|
||||
}
|
||||
|
||||
AndroidManifestEditorWidget *m_editorWidget;
|
||||
};
|
||||
|
||||
// AndroidManifestEditorWidget
|
||||
|
||||
AndroidManifestTextEditorWidget::AndroidManifestTextEditorWidget(AndroidManifestEditorWidget *parent)
|
||||
: TextEditor::TextEditorWidget(parent)
|
||||
|
Reference in New Issue
Block a user