Country register plugin created
parent
a0f325708b
commit
25c481f5f1
@ -0,0 +1,18 @@
|
||||
#include "countryregister.h"
|
||||
|
||||
#include "countryregistergrid.h"
|
||||
|
||||
CountryRegister::CountryRegister()
|
||||
{
|
||||
}
|
||||
|
||||
void CountryRegister::initServiceUi()
|
||||
{
|
||||
m_service = new Service<CountryData>();
|
||||
m_ui = new CountryRegisterGrid();
|
||||
}
|
||||
|
||||
bool CountryRegister::showIcon()
|
||||
{
|
||||
return false;
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
#ifndef COUNTRYREGISTER_H
|
||||
#define COUNTRYREGISTER_H
|
||||
|
||||
#include "countryregister_global.h"
|
||||
#include <QObject>
|
||||
#include <imetadataplugin.h>
|
||||
|
||||
class COUNTRYREGISTERSHARED_EXPORT CountryRegister : public QObject, IMetaDataPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PLUGIN_METADATA(IID PluginInterface_iid FILE "countryregister.json")
|
||||
Q_INTERFACES(IPlugin)
|
||||
|
||||
public:
|
||||
CountryRegister();
|
||||
|
||||
// IMetaDataPlugin interface
|
||||
protected:
|
||||
void initServiceUi();
|
||||
|
||||
// IPlugin interface
|
||||
public:
|
||||
bool showIcon();
|
||||
};
|
||||
|
||||
#endif // COUNTRYREGISTER_H
|
@ -0,0 +1,34 @@
|
||||
{
|
||||
"id" : "COUNTRYREGISTER",
|
||||
"name" : {
|
||||
"default" : "Country register",
|
||||
"CZ" : "Číselník zemí"
|
||||
},
|
||||
"descriptoin" : {
|
||||
"default" : "",
|
||||
"CZ" : ""
|
||||
},
|
||||
"schemaVersion" : 1,
|
||||
"sql" : [
|
||||
"CREATE TABLE \"CountryData\" (
|
||||
\"id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
\"code2\" TEXT NULL,
|
||||
\"code3\" TEXT NULL,
|
||||
\"czechFullName\" TEXT NULL,
|
||||
\"czechName\" TEXT NULL,
|
||||
\"englishFullName\" TEXT NULL,
|
||||
\"englishName\" TEXT NULL);
|
||||
"
|
||||
],
|
||||
"dependencies" : [ ],
|
||||
"translations" : {
|
||||
"CZ" : {
|
||||
"code2" : "Dvoupísmená zkratka",
|
||||
"code3" : "Trojpísmená zkratka",
|
||||
"czechFullName" : "Český název",
|
||||
"czechName" : "Zkrácený český název",
|
||||
"englishFullName" : "Anglický název",
|
||||
"englishName" : "Zkrácený anglický název"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2017-05-03T21:05:30
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += widgets sql
|
||||
|
||||
TARGET = countryregister
|
||||
TEMPLATE = lib
|
||||
|
||||
DEFINES += COUNTRYREGISTER_LIBRARY
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any feature of Qt which as been marked as deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
# You can also make your code fail to compile if you use deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
SOURCES += countryregister.cpp \
|
||||
countryregistergrid.cpp \
|
||||
data/countrydata.cpp
|
||||
|
||||
HEADERS += countryregister.h\
|
||||
countryregister_global.h \
|
||||
countryregistergrid.h \
|
||||
data/countrydata.h
|
||||
|
||||
include(../config_plugin.pri)
|
||||
|
||||
ODB_FILES = countryregister/data/countrydata.h
|
||||
H_DIR = $$PWD/data/*.h
|
||||
include(../odb.pri)
|
||||
|
||||
DISTFILES += \
|
||||
countryregister.json
|
@ -0,0 +1,12 @@
|
||||
#ifndef COUNTRYREGISTER_GLOBAL_H
|
||||
#define COUNTRYREGISTER_GLOBAL_H
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#if defined(COUNTRYREGISTER_LIBRARY)
|
||||
# define COUNTRYREGISTERSHARED_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
# define COUNTRYREGISTERSHARED_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
#endif // COUNTRYREGISTER_GLOBAL_H
|
@ -0,0 +1,22 @@
|
||||
#include "countryregistergrid.h"
|
||||
#include "countryregister-odb.hxx"
|
||||
|
||||
CountryRegisterGrid::CountryRegisterGrid(QWidget *parent) : GridForm<CountryData>(parent)
|
||||
{
|
||||
setTableModel(new AutoTableModel<CountryData>());
|
||||
}
|
||||
|
||||
bool CountryRegisterGrid::canAddRecord()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CountryRegisterGrid::canEditRecord()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CountryRegisterGrid::canDeleteRecord()
|
||||
{
|
||||
return false;
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
#ifndef COUNTRYREGISTERGRID_H
|
||||
#define COUNTRYREGISTERGRID_H
|
||||
|
||||
#include <core.h>
|
||||
#include "data/countrydata.h"
|
||||
|
||||
class CountryRegisterGrid : public GridForm<CountryData>
|
||||
{
|
||||
|
||||
public:
|
||||
explicit CountryRegisterGrid(QWidget *parent = NULL);
|
||||
|
||||
// IGridForm interface
|
||||
protected:
|
||||
bool canAddRecord();
|
||||
bool canEditRecord();
|
||||
bool canDeleteRecord();
|
||||
};
|
||||
|
||||
#endif // COUNTRYREGISTERGRID_H
|
@ -0,0 +1,76 @@
|
||||
#include "countrydata.h"
|
||||
|
||||
CountryData::CountryData(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int CountryData::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
void CountryData::setId(int id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
QString CountryData::code2() const
|
||||
{
|
||||
return m_code2;
|
||||
}
|
||||
|
||||
void CountryData::setCode2(const QString &code2)
|
||||
{
|
||||
m_code2 = code2;
|
||||
}
|
||||
|
||||
QString CountryData::code3() const
|
||||
{
|
||||
return m_code3;
|
||||
}
|
||||
|
||||
void CountryData::setCode3(const QString &code3)
|
||||
{
|
||||
m_code3 = code3;
|
||||
}
|
||||
|
||||
QString CountryData::czechFullName() const
|
||||
{
|
||||
return m_czechFullName;
|
||||
}
|
||||
|
||||
void CountryData::setCzechFullName(const QString &czechFullName)
|
||||
{
|
||||
m_czechFullName = czechFullName;
|
||||
}
|
||||
|
||||
QString CountryData::czechName() const
|
||||
{
|
||||
return m_czechName;
|
||||
}
|
||||
|
||||
void CountryData::setCzechName(const QString &czechName)
|
||||
{
|
||||
m_czechName = czechName;
|
||||
}
|
||||
|
||||
QString CountryData::englishFullName() const
|
||||
{
|
||||
return m_englishFullName;
|
||||
}
|
||||
|
||||
void CountryData::setEnglishFullName(const QString &englishFullName)
|
||||
{
|
||||
m_englishFullName = englishFullName;
|
||||
}
|
||||
|
||||
QString CountryData::englishName() const
|
||||
{
|
||||
return m_englishName;
|
||||
}
|
||||
|
||||
void CountryData::setEnglishName(const QString &englishName)
|
||||
{
|
||||
m_englishName = englishName;
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
#ifndef COUNTRYDATA_H
|
||||
#define COUNTRYDATA_H
|
||||
|
||||
#include <QString>
|
||||
#include <QObject>
|
||||
#include <odb/core.hxx>
|
||||
|
||||
#pragma db object
|
||||
class CountryData : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString code2 READ code2 WRITE setCode2)
|
||||
Q_PROPERTY(QString code3 READ code3 WRITE setCode3)
|
||||
Q_PROPERTY(QString czechFullName READ czechFullName WRITE setCzechFullName)
|
||||
Q_PROPERTY(QString czechName READ czechName WRITE setCzechName)
|
||||
Q_PROPERTY(QString englishFullName READ englishFullName WRITE setEnglishFullName)
|
||||
Q_PROPERTY(QString englishName READ englishName WRITE setEnglishName)
|
||||
public:
|
||||
Q_INVOKABLE explicit CountryData(QObject *parent = 0);
|
||||
|
||||
int id() const;
|
||||
void setId(int id);
|
||||
|
||||
QString code2() const;
|
||||
void setCode2(const QString &code2);
|
||||
|
||||
QString code3() const;
|
||||
void setCode3(const QString &code3);
|
||||
|
||||
QString czechFullName() const;
|
||||
void setCzechFullName(const QString &czechFullName);
|
||||
|
||||
QString czechName() const;
|
||||
void setCzechName(const QString &czechName);
|
||||
|
||||
QString englishFullName() const;
|
||||
void setEnglishFullName(const QString &englishFullName);
|
||||
|
||||
QString englishName() const;
|
||||
void setEnglishName(const QString &englishName);
|
||||
|
||||
private:
|
||||
friend class odb::access;
|
||||
#pragma db id auto
|
||||
int m_id;
|
||||
QString m_code2;
|
||||
QString m_code3;
|
||||
QString m_czechFullName;
|
||||
QString m_czechName;
|
||||
QString m_englishFullName;
|
||||
QString m_englishName;
|
||||
|
||||
};
|
||||
|
||||
#endif // COUNTRYDATA_H
|
Loading…
Reference in New Issue