KSUserDB

Search for usage in LXR

KSUserDB Class Reference

#include <ksuserdb.h>

Public Member Functions

bool AddCustomDriver (const QVariantMap &oneDriver)
 
void AddDarkFrame (const QVariantMap &oneFrame)
 
void AddDSLRInfo (const QMap< QString, QVariant > &oneInfo)
 
void AddDSLRLens (const QString &model, const QString &vendor, const double focalLength, const double focalRatio)
 
void AddDSLRLens (const QString &model, const QString &vendor, const double focalLength, const double focalRatio, const QString &id)
 
void AddEffectiveFOV (const QVariantMap &oneFOV)
 
void AddEyepiece (const QString &vendor, const QString &model, const double &focalLength, const double &fov, const QString &fovunit)
 
void AddEyepiece (const QString &vendor, const QString &model, const double &focalLength, const double &fov, const QString &fovunit, const QString &id)
 
void AddFilter (const filterProperties *fp)
 
void AddFilter (const filterProperties *fp, const QString &id)
 
void AddFlag (const QString &ra, const QString &dec, const QString &epoch, const QString &image_name, const QString &label, const QString &labelColor)
 
void AddHIPSSource (const QMap< QString, QString > &oneSource)
 
void AddHorizon (ArtificialHorizonEntity *horizon)
 
void AddLens (const QString &vendor, const QString &model, const double &factor)
 
void AddLens (const QString &vendor, const QString &model, const double &factor, const QString &id)
 
void AddObserver (const QString &name, const QString &surname, const QString &contact)
 
void AddOpticalTrain (const QVariantMap &oneTrain)
 
void AddOpticalTrainSettings (uint32_t train, const QByteArray &settings)
 
int AddProfile (const QString &name)
 
void AddProfileSettings (uint32_t profile, const QByteArray &settings)
 
void AddScope (const QString &model, const QString &vendor, const QString &type, const double &aperture, const double &focalLength)
 
void AddScope (const QString &model, const QString &vendor, const QString &type, const double &aperture, const double &focalLength, const QString &id)
 
bool DeleteAllDSLRInfo ()
 
void DeleteAllEquipment (const QString &type)
 
void DeleteAllFlags ()
 
void DeleteAllHorizons ()
 
bool DeleteCustomDriver (const QString &id)
 
void DeleteDarkFrame (const QString &filename)
 
bool DeleteDSLRInfo (const QString &model)
 
bool DeleteEffectiveFOV (const QString &id)
 
void DeleteEquipment (const QString &type, const QString &id)
 
bool DeleteHIPSSource (const QString &ID)
 
bool DeleteObserver (const QString &id)
 
void DeleteOpticalTrain (int id)
 
void DeleteOpticalTrainSettings (uint32_t train)
 
bool DeleteProfile (const QSharedPointer< ProfileInfo > &pi)
 
void DeleteProfileSettings (uint32_t profile)
 
bool FindObserver (const QString &name, const QString &surname)
 
void GetAllCustomDrivers (QList< QVariantMap > &CustomDrivers)
 
void GetAllDarkFrames (QList< QVariantMap > &darkFrames)
 
void GetAllDSLRInfos (QList< QMap< QString, QVariant >> &DSLRInfos)
 
void GetAllDSLRLenses (QList< OAL::DSLRLens * > &dslrlens_list)
 
void GetAllEffectiveFOVs (QList< QVariantMap > &effectiveFOVs)
 
void GetAllEyepieces (QList< OAL::Eyepiece * > &m_eyepieceList)
 
void GetAllFilters (QList< OAL::Filter * > &m_filterList)
 
QList< QStringListGetAllFlags ()
 
void GetAllHIPSSources (QList< QMap< QString, QString >> &HIPSSources)
 
QList< ArtificialHorizonEntity * > GetAllHorizons ()
 
void GetAllLenses (QList< OAL::Lens * > &m_lensList)
 
void GetAllObservers (QList< OAL::Observer * > &observer_list)
 
void GetAllProfiles (QList< QSharedPointer< ProfileInfo > > &profiles)
 
void GetAllScopes (QList< OAL::Scope * > &m_scopeList)
 
QSqlDatabase GetDatabase ()
 
bool getLastOpticalElement (QJsonObject &element)
 
bool getOpticalElementByID (int id, QJsonObject &element)
 
bool getOpticalElementByName (const QString &name, QJsonObject &element)
 
QStringList getOpticalElementNames ()
 
void GetOpticalTrains (uint32_t profileID, QList< QVariantMap > &opticalTrains)
 
bool GetOpticalTrainSettings (uint32_t train, QVariantMap &settings)
 
bool GetProfileSettings (uint32_t profile, QVariantMap &settings)
 
bool Initialize ()
 
bool PurgeProfile (const QSharedPointer< ProfileInfo > &pi)
 
void SaveProfile (const QSharedPointer< ProfileInfo > &pi)
 
void UpdateDarkFrame (const QVariantMap &oneFrame)
 
void UpdateOpticalTrain (const QVariantMap &oneTrain, int id)
 
void UpdateOpticalTrainSettings (uint32_t train, const QByteArray &settings)
 
void UpdateProfileSettings (uint32_t profileID, const QByteArray &settings)
 

Detailed Description

Single class to delegate all User database I/O.

usage: Call QSqlDatabase::removeDatabase("userdb"); after the object of this class is deallocated

Author
Rishab Arora
Jasem Mutlaq
Version
1.2

Definition at line 38 of file ksuserdb.h.

Member Function Documentation

◆ AddDarkFrame()

void KSUserDB::AddDarkFrame ( const QVariantMap &  oneFrame)

KSUserDB::AddDarkFrame Saves a new dark frame data to the database.

Parameters
oneFrameMap that contains 1 to 1 correspondence with the database table, except for primary key and timestamp.

Definition at line 686 of file ksuserdb.cpp.

◆ AddDSLRLens() [1/2]

void KSUserDB::AddDSLRLens ( const QString model,
const QString vendor,
const double  focalLength,
const double  focalRatio 
)

Appends the DSLR lens with given details in the database.

Returns
void

Definition at line 2364 of file ksuserdb.cpp.

◆ AddDSLRLens() [2/2]

void KSUserDB::AddDSLRLens ( const QString model,
const QString vendor,
const double  focalLength,
const double  focalRatio,
const QString id 
)

Replaces the scope with given ID with provided content.

Returns
void

Definition at line 2383 of file ksuserdb.cpp.

◆ AddEyepiece() [1/2]

void KSUserDB::AddEyepiece ( const QString vendor,
const QString model,
const double &  focalLength,
const double &  fov,
const QString fovunit 
)

Add new eyepiece to database.

Returns
void

Definition at line 1305 of file ksuserdb.cpp.

◆ AddEyepiece() [2/2]

void KSUserDB::AddEyepiece ( const QString vendor,
const QString model,
const double &  focalLength,
const double &  fov,
const QString fovunit,
const QString id 
)

Replace eyepiece at position (ID) with new content.

Returns
void

Definition at line 1325 of file ksuserdb.cpp.

◆ AddFilter() [1/2]

void KSUserDB::AddFilter ( const filterProperties *  fp)

Add a new filter to the database.

Returns
void

Definition at line 1443 of file ksuserdb.cpp.

◆ AddFilter() [2/2]

void KSUserDB::AddFilter ( const filterProperties *  fp,
const QString id 
)

Replace a filter at given ID with new content.

Returns
void

Definition at line 1490 of file ksuserdb.cpp.

◆ AddFlag()

void KSUserDB::AddFlag ( const QString ra,
const QString dec,
const QString epoch,
const QString image_name,
const QString label,
const QString labelColor 
)

Add a new Flag with given parameters.

Parameters
raRight Ascension
decDeclination
epochEpoch
image_nameName of the image used
labelContent of display label on screen
labelColorColor of the label (name or hex code) eg #00FF00
Returns
void

Definition at line 1138 of file ksuserdb.cpp.

◆ AddLens() [1/2]

void KSUserDB::AddLens ( const QString vendor,
const QString model,
const double &  factor 
)

Add a new lens to the database.

Returns
void

Definition at line 1379 of file ksuserdb.cpp.

◆ AddLens() [2/2]

void KSUserDB::AddLens ( const QString vendor,
const QString model,
const double &  factor,
const QString id 
)

Replace a lens at given ID with new content.

Returns
void

Definition at line 1396 of file ksuserdb.cpp.

◆ AddObserver()

void KSUserDB::AddObserver ( const QString name,
const QString surname,
const QString contact 
)

Adds a new observer into the database.

Definition at line 587 of file ksuserdb.cpp.

◆ AddOpticalTrain()

void KSUserDB::AddOpticalTrain ( const QVariantMap &  oneTrain)

Add a new optical train to the database.

Parameters
oneTrainoptical train data

Definition at line 834 of file ksuserdb.cpp.

◆ AddOpticalTrainSettings()

void KSUserDB::AddOpticalTrainSettings ( uint32_t  train,
const QByteArray settings 
)

Add new Train settings to the database.

Parameters
settingsJSON settings

Definition at line 2610 of file ksuserdb.cpp.

◆ AddProfileSettings()

void KSUserDB::AddProfileSettings ( uint32_t  profile,
const QByteArray settings 
)

Add new profile settings to the database.

Parameters
settingsJSON settings

Definition at line 2532 of file ksuserdb.cpp.

◆ AddScope() [1/2]

void KSUserDB::AddScope ( const QString model,
const QString vendor,
const QString type,
const double &  aperture,
const double &  focalLength 
)

Appends the scope with given details in the database.

Returns
void

Definition at line 1229 of file ksuserdb.cpp.

◆ AddScope() [2/2]

void KSUserDB::AddScope ( const QString model,
const QString vendor,
const QString type,
const double &  aperture,
const double &  focalLength,
const QString id 
)

Replaces the scope with given ID with provided content.

Returns
void

Definition at line 1252 of file ksuserdb.cpp.

◆ DeleteAllEquipment()

void KSUserDB::DeleteAllEquipment ( const QString type)

Erases the whole equipment table of given type.

Parameters
typeEquipment type (same as table name)
Returns
void

Definition at line 1211 of file ksuserdb.cpp.

◆ DeleteAllFlags()

void KSUserDB::DeleteAllFlags ( )

Erases all the flags from the database.

Returns
void

Definition at line 1123 of file ksuserdb.cpp.

◆ DeleteDarkFrame()

void KSUserDB::DeleteDarkFrame ( const QString filename)

KSUserDB::DeleteDarkFrame Delete from database a dark frame record that matches the filename field.

Parameters
filenamefilename of dark frame to delete from database.

Definition at line 731 of file ksuserdb.cpp.

◆ DeleteEquipment()

void KSUserDB::DeleteEquipment ( const QString type,
const QString id 
)

Erase the equipment with given type and unique id Valid equipment types: "telescope","lens","filter".

Parameters
typeEquipment type (same as table name)
idUnique id (same as row number)
Returns
void

Definition at line 1196 of file ksuserdb.cpp.

◆ DeleteObserver()

bool KSUserDB::DeleteObserver ( const QString id)

Removes the user with unique id as given by FindObserver Returns false if the user is not found.

Returns
bool

Definition at line 633 of file ksuserdb.cpp.

◆ FindObserver()

bool KSUserDB::FindObserver ( const QString name,
const QString surname 
)

Returns the unique id of the user with given name & surname.

Returns
true if found, false otherwise

Definition at line 617 of file ksuserdb.cpp.

◆ GetAllDSLRLenses()

void KSUserDB::GetAllDSLRLenses ( QList< OAL::DSLRLens * > &  dslrlens_list)

updates the dslr list with all DSLR lenses from database List is cleared and then filled with content.

Parameters
dslrlens_listReference to list to be updated
Returns
void

Definition at line 2406 of file ksuserdb.cpp.

◆ GetAllEyepieces()

void KSUserDB::GetAllEyepieces ( QList< OAL::Eyepiece * > &  m_eyepieceList)

Populate the reference passed with all eyepieces.

Parameters
m_eyepieceListReference to list of eyepieces
Returns
void

Definition at line 1349 of file ksuserdb.cpp.

◆ GetAllFilters()

void KSUserDB::GetAllFilters ( QList< OAL::Filter * > &  m_filterList)

Populate the reference passed with all filters.

Parameters
m_filterListReference to list of filters
Returns
void

Definition at line 1523 of file ksuserdb.cpp.

◆ GetAllFlags()

QList< QStringList > KSUserDB::GetAllFlags ( )

Returns a QList populated with all stored flags Order: const QString &ra, const QString &dec, const QString &epoch, const QString &imageName, const QString &label, const QString &labelColor.

Returns
QList< QStringList >

Definition at line 1159 of file ksuserdb.cpp.

◆ GetAllLenses()

void KSUserDB::GetAllLenses ( QList< OAL::Lens * > &  m_lensList)

Populate the reference passed with all lenses.

Parameters
m_lensListReference to list of lenses
Returns
void

Definition at line 1416 of file ksuserdb.cpp.

◆ GetAllObservers()

void KSUserDB::GetAllObservers ( QList< OAL::Observer * > &  observer_list)

Updates the passed reference of observer_list with all observers The original content of the list is cleared.

Returns
void

Definition at line 656 of file ksuserdb.cpp.

◆ GetAllProfiles()

void KSUserDB::GetAllProfiles ( QList< QSharedPointer< ProfileInfo > > &  profiles)

GetAllProfiles Return all profiles in a QList.

Returns
QMap with the keys as profile names and values are profile ids.

Definition at line 2257 of file ksuserdb.cpp.

◆ GetAllScopes()

void KSUserDB::GetAllScopes ( QList< OAL::Scope * > &  m_scopeList)

updates the scope list with all scopes from database List is cleared and then filled with content.

Parameters
m_scopeListReference to list to be updated
Returns
void

Definition at line 1276 of file ksuserdb.cpp.

◆ getLastOpticalElement()

bool KSUserDB::getLastOpticalElement ( QJsonObject element)

getLastOpticalElement Return last inserted scope or lens

Parameters
elementJSON object to fill with scope or lens metadata
Returns
True if found, false if none found.

Definition at line 2461 of file ksuserdb.cpp.

◆ GetOpticalTrains()

void KSUserDB::GetOpticalTrains ( uint32_t  profileID,
QList< QVariantMap > &  opticalTrains 
)

Populate the reference passed with all optical trains.

Parameters
opticalTrainsReference to all trains list

Definition at line 893 of file ksuserdb.cpp.

◆ GetOpticalTrainSettings()

bool KSUserDB::GetOpticalTrainSettings ( uint32_t  train,
QVariantMap &  settings 
)

Populate the reference passed with settings for one paritcular Train.

Parameters
TrainIDid of Train
settingspopulate settings with parsed Train settings.

Definition at line 2657 of file ksuserdb.cpp.

◆ GetProfileSettings()

bool KSUserDB::GetProfileSettings ( uint32_t  profile,
QVariantMap &  settings 
)

Populate the reference passed with settings for one paritcular profile.

Parameters
profileid of profile
settingspopulate settings with parsed profile settings.

Definition at line 2583 of file ksuserdb.cpp.

◆ Initialize()

bool KSUserDB::Initialize ( )

Initialize KStarsDB while running splash screen.

Returns
true on success

Definition at line 43 of file ksuserdb.cpp.

◆ UpdateDarkFrame()

void KSUserDB::UpdateDarkFrame ( const QVariantMap &  oneFrame)

KSUserDB::UpdateDarkFrame Updates an existing dark frame record in the data, replace all values matching the supplied ID.

Parameters
oneFramedark frame to update. The ID should already exist in the database.

Definition at line 710 of file ksuserdb.cpp.

◆ UpdateOpticalTrain()

void KSUserDB::UpdateOpticalTrain ( const QVariantMap &  oneTrain,
int  id 
)

Update an existing optical train.

Parameters
oneTrainoptical train data
idID of train to replace in database

Definition at line 857 of file ksuserdb.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon May 8 2023 03:57:37 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.