2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2013-06-17 13:55:31 +02:00
|
|
|
|
|
|
|
|
#include "diffeditor.h"
|
|
|
|
|
#include "diffeditorconstants.h"
|
2014-08-21 21:12:04 +02:00
|
|
|
#include "diffeditordocument.h"
|
2014-01-30 14:27:50 +01:00
|
|
|
#include "diffeditorfactory.h"
|
2013-06-17 13:55:31 +02:00
|
|
|
|
2017-05-09 12:19:11 +02:00
|
|
|
#include "texteditor/texteditoractionhandler.h"
|
|
|
|
|
|
2013-06-17 13:55:31 +02:00
|
|
|
#include <QCoreApplication>
|
|
|
|
|
|
2020-02-05 17:51:41 +01:00
|
|
|
using namespace Core;
|
|
|
|
|
using namespace TextEditor;
|
2020-06-26 13:59:38 +02:00
|
|
|
using namespace Utils;
|
2020-02-05 17:51:41 +01:00
|
|
|
|
2013-06-17 13:55:31 +02:00
|
|
|
namespace DiffEditor {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2020-02-05 17:51:41 +01:00
|
|
|
DiffEditorFactory::DiffEditorFactory() :
|
|
|
|
|
descriptionHandler {
|
|
|
|
|
Constants::DIFF_EDITOR_ID,
|
|
|
|
|
Constants::C_DIFF_EDITOR_DESCRIPTION,
|
|
|
|
|
TextEditorActionHandler::None,
|
|
|
|
|
[](IEditor *e) { return static_cast<DiffEditor *>(e)->descriptionWidget(); }
|
|
|
|
|
},
|
|
|
|
|
unifiedHandler {
|
|
|
|
|
Constants::DIFF_EDITOR_ID,
|
|
|
|
|
Constants::UNIFIED_VIEW_ID,
|
|
|
|
|
TextEditorActionHandler::None,
|
|
|
|
|
[](IEditor *e) { return static_cast<DiffEditor *>(e)->unifiedEditorWidget(); }
|
|
|
|
|
},
|
|
|
|
|
leftHandler {
|
|
|
|
|
Constants::DIFF_EDITOR_ID,
|
|
|
|
|
Id(Constants::SIDE_BY_SIDE_VIEW_ID).withSuffix(1),
|
|
|
|
|
TextEditorActionHandler::None,
|
2022-09-29 14:25:34 +02:00
|
|
|
[](IEditor *e) { return static_cast<DiffEditor *>(e)->sideEditorWidget(LeftSide); }
|
2020-02-05 17:51:41 +01:00
|
|
|
},
|
|
|
|
|
rightHandler {
|
|
|
|
|
Constants::DIFF_EDITOR_ID,
|
2022-06-03 15:19:02 +02:00
|
|
|
Id(Constants::SIDE_BY_SIDE_VIEW_ID).withSuffix(2),
|
2020-02-05 17:51:41 +01:00
|
|
|
TextEditorActionHandler::None,
|
2022-09-29 14:25:34 +02:00
|
|
|
[](Core::IEditor *e) { return static_cast<DiffEditor *>(e)->sideEditorWidget(RightSide); }
|
2020-02-05 17:51:41 +01:00
|
|
|
}
|
2013-06-17 13:55:31 +02:00
|
|
|
{
|
2013-08-12 11:21:58 +02:00
|
|
|
setId(Constants::DIFF_EDITOR_ID);
|
2017-04-24 17:01:10 +02:00
|
|
|
setDisplayName(QCoreApplication::translate("DiffEditorFactory", Constants::DIFF_EDITOR_DISPLAY_NAME));
|
2014-02-13 16:43:28 +01:00
|
|
|
addMimeType(Constants::DIFF_EDITOR_MIMETYPE);
|
2020-02-04 18:16:57 +01:00
|
|
|
setEditorCreator([] { return new DiffEditor(new DiffEditorDocument); });
|
2013-06-17 13:55:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace DiffEditor
|