forked from qt-creator/qt-creator
Android: Merge manifesteditorwidget.* into manifesteditor.* (1/2)
This is the first part, actually merging the opposite direction. Second part will rename the result. This are, also in total, much smaller patches then doing it directly. Change-Id: I76cf3e3b5d71390c746aeff6b412d535ea7f520f Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -17,7 +17,6 @@ add_qtc_plugin(Android
|
|||||||
androidglobal.h
|
androidglobal.h
|
||||||
androidmanager.cpp androidmanager.h
|
androidmanager.cpp androidmanager.h
|
||||||
androidmanifestdocument.cpp androidmanifestdocument.h
|
androidmanifestdocument.cpp androidmanifestdocument.h
|
||||||
androidmanifesteditor.cpp androidmanifesteditor.h
|
|
||||||
androidmanifesteditorwidget.cpp androidmanifesteditorwidget.h
|
androidmanifesteditorwidget.cpp androidmanifesteditorwidget.h
|
||||||
androidmanifesteditoriconwidget.cpp androidmanifesteditoriconwidget.h
|
androidmanifesteditoriconwidget.cpp androidmanifesteditoriconwidget.h
|
||||||
androidmanifesteditoriconcontainerwidget.cpp androidmanifesteditoriconcontainerwidget.h
|
androidmanifesteditoriconcontainerwidget.cpp androidmanifesteditoriconcontainerwidget.h
|
||||||
|
@@ -40,8 +40,6 @@ QtcPlugin {
|
|||||||
"androidmanager.h",
|
"androidmanager.h",
|
||||||
"androidmanifestdocument.cpp",
|
"androidmanifestdocument.cpp",
|
||||||
"androidmanifestdocument.h",
|
"androidmanifestdocument.h",
|
||||||
"androidmanifesteditor.cpp",
|
|
||||||
"androidmanifesteditor.h",
|
|
||||||
"androidmanifesteditoriconwidget.cpp",
|
"androidmanifesteditoriconwidget.cpp",
|
||||||
"androidmanifesteditoriconwidget.h",
|
"androidmanifesteditoriconwidget.h",
|
||||||
"androidmanifesteditoriconcontainerwidget.cpp",
|
"androidmanifesteditoriconcontainerwidget.cpp",
|
||||||
|
@@ -1,112 +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 "androidconstants.h"
|
|
||||||
#include "androidmanifestdocument.h"
|
|
||||||
#include "androidmanifesteditor.h"
|
|
||||||
#include "androidmanifesteditorwidget.h"
|
|
||||||
#include "androidtr.h"
|
|
||||||
|
|
||||||
#include <texteditor/texteditorconstants.h>
|
|
||||||
|
|
||||||
#include <QActionGroup>
|
|
||||||
#include <QToolBar>
|
|
||||||
#include <QTextBlock>
|
|
||||||
|
|
||||||
namespace Android::Internal {
|
|
||||||
|
|
||||||
AndroidManifestEditor::AndroidManifestEditor(AndroidManifestEditorWidget *editorWidget)
|
|
||||||
: m_toolBar(nullptr)
|
|
||||||
{
|
|
||||||
m_toolBar = new QToolBar(editorWidget);
|
|
||||||
m_actionGroup = new QActionGroup(this);
|
|
||||||
connect(m_actionGroup, &QActionGroup::triggered,
|
|
||||||
this, &AndroidManifestEditor::changeEditorPage);
|
|
||||||
|
|
||||||
QAction *generalAction = m_toolBar->addAction(Tr::tr("General"));
|
|
||||||
generalAction->setData(AndroidManifestEditorWidget::General);
|
|
||||||
generalAction->setCheckable(true);
|
|
||||||
m_actionGroup->addAction(generalAction);
|
|
||||||
|
|
||||||
QAction *sourceAction = m_toolBar->addAction(Tr::tr("XML Source"));
|
|
||||||
sourceAction->setData(AndroidManifestEditorWidget::Source);
|
|
||||||
sourceAction->setCheckable(true);
|
|
||||||
m_actionGroup->addAction(sourceAction);
|
|
||||||
|
|
||||||
generalAction->setChecked(true);
|
|
||||||
|
|
||||||
setWidget(editorWidget);
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *AndroidManifestEditor::toolBar()
|
|
||||||
{
|
|
||||||
return m_toolBar;
|
|
||||||
}
|
|
||||||
|
|
||||||
AndroidManifestEditorWidget *AndroidManifestEditor::ownWidget() const
|
|
||||||
{
|
|
||||||
return static_cast<AndroidManifestEditorWidget *>(widget());
|
|
||||||
}
|
|
||||||
|
|
||||||
Core::IDocument *AndroidManifestEditor::document() const
|
|
||||||
{
|
|
||||||
return textEditor()->textDocument();
|
|
||||||
}
|
|
||||||
|
|
||||||
TextEditor::TextEditorWidget *AndroidManifestEditor::textEditor() const
|
|
||||||
{
|
|
||||||
return ownWidget()->textEditorWidget();
|
|
||||||
}
|
|
||||||
|
|
||||||
int AndroidManifestEditor::currentLine() const
|
|
||||||
{
|
|
||||||
return textEditor()->textCursor().blockNumber() + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int AndroidManifestEditor::currentColumn() const
|
|
||||||
{
|
|
||||||
QTextCursor cursor = textEditor()->textCursor();
|
|
||||||
return cursor.position() - cursor.block().position() + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AndroidManifestEditor::gotoLine(int line, int column, bool centerLine)
|
|
||||||
{
|
|
||||||
textEditor()->gotoLine(line, column, centerLine);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AndroidManifestEditor::changeEditorPage(QAction *action)
|
|
||||||
{
|
|
||||||
if (!ownWidget()->setActivePage(static_cast<AndroidManifestEditorWidget::EditorPage>(action->data().toInt()))) {
|
|
||||||
const QList<QAction *> actions = m_actionGroup->actions();
|
|
||||||
for (QAction *action : actions) {
|
|
||||||
if (action->data().toInt() == ownWidget()->activePage()) {
|
|
||||||
action->setChecked(true);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Factory
|
|
||||||
|
|
||||||
class AndroidManifestEditorFactory final : public Core::IEditorFactory
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
AndroidManifestEditorFactory()
|
|
||||||
{
|
|
||||||
setId(Constants::ANDROID_MANIFEST_EDITOR_ID);
|
|
||||||
setDisplayName(Tr::tr("Android Manifest editor"));
|
|
||||||
addMimeType(Constants::ANDROID_MANIFEST_MIME_TYPE);
|
|
||||||
setEditorCreator([] {
|
|
||||||
auto androidManifestEditorWidget = new AndroidManifestEditorWidget;
|
|
||||||
return androidManifestEditorWidget->editor();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
void setupAndroidManifestEditor()
|
|
||||||
{
|
|
||||||
static AndroidManifestEditorFactory theAndroidManifestEditorFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // Android::Internal
|
|
@@ -1,45 +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 "androidmanifestdocument.h"
|
|
||||||
#include "androidmanifesteditorwidget.h"
|
|
||||||
|
|
||||||
#include <coreplugin/editormanager/ieditor.h>
|
|
||||||
#include <texteditor/texteditor.h>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QToolBar;
|
|
||||||
class QActionGroup;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace Android::Internal {
|
|
||||||
|
|
||||||
class AndroidManifestEditor : public Core::IEditor
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit AndroidManifestEditor(AndroidManifestEditorWidget *editorWidget);
|
|
||||||
|
|
||||||
QWidget *toolBar() override;
|
|
||||||
Core::IDocument *document() const override;
|
|
||||||
TextEditor::TextEditorWidget *textEditor() const;
|
|
||||||
|
|
||||||
int currentLine() const override;
|
|
||||||
int currentColumn() const override;
|
|
||||||
void gotoLine(int line, int column = 0, bool centerLine = true) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
AndroidManifestEditorWidget *ownWidget() const;
|
|
||||||
void changeEditorPage(QAction *action);
|
|
||||||
|
|
||||||
QString m_displayName;
|
|
||||||
QToolBar *m_toolBar;
|
|
||||||
QActionGroup *m_actionGroup;
|
|
||||||
};
|
|
||||||
|
|
||||||
void setupAndroidManifestEditor();
|
|
||||||
|
|
||||||
} // Android::Internal
|
|
@@ -5,7 +5,6 @@
|
|||||||
#include "androidconstants.h"
|
#include "androidconstants.h"
|
||||||
#include "androidmanager.h"
|
#include "androidmanager.h"
|
||||||
#include "androidmanifestdocument.h"
|
#include "androidmanifestdocument.h"
|
||||||
#include "androidmanifesteditor.h"
|
|
||||||
#include "androidmanifesteditoriconcontainerwidget.h"
|
#include "androidmanifesteditoriconcontainerwidget.h"
|
||||||
#include "androidmanifesteditorwidget.h"
|
#include "androidmanifesteditorwidget.h"
|
||||||
#include "androidtr.h"
|
#include "androidtr.h"
|
||||||
@@ -26,6 +25,7 @@
|
|||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
|
|
||||||
#include <texteditor/texteditor.h>
|
#include <texteditor/texteditor.h>
|
||||||
|
#include <texteditor/texteditorconstants.h>
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
@@ -33,12 +33,12 @@
|
|||||||
#include <utils/stylehelper.h>
|
#include <utils/stylehelper.h>
|
||||||
#include <utils/utilsicons.h>
|
#include <utils/utilsicons.h>
|
||||||
|
|
||||||
|
#include <QActionGroup>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDomDocument>
|
#include <QDomDocument>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
@@ -50,13 +50,14 @@
|
|||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
|
#include <QTextBlock>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QToolBar>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
#include <QXmlStreamReader>
|
#include <QXmlStreamReader>
|
||||||
#include <QXmlStreamWriter>
|
#include <QXmlStreamWriter>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <limits>
|
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
@@ -101,6 +102,28 @@ private:
|
|||||||
QStringList m_permissions;
|
QStringList m_permissions;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class AndroidManifestEditor : public Core::IEditor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit AndroidManifestEditor(AndroidManifestEditorWidget *editorWidget);
|
||||||
|
|
||||||
|
QWidget *toolBar() override;
|
||||||
|
Core::IDocument *document() const override;
|
||||||
|
TextEditor::TextEditorWidget *textEditor() const;
|
||||||
|
|
||||||
|
int currentLine() const override;
|
||||||
|
int currentColumn() const override;
|
||||||
|
void gotoLine(int line, int column = 0, bool centerLine = true) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
AndroidManifestEditorWidget *ownWidget() const;
|
||||||
|
void changeEditorPage(QAction *action);
|
||||||
|
|
||||||
|
QString m_displayName;
|
||||||
|
QToolBar *m_toolBar;
|
||||||
|
QActionGroup *m_actionGroup;
|
||||||
|
};
|
||||||
|
|
||||||
class AndroidManifestTextEditorWidget : public TextEditor::TextEditorWidget
|
class AndroidManifestTextEditorWidget : public TextEditor::TextEditorWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -1415,5 +1438,100 @@ AndroidManifestTextEditorWidget::AndroidManifestTextEditorWidget(AndroidManifest
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// AndroidManifestEditor
|
||||||
|
|
||||||
|
AndroidManifestEditor::AndroidManifestEditor(AndroidManifestEditorWidget *editorWidget)
|
||||||
|
: m_toolBar(nullptr)
|
||||||
|
{
|
||||||
|
m_toolBar = new QToolBar(editorWidget);
|
||||||
|
m_actionGroup = new QActionGroup(this);
|
||||||
|
connect(m_actionGroup, &QActionGroup::triggered,
|
||||||
|
this, &AndroidManifestEditor::changeEditorPage);
|
||||||
|
|
||||||
|
QAction *generalAction = m_toolBar->addAction(Tr::tr("General"));
|
||||||
|
generalAction->setData(AndroidManifestEditorWidget::General);
|
||||||
|
generalAction->setCheckable(true);
|
||||||
|
m_actionGroup->addAction(generalAction);
|
||||||
|
|
||||||
|
QAction *sourceAction = m_toolBar->addAction(Tr::tr("XML Source"));
|
||||||
|
sourceAction->setData(AndroidManifestEditorWidget::Source);
|
||||||
|
sourceAction->setCheckable(true);
|
||||||
|
m_actionGroup->addAction(sourceAction);
|
||||||
|
|
||||||
|
generalAction->setChecked(true);
|
||||||
|
|
||||||
|
setWidget(editorWidget);
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget *AndroidManifestEditor::toolBar()
|
||||||
|
{
|
||||||
|
return m_toolBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
AndroidManifestEditorWidget *AndroidManifestEditor::ownWidget() const
|
||||||
|
{
|
||||||
|
return static_cast<AndroidManifestEditorWidget *>(widget());
|
||||||
|
}
|
||||||
|
|
||||||
|
Core::IDocument *AndroidManifestEditor::document() const
|
||||||
|
{
|
||||||
|
return textEditor()->textDocument();
|
||||||
|
}
|
||||||
|
|
||||||
|
TextEditor::TextEditorWidget *AndroidManifestEditor::textEditor() const
|
||||||
|
{
|
||||||
|
return ownWidget()->textEditorWidget();
|
||||||
|
}
|
||||||
|
|
||||||
|
int AndroidManifestEditor::currentLine() const
|
||||||
|
{
|
||||||
|
return textEditor()->textCursor().blockNumber() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int AndroidManifestEditor::currentColumn() const
|
||||||
|
{
|
||||||
|
QTextCursor cursor = textEditor()->textCursor();
|
||||||
|
return cursor.position() - cursor.block().position() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AndroidManifestEditor::gotoLine(int line, int column, bool centerLine)
|
||||||
|
{
|
||||||
|
textEditor()->gotoLine(line, column, centerLine);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AndroidManifestEditor::changeEditorPage(QAction *action)
|
||||||
|
{
|
||||||
|
if (!ownWidget()->setActivePage(static_cast<AndroidManifestEditorWidget::EditorPage>(action->data().toInt()))) {
|
||||||
|
const QList<QAction *> actions = m_actionGroup->actions();
|
||||||
|
for (QAction *action : actions) {
|
||||||
|
if (action->data().toInt() == ownWidget()->activePage()) {
|
||||||
|
action->setChecked(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Factory
|
||||||
|
|
||||||
|
class AndroidManifestEditorFactory final : public Core::IEditorFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AndroidManifestEditorFactory()
|
||||||
|
{
|
||||||
|
setId(Constants::ANDROID_MANIFEST_EDITOR_ID);
|
||||||
|
setDisplayName(Tr::tr("Android Manifest editor"));
|
||||||
|
addMimeType(Constants::ANDROID_MANIFEST_MIME_TYPE);
|
||||||
|
setEditorCreator([] {
|
||||||
|
auto androidManifestEditorWidget = new AndroidManifestEditorWidget;
|
||||||
|
return androidManifestEditorWidget->editor();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void setupAndroidManifestEditor()
|
||||||
|
{
|
||||||
|
static AndroidManifestEditorFactory theAndroidManifestEditorFactory;
|
||||||
|
}
|
||||||
|
|
||||||
} // Android::Internal
|
} // Android::Internal
|
||||||
|
@@ -140,4 +140,6 @@ private:
|
|||||||
QTabWidget *m_advanvedTabWidget = nullptr;
|
QTabWidget *m_advanvedTabWidget = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void setupAndroidManifestEditor();
|
||||||
|
|
||||||
} // Android::Internal
|
} // Android::Internal
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
#include "androiddebugsupport.h"
|
#include "androiddebugsupport.h"
|
||||||
#include "androiddeployqtstep.h"
|
#include "androiddeployqtstep.h"
|
||||||
#include "androiddevice.h"
|
#include "androiddevice.h"
|
||||||
#include "androidmanifesteditor.h"
|
#include "androidmanifesteditorwidget.h"
|
||||||
#include "androidpackageinstallationstep.h"
|
#include "androidpackageinstallationstep.h"
|
||||||
#include "androidpotentialkit.h"
|
#include "androidpotentialkit.h"
|
||||||
#include "androidqmltoolingsupport.h"
|
#include "androidqmltoolingsupport.h"
|
||||||
|
Reference in New Issue
Block a user