##// END OF EJS Templates
Fixed bug 388...
Fixed bug 388 Added cassini FGM download from Time table files. Fixed smal issue on export function. Some Work on QLop database.

File last commit:

r14:0e9217f77498 default
r14:0e9217f77498 default
Show More
qlopdatabase.cpp
140 lines | 2.6 KiB | text/x-c | CppLexer
/ src / Core / qlopdatabase.cpp
QLop dataBase started, WIP.
r12 #include "qlopdatabase.h"
Fixed bug #388...
r14 #include <qlopdatabaseviewer.h>
QLop dataBase started, WIP.
r12
QList<QLopData*>* QLopDataBase::m_dataBase=NULL;
QLopDataBase* QLopDataBase::_self=NULL;
Fixed bug #388...
r14 QDockWidget* QLopDataBase::m_gui=NULL;
QLop dataBase started, WIP.
r12
#define INIT() \
if(Q_UNLIKELY(_self==NULL))\
{\
init();\
}
Fixed bug #388...
r14 QLopDataBase::QLopDataBase(bool noGUI,QObject *parent) : QLopService(parent)
QLop dataBase started, WIP.
r12 {
this->m_dataBase = new QList<QLopData*>();
Fixed bug #388...
r14 m_serviceName="QLopDataBase";
m_noGui=noGUI;
QLop dataBase started, WIP.
r12 }
QLopDataBase::~QLopDataBase()
{
}
Fixed bug #388...
r14 QDockWidget *QLopDataBase::getGUI()
{
if(!m_noGui && (m_gui==NULL))
{
m_gui=new QLopDataBaseViewer();
m_gui->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable);
}
return m_gui;
}
void QLopDataBase::init(bool noGUI, QObject *parent)
QLop dataBase started, WIP.
r12 {
_self=new QLopDataBase();
}
Fixed bug #388...
r14 const QString &QLopDataBase::serviceName()
{
INIT();
return m_serviceName;
}
QLop dataBase started, WIP.
r12 int QLopDataBase::addData(QLopData *data)
{
INIT();
if(!m_dataBase->contains(data))
{
m_dataBase->append(data);
Fixed bug #388...
r14 emit QLopDataBase::self()->DBChanged();
QLop dataBase started, WIP.
r12 return 1;
}
return 0;
}
int QLopDataBase::addData(const QLopDataList& data)
{
INIT();
int addedData=0;
for (int i = 0; i < data.count(); i++)
{
addedData += addData(data.at(i));
}
Fixed bug #388...
r14 emit QLopDataBase::self()->DBChanged();
QLop dataBase started, WIP.
r12 return addedData;
}
Fixed bug #388...
r14 int QLopDataBase::removeData(QLopData *data)
{
INIT();
if(m_dataBase->contains(data))
{
m_dataBase->removeAll(data);
emit QLopDataBase::self()->DBChanged();
return 1;
}
return 0;
}
int QLopDataBase::removeData(const QLopDataList &data)
{
INIT();
int removedData=0;
for (int i = 0; i < data.count(); i++)
{
removedData += removeData(data.at(i));
}
emit QLopDataBase::self()->DBChanged();
return removedData;
}
QLop dataBase started, WIP.
r12 QLopDataBase *QLopDataBase::self()
{
INIT();
return _self;
}
int QLopDataBase::count()
{
Fixed bug #388...
r14 INIT();
QLop dataBase started, WIP.
r12 return m_dataBase->count();
}
QLopData *QLopDataBase::getData(const QString &name)
{
Fixed bug #388...
r14 INIT();
QLop dataBase started, WIP.
r12 for (int i = 0; i < m_dataBase->count(); i++)
{
if(Q_UNLIKELY(m_dataBase->at(i)->name==name))
{
return m_dataBase->at(i);
}
}
return NULL;
}
QLopData *QLopDataBase::getData(int ID)
{
Fixed bug #388...
r14 INIT();
QLop dataBase started, WIP.
r12 for (int i = 0; i < m_dataBase->count(); i++)
{
if(Q_UNLIKELY(m_dataBase->at(i)->ID==ID))
{
return m_dataBase->at(i);
}
}
return NULL;
}
Spec file ready for rpm packaging....
r13 QLopData *QLopDataBase::getDataFromIdex(int index)
{
if((index>=0)&&(index<m_dataBase->count()))
return m_dataBase->at(index);
else
return NULL;
}