KSUserDB

Search for usage in LXR

KSUserDB Class Reference

#include <ksuserdb.h>

Public Member Functions

bool AddCollimationOverlayElement (const QVariantMap &oneElement)
 
bool AddCustomDriver (const QVariantMap &oneDriver)
 
bool AddDarkFrame (const QVariantMap &oneFrame)
 
bool AddDSLRInfo (const QMap< QString, QVariant > &oneInfo)
 
bool AddDSLRLens (const QString &model, const QString &vendor, const double focalLength, const double focalRatio)
 
bool AddDSLRLens (const QString &model, const QString &vendor, const double focalLength, const double focalRatio, const QString &id)
 
bool AddEffectiveFOV (const QVariantMap &oneFOV)
 
bool AddEyepiece (const QString &vendor, const QString &model, const double &focalLength, const double &fov, const QString &fovunit)
 
bool AddEyepiece (const QString &vendor, const QString &model, const double &focalLength, const double &fov, const QString &fovunit, const QString &id)
 
bool AddFilter (const filterProperties *fp)
 
bool AddFilter (const filterProperties *fp, const QString &id)
 
bool AddFlag (const QString &ra, const QString &dec, const QString &epoch, const QString &image_name, const QString &label, const QString &labelColor)
 
bool AddHIPSSource (const QMap< QString, QString > &oneSource)
 
bool AddHorizon (ArtificialHorizonEntity *horizon)
 
bool AddImageOverlay (const ImageOverlay &overlay)
 
bool AddLens (const QString &vendor, const QString &model, const double &factor)
 
bool AddLens (const QString &vendor, const QString &model, const double &factor, const QString &id)
 
bool AddObserver (const QString &name, const QString &surname, const QString &contact)
 
bool AddOpticalTrain (const QVariantMap &oneTrain)
 
bool AddOpticalTrainSettings (uint32_t train, const QByteArray &settings)
 
int AddProfile (const QString &name)
 
void AddProfileSettings (uint32_t profile, const QByteArray &settings)
 
bool AddScope (const QString &model, const QString &vendor, const QString &type, const double &aperture, const double &focalLength)
 
bool AddScope (const QString &model, const QString &vendor, const QString &type, const double &aperture, const double &focalLength, const QString &id)
 
bool AddSkyMapView (const SkyMapView &view)
 
const QStringconnectionName () const
 
bool DeleteAllDSLRInfo ()
 
bool DeleteAllEquipment (const QString &type)
 
bool DeleteAllFlags ()
 
bool DeleteAllHorizons ()
 
bool DeleteAllImageOverlays ()
 
bool DeleteAllSkyMapViews ()
 
bool DeleteCollimationOverlayElement (int id)
 
bool DeleteCustomDriver (const QString &id)
 
bool DeleteDarkFrame (const QString &filename)
 
bool DeleteDSLRInfo (const QString &model)
 
bool DeleteEffectiveFOV (const QString &id)
 
bool DeleteEquipment (const QString &type, const QString &id)
 
bool DeleteHIPSSource (const QString &ID)
 
bool DeleteObserver (const QString &id)
 
bool DeleteOpticalTrain (int id)
 
bool DeleteOpticalTrainSettings (uint32_t train)
 
bool DeleteProfile (const QSharedPointer< ProfileInfo > &pi)
 
void DeleteProfileSettings (uint32_t profile)
 
bool FindObserver (const QString &name, const QString &surname)
 
bool GetAllCustomDrivers (QList< QVariantMap > &CustomDrivers)
 
bool GetAllDarkFrames (QList< QVariantMap > &darkFrames)
 
bool GetAllDSLRInfos (QList< QMap< QString, QVariant > > &DSLRInfos)
 
bool GetAllDSLRLenses (QList< OAL::DSLRLens * > &dslrlens_list)
 
bool GetAllEffectiveFOVs (QList< QVariantMap > &effectiveFOVs)
 
bool GetAllEyepieces (QList< OAL::Eyepiece * > &m_eyepieceList)
 
bool GetAllFilters (QList< OAL::Filter * > &m_filterList)
 
bool GetAllFlags (QList< QStringList > &flagList)
 
bool GetAllHIPSSources (QList< QMap< QString, QString > > &HIPSSources)
 
bool GetAllHorizons (QList< ArtificialHorizonEntity * > &horizonList)
 
bool GetAllImageOverlays (QList< ImageOverlay > *imageOverlayList)
 
bool GetAllLenses (QList< OAL::Lens * > &m_lensList)
 
bool GetAllObservers (QList< OAL::Observer * > &observer_list)
 
bool GetAllProfiles (QList< QSharedPointer< ProfileInfo > > &profiles)
 
bool GetAllScopes (QList< OAL::Scope * > &m_scopeList)
 
bool GetAllSkyMapViews (QList< SkyMapView > &skyMapViewList)
 
bool GetCollimationOverlayElements (QList< QVariantMap > &collimationOverlayElements)
 
bool getLastOpticalElement (QJsonObject &element)
 
bool getOpticalElementByID (int id, QJsonObject &element)
 
bool getOpticalElementByName (const QString &name, QJsonObject &element)
 
QStringList getOpticalElementNames ()
 
bool 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)
 
bool SaveProfile (const QSharedPointer< ProfileInfo > &pi)
 
bool UpdateCollimationOverlayElement (const QVariantMap &oneElement, int id)
 
bool UpdateDarkFrame (const QVariantMap &oneFrame)
 
bool UpdateOpticalTrain (const QVariantMap &oneTrain, int id)
 
bool 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 39 of file ksuserdb.h.

Constructor & Destructor Documentation

◆ ~KSUserDB()

KSUserDB::~KSUserDB ( )

Definition at line 33 of file ksuserdb.cpp.

Member Function Documentation

◆ AddCollimationOverlayElement()

bool KSUserDB::AddCollimationOverlayElement ( const QVariantMap & oneElement)

Add a new collimation overlay element to the database.

Parameters
oneElementcollimation overlay element data

Definition at line 3290 of file ksuserdb.cpp.

◆ AddCustomDriver()

bool KSUserDB::AddCustomDriver ( const QVariantMap & oneDriver)

Definition at line 1072 of file ksuserdb.cpp.

◆ AddDarkFrame()

bool 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 746 of file ksuserdb.cpp.

◆ AddDSLRInfo()

bool KSUserDB::AddDSLRInfo ( const QMap< QString, QVariant > & oneInfo)

Definition at line 1244 of file ksuserdb.cpp.

◆ AddDSLRLens() [1/2]

bool 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 2911 of file ksuserdb.cpp.

◆ AddDSLRLens() [2/2]

bool 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 2938 of file ksuserdb.cpp.

◆ AddEffectiveFOV()

bool KSUserDB::AddEffectiveFOV ( const QVariantMap & oneFOV)

Definition at line 860 of file ksuserdb.cpp.

◆ AddEyepiece() [1/2]

bool 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 1611 of file ksuserdb.cpp.

◆ AddEyepiece() [2/2]

bool 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 1640 of file ksuserdb.cpp.

◆ AddFilter() [1/2]

bool KSUserDB::AddFilter ( const filterProperties * fp)

Add a new filter to the database.

Returns
void

Definition at line 1809 of file ksuserdb.cpp.

◆ AddFilter() [2/2]

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

Replace a filter at given ID with new content.

Returns
void

Definition at line 1850 of file ksuserdb.cpp.

◆ AddFlag()

bool 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
True if database transaction is successful, false otherwise

Definition at line 1377 of file ksuserdb.cpp.

◆ AddHIPSSource()

bool KSUserDB::AddHIPSSource ( const QMap< QString, QString > & oneSource)

Definition at line 1161 of file ksuserdb.cpp.

◆ AddHorizon()

bool KSUserDB::AddHorizon ( ArtificialHorizonEntity * horizon)

Adds a new artificial horizon row into the database.

Definition at line 2311 of file ksuserdb.cpp.

◆ AddImageOverlay()

bool KSUserDB::AddImageOverlay ( const ImageOverlay & overlay)

Adds a new image overlay row into the database.

Definition at line 2410 of file ksuserdb.cpp.

◆ AddLens() [1/2]

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

Add a new lens to the database.

Returns
void

Definition at line 1715 of file ksuserdb.cpp.

◆ AddLens() [2/2]

bool 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 1741 of file ksuserdb.cpp.

◆ AddObserver()

bool KSUserDB::AddObserver ( const QString & name,
const QString & surname,
const QString & contact )

Adds a new observer into the database.

Definition at line 621 of file ksuserdb.cpp.

◆ AddOpticalTrain()

bool KSUserDB::AddOpticalTrain ( const QVariantMap & oneTrain)

Add a new optical train to the database.

Parameters
oneTrainoptical train data

Definition at line 947 of file ksuserdb.cpp.

◆ AddOpticalTrainSettings()

bool KSUserDB::AddOpticalTrainSettings ( uint32_t train,
const QByteArray & settings )

Add new Train settings to the database.

Parameters
settingsJSON settings

Definition at line 3188 of file ksuserdb.cpp.

◆ AddProfile()

int KSUserDB::AddProfile ( const QString & name)

Definition at line 2613 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 3101 of file ksuserdb.cpp.

◆ AddScope() [1/2]

bool 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 1503 of file ksuserdb.cpp.

◆ AddScope() [2/2]

bool 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 1536 of file ksuserdb.cpp.

◆ AddSkyMapView()

bool KSUserDB::AddSkyMapView ( const SkyMapView & view)

Adds a new sky map view row in the database.

Definition at line 2543 of file ksuserdb.cpp.

◆ connectionName()

const QString & KSUserDB::connectionName ( ) const
inline

Definition at line 50 of file ksuserdb.h.

◆ DeleteAllDSLRInfo()

bool KSUserDB::DeleteAllDSLRInfo ( )

Definition at line 1271 of file ksuserdb.cpp.

◆ DeleteAllEquipment()

bool 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 1475 of file ksuserdb.cpp.

◆ DeleteAllFlags()

bool KSUserDB::DeleteAllFlags ( )

Erases all the flags from the database.

Returns
void

Definition at line 1352 of file ksuserdb.cpp.

◆ DeleteAllHorizons()

bool KSUserDB::DeleteAllHorizons ( )

Deletes all artificial horizon rows from the database.

Definition at line 2280 of file ksuserdb.cpp.

◆ DeleteAllImageOverlays()

bool KSUserDB::DeleteAllImageOverlays ( )

Deletes all image overlay rows from the database.

Definition at line 2385 of file ksuserdb.cpp.

◆ DeleteAllSkyMapViews()

bool KSUserDB::DeleteAllSkyMapViews ( )

Deletes all the sky map views stored in the database.

Definition at line 2518 of file ksuserdb.cpp.

◆ DeleteCollimationOverlayElement()

bool KSUserDB::DeleteCollimationOverlayElement ( int id)

Definition at line 3358 of file ksuserdb.cpp.

◆ DeleteCustomDriver()

bool KSUserDB::DeleteCustomDriver ( const QString & id)

Definition at line 1105 of file ksuserdb.cpp.

◆ DeleteDarkFrame()

bool 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 803 of file ksuserdb.cpp.

◆ DeleteDSLRInfo()

bool KSUserDB::DeleteDSLRInfo ( const QString & model)

Definition at line 1293 of file ksuserdb.cpp.

◆ DeleteEffectiveFOV()

bool KSUserDB::DeleteEffectiveFOV ( const QString & id)

Definition at line 891 of file ksuserdb.cpp.

◆ DeleteEquipment()

bool 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 1451 of file ksuserdb.cpp.

◆ DeleteHIPSSource()

bool KSUserDB::DeleteHIPSSource ( const QString & ID)

Definition at line 1188 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 683 of file ksuserdb.cpp.

◆ DeleteOpticalTrain()

bool KSUserDB::DeleteOpticalTrain ( int id)

Definition at line 1015 of file ksuserdb.cpp.

◆ DeleteOpticalTrainSettings()

bool KSUserDB::DeleteOpticalTrainSettings ( uint32_t train)

Definition at line 3239 of file ksuserdb.cpp.

◆ DeleteProfile()

bool KSUserDB::DeleteProfile ( const QSharedPointer< ProfileInfo > & pi)

Definition at line 2635 of file ksuserdb.cpp.

◆ DeleteProfileSettings()

void KSUserDB::DeleteProfileSettings ( uint32_t profile)

Definition at line 3140 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 660 of file ksuserdb.cpp.

◆ GetAllCustomDrivers()

bool KSUserDB::GetAllCustomDrivers ( QList< QVariantMap > & CustomDrivers)

Definition at line 1129 of file ksuserdb.cpp.

◆ GetAllDarkFrames()

bool KSUserDB::GetAllDarkFrames ( QList< QVariantMap > & darkFrames)

Definition at line 827 of file ksuserdb.cpp.

◆ GetAllDSLRInfos()

bool KSUserDB::GetAllDSLRInfos ( QList< QMap< QString, QVariant > > & DSLRInfos)

Definition at line 1317 of file ksuserdb.cpp.

◆ GetAllDSLRLenses()

bool 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 2968 of file ksuserdb.cpp.

◆ GetAllEffectiveFOVs()

bool KSUserDB::GetAllEffectiveFOVs ( QList< QVariantMap > & effectiveFOVs)

Definition at line 914 of file ksuserdb.cpp.

◆ GetAllEyepieces()

bool 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 1675 of file ksuserdb.cpp.

◆ GetAllFilters()

bool 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 1894 of file ksuserdb.cpp.

◆ GetAllFlags()

bool KSUserDB::GetAllFlags ( QList< QStringList > & flagList)

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

Definition at line 1407 of file ksuserdb.cpp.

◆ GetAllHIPSSources()

bool KSUserDB::GetAllHIPSSources ( QList< QMap< QString, QString > > & HIPSSources)

Definition at line 1212 of file ksuserdb.cpp.

◆ GetAllHorizons()

bool KSUserDB::GetAllHorizons ( QList< ArtificialHorizonEntity * > & horizonList)

Gets all the artificial horizon rows from the database.

Definition at line 2220 of file ksuserdb.cpp.

◆ GetAllImageOverlays()

bool KSUserDB::GetAllImageOverlays ( QList< ImageOverlay > * imageOverlayList)

Gets all the image overlay rows from the database.

Definition at line 2463 of file ksuserdb.cpp.

◆ GetAllLenses()

bool 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 1771 of file ksuserdb.cpp.

◆ GetAllObservers()

bool 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
true if database read was successfull, false otherwise.

Definition at line 710 of file ksuserdb.cpp.

◆ GetAllProfiles()

bool 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 2788 of file ksuserdb.cpp.

◆ GetAllScopes()

bool 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 1571 of file ksuserdb.cpp.

◆ GetAllSkyMapViews()

bool KSUserDB::GetAllSkyMapViews ( QList< SkyMapView > & skyMapViewList)

Gets all the sky map view rows from the database.

Definition at line 2578 of file ksuserdb.cpp.

◆ GetCollimationOverlayElements()

bool KSUserDB::GetCollimationOverlayElements ( QList< QVariantMap > & collimationOverlayElements)

Populate the reference passed with all collimation overlay elements.

Parameters
collimationOverlayElementsReference to all elements list

Definition at line 3381 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 3030 of file ksuserdb.cpp.

◆ getOpticalElementByID()

bool KSUserDB::getOpticalElementByID ( int id,
QJsonObject & element )

Definition at line 3001 of file ksuserdb.cpp.

◆ getOpticalElementByName()

bool KSUserDB::getOpticalElementByName ( const QString & name,
QJsonObject & element )

Definition at line 3053 of file ksuserdb.cpp.

◆ getOpticalElementNames()

QStringList KSUserDB::getOpticalElementNames ( )

Definition at line 3082 of file ksuserdb.cpp.

◆ GetOpticalTrains()

bool 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 1038 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 3252 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 3155 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.

◆ PurgeProfile()

bool KSUserDB::PurgeProfile ( const QSharedPointer< ProfileInfo > & pi)

Definition at line 2655 of file ksuserdb.cpp.

◆ SaveProfile()

bool KSUserDB::SaveProfile ( const QSharedPointer< ProfileInfo > & pi)

Definition at line 2684 of file ksuserdb.cpp.

◆ UpdateCollimationOverlayElement()

bool KSUserDB::UpdateCollimationOverlayElement ( const QVariantMap & oneElement,
int id )

Update an existing collimation overlay element.

Parameters
oneElementcollimation overlay element data
idID of element to replace in database

Definition at line 3325 of file ksuserdb.cpp.

◆ UpdateDarkFrame()

bool 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 775 of file ksuserdb.cpp.

◆ UpdateOpticalTrain()

bool 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 982 of file ksuserdb.cpp.

◆ UpdateOpticalTrainSettings()

bool KSUserDB::UpdateOpticalTrainSettings ( uint32_t train,
const QByteArray & settings )

Definition at line 3215 of file ksuserdb.cpp.

◆ UpdateProfileSettings()

void KSUserDB::UpdateProfileSettings ( uint32_t profileID,
const QByteArray & settings )

Definition at line 3121 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-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:38:44 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.