• 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
  • gui
  • io
  • generator
  • pattern
bytearraypatterngeneratorconfigeditor.cpp
Go to the documentation of this file.
1 /*
2  This file is part of the Kasten Framework, made within the KDE community.
3 
4  Copyright 2009 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 "bytearraypatterngeneratorconfigeditor.h"
24 
25 // lib
26 #include <bytearraycombobox.h>
27 // KDE
28 #include <KLocale>
29 #include <KIntNumInput>
30 // Qt
31 #include <QtGui/QFormLayout>
32 
33 
34 namespace Kasten2
35 {
36 
37 ByteArrayPatternGeneratorConfigEditor::ByteArrayPatternGeneratorConfigEditor( ByteArrayPatternGenerator* generator, QWidget* parent )
38  : AbstractModelDataGeneratorConfigEditor( parent ),
39  mGenerator( generator )
40 {
41  mSettings = mGenerator->settings();
42 
43  QFormLayout* pageLayout = new QFormLayout( this );
44  pageLayout->setMargin( 0 );
45 
46  // pattern
47  const QString patternEditLabel =
48  i18nc( "@label:textbox",
49  "Pattern:" );
50  mPatternEdit = new Okteta::ByteArrayComboBox( this );
51  mPatternEdit->setByteArray( mSettings.pattern );
52  connect( mPatternEdit, SIGNAL(byteArrayChanged(QByteArray)), SLOT(onSettingsChanged()) );
53  connect( mPatternEdit, SIGNAL(byteArrayChanged(QByteArray)), SLOT(onPatternChanged(QByteArray)) );
54  const QString inputWhatsThis =
55  i18nc( "@info:whatsthis",
56  "Enter a pattern to search for, or select a previous pattern from the list." );
57  mPatternEdit->setWhatsThis( inputWhatsThis );
58 
59  pageLayout->addRow( patternEditLabel, mPatternEdit );
60 
61  // number
62  const QString numberInputLabel =
63  i18nc( "@label:spinbox number of times to insert the pattern",
64  "&Number:" );
65  mNumberInput = new KIntNumInput( this );
66  mNumberInput->setRange( 1, INT_MAX );
67  mNumberInput->setValue( mSettings.count );
68  connect( mNumberInput, SIGNAL(valueChanged(int)), SLOT(onSettingsChanged()) );
69  const QString numberWhatsThis =
70  i18nc( "@info:whatsthis",
71  "Enter the number of times the pattern should be inserted." );
72  mNumberInput->setWhatsThis( numberWhatsThis );
73 
74  pageLayout->addRow( numberInputLabel, mNumberInput );
75 }
76 
77 bool ByteArrayPatternGeneratorConfigEditor::isValid() const { return ( ! mSettings.pattern.isEmpty() ); }
78 
79 QString ByteArrayPatternGeneratorConfigEditor::name() const
80 {
81  return i18nc("@item name of the generated data","Pattern");
82 }
83 
84 // TODO: get char codec
85 #if 0
86 void InsertPatternDialog::setCharCodec( const QString& codecName )
87 {
88  mPatternEdit->setCharCodec( codecName );
89 }
90 #endif
91 
92 void ByteArrayPatternGeneratorConfigEditor::onSettingsChanged()
93 {
94  mSettings.pattern = mPatternEdit->byteArray();
95  mSettings.count = mNumberInput->value();
96 
97  mGenerator->setSettings( mSettings );
98 }
99 
100 void ByteArrayPatternGeneratorConfigEditor::onPatternChanged( const QByteArray& pattern )
101 {
102  emit validityChanged( ! pattern.isEmpty() );
103 }
104 
105 ByteArrayPatternGeneratorConfigEditor::~ByteArrayPatternGeneratorConfigEditor()
106 {
107 }
108 
109 }
Kasten2::ByteArrayPatternGeneratorConfigEditor::mGenerator
ByteArrayPatternGenerator * mGenerator
Definition: bytearraypatterngeneratorconfigeditor.h:61
Kasten2::ByteArrayPatternGeneratorConfigEditor::mPatternEdit
Okteta::ByteArrayComboBox * mPatternEdit
Definition: bytearraypatterngeneratorconfigeditor.h:65
bytearraycombobox.h
Kasten2::AbstractModelDataGeneratorConfigEditor::validityChanged
void validityChanged(bool isValid)
bytearraypatterngeneratorconfigeditor.h
QWidget
Kasten2::ByteArrayPatternGeneratorSettings::pattern
QByteArray pattern
Definition: bytearraypatterngenerator.h:43
Kasten2::ByteArrayPatternGeneratorConfigEditor::mNumberInput
KIntNumInput * mNumberInput
Definition: bytearraypatterngeneratorconfigeditor.h:64
Okteta::ByteArrayComboBox::setByteArray
void setByteArray(const QByteArray &byteArray)
Definition: bytearraycombobox.cpp:40
Kasten2::ByteArrayPatternGeneratorConfigEditor::onSettingsChanged
void onSettingsChanged()
Definition: bytearraypatterngeneratorconfigeditor.cpp:92
Kasten2::ByteArrayPatternGenerator
Definition: bytearraypatterngenerator.h:48
Okteta::ByteArrayComboBox::byteArray
QByteArray byteArray() const
Definition: bytearraycombobox.cpp:76
Kasten2::ByteArrayPatternGeneratorConfigEditor::mSettings
ByteArrayPatternGeneratorSettings mSettings
Definition: bytearraypatterngeneratorconfigeditor.h:62
Kasten2::ByteArrayPatternGeneratorConfigEditor::isValid
virtual bool isValid() const
default returns true
Definition: bytearraypatterngeneratorconfigeditor.cpp:77
Okteta::ByteArrayComboBox
Definition: bytearraycombobox.h:40
Kasten2::ByteArrayPatternGeneratorConfigEditor::name
virtual QString name() const
Definition: bytearraypatterngeneratorconfigeditor.cpp:79
Kasten2::ByteArrayPatternGeneratorConfigEditor::ByteArrayPatternGeneratorConfigEditor
ByteArrayPatternGeneratorConfigEditor(ByteArrayPatternGenerator *generator, QWidget *parent=0)
Definition: bytearraypatterngeneratorconfigeditor.cpp:37
Kasten2::ByteArrayPatternGenerator::settings
ByteArrayPatternGeneratorSettings settings() const
Definition: bytearraypatterngenerator.h:69
Kasten2::AbstractModelDataGeneratorConfigEditor
Definition: abstractmodeldatageneratorconfigeditor.h:37
Kasten2::ByteArrayPatternGenerator::setSettings
void setSettings(const ByteArrayPatternGeneratorSettings &settings)
Definition: bytearraypatterngenerator.h:70
Kasten2::ByteArrayPatternGeneratorSettings::count
int count
Definition: bytearraypatterngenerator.h:44
Kasten2::ByteArrayPatternGeneratorConfigEditor::~ByteArrayPatternGeneratorConfigEditor
virtual ~ByteArrayPatternGeneratorConfigEditor()
Definition: bytearraypatterngeneratorconfigeditor.cpp:105
Kasten2::ByteArrayPatternGeneratorConfigEditor::onPatternChanged
void onPatternChanged(const QByteArray &pattern)
Definition: bytearraypatterngeneratorconfigeditor.cpp:100
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:04:07 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