Torc  0.1
Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | Properties | List of all members
TorcSetting Class Reference

A wrapper around a database setting. More...

#include <torcsetting.h>

Inheritance diagram for TorcSetting:
[legend]

Public Types

enum  Type {
  Bool, Integer, String, StringList,
  Group
}
 
enum  Role { None = (0 << 0), Persistent = (1 << 0), Public = (1 << 1) }
 

Public Slots

void SubscriberDeleted (QObject *Subscriber)
 
QVariantMap GetChildList (void)
 
bool SetValue (const QVariant &Value)
 
bool GetIsActive (void)
 
void SetActive (bool Value)
 
QVariant GetValue (void)
 
QString GetUiName (void)
 
QString GetHelpText (void)
 
QVariant GetDefaultValue (void)
 
QString GetSettingType (void)
 
QVariantMap GetSelections (void)
 
int GetBegin (void)
 
int GetEnd (void)
 
int GetStep (void)
 

Signals

void ValueChanged (int Value)
 
void ValueChanged (bool Value)
 
void ValueChanged (QString &Value)
 
void ValueChanged (QStringList &Value)
 
void ActiveChanged (bool Active)
 
void Removed (void)
 

Public Member Functions

 TorcSetting (TorcSetting *Parent, const QString &DBName, const QString &UIName, Type SettingType, Roles SettingRoles, const QVariant &Default)
 
void Remove (void)
 
void SetActiveThreshold (int Threshold)
 
void SetHelpText (const QString &HelpText)
 
void SetRange (int Begin, int End, int Step)
 
void SetSelections (QVariantMap &Selections)
 
- Public Member Functions inherited from TorcHTTPService
 TorcHTTPService (QObject *Parent, const QString &Signature, const QString &Name, const QMetaObject &MetaObject, const QString &Blacklist=QStringLiteral(""))
 
virtual ~TorcHTTPService ()
 
void ProcessHTTPRequest (const QString &PeerAddress, int PeerPort, const QString &LocalAddress, int LocalPort, TorcHTTPRequest &Request) override
 
QVariantMap ProcessRequest (const QString &Method, const QVariant &Parameters, QObject *Connection, bool Authenticated) override
 
QString GetMethod (int Index)
 
QVariant GetProperty (int Index)
 Get the value of a given property. More...
 
QVariantMap GetServiceDetails (void)
 Return a QVariantMap describing the services methods and properties. More...
 
virtual QString GetUIName (void)
 
virtual QString GetPresentationURL (void)
 
- Public Member Functions inherited from TorcHTTPHandler
 TorcHTTPHandler (const QString &Signature, const QString &Name)
 
virtual ~TorcHTTPHandler ()
 
QString Signature (void) const
 
bool GetRecursive (void) const
 
QString Name (void) const
 
- Public Member Functions inherited from TorcReferenceCounter
 TorcReferenceCounter (void)
 
virtual ~TorcReferenceCounter (void)=default
 
void UpRef (void)
 
virtual bool DownRef (void)
 
bool IsShared (void)
 

Protected Member Functions

virtual ~TorcSetting ()=default
 
QString GetChildList (QVariantMap &Children)
 
TorcSettingFindChild (const QString &Child, bool Recursive=false)
 
QSet< TorcSetting * > GetChildren (void)
 
void AddChild (TorcSetting *Child)
 
void RemoveChild (TorcSetting *Child)
 
- Protected Member Functions inherited from TorcHTTPService
void HandleSubscriberDeleted (QObject *Subscriber)
 

Properties

QVariant value
 
QString uiName
 
QString helpText
 
QVariant defaultValue
 
bool isActive
 
QString settingType
 
QVariantMap selections
 

Additional Inherited Members

- Static Public Member Functions inherited from TorcReferenceCounter
static void EventLoopEnding (bool Ending)
 
- Static Protected Member Functions inherited from TorcHTTPHandler
static bool MethodIsAuthorised (TorcHTTPRequest &Request, int Allowed)
 Check the current request is authorised and set the authentication header if not. More...
 
static void HandleOptions (TorcHTTPRequest &Request, int Allowed)
 
static void HandleFile (TorcHTTPRequest &Request, const QString &Filename, int Cache)
 
- Protected Attributes inherited from TorcHTTPService
QReadWriteLock m_httpServiceLock
 
- Protected Attributes inherited from TorcHTTPHandler
QString m_signature
 
bool m_recursive
 
QString m_name
 
- Protected Attributes inherited from TorcReferenceCounter
QAtomicInt m_refCount
 
- Static Protected Attributes inherited from TorcReferenceCounter
static bool m_eventLoopEnding = false
 

Detailed Description

A wrapper around a database setting.

TorcSetting acts as a wrapper around a persistent (stored in a database) or temporary (system/state dependant) setting.

Setting storage types are currently limited to Int, Bool, String or StringList but could be extended to any QVariant supported type that can be converted to a string and hence easily stored within the database.

The setting type describes the setting's behaviour.

TorcSetting additionally acts as a state machine. It can be activated by other settings and QObjects and can notify other objects of any change to its value.

A class can create and connect a number of TorcSettings to encapsulate the desired setting behaviour and allow the setting structure to be presented and manipulated by an appropriate user facing interface.

See also
TorcUISetting

Definition at line 15 of file torcsetting.h.

Member Enumeration Documentation

Enumerator
None 
Persistent 
Public 

Definition at line 27 of file torcsetting.h.

Enumerator
Bool 
Integer 
String 
StringList 
Group 

Definition at line 18 of file torcsetting.h.

Constructor & Destructor Documentation

TorcSetting::TorcSetting ( TorcSetting Parent,
const QString &  DBName,
const QString &  UIName,
Type  SettingType,
Roles  SettingRoles,
const QVariant &  Default 
)

Definition at line 50 of file torcsetting.cpp.

virtual TorcSetting::~TorcSetting ( )
protectedvirtualdefault

Member Function Documentation

void TorcSetting::ActiveChanged ( bool  Active)
signal
void TorcSetting::AddChild ( TorcSetting Child)
protected

Definition at line 158 of file torcsetting.cpp.

TorcSetting * TorcSetting::FindChild ( const QString &  Child,
bool  Recursive = false 
)
protected

Definition at line 196 of file torcsetting.cpp.

int TorcSetting::GetBegin ( void  )
slot

Definition at line 262 of file torcsetting.cpp.

QVariantMap TorcSetting::GetChildList ( void  )
slot

Definition at line 119 of file torcsetting.cpp.

QString TorcSetting::GetChildList ( QVariantMap &  Children)
protected

Definition at line 128 of file torcsetting.cpp.

QSet< TorcSetting * > TorcSetting::GetChildren ( void  )
protected

Definition at line 217 of file torcsetting.cpp.

QVariant TorcSetting::GetDefaultValue ( void  )
slot

Definition at line 250 of file torcsetting.cpp.

int TorcSetting::GetEnd ( void  )
slot

Definition at line 268 of file torcsetting.cpp.

QString TorcSetting::GetHelpText ( void  )
slot

Definition at line 244 of file torcsetting.cpp.

bool TorcSetting::GetIsActive ( void  )
slot

Definition at line 232 of file torcsetting.cpp.

QVariantMap TorcSetting::GetSelections ( void  )
slot

Definition at line 146 of file torcsetting.cpp.

QString TorcSetting::GetSettingType ( void  )
slot

Definition at line 256 of file torcsetting.cpp.

int TorcSetting::GetStep ( void  )
slot

Definition at line 274 of file torcsetting.cpp.

QString TorcSetting::GetUiName ( void  )
slot

Definition at line 238 of file torcsetting.cpp.

QVariant TorcSetting::GetValue ( void  )
slot

Definition at line 398 of file torcsetting.cpp.

void TorcSetting::Remove ( void  )

Definition at line 187 of file torcsetting.cpp.

void TorcSetting::RemoveChild ( TorcSetting Child)
protected

Definition at line 167 of file torcsetting.cpp.

void TorcSetting::Removed ( void  )
signal
void TorcSetting::SetActive ( bool  Value)
slot

Definition at line 280 of file torcsetting.cpp.

void TorcSetting::SetActiveThreshold ( int  Threshold)

Definition at line 294 of file torcsetting.cpp.

void TorcSetting::SetHelpText ( const QString &  HelpText)

Definition at line 392 of file torcsetting.cpp.

void TorcSetting::SetRange ( int  Begin,
int  End,
int  Step 
)

Definition at line 374 of file torcsetting.cpp.

void TorcSetting::SetSelections ( QVariantMap &  Selections)

Definition at line 152 of file torcsetting.cpp.

bool TorcSetting::SetValue ( const QVariant &  Value)
slot

Definition at line 308 of file torcsetting.cpp.

void TorcSetting::SubscriberDeleted ( QObject *  Subscriber)
slot

Definition at line 114 of file torcsetting.cpp.

void TorcSetting::ValueChanged ( int  Value)
signal
void TorcSetting::ValueChanged ( bool  Value)
signal
void TorcSetting::ValueChanged ( QString &  Value)
signal
void TorcSetting::ValueChanged ( QStringList &  Value)
signal

Property Documentation

QVariant TorcSetting::defaultValue
read

Definition at line 49 of file torcsetting.h.

QString TorcSetting::helpText
read

Definition at line 48 of file torcsetting.h.

bool TorcSetting::isActive
read

Definition at line 50 of file torcsetting.h.

QVariantMap TorcSetting::selections
read

Definition at line 52 of file torcsetting.h.

QString TorcSetting::settingType
read

Definition at line 51 of file torcsetting.h.

QString TorcSetting::uiName
read

Definition at line 47 of file torcsetting.h.

QVariant TorcSetting::value
read

Definition at line 46 of file torcsetting.h.


The documentation for this class was generated from the following files: