diff --git a/plugins/okteta/CMakeLists.txt b/plugins/okteta/CMakeLists.txt index ef2a5ea539..e1cd0f2f22 100644 --- a/plugins/okteta/CMakeLists.txt +++ b/plugins/okteta/CMakeLists.txt @@ -1,24 +1,29 @@ add_definitions(-DTRANSLATION_DOMAIN=\"kdevokteta\") SET( kdevokteta_PART_SRCS kastentoolviewwidget.cpp oktetatoolviewfactory.cpp oktetaplugin.cpp oktetadocument.cpp oktetaview.cpp oktetawidget.cpp ) +if (NOT KastenCore_VERSION VERSION_LESS 0.4.0) + set(USE_KASTEN_CONTROLLER_FACTORIES TRUE) +endif() +configure_file(config-kdevokteta.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kdevokteta.h) + qt5_add_resources(kdevokteta_PART_SRCS kdevokteta.qrc) kdevplatform_add_plugin(kdevokteta JSON kdevokteta.json SOURCES ${kdevokteta_PART_SRCS}) TARGET_LINK_LIBRARIES( kdevokteta KDev::Interfaces KDev::Project KDev::Sublime KDev::Shell KF5::WidgetsAddons OktetaKastenControllers KastenControllers ) diff --git a/plugins/okteta/config-kdevokteta.h.cmake b/plugins/okteta/config-kdevokteta.h.cmake new file mode 100644 index 0000000000..7424e79d6c --- /dev/null +++ b/plugins/okteta/config-kdevokteta.h.cmake @@ -0,0 +1,8 @@ +#ifndef CONFIG_KDEVOKTETA_H +#define CONFIG_KDEVOKTETA_H + +/* config-kdevokteta.h. Generated by cmake from config-kdevokteta.h.cmake */ + +#cmakedefine01 USE_KASTEN_CONTROLLER_FACTORIES + +#endif // CONFIG_KDEVOKTETA_H diff --git a/plugins/okteta/oktetawidget.cpp b/plugins/okteta/oktetawidget.cpp index 5c1ba3b4d5..4aad944695 100644 --- a/plugins/okteta/oktetawidget.cpp +++ b/plugins/okteta/oktetawidget.cpp @@ -1,132 +1,165 @@ /* This file is part of the KDevelop Okteta module, part of the KDE project. Copyright 2010 Friedrich W. H. Kossebau This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 6 of version 3 of the license. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ #include "oktetawidget.h" // plugin #include "oktetadocument.h" #include "oktetaplugin.h" +#include // Okteta Kasten #include -//#include -//#include + +#if USE_KASTEN_CONTROLLER_FACTORIES +// Okteta Kasten controllers +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// Kasten controllers +#include +#include +#include +#include +#include +#include +#include +#include +#include +// Kasten +#include +#else +// Okteta Kasten controllers #include #include #include #include #include #include #include #include #include #include #include #include -// Kasten +// Kasten controllers #include -// #include -// #include #include #include #include #include #include #include #include #include +#endif + // KDevelop #include // KF #include #include #include // Qt #include #include namespace KDevelop { OktetaWidget::OktetaWidget( QWidget* parent, Kasten::ByteArrayView* byteArrayView, OktetaPlugin* plugin ) : QWidget( parent ), KXMLGUIClient(), mByteArrayView( byteArrayView ) { setComponentName( QStringLiteral("kdevokteta") , QStringLiteral("KDevelop Okteta")); setXMLFile( QStringLiteral("kdevokteta.rc") ); setupActions(plugin); QVBoxLayout* layout = new QVBoxLayout( this ); layout->setMargin( 0 ); QWidget* widget = mByteArrayView->widget(); layout->addWidget( widget ); setFocusProxy( widget ); } void OktetaWidget::setupActions(OktetaPlugin* plugin) { Kasten::ByteArrayViewProfileManager* viewProfileManager = plugin->viewProfileManager(); mControllers = { +#if USE_KASTEN_CONTROLLER_FACTORIES + Kasten::VersionControllerFactory().create(this), + Kasten::ReadOnlyControllerFactory().create(this), + Kasten::ZoomControllerFactory().create(this), + Kasten::SelectControllerFactory().create(this), + Kasten::ClipboardControllerFactory().create(this), + Kasten::OverwriteModeControllerFactory().create(this), + Kasten::SearchControllerFactory(this).create(this), + Kasten::ReplaceControllerFactory(this).create(this), + Kasten::BookmarksControllerFactory().create(this), + Kasten::PrintControllerFactory().create(this), + Kasten::ViewConfigControllerFactory().create(this), + Kasten::ViewModeControllerFactory().create(this), + Kasten::ViewProfileControllerFactory(viewProfileManager, mByteArrayView->widget()).create(this), + Kasten::ViewProfilesManageControllerFactory(viewProfileManager, mByteArrayView->widget()).create(this), +#else new Kasten::VersionController(this), new Kasten::ReadOnlyController(this), - // TODO: save_as -// mControllers.append( new ExportController(mProgram->viewManager(),mProgram->documentManager(),this) ); new Kasten::ZoomController(this), new Kasten::SelectController(this), new Kasten::ClipboardController(this), -// if( modus != BrowserViewModus ) -// mControllers.append( new Kasten::InsertController(mProgram->viewManager(),mProgram->documentManager(),this) ); -// mControllers.append( new Kasten::CopyAsController(mProgram->viewManager(),mProgram->documentManager(),this) ); new Kasten::OverwriteModeController(this), new Kasten::SearchController(this,this), new Kasten::ReplaceController(this,this), -// mControllers.append( new Kasten::GotoOffsetController(mGroupedViews,this) ); -// mControllers.append( new Kasten::SelectRangeController(mGroupedViews,this) ); new Kasten::BookmarksController(this), new Kasten::PrintController(this), new Kasten::ViewConfigController(this), new Kasten::ViewModeController(this), new Kasten::ViewProfileController(viewProfileManager, mByteArrayView->widget(), this), new Kasten::ViewProfilesManageController(this, viewProfileManager, mByteArrayView->widget()), +#endif }; // update the text of the viewprofiles_manage action, to make clear this is just for byte arrays QAction* viewprofilesManageAction = actionCollection()->action(QStringLiteral("settings_viewprofiles_manage")); viewprofilesManageAction->setText( i18nc("@action:inmenu", "Manage Byte Array View Profiles...") ); -// Kasten::StatusBar* bottomBar = static_cast( statusBar() ); -// mControllers.append( new ViewStatusController(bottomBar) ); -// mControllers.append( new ReadOnlyBarController(bottomBar) ); -// mControllers.append( new ZoomBarController(bottomBar) ); - foreach( Kasten::AbstractXmlGuiController* controller, mControllers ) controller->setTargetModel( mByteArrayView ); } OktetaWidget::~OktetaWidget() { qDeleteAll( mControllers ); } }