interfaces: remove hex editor interface

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-02-17 14:31:37 +02:00
parent 82cdec9ed4
commit bdbc5faab6
8 changed files with 0 additions and 643 deletions

View file

@ -5,7 +5,6 @@ project(interfaces)
add_subdirectory( ktexteditor )
add_subdirectory( kregexpeditor )
add_subdirectory( terminal )
add_subdirectory( khexedit )
add_subdirectory( kspeech )
########### install files ###############

View file

@ -1,17 +0,0 @@
########### install files ###############
install(
FILES
byteseditinterface.h
valuecolumninterface.h
charcolumninterface.h
zoominterface.h
clipboardinterface.h
DESTINATION ${KDE4_INCLUDE_INSTALL_DIR}/khexedit
)
install(
FILES
kbytesedit.desktop
DESTINATION ${KDE4_SERVICETYPES_INSTALL_DIR}
)

View file

@ -1,175 +0,0 @@
/***************************************************************************
byteseditinterface.h - description
-------------------
begin : Fri Sep 12 2003
copyright : (C) 2003 by Friedrich W. H. Kossebau
email : kossebau@kde.org
***************************************************************************/
/***************************************************************************
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License version 2 as published by the Free Software Foundation. *
* *
***************************************************************************/
#ifndef KHE_BYTESEDITINTERFACE_H
#define KHE_BYTESEDITINTERFACE_H
// KDE
#include <kservicetypetrader.h>
// Qt
#include <QtGui/QWidget>
/**
* @short KHE (short for KHexEdit) is KDE's namespace for all things related
* to the viewing/editing of bytes.
*/
namespace KHE
{
/**
* @short An interface for a hex edit editor/viewer for arrays of byte
*
* \code
* KHE::BytesEditInterface *BytesEdit = KHE::bytesEditInterface( BytesEditWidget );
* \endcode
*
* It can be used in different ways:
* <ul>
* <li> as an viewer for array char* Data, sized DataSize
* \code
* BytesEdit->setData( Data, DataSize );
* BytesEdit->setReadOnly( true );
* \endcode
*
* <li> as an editor for a given array of bytes with a fixed size
* \code
* BytesEdit->setData( Data, DataSize );
* BytesEdit->setOverWriteOnly( true );
* \endcode
*
* <li> as an editor for a given array of bytes with a limited size
* \code
* BytesEdit->setData( Data, DataSize, -1, false );
* BytesEdit->setMaxDataSize( MaxDataSize );
* BytesEdit->setOverWriteMode( false );
* \endcode
*
* <li> as an editor for a new to be created array of chars, max. with MaxDataSize
* \code
* BytesEdit->setMaxDataSize( MaxDataSize );
* ...
* QByteArray BA;
* BA.setRawData( BytesEdit->data(), BytesEdit->dataSize() );
* \endcode
* </ul>
*
* @author Friedrich W. H. Kossebau <kossebau@kde.org>
* @see createBytesEditWidget(), bytesEditInterface()
*/
class BytesEditInterface
{
public:
virtual ~BytesEditInterface() {}
public: // set methods
/** hands over to the editor a new byte array.
* If there exists an old one and autodelete is set the old one gets deleted.
* @param D pointer to memory
* @param S size of used memory
* @param RS real size of the memory, -1 means S is the real size
* @param KM keep the memory on resize (RS is the maximum size)
*/
virtual void setData( char *D, int S, int RS = -1, bool KM = true ) = 0;
/** sets whether the given array should be handled read only or not. Default is false. */
virtual void setReadOnly( bool RO = true ) = 0;
/** sets the maximal size of the actual byte array. If the actual array is already larger
* it will not be modified but there can be only done non-inserting actions
* until the array's is below the limit
* If the flag KeepsMemory is set MaxDataSize is limited to the real size of the array.
* MaxDataSize == -1 means no limit.
* Default is -1.
* @param MS new maximal data size
*/
virtual void setMaxDataSize( int MS ) = 0;
/** sets whether the array should be deleted on the widget's end or if a new array is set.
* Default is false
*/
virtual void setAutoDelete( bool AD = true ) = 0;
/** switches the array */
// virtual void resetData( char *D, int S, bool Repaint ) = 0;
/** sets whether the actual memory used to store the data
* (as given by setData or in the constructor, or allocated by the class)
* should be kept on resize.
* If MaxDataSize is set and greater than the raw size of the memory
* it is limited to the raw size.
* Default is false.
*/
virtual void setKeepsMemory( bool KM = true ) = 0;
//
/** sets whether the widget is overwriteonly or not. Default is false. */
virtual void setOverwriteOnly( bool b ) = 0;
/** sets whether the widget is in overwrite mode or not. Default is true. */
virtual void setOverwriteMode( bool b ) = 0;
/** sets whether the data should be treated modified or not */
virtual void setModified( bool b ) = 0;
public: // get methods
/** @return a pointer to the actual byte array */
virtual char *data() const = 0;
/** @return the size of the actual byte array */
virtual int dataSize() const = 0;
/** @return the maximal allowed size for the byte array */
virtual int maxDataSize () const = 0;
/** @return whether autodelete is set for the byte array */
virtual bool isAutoDelete() const = 0;
/** @return @c true if the memory of the byte array is kept, otherwise @c false */
virtual bool keepsMemory() const = 0;
/** @return @c true if the edit mode is overwrite, otherwise @c false for insert mode*/
virtual bool isOverwriteMode() const = 0;
/** @return @c true if the memory of the byte array is kept, otherwise @c false */
virtual bool isOverwriteOnly() const = 0;
/** @return @c true if the ReadOnly flag is set, otherwise @c false */
virtual bool isReadOnly() const = 0;
/** @return @c true if the Modified flag is set, otherwise @c false */
virtual bool isModified() const = 0;
public: // call for action
/** repaint the indizes from i1 to i2 */
virtual void repaintRange( int i1, int i2 ) = 0;
};
/** tries to get the bytesedit interface of t
* @return a pointer to the interface, otherwise 0
* @author Friedrich W. H. Kossebau <kossebau@kde.org>
*/
template<class T>
inline BytesEditInterface *bytesEditInterface( T *t )
{
return t ? qobject_cast<KHE::BytesEditInterface *>( t ) : 0;
}
/** tries to create an instance of a hexedit widget for arrays of chars (char[])
*
* @param Parent parent widget
* @return a pointer to the widget, otherwise 0
* @author Friedrich W. H. Kossebau <kossebau@kde.org>
* @see BytesEditInterface, ValueColumnInterface, CharColumnInterface, ZoomInterface, ClipboardInterface
*/
inline QWidget *createBytesEditWidget( QWidget *Parent = 0 )
{
return KServiceTypeTrader::createInstanceFromQuery<QWidget>
( QString::fromLatin1("KHexEdit/KBytesEdit"), QString(), Parent );
}
}
Q_DECLARE_INTERFACE( KHE::BytesEditInterface, "org.kde.khe.byteseditinterface/1.0" )
#endif

View file

@ -1,106 +0,0 @@
/***************************************************************************
charcolumninterface.h - description
-------------------
begin : Fri Sep 12 2003
copyright : (C) 2003 by Friedrich W. H. Kossebau
email : kossebau@kde.org
***************************************************************************/
/***************************************************************************
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License version 2 as published by the Free Software Foundation. *
* *
***************************************************************************/
#ifndef KHE_CHARCOLUMNINTERFACE_H
#define KHE_CHARCOLUMNINTERFACE_H
#include <QtCore/QChar>
#include <QtCore/QObject>
namespace KHE
{
/**
* @short A simple interface for the access to the char column of a hex edit widget
*
* @author Friedrich W. H. Kossebau <kossebau@kde.org>
* @see createBytesEditWidget(), charColumnInterface()
*/
class CharColumnInterface
{
public:
virtual ~CharColumnInterface(){}
public:
/** encoding used to display the symbols in the text column */
enum KEncoding
{
/** the encoding of your shell. If that is a multibyte encoding this will default to Latin1. */
LocalEncoding=0,
/** extended ASCII encoding, also known as Latin1 */
ISO8859_1Encoding=1,
/** @internal not implemented: the most common EBCDIC codepage */
CECP1047Encoding=2,
/** @internal enables extension without breaking binary compatibility */
MaxEncodingId=0xFFFF
};
public: // set methods
/** sets whether "unprintable" chars (value<32) should be displayed in the text column
* with their corresponding character.
* Default is @c false.
* @param SU
* @see showUnprintable()
*/
virtual void setShowUnprintable( bool SU = true ) = 0;
/** sets the substitute character for "unprintable" chars
* Default is '.'.
* @param SC new character
* @see substituteChar()
*/
virtual void setSubstituteChar( QChar SC ) = 0;
/** sets the encoding of the text column.
* If the encoding is not available the format will not be changed.
* Default is @c LocalEncoding.
* @param C the new encoding
* @see encoding()
*/
virtual void setEncoding( KEncoding C ) = 0;
public: // get methods
/** @return @c true if "unprintable" chars (value<32) are displayed in the text column
* with their corresponding character, @c false otherwise
* @see setShowUnprintable()
*/
virtual bool showUnprintable() const = 0;
/** @return the currently used substitute character for "unprintable" chars.
* @see setSubstituteChar()
*/
virtual QChar substituteChar() const = 0;
/** @return the currently used encoding
* @see setEncoding()
*/
virtual KEncoding encoding() const = 0;
};
/** tries to get the charcolumn interface of t
* @return a pointer to the interface, otherwise 0
* @author Friedrich W. H. Kossebau <kossebau@kde.org>
*/
template<class T>
CharColumnInterface *charColumnInterface( T *t )
{
return t ? qobject_cast<KHE::CharColumnInterface *>( t ) : 0;
}
}
Q_DECLARE_INTERFACE( KHE::CharColumnInterface, "org.kde.khe.charcolumninterface/1.0" )
#endif

View file

@ -1,88 +0,0 @@
/***************************************************************************
clipboardinterface.h - description
-------------------
begin : Sat Sep 13 2003
copyright : (C) 2003 by Friedrich W. H. Kossebau
email : kossebau@kde.org
***************************************************************************/
/***************************************************************************
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License version 2 as published by the Free Software Foundation. *
* *
***************************************************************************/
#ifndef KHE_CLIPBOARDINTERFACE_H
#define KHE_CLIPBOARDINTERFACE_H
#include <QtCore/QObject>
namespace KHE
{
/**
* @short A simple interface for interaction with the clipboard
*
* This interface enables the interaction with the clipboard. It relies on the
* possibilities of signal/slot so a class B that implements this interface
* should be derived from QObject. When connecting to a signal or a slot
* the class B has to be used, not the interface.
* <p>
* Example:
* \code
* KHE::ClipboardInterface *Clipboard = KHE::clipboardInterface( BytesEditWidget );
* if( Clipboard )
* {
* // Yes, use BytesEditWidget, not Clipboard, because that's the QObject, indeed hacky...
* connect( BytesEditWidget, SIGNAL(copyAvailable(bool)), this, SLOT(offerCopy(bool)) );
* }
* \endcode
*
* @author Friedrich W. H. Kossebau <kossebau@kde.org>
* @see createBytesEditWidget(), clipboardInterface()
*/
class ClipboardInterface
{
public:
virtual ~ClipboardInterface() {}
public: // slots
/** tries to copy. If there is nothing to copy this call is a noop. */
virtual void copy() = 0;
/** tries to cut. If there is nothing to cut this call is a noop. */
virtual void cut() = 0;
/** tries to paste.
* If there is nothing to paste or paste is not possible this call is a noop.
* Use BytesEditInterface::isReadOnly() to find out if you can paste at all.
*/
virtual void paste() = 0;
public: // signals
/** signal: tells whether copy is possible or not.
* Remember to use the created object, not the interface for connecting
* Use BytesEditInterface::isReadOnly() to find out if you can also cut
* As this function symbol serves as a signal, this is a noop. Don't use it
* for anything else.
*/
virtual void copyAvailable( bool Really ) = 0;
};
/** tries to get the clipboard interface of t
* @return a pointer to the interface, otherwise 0
* @author Friedrich W. H. Kossebau <kossebau@kde.org>
*/
template<class T>
ClipboardInterface *clipboardInterface( T *t )
{
return t ? qobject_cast<KHE::ClipboardInterface *>( t ) : 0;
}
}
Q_DECLARE_INTERFACE( KHE::ClipboardInterface, "org.kde.khe.clipboardinterface/1.0" )
#endif

View file

@ -1,4 +0,0 @@
[Desktop Entry]
Type=ServiceType
X-KDE-ServiceType=KHexEdit/KBytesEdit

View file

@ -1,172 +0,0 @@
/***************************************************************************
valuecolumninterface.h - description
-------------------
begin : Fri Sep 12 2003
copyright : (C) 2003 by Friedrich W. H. Kossebau
email : kossebau@kde.org
***************************************************************************/
/***************************************************************************
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License version 2 as published by the Free Software Foundation. *
* *
***************************************************************************/
#ifndef KHE_VALUECOLUMNINTERFACE_H
#define KHE_VALUECOLUMNINTERFACE_H
#include <QtCore/QObject>
namespace KHE
{
/**
* Interface for the value displaying column of a hexedit widget
*
* @author Friedrich W. H. Kossebau <kossebau@kde.org>
* @see createBytesEditWidget(), valueColumnInterface()
*/
class ValueColumnInterface
{
public:
virtual ~ValueColumnInterface() {}
public:
/** collection of ids for the different numeric codings of a byte */
enum KCoding
{
/** hexadecimal encoding */
HexadecimalCoding=0,
/** decimal encoding */
DecimalCoding=1,
/** octal encoding */
OctalCoding=2,
/** bit by bit coding */
BinaryCoding=3,
/** @internal enables extension without breaking binary compatibility */
MaxCodingId=0xFFFF
};
/** collection of ids for the fitting of the layout into the available widget's width */
enum KResizeStyle
{
/** we don't care about the actual sizing of the widget
* but stick to the given NoOfBytesPerLine
*/
NoResize=0,
/** we try to fit the layout to the available width
* but only with full groups like set in NoOfGroupedBytes
* with minimum of one full group
*/
LockGrouping=1,
/** we try to fit as many bytes into the width as possible, with minimum of 1 byte
*/
FullSizeUsage=2,
/** @internal enables extension without breaking binary compatibility */
MaxResizeStyleId=0xFF
};
public: // get methods
/** @return the current resize style
* @see setResizeStyle()
*/
virtual KResizeStyle resizeStyle() const = 0;
/** @return the current number of bytes per line
* @see setNoOfBytesPerLine()
*/
virtual int noOfBytesPerLine() const = 0;
/** @return the current coding
* @see setCoding()
*/
virtual KCoding coding() const = 0;
/** @return the spacing between bytes (in pixels)
* @see setByteSpacingWidth()
*/
virtual int byteSpacingWidth() const = 0;
/** @return the current number of bytes per group
* @see setNoOfGroupedBytes()
*/
virtual int noOfGroupedBytes() const = 0;
/** @return the spacing between groups of bytes (in pixels)
* @see setGroupSpacingWidth()
*/
virtual int groupSpacingWidth() const = 0;
/** @return the gap in the middle of a binary (in pixels)
* @see setBinaryGapWidth()
*/
virtual int binaryGapWidth() const = 0;
public: // set methods
/** sets the resize style for the hex column.
* Default is @c FullSizeUsage
* @param Style new style
* @see resizeStyle()
*/
virtual void setResizeStyle( KResizeStyle Style ) = 0;
/** sets the number of bytes per line, switching the resize style to @c NoResize
* Default is 16.
* @param NoCpL new number of bytes per line
* @see noOfBytesPerLine()
*/
virtual void setNoOfBytesPerLine( int NoCpL ) = 0;
/** sets the format of the hex column.
* If the coding is not available the format will not be changed.
* Default is @c HexadecimalCoding.
* @param C
* @see coding()
*/
virtual void setCoding( KCoding C ) = 0;
/** sets the spacing between the bytes.
* Default is 3.
* @param BSW new spacing between bytes (in pixels)
* @see byteSpacingWidth()
*/
virtual void setByteSpacingWidth( int BSW ) = 0;
/** sets the numbers of grouped bytes, 0 means no grouping.
* Default is 4.
* @param NoGB new number of bytes per group
* @see noOfGroupedBytes()
*/
virtual void setNoOfGroupedBytes( int NoGB ) = 0;
/** sets the spacing between the groups.
* Default is 9.
* @param GSW new spacing width (in pixels)
* @see groupSpacingWidth()
*/
virtual void setGroupSpacingWidth( int GSW ) = 0;
/** sets the spacing in the middle of a binary encoded byte.
* Default is 1.
* @param BGW spacing in the middle of a binary (in pixels)
* @see binaryGapWidth()
*/
virtual void setBinaryGapWidth( int BGW ) = 0;
};
/** tries to get the valuecolumn interface of t
* @return a pointer to the interface, otherwise 0
* @author Friedrich W. H. Kossebau <kossebau@kde.org>
*/
template<class T>
ValueColumnInterface *valueColumnInterface( T *t )
{
return t ? qobject_cast<KHE::ValueColumnInterface *>( t ) : 0;
}
}
Q_DECLARE_INTERFACE( KHE::ValueColumnInterface, "org.kde.khe.valuecolumninterface/1.0" )
#endif

View file

@ -1,80 +0,0 @@
/***************************************************************************
zoominterface.h - description
-------------------
begin : Fri Sep 12 2003
copyright : (C) 2003 by Friedrich W. H. Kossebau
email : kossebau@kde.org
***************************************************************************/
/***************************************************************************
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License version 2 as published by the Free Software Foundation. *
* *
***************************************************************************/
#ifndef KHE_ZOOMINTERFACE_H
#define KHE_ZOOMINTERFACE_H
#include <QtCore/QObject>
namespace KHE
{
/**
* @short A simple interface for zooming
*
* This interface enables abstract linear zooming.
* It operates in sizes of font point size.
*
* @author Friedrich W. H. Kossebau <kossebau@kde.org>
* @see createBytesEditWidget(), zoomInterface()
*/
class ZoomInterface
{
public:
virtual ~ZoomInterface() {}
public:
/** enlarges the display
* @param PointInc increment to the display size (in font point size)
*/
virtual void zoomIn( int PointInc ) = 0;
/** increases the display size by an arbitrary value, usually 1 font point
* @see zoomOut()
*/
virtual void zoomIn() = 0;
/** makes the display smaller
* @param PointDec decrement to the display size (in font point size)
*/
virtual void zoomOut( int PointDec ) = 0;
/** decreases the display size by an arbitrary value, usually 1 font point
* @see zoomIn()
*/
virtual void zoomOut() = 0;
/** sets the display size
* @param PointSize new display size (in font point size)
*/
virtual void zoomTo( int PointSize ) = 0;
/** resets the display to the default size */
virtual void unZoom() = 0;
};
/** tries to get the zoom interface of t
* @return a pointer to the interface, otherwise 0
* @author Friedrich W. H. Kossebau <kossebau@kde.org>
*/
template<class T>
ZoomInterface *zoomInterface( T *t )
{
return t ? qobject_cast<KHE::ZoomInterface *>( t ) : 0;
}
}
Q_DECLARE_INTERFACE( KHE::ZoomInterface, "org.kde.khe.zoominterface/1.0" )
#endif