Commit 838bcfcd authored by Alex Richardson's avatar Alex Richardson

Remove all the SInt*Editor classes

They added no functionality to the [US]IntSpinBox classes, tgey only set
the minimum and maximum values. Thanks to removing them
libkasten2okteta1controllers.so text+data size is down by 28 794 bytes.
parent adf5f7a9
......@@ -65,7 +65,7 @@ set( OKTETA_BUILD_INTERNAL_TEMPLATES NOT OMIT_INTERNAL_TEMPLATES )
# mobile needs
option(OKTETA_MOBILE_UI "Build UI for mobile devices instead of for desktops" FALSE)
if (OKTETA_MOBILE_UI)
macro_log_feature(QT_QTDECLARATIVE_FOUND "QtDeclarative" "Qt Declarative (QML) module" "http://qt.nokia.com" TRUE "4.7" "Required for building mobile UI")
find_package(Qt5Quick REQUIRED)
add_definitions( -DOKTETA_MOBILE_UI )
endif (OKTETA_MOBILE_UI)
......@@ -120,8 +120,8 @@ add_subdirectory( parts )
add_subdirectory( program )
# program for mobile
if (QT_QTDECLARATIVE_FOUND AND OKTETA_MOBILE_UI)
if (Qt5Quick_FOUND AND OKTETA_MOBILE_UI)
macro_optional_add_subdirectory(mobile)
endif (QT_QTDECLARATIVE_FOUND AND OKTETA_MOBILE_UI)
endif ()
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
......@@ -148,14 +148,6 @@ set( PODDECODERCONTROLLER_SRCS
view/poddecoder/typeeditors/hexadecimal8editor.cpp
view/poddecoder/typeeditors/uintspinbox.cpp
view/poddecoder/typeeditors/sintspinbox.cpp
view/poddecoder/typeeditors/uint8editor.cpp
view/poddecoder/typeeditors/uint16editor.cpp
view/poddecoder/typeeditors/uint32editor.cpp
view/poddecoder/typeeditors/uint64editor.cpp
view/poddecoder/typeeditors/sint8editor.cpp
view/poddecoder/typeeditors/sint16editor.cpp
view/poddecoder/typeeditors/sint32editor.cpp
view/poddecoder/typeeditors/sint64editor.cpp
view/poddecoder/typeeditors/float32editor.cpp
view/poddecoder/typeeditors/float64editor.cpp
view/poddecoder/typeeditors/char8editor.cpp
......
......@@ -26,19 +26,22 @@
#include "typeeditors/binary8editor.h"
#include "typeeditors/octal8editor.h"
#include "typeeditors/hexadecimal8editor.h"
#include "typeeditors/sint8editor.h"
#include "typeeditors/sint16editor.h"
#include "typeeditors/sint32editor.h"
#include "typeeditors/sint64editor.h"
#include "typeeditors/uint8editor.h"
#include "typeeditors/uint16editor.h"
#include "typeeditors/uint32editor.h"
#include "typeeditors/uint64editor.h"
#include "typeeditors/float32editor.h"
#include "typeeditors/float64editor.h"
#include "typeeditors/char8editor.h"
#include "typeeditors/utf8editor.h"
#include "typeeditors/sintspinbox.h"
#include "typeeditors/uintspinbox.h"
#include "poddecodertool.h"
#include "types/sint8.h"
#include "types/sint16.h"
#include "types/sint32.h"
#include "types/sint64.h"
#include "types/uint8.h"
#include "types/uint16.h"
#include "types/uint32.h"
#include "types/uint64.h"
// TODO: Stranger that you are reading this: please help out and show how to add QVariant::Types for custom datatypes,
// so that instead of this unflexible maintanance mess^WWWunlooped code QItemEditorCreator can be used!
......@@ -102,35 +105,35 @@ QWidget* PODDelegate::createEditor( QWidget* parent, const QStyleOptionViewItem&
}
else if( data.canConvert<SInt8>() )
{
SInt8Editor* editor = new SInt8Editor( parent );
SIntSpinBox* editor = SIntSpinBox::createSInt8Spinbox( parent );
connect( editor, SIGNAL(editingFinished()),
SLOT(onEditorDone()) );
result = editor;
}
else if( data.canConvert<SInt16>() )
{
SInt16Editor* editor = new SInt16Editor( parent );
SIntSpinBox* editor = SIntSpinBox::createSInt16Spinbox( parent );
connect( editor, SIGNAL(editingFinished()),
SLOT(onEditorDone()) );
result = editor;
}
else if( data.canConvert<SInt32>() )
{
SInt32Editor* editor = new SInt32Editor( parent );
SIntSpinBox* editor = SIntSpinBox::createSInt32Spinbox( parent );
connect( editor, SIGNAL(editingFinished()),
SLOT(onEditorDone()) );
result = editor;
}
else if( data.canConvert<SInt64>() )
{
SInt64Editor* editor = new SInt64Editor( parent );
SIntSpinBox* editor = SIntSpinBox::createSInt64Spinbox( parent );
connect( editor, SIGNAL(editingFinished()),
SLOT(onEditorDone()) );
result = editor;
}
else if( data.canConvert<UInt8>() )
{
UInt8Editor* editor = new UInt8Editor( parent );
UIntSpinBox* editor = UIntSpinBox::createUInt8Spinbox( parent );
editor->setBase( mTool->isUnsignedAsHex() ? 16 : 10 );
connect( editor, SIGNAL(editingFinished()),
SLOT(onEditorDone()) );
......@@ -138,7 +141,7 @@ QWidget* PODDelegate::createEditor( QWidget* parent, const QStyleOptionViewItem&
}
else if( data.canConvert<UInt16>() )
{
UInt16Editor* editor = new UInt16Editor( parent );
UIntSpinBox* editor = UIntSpinBox::createUInt16Spinbox( parent );
editor->setBase( mTool->isUnsignedAsHex() ? 16 : 10 );
connect( editor, SIGNAL(editingFinished()),
SLOT(onEditorDone()) );
......@@ -146,7 +149,7 @@ QWidget* PODDelegate::createEditor( QWidget* parent, const QStyleOptionViewItem&
}
else if( data.canConvert<UInt32>() )
{
UInt32Editor* editor = new UInt32Editor( parent );
UIntSpinBox* editor = UIntSpinBox::createUInt32Spinbox( parent );
editor->setBase( mTool->isUnsignedAsHex() ? 16 : 10 );
connect( editor, SIGNAL(editingFinished()),
SLOT(onEditorDone()) );
......@@ -154,7 +157,7 @@ QWidget* PODDelegate::createEditor( QWidget* parent, const QStyleOptionViewItem&
}
else if( data.canConvert<UInt64>() )
{
UInt64Editor* editor = new UInt64Editor( parent );
UIntSpinBox* editor = UIntSpinBox::createUInt64Spinbox( parent );
editor->setBase( mTool->isUnsignedAsHex() ? 16 : 10 );
connect( editor, SIGNAL(editingFinished()),
SLOT(onEditorDone()) );
......@@ -222,50 +225,50 @@ void PODDelegate::setEditorData( QWidget* editor, const QModelIndex& index ) con
else if( data.canConvert<SInt8>() )
{
SInt8 sInt8 = data.value<SInt8>();
SInt8Editor* sInt8Editor = qobject_cast<SInt8Editor*>( editor );
sInt8Editor->setData( sInt8 );
SIntSpinBox* sInt8Editor = qobject_cast<SIntSpinBox*>( editor );
sInt8Editor->setValue( sInt8.value );
}
else if( data.canConvert<SInt16>() )
{
SInt16 sInt16 = data.value<SInt16>();
SInt16Editor* sInt16Editor = qobject_cast<SInt16Editor*>( editor );
sInt16Editor->setData( sInt16 );
SIntSpinBox* sInt16Editor = qobject_cast<SIntSpinBox*>( editor );
sInt16Editor->setValue( sInt16.value );
}
else if( data.canConvert<SInt32>() )
{
SInt32 sInt32 = data.value<SInt32>();
SInt32Editor* sInt32Editor = qobject_cast<SInt32Editor*>( editor );
sInt32Editor->setData( sInt32 );
SIntSpinBox* sInt32Editor = qobject_cast<SIntSpinBox*>( editor );
sInt32Editor->setValue( sInt32.value );
}
else if( data.canConvert<SInt64>() )
{
SInt64 sInt64 = data.value<SInt64>();
SInt64Editor* sInt64Editor = qobject_cast<SInt64Editor*>( editor );
sInt64Editor->setData( sInt64 );
SIntSpinBox* sInt64Editor = qobject_cast<SIntSpinBox*>( editor );
sInt64Editor->setValue( sInt64.value );
}
else if( data.canConvert<UInt8>() )
{
UInt8 uInt8 = data.value<UInt8>();
UInt8Editor* uInt8Editor = qobject_cast<UInt8Editor*>( editor );
uInt8Editor->setData( uInt8 );
UIntSpinBox* uInt8Editor = qobject_cast<UIntSpinBox*>( editor );
uInt8Editor->setValue( uInt8.value );
}
else if( data.canConvert<UInt16>() )
{
UInt16 uInt16 = data.value<UInt16>();
UInt16Editor* uInt16Editor = qobject_cast<UInt16Editor*>( editor );
uInt16Editor->setData( uInt16 );
UIntSpinBox* uInt16Editor = qobject_cast<UIntSpinBox*>( editor );
uInt16Editor->setValue( uInt16.value );
}
else if( data.canConvert<UInt32>() )
{
UInt32 uInt32 = data.value<UInt32>();
UInt32Editor* uInt32Editor = qobject_cast<UInt32Editor*>( editor );
uInt32Editor->setData( uInt32 );
UIntSpinBox* uInt32Editor = qobject_cast<UIntSpinBox*>( editor );
uInt32Editor->setValue( uInt32.value );
}
else if( data.canConvert<UInt64>() )
{
UInt64 uInt64 = data.value<UInt64>();
UInt64Editor* uInt64Editor = qobject_cast<UInt64Editor*>( editor );
uInt64Editor->setData( uInt64 );
UIntSpinBox* uInt64Editor = qobject_cast<UIntSpinBox*>( editor );
uInt64Editor->setValue( uInt64.value );
}
else if( data.canConvert<Float32>() )
{
......@@ -319,43 +322,43 @@ void PODDelegate::setModelData( QWidget* editor, QAbstractItemModel* model, cons
}
else if( data.canConvert<SInt8>() )
{
SInt8Editor* sInt8Editor = qobject_cast<SInt8Editor*>( editor );
model->setData( index, QVariant::fromValue(sInt8Editor->data()) );
SIntSpinBox* editor = qobject_cast<SIntSpinBox*>( editor );
model->setData( index, QVariant::fromValue( SInt8(editor->value()) ) );
}
else if( data.canConvert<SInt16>() )
{
SInt16Editor* sInt16Editor = qobject_cast<SInt16Editor*>( editor );
model->setData( index, QVariant::fromValue(sInt16Editor->data()) );
SIntSpinBox* editor = qobject_cast<SIntSpinBox*>( editor );
model->setData( index, QVariant::fromValue( SInt16(editor->value()) ) );
}
else if( data.canConvert<SInt32>() )
{
SInt32Editor* sInt32Editor = qobject_cast<SInt32Editor*>( editor );
model->setData( index, QVariant::fromValue(sInt32Editor->data()) );
SIntSpinBox* editor = qobject_cast<SIntSpinBox*>( editor );
model->setData( index, QVariant::fromValue( SInt32(editor->value()) ) );
}
else if( data.canConvert<SInt64>() )
{
SInt64Editor* sInt64Editor = qobject_cast<SInt64Editor*>( editor );
model->setData( index, QVariant::fromValue(sInt64Editor->data()) );
SIntSpinBox* editor = qobject_cast<SIntSpinBox*>( editor );
model->setData( index, QVariant::fromValue( SInt64(editor->value()) ) );
}
else if( data.canConvert<UInt8>() )
{
UInt8Editor* uInt8Editor = qobject_cast<UInt8Editor*>( editor );
model->setData( index, QVariant::fromValue(uInt8Editor->data()) );
UIntSpinBox* editor = qobject_cast<UIntSpinBox*>( editor );
model->setData( index, QVariant::fromValue( UInt8(editor->value()) ) );
}
else if( data.canConvert<UInt16>() )
{
UInt16Editor* uInt16Editor = qobject_cast<UInt16Editor*>( editor );
model->setData( index, QVariant::fromValue(uInt16Editor->data()) );
UIntSpinBox* editor = qobject_cast<UIntSpinBox*>( editor );
model->setData( index, QVariant::fromValue( UInt16(editor->value()) ) );
}
else if( data.canConvert<UInt32>() )
{
UInt32Editor* uInt32Editor = qobject_cast<UInt32Editor*>( editor );
model->setData( index, QVariant::fromValue(uInt32Editor->data()) );
UIntSpinBox* editor = qobject_cast<UIntSpinBox*>( editor );
model->setData( index, QVariant::fromValue( UInt32(editor->value()) ) );
}
else if( data.canConvert<UInt64>() )
{
UInt64Editor* uInt64Editor = qobject_cast<UInt64Editor*>( editor );
model->setData( index, QVariant::fromValue(uInt64Editor->data()) );
UIntSpinBox* editor = qobject_cast<UIntSpinBox*>( editor );
model->setData( index, QVariant::fromValue( UInt64(editor->value()) ) );
}
else if( data.canConvert<Float32>() )
{
......
/*
This file is part of the Okteta Kasten module, made within the KDE community.
Copyright 2009 Friedrich W. H. Kossebau <kossebau@kde.org>
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 <http://www.gnu.org/licenses/>.
*/
#include "sint16editor.h"
// C++
#include <limits>
SInt16Editor::SInt16Editor( QWidget* parent )
: SIntSpinBox( parent )
{
const qint16 int16Max = std::numeric_limits<qint16>::max();
const qint16 int16Min = std::numeric_limits<qint16>::min();
setRange( int16Min, int16Max );
}
void SInt16Editor::setData( SInt16 data )
{
setValue( data.value );
}
SInt16 SInt16Editor::data() const
{
return value();
}
SInt16Editor::~SInt16Editor() {}
/*
This file is part of the Okteta Kasten module, made within the KDE community.
Copyright 2009 Friedrich W. H. Kossebau <kossebau@kde.org>
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 <http://www.gnu.org/licenses/>.
*/
#ifndef SINT16EDITOR_H
#define SINT16EDITOR_H
// lib
#include "../types/sint16.h"
#include "sintspinbox.h"
class SInt16Editor : public SIntSpinBox
{
Q_OBJECT
Q_PROPERTY( SInt16 data READ data WRITE setData USER true )
public:
explicit SInt16Editor( QWidget* parent );
virtual ~SInt16Editor();
public:
void setData( SInt16 data );
SInt16 data() const;
};
#endif
/*
This file is part of the Okteta Kasten module, made within the KDE community.
Copyright 2009 Friedrich W. H. Kossebau <kossebau@kde.org>
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 <http://www.gnu.org/licenses/>.
*/
#include "sint32editor.h"
// C++
#include <limits>
SInt32Editor::SInt32Editor( QWidget* parent )
: SIntSpinBox( parent )
{
const qint32 int32Max = std::numeric_limits<qint32>::max();
const qint32 int32Min = std::numeric_limits<qint32>::min();
setRange( int32Min, int32Max );
}
void SInt32Editor::setData( SInt32 data )
{
setValue( data.value );
}
SInt32 SInt32Editor::data() const
{
return value();
}
SInt32Editor::~SInt32Editor() {}
/*
This file is part of the Okteta Kasten module, made within the KDE community.
Copyright 2009 Friedrich W. H. Kossebau <kossebau@kde.org>
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 <http://www.gnu.org/licenses/>.
*/
#ifndef SINT32EDITOR_H
#define SINT32EDITOR_H
// lib
#include "../types/sint32.h"
#include "sintspinbox.h"
class SInt32Editor : public SIntSpinBox
{
Q_OBJECT
Q_PROPERTY( SInt32 data READ data WRITE setData USER true )
public:
explicit SInt32Editor( QWidget* parent );
virtual ~SInt32Editor();
public:
void setData( SInt32 data );
SInt32 data() const;
};
#endif
/*
This file is part of the Okteta Kasten module, made within the KDE community.
Copyright 2009 Friedrich W. H. Kossebau <kossebau@kde.org>
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 <http://www.gnu.org/licenses/>.
*/
#include "sint64editor.h"
SInt64Editor::SInt64Editor( QWidget* parent )
: SIntSpinBox( parent )
{
}
void SInt64Editor::setData( SInt64 data )
{
setValue( data.value );
}
SInt64 SInt64Editor::data() const
{
return value();
}
SInt64Editor::~SInt64Editor() {}
/*
This file is part of the Okteta Kasten module, made within the KDE community.
Copyright 2009 Friedrich W. H. Kossebau <kossebau@kde.org>
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 <http://www.gnu.org/licenses/>.
*/
#ifndef SINT64EDITOR_H
#define SINT64EDITOR_H
// lib
#include "../types/sint64.h"
#include "sintspinbox.h"
class SInt64Editor : public SIntSpinBox
{
Q_OBJECT
Q_PROPERTY( SInt64 data READ data WRITE setData USER true )
public:
explicit SInt64Editor( QWidget* parent );
virtual ~SInt64Editor();
public:
void setData( SInt64 data );
SInt64 data() const;
};
#endif
/*
This file is part of the Okteta Kasten module, made within the KDE community.
Copyright 2009 Friedrich W. H. Kossebau <kossebau@kde.org>
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 <http://www.gnu.org/licenses/>.
*/
#include "sint8editor.h"
// C++
#include <limits>
SInt8Editor::SInt8Editor( QWidget* parent )
: SIntSpinBox( parent )
{
const qint8 int8Max = std::numeric_limits<qint8>::max();
const qint8 int8Min = std::numeric_limits<qint8>::min();
setRange( int8Min, int8Max );
}
void SInt8Editor::setData( SInt8 data )
{
setValue( data.value );
}
SInt8 SInt8Editor::data() const