2013-06-17 13:55:31 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2013-06-17 13:55:31 +02:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2013-06-17 13:55:31 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
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"
|
|
|
|
|
#include "sidebysidediffeditorwidget.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,
|
|
|
|
|
[](IEditor *e) { return static_cast<DiffEditor *>(e)->leftEditorWidget(); }
|
|
|
|
|
},
|
|
|
|
|
rightHandler {
|
|
|
|
|
Constants::DIFF_EDITOR_ID,
|
2020-06-26 13:59:38 +02:00
|
|
|
Utils::Id(Constants::SIDE_BY_SIDE_VIEW_ID).withSuffix(2),
|
2020-02-05 17:51:41 +01:00
|
|
|
TextEditorActionHandler::None,
|
|
|
|
|
[](Core::IEditor *e) { return static_cast<DiffEditor *>(e)->rightEditorWidget(); }
|
|
|
|
|
}
|
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
|