okteta: handle API change with Kasten 0.4.0

parent 631210c4
......@@ -9,6 +9,11 @@ SET( kdevokteta_PART_SRCS
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})
......
#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
......@@ -25,10 +25,38 @@
// plugin
#include "oktetadocument.h"
#include "oktetaplugin.h"
#include <config-kdevokteta.h>
// Okteta Kasten
#include <Kasten/Okteta/ByteArrayView>
//#include <Kasten/Okteta/bytearrayrafilesynchronizerfactory.h>
//#include <Kasten/Okteta/overwriteonlycontroller.h>
#if USE_KASTEN_CONTROLLER_FACTORIES
// Okteta Kasten controllers
#include <Kasten/Okteta/OverwriteModeControllerFactory>
#include <Kasten/Okteta/GotoOffsetControllerFactory>
#include <Kasten/Okteta/SelectRangeControllerFactory>
#include <Kasten/Okteta/SearchControllerFactory>
#include <Kasten/Okteta/ReplaceControllerFactory>
#include <Kasten/Okteta/BookmarksControllerFactory>
#include <Kasten/Okteta/PrintControllerFactory>
#include <Kasten/Okteta/ViewConfigControllerFactory>
#include <Kasten/Okteta/ViewModeControllerFactory>
#include <Kasten/Okteta/ViewStatusControllerFactory>
#include <Kasten/Okteta/ViewProfileControllerFactory>
#include <Kasten/Okteta/ViewProfilesManageControllerFactory>
// Kasten controllers
#include <Kasten/ReadOnlyControllerFactory>
#include <Kasten/ClipboardControllerFactory>
#include <Kasten/InsertControllerFactory>
#include <Kasten/CopyAsControllerFactory>
#include <Kasten/ExportControllerFactory>
#include <Kasten/VersionControllerFactory>
#include <Kasten/ZoomControllerFactory>
#include <Kasten/ZoomBarControllerFactory>
#include <Kasten/SelectControllerFactory>
// Kasten
#include <Kasten/AbstractXmlGuiController>
#else
// Okteta Kasten controllers
#include <Kasten/Okteta/OverwriteModeController>
#include <Kasten/Okteta/GotoOffsetController>
#include <Kasten/Okteta/SelectRangeController>
......@@ -41,10 +69,8 @@
#include <Kasten/Okteta/ViewStatusController>
#include <Kasten/Okteta/ViewProfileController>
#include <Kasten/Okteta/ViewProfilesManageController>
// Kasten
// Kasten controllers
#include <Kasten/ReadOnlyController>
// #include <document/readonly/readonlybarcontroller.h>
// #include <io/synchronize/synchronizecontroller.h>
#include <Kasten/ClipboardController>
#include <Kasten/InsertController>
#include <Kasten/CopyAsController>
......@@ -53,6 +79,8 @@
#include <Kasten/ZoomController>
#include <Kasten/ZoomBarController>
#include <Kasten/SelectController>
#endif
// KDevelop
#include <sublime/view.h>
// KF
......@@ -88,38 +116,43 @@ 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<Kasten::StatusBar*>( statusBar() );
// mControllers.append( new ViewStatusController(bottomBar) );
// mControllers.append( new ReadOnlyBarController(bottomBar) );
// mControllers.append( new ZoomBarController(bottomBar) );
foreach( Kasten::AbstractXmlGuiController* controller, mControllers )
controller->setTargetModel( mByteArrayView );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment