• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdesdk API Reference
  • KDE Home
  • Contact Us
 

okteta

  • sources
  • kde-4.12
  • kdesdk
  • okteta
  • kasten
  • controllers
  • view
  • libbytearrayfilter
  • filter
operandbytearrayfilterparametersetedit.cpp
Go to the documentation of this file.
1 /*
2  This file is part of the Okteta Kasten module, made within the KDE community.
3 
4  Copyright 2008 Friedrich W. H. Kossebau <kossebau@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) version 3, or any
10  later version accepted by the membership of KDE e.V. (or its
11  successor approved by the membership of KDE e.V.), which shall
12  act as a proxy defined in Section 6 of version 3 of the license.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public
20  License along with this library. If not, see <http://www.gnu.org/licenses/>.
21 */
22 
23 #include "operandbytearrayfilterparametersetedit.h"
24 
25 //
26 #include "operandbytearrayfilterparameterset.h"
27 // lib
28 #include <bytearraycombobox.h>
29 // KDE
30 #include <KLocale>
31 // Qt
32 #include <QtGui/QCheckBox>
33 #include <QtGui/QFormLayout>
34 
35 
36 const char* const OperandByteArrayFilterParameterSetEdit::Id = "Operand";
37 
38 
39 OperandByteArrayFilterParameterSetEdit::OperandByteArrayFilterParameterSetEdit( QWidget* parent )
40  : AbstractByteArrayFilterParameterSetEdit( parent )
41 {
42  QFormLayout *baseLayout = new QFormLayout( this );
43  baseLayout->setMargin( 0 );
44 
45  const QString operandLabelText =
46  i18nc( "@label:textbox operand to the arithmetic filter function",
47  "Operand:" );
48  mOperandEdit = new Okteta::ByteArrayComboBox( this );
49  connect( mOperandEdit, SIGNAL(byteArrayChanged(QByteArray)),
50  SLOT(onInputChanged(QByteArray)) );
51  const QString operandToolTip =
52  i18nc( "@info:tooltip",
53  "The operand to do the operation with." );
54  const QString operandWhatsThis =
55  i18nc( "@info:whatsthis",
56  "Enter an operand, or select a previous operand from the list." );
57  mOperandEdit->setToolTip( operandToolTip );
58  mOperandEdit->setWhatsThis( operandWhatsThis );
59 
60  baseLayout->addRow( operandLabelText, mOperandEdit );
61 
62  const QString alignAtEndLabelText =
63  i18nc( "@option:check",
64  "Align at end:" );
65  mAlignAtEndCheckBox = new QCheckBox( this );
66  mAlignAtEndCheckBox->setChecked( false );
67  const QString alignToolTip =
68  i18nc( "@info:tooltip",
69  "Sets if the operation will be aligned to the end of the data instead of to the begin." );
70  const QString alignWhatsThis =
71  i18nc( "@info:whatsthis",
72  "If set, the operation will be aligned to the end of the data." );
73  mAlignAtEndCheckBox->setToolTip( alignToolTip );
74  mAlignAtEndCheckBox->setWhatsThis( alignWhatsThis );
75 
76  baseLayout->addRow( alignAtEndLabelText, mAlignAtEndCheckBox );
77 }
78 
79 bool OperandByteArrayFilterParameterSetEdit::isValid() const { return !mOperandEdit->byteArray().isEmpty(); }
80 
81 void OperandByteArrayFilterParameterSetEdit::setValues( const AbstractByteArrayFilterParameterSet *parameterSet )
82 {
83  const OperandByteArrayFilterParameterSet *operandParameterSet =
84  static_cast<const OperandByteArrayFilterParameterSet *>( parameterSet );
85 
86 // mOperandEdit->setValue( operandParameterSet->operand() ); TODO: not yet implemented
87  mAlignAtEndCheckBox->setChecked( operandParameterSet->alignAtEnd() );
88 }
89 
90 void OperandByteArrayFilterParameterSetEdit::setCharCodec( const QString &charCodecName )
91 {
92  mOperandEdit->setCharCodec( charCodecName );
93 }
94 
95 void OperandByteArrayFilterParameterSetEdit::getParameterSet( AbstractByteArrayFilterParameterSet *parameterSet ) const
96 {
97  OperandByteArrayFilterParameterSet *operandParameterSet =
98  static_cast<OperandByteArrayFilterParameterSet *>( parameterSet );
99 
100  operandParameterSet->setOperand( mOperandEdit->byteArray() );
101  operandParameterSet->setOperandFormat( mOperandEdit->format() );
102  operandParameterSet->setAlignAtEnd( mAlignAtEndCheckBox->isChecked() );
103 }
104 
105 void OperandByteArrayFilterParameterSetEdit::rememberCurrentSettings()
106 {
107  mOperandEdit->rememberCurrentByteArray();
108 }
109 
110 void OperandByteArrayFilterParameterSetEdit::onInputChanged( const QByteArray &data )
111 {
112  emit validityChanged( !data.isEmpty() );
113 }
114 
115 OperandByteArrayFilterParameterSetEdit::~OperandByteArrayFilterParameterSetEdit()
116 {}
bytearraycombobox.h
OperandByteArrayFilterParameterSetEdit::OperandByteArrayFilterParameterSetEdit
OperandByteArrayFilterParameterSetEdit(QWidget *parent=0)
Definition: operandbytearrayfilterparametersetedit.cpp:39
OperandByteArrayFilterParameterSetEdit::mAlignAtEndCheckBox
QCheckBox * mAlignAtEndCheckBox
Definition: operandbytearrayfilterparametersetedit.h:58
OperandByteArrayFilterParameterSetEdit::setCharCodec
virtual void setCharCodec(const QString &charCodecName)
default does nothing
Definition: operandbytearrayfilterparametersetedit.cpp:90
Okteta::ByteArrayComboBox::format
int format() const
Definition: bytearraycombobox.cpp:83
QWidget
OperandByteArrayFilterParameterSetEdit::~OperandByteArrayFilterParameterSetEdit
virtual ~OperandByteArrayFilterParameterSetEdit()
Definition: operandbytearrayfilterparametersetedit.cpp:115
operandbytearrayfilterparametersetedit.h
OperandByteArrayFilterParameterSet::setOperandFormat
void setOperandFormat(int operandFormat)
Definition: operandbytearrayfilterparameterset.cpp:36
Okteta::ByteArrayComboBox::byteArray
QByteArray byteArray() const
Definition: bytearraycombobox.cpp:76
OperandByteArrayFilterParameterSetEdit::rememberCurrentSettings
virtual void rememberCurrentSettings()
default is a noop
Definition: operandbytearrayfilterparametersetedit.cpp:105
OperandByteArrayFilterParameterSetEdit::Id
static const char *const Id
Definition: operandbytearrayfilterparametersetedit.h:40
OperandByteArrayFilterParameterSetEdit::isValid
virtual bool isValid() const
default returns true
Definition: operandbytearrayfilterparametersetedit.cpp:79
AbstractByteArrayFilterParameterSetEdit::validityChanged
void validityChanged(bool isValid)
OperandByteArrayFilterParameterSet::alignAtEnd
bool alignAtEnd() const
Definition: operandbytearrayfilterparameterset.cpp:33
OperandByteArrayFilterParameterSetEdit::onInputChanged
void onInputChanged(const QByteArray &data)
Definition: operandbytearrayfilterparametersetedit.cpp:110
operandbytearrayfilterparameterset.h
OperandByteArrayFilterParameterSet
Definition: operandbytearrayfilterparameterset.h:32
Okteta::ByteArrayComboBox
Definition: bytearraycombobox.h:40
OperandByteArrayFilterParameterSetEdit::mOperandEdit
Okteta::ByteArrayComboBox * mOperandEdit
Definition: operandbytearrayfilterparametersetedit.h:57
Okteta::ByteArrayComboBox::rememberCurrentByteArray
void rememberCurrentByteArray()
Definition: bytearraycombobox.cpp:68
AbstractByteArrayFilterParameterSetEdit
Definition: abstractbytearrayfilterparametersetedit.h:32
OperandByteArrayFilterParameterSetEdit::getParameterSet
virtual void getParameterSet(AbstractByteArrayFilterParameterSet *parameterSet) const
Definition: operandbytearrayfilterparametersetedit.cpp:95
AbstractByteArrayFilterParameterSet
Definition: abstractbytearrayfilterparameterset.h:27
OperandByteArrayFilterParameterSet::setOperand
void setOperand(const QByteArray &operand)
Definition: operandbytearrayfilterparameterset.cpp:35
OperandByteArrayFilterParameterSetEdit::setValues
virtual void setValues(const AbstractByteArrayFilterParameterSet *parameterSet)
Definition: operandbytearrayfilterparametersetedit.cpp:81
Okteta::ByteArrayComboBox::setCharCodec
void setCharCodec(const QString &charCodecName)
Definition: bytearraycombobox.cpp:47
OperandByteArrayFilterParameterSet::setAlignAtEnd
void setAlignAtEnd(bool alignAtEnd)
Definition: operandbytearrayfilterparameterset.cpp:37
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:04:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

okteta

Skip menu "okteta"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • okteta
  • umbrello
  •   umbrello

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal