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

palapeli/libpala

  • sources
  • kde-4.14
  • kdegames
  • palapeli
  • libpala
slicermode.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright 2010 Stefan Majewsky <majewsky@gmx.net>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  ***************************************************************************/
18 
19 #include "slicermode.h"
20 #include "slicerproperty.h"
21 
22 class Pala::SlicerMode::Private
23 {
24  public:
25  QByteArray m_key;
26  QString m_name;
27 
28  QHash<QByteArray, bool> m_propertyEnabledExceptions;
29 };
30 
31 Pala::SlicerMode::SlicerMode(const QByteArray& key, const QString& name)
32  : p(new Pala::SlicerMode::Private)
33 {
34  p->m_key = key;
35  p->m_name = name;
36 }
37 
38 Pala::SlicerMode::~SlicerMode()
39 {
40  delete p;
41 }
42 
43 void Pala::SlicerMode::filterProperties(QList<const Pala::SlicerProperty*>& properties) const
44 {
45  QMutableListIterator<const Pala::SlicerProperty*> iter(properties);
46  while (iter.hasNext())
47  {
48  const Pala::SlicerProperty* property = iter.next();
49  bool isEnabled = property->isEnabled();
50  if (p->m_propertyEnabledExceptions.contains(property->key()))
51  isEnabled = p->m_propertyEnabledExceptions.value(property->key());
52  if (!isEnabled)
53  iter.remove();
54  }
55 }
56 
57 QByteArray Pala::SlicerMode::key() const
58 {
59  return p->m_key;
60 }
61 
62 QString Pala::SlicerMode::name() const
63 {
64  return p->m_name;
65 }
66 
67 void Pala::SlicerMode::setPropertyEnabled(const QByteArray& property, bool enabled)
68 {
69  p->m_propertyEnabledExceptions.insert(property, enabled);
70 }
QByteArray
Pala::SlicerMode::SlicerMode
SlicerMode(const QByteArray &key, const QString &name)
Create a new SlicerMode instance.
Definition: slicermode.cpp:31
Pala::SlicerMode::name
QString name() const
Definition: slicermode.cpp:62
Pala::SlicerMode
Representation of an operational mode of a slicing algorithm.
Definition: slicermode.h:46
QHash< QByteArray, bool >
QMutableListIterator::remove
void remove()
slicermode.h
QString
QList
Pala::SlicerMode::filterProperties
void filterProperties(QList< const Pala::SlicerProperty * > &properties) const
Definition: slicermode.cpp:43
QMutableListIterator::hasNext
bool hasNext() const
slicerproperty.h
Pala::SlicerMode::setPropertyEnabled
void setPropertyEnabled(const QByteArray &property, bool enabled)
Defines whether the property which has been added to Pala::Slicer with the given key, is enabled when this mode is selected. If this mode does not define the state for some property, the state defined by the property itself (through the Palapeli::SlicerProperty::setEnabled() method) is used. You will therefore probably use this function only to define exceptions from this default state.
Definition: slicermode.cpp:67
QMutableListIterator::next
T & next()
QMutableListIterator
Pala::SlicerMode::key
QByteArray key() const
Definition: slicermode.cpp:57
Pala::SlicerProperty
Representation of a single configurable parameter of a slicing algorithm.
Definition: slicerproperty.h:44
Pala::SlicerMode::~SlicerMode
virtual ~SlicerMode()
Definition: slicermode.cpp:38
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:19:02 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

palapeli/libpala

Skip menu "palapeli/libpala"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdegames API Reference

Skip menu "kdegames API Reference"
  • granatier
  • kapman
  • kblackbox
  • kgoldrunner
  • kigo
  • kmahjongg
  • KShisen
  • ksquares
  • libkdegames
  •   highscore
  •   libkdegamesprivate
  •     kgame
  • libkmahjongg
  • palapeli
  •   libpala

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