KSUserDB

Search for usage in LXR

KSUserDB Class Reference

#include <ksuserdb.h>

Public Member Functions

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)
 
const QStringconnectionName () const
 
bool DeleteAllDSLRInfo ()
 
bool DeleteAllEquipment (const QString &type)
 
bool DeleteAllFlags ()
 
bool DeleteAllHorizons ()
 
bool DeleteAllImageOverlays ()
 
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 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 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 38 of file ksuserdb.h.

Member Function Documentation

◆ 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 714 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 2774 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 2801 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 1581 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 1610 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 1779 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 1820 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 1347 of file ksuserdb.cpp.

◆ AddHorizon()

bool KSUserDB::AddHorizon ( ArtificialHorizonEntity *  horizon)

Adds a new artificial horizon row into the database.

Definition at line 2281 of file ksuserdb.cpp.

◆ AddImageOverlay()

bool KSUserDB::AddImageOverlay ( const ImageOverlay &  overlay)

Adds a new image overlay row into the database.

Definition at line 2380 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 1685 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 1711 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 589 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 916 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 3053 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 2964 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 1473 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 1506 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 1445 of file ksuserdb.cpp.

◆ DeleteAllFlags()

bool KSUserDB::DeleteAllFlags ( )

Erases all the flags from the database.

Returns
void

Definition at line 1322 of file ksuserdb.cpp.

◆ DeleteAllHorizons()

bool KSUserDB::DeleteAllHorizons ( )

Deletes all artificial horizon rows from the database.

Definition at line 2250 of file ksuserdb.cpp.

◆ DeleteAllImageOverlays()

bool KSUserDB::DeleteAllImageOverlays ( )

Deletes all image overlay rows from the database.

Definition at line 2355 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 771 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 1421 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 651 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 628 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 2831 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 1645 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 1864 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 1377 of file ksuserdb.cpp.

◆ GetAllHorizons()

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

Gets all the artificial horizon rows from the database.

Definition at line 2190 of file ksuserdb.cpp.

◆ GetAllImageOverlays()

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

Gets all the image overlay rows from the database.

Definition at line 2433 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 1741 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 678 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 2651 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 1541 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 2893 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 1007 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 3117 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 3020 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()

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 743 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 951 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 Sat Sep 30 2023 04:02:49 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.