PictureCrypt  1.4.1
An image-steganography project
Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Slots | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
ModelPC Class Reference

The ModelPC class Model Layer of the app. Main class that does the work of PictureCrypt logic Controled by ControllerPC. More...

#include <modelpc.h>

Inheritance diagram for ModelPC:
Inheritance graph
[legend]
Collaboration diagram for ModelPC:
Collaboration graph
[legend]

Public Types

enum  CryptMode { Unspecified, v1_3, v1_4, jphs_mode }
 

Public Slots

QImage * encrypt (QByteArray data, QImage *image, int _mode, QString key="", int _bitsUsed=8, QString *_error=nullptr)
 ModelPC::encrypt Slot to zip and inject data and provide it with some extra stuff After completion start standard ModelPC::inject Isn't used in PictureCrypt, but used can be used in other - custom projects. More...
 
QByteArray decrypt (QImage *image, QString key, int _mode=Unspecified, QString *_error=nullptr)
 ModelPC::decrypt Slot to be called when decrypt mode in ViewPC is selected and started. More...
 
void fail (QString message)
 ModelPC::fail Slot to stop execution of cryption. More...
 
void alert (QString message, bool isWarning=false)
 ModelPC::alert Function emits signal ModelPC::alertView and calls ViewPC::alert. More...
 

Signals

void alertView (QString messageCode, bool isWarning)
 alertView Signal to be called to create MessageBox. More...
 
void saveData (QByteArray data)
 saveData Signal to be called to save data from ModelPC::decrypt. More...
 
void saveImage (QImage *image)
 saveImage Signal to be called to save image from ModelPC::encrypt. More...
 
void setProgress (int val)
 setProgress Signal to be called to set progress of ProgressDialog. More...
 

Public Member Functions

 ModelPC ()
 ModelPC::ModelPC Constructor Unit tests are run here. More...
 
QByteArray unzip (QByteArray data, QByteArray key)
 ModelPC::unzip Unzip data from ModelPC::decrypt. Just mirrored EncryptDialog::zip. More...
 

Static Public Member Functions

static QImage * Encrypt (QByteArray data, QImage *image, CryptMode _mode, QString key="", int _bitsUsed=8, QString *_error=nullptr)
 
static QByteArray Decrypt (QImage *image, QString key, CryptMode _mode=Unspecified, QString *_error=nullptr)
 

Public Attributes

bool success
 success Flag that true by default, but in case of error or cancelling of ProgressDialog it turns to false, which stops execution of ModelPC::circuit More...
 
long version
 version Version of the class More...
 
QString versionString
 versionString Version as string More...
 
QString defaultJPHSDir
 defaultJPHSDir Default JPHS directory More...
 

Protected Slots

QImage * inject (QByteArray encr_data, QImage *image, int _mode, int _bitsUsed=8, QString *_error=nullptr)
 ModelPC::inject Slot to be called when encrypt mode in ViewPC is selected and started. More...
 

Protected Member Functions

void circuit (QImage *image, QByteArray *data, long long int countBytes)
 ModelPC::circuit The brain of the app. Via special circuit stores data in image. More...
 
void jphs (QImage *image, QByteArray *data)
 ModelPC::jphs JPHS function to use jphide and jpseek (currently under development) More...
 
void processPixel (QPoint pos, QVector< QPoint > *were, bool isEncrypt)
 ModelPC::processPixel Processes every pixel. Reads its contains or writes data. More...
 
void encryptv1_4 (QImage *image, QByteArray data, QString key)
 ModelPC::encryptv1_4 Encrypts and injects data to image used in v1.4+. More...
 
QByteArray decryptv1_3 (QImage *image, QString key)
 ModelPC::decryptv1_3 Decrytps data from image in v1.3. More...
 
QByteArray decryptv1_4 (QImage *image, QString key)
 ModelPC::decryptv1_4 Decrypts data from image in v1.4+. More...
 
void proccessPixelsv1_4 (QImage *image, QByteArray *data, QByteArray key, bool isEncrypt, QVector< QPair< QPoint, QPair< int, int > > > *were, long long size=-1)
 ModelPC::proccessPixelsv1_4 Hides (or retrieves) data to/from pixels. More...
 
QByteArray zip (QByteArray data, QByteArray key)
 ModelPC::zip Zip function, copy of EncryptDialog::zip Used for ModelPC in custom projects, other than PictureCrypt. More...
 

Static Protected Member Functions

static QImage * Inject (QByteArray encr_data, QImage *image, CryptMode _mode, int _bitsUsed=8, QString *_error=nullptr)
 

Protected Attributes

QString * error
 error Current error More...
 

Detailed Description

The ModelPC class Model Layer of the app. Main class that does the work of PictureCrypt logic Controled by ControllerPC.

See also
ViewPC, ControllerPC
Author
Alex Kovrigin (waleko)

Definition at line 33 of file modelpc.h.

Member Enumeration Documentation

Enumerator
Unspecified 
v1_3 
v1_4 
jphs_mode 

Definition at line 38 of file modelpc.h.

Constructor & Destructor Documentation

ModelPC::ModelPC ( )

ModelPC::ModelPC Constructor Unit tests are run here.

See also
ControllerPC, ViewPC

Definition at line 9 of file modelpc.cpp.

Here is the caller graph for this function:

Member Function Documentation

void ModelPC::alert ( QString  message,
bool  isWarning = false 
)
slot

ModelPC::alert Function emits signal ModelPC::alertView and calls ViewPC::alert.

Parameters
messageMessage to be transmitted.
isWarningFlag if message is critical.
See also
ViewPC::alert

Definition at line 941 of file modelpc.cpp.

Here is the caller graph for this function:

void ModelPC::alertView ( QString  messageCode,
bool  isWarning 
)
signal

alertView Signal to be called to create MessageBox.

Parameters
messageCodeMessage Code to be shown.
isWarningFlag if message is critical.
See also
ModelPC::alert, ViewPC::alert

Here is the caller graph for this function:

void ModelPC::circuit ( QImage *  image,
QByteArray *  data,
long long int  countBytes 
)
protected

ModelPC::circuit The brain of the app. Via special circuit stores data in image.

The circuit itself can be found in documentation or in commentaries in source.

Parameters
imageImage to be processed.
dataData to be processed.
countBytesNumber of bytes to be read or written.
See also
ModelPC::processPixel

Definition at line 359 of file modelpc.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

QByteArray ModelPC::Decrypt ( QImage *  image,
QString  key,
CryptMode  _mode = Unspecified,
QString *  _error = nullptr 
)
static

Definition at line 34 of file modelpc.cpp.

Here is the call graph for this function:

QByteArray ModelPC::decrypt ( QImage *  image,
QString  key,
int  _mode = Unspecified,
QString *  _error = nullptr 
)
slot

ModelPC::decrypt Slot to be called when decrypt mode in ViewPC is selected and started.

Parameters
imageImage to be decrypted.
keyKeyphrase with which the data is injected
_modeMode for decryption
_errorError output
Returns
Returns decrypted data
See also
ViewPC::on_startButton_clicked, ModelPC::inject, ModelPC::circuit

Definition at line 212 of file modelpc.cpp.

Here is the call graph for this function:

QByteArray ModelPC::decryptv1_3 ( QImage *  image,
QString  key 
)
protected

ModelPC::decryptv1_3 Decrytps data from image in v1.3.

Parameters
imageImage with data
keyKey
Returns
Returns obtained data

Definition at line 778 of file modelpc.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

QByteArray ModelPC::decryptv1_4 ( QImage *  image,
QString  key 
)
protected

ModelPC::decryptv1_4 Decrypts data from image in v1.4+.

Parameters
imageImage with data
keyKey
Returns
Returns obtained data

Definition at line 603 of file modelpc.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

QImage * ModelPC::Encrypt ( QByteArray  data,
QImage *  image,
CryptMode  _mode,
QString  key = "",
int  _bitsUsed = 8,
QString *  _error = nullptr 
)
static

Definition at line 24 of file modelpc.cpp.

Here is the call graph for this function:

QImage * ModelPC::encrypt ( QByteArray  data,
QImage *  image,
int  _mode,
QString  key = "",
int  _bitsUsed = 8,
QString *  _error = nullptr 
)
slot

ModelPC::encrypt Slot to zip and inject data and provide it with some extra stuff After completion start standard ModelPC::inject Isn't used in PictureCrypt, but used can be used in other - custom projects.

Parameters
dataData for embedding
imageImage for embedding
_modeMode for embedding
keyKey for extra encryption
_bitsUsedBits per byte (see ModelPC::bitsUsed)
_errorError output
Returns
Returns image with embedded data
See also
ModelPC::inject

Definition at line 51 of file modelpc.cpp.

Here is the call graph for this function:

void ModelPC::encryptv1_4 ( QImage *  image,
QByteArray  data,
QString  key 
)
protected

ModelPC::encryptv1_4 Encrypts and injects data to image used in v1.4+.

Parameters
imageImage for injecting
dataData for embedding
keyKey of encryption

Definition at line 561 of file modelpc.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void ModelPC::fail ( QString  message)
slot

ModelPC::fail Slot to stop execution of cryption.

Parameters
messageMessage for user

Definition at line 283 of file modelpc.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

QImage * ModelPC::Inject ( QByteArray  encr_data,
QImage *  image,
CryptMode  _mode,
int  _bitsUsed = 8,
QString *  _error = nullptr 
)
staticprotected

Definition at line 29 of file modelpc.cpp.

Here is the call graph for this function:

QImage * ModelPC::inject ( QByteArray  encr_data,
QImage *  image,
int  _mode,
int  _bitsUsed = 8,
QString *  _error = nullptr 
)
protectedslot

ModelPC::inject Slot to be called when encrypt mode in ViewPC is selected and started.

Parameters
encr_dataData to be inserted to an image.
imageImage to be inserted in.
_modeMode of encryption
_bitsUsedBits per byte used
_errorError output
Returns
Returns image with embedded data.
See also
ViewPC::on_startButton_clicked, ModelPC::decrypt, ModelPC::circuit, ModelPC::start

Definition at line 139 of file modelpc.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void ModelPC::jphs ( QImage *  image,
QByteArray *  data 
)
protected

ModelPC::jphs JPHS function to use jphide and jpseek (currently under development)

Parameters
imageImage for embedding
dataData

Definition at line 298 of file modelpc.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void ModelPC::proccessPixelsv1_4 ( QImage *  image,
QByteArray *  data,
QByteArray  key,
bool  isEncrypt,
QVector< QPair< QPoint, QPair< int, int > > > *  were,
long long  size = -1 
)
protected

ModelPC::proccessPixelsv1_4 Hides (or retrieves) data to/from pixels.

Parameters
imageOriginal image
dataData to write (Pointer to empty QByteArray if decrypting)
keyKey
isEncryptMode of Cryption (true -> encryption, false -> decryption)
wereWere vector for visited pixels
sizeSize of reading data, unneeded if writing

Definition at line 664 of file modelpc.cpp.

Here is the caller graph for this function:

void ModelPC::processPixel ( QPoint  pos,
QVector< QPoint > *  were,
bool  isEncrypt 
)
protected

ModelPC::processPixel Processes every pixel. Reads its contains or writes data.

Parameters
posPosition of pixel
wereVector array containing pixels, that were already processed.
isEncryptMode of operation. If true encryption operations will continue, else the decryption ones.

Definition at line 500 of file modelpc.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void ModelPC::saveData ( QByteArray  data)
signal

saveData Signal to be called to save data from ModelPC::decrypt.

Parameters
dataData to be saved.

Here is the caller graph for this function:

void ModelPC::saveImage ( QImage *  image)
signal

saveImage Signal to be called to save image from ModelPC::encrypt.

Parameters
imageImage to be saved.

Here is the caller graph for this function:

void ModelPC::setProgress ( int  val)
signal

setProgress Signal to be called to set progress of ProgressDialog.

Parameters
valValue to be set.
See also
ViewPC::setProgress

Here is the caller graph for this function:

QByteArray ModelPC::unzip ( QByteArray  data,
QByteArray  key 
)

ModelPC::unzip Unzip data from ModelPC::decrypt. Just mirrored EncryptDialog::zip.

Parameters
dataData to be decrypted.
keyKey to decrypt the data.
Returns
Returns data
See also
EncryptDialog::zip, ModelPC::decrypt, ModelPC::zip

Definition at line 880 of file modelpc.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

QByteArray ModelPC::zip ( QByteArray  data,
QByteArray  key 
)
protected

ModelPC::zip Zip function, copy of EncryptDialog::zip Used for ModelPC in custom projects, other than PictureCrypt.

Parameters
dataData to be encrypted
keyKey for encryption
Returns
Returns decrypted data
See also
ModelPC::start, ModelPC::inject, ModelPC::unzip

Definition at line 897 of file modelpc.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

QString ModelPC::defaultJPHSDir

defaultJPHSDir Default JPHS directory

Definition at line 92 of file modelpc.h.

QString* ModelPC::error
protected

error Current error

Definition at line 108 of file modelpc.h.

bool ModelPC::success

success Flag that true by default, but in case of error or cancelling of ProgressDialog it turns to false, which stops execution of ModelPC::circuit

Definition at line 80 of file modelpc.h.

long ModelPC::version

version Version of the class

Definition at line 84 of file modelpc.h.

QString ModelPC::versionString

versionString Version as string

Definition at line 88 of file modelpc.h.


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