Josef Rokos 9 years ago
commit ebf155603a

@ -23,6 +23,11 @@ void Accommodation::initServiceUi()
m_service = service; m_service = service;
m_ui = grid; m_ui = grid;
} }
QIcon Accommodation::pluginIcon()
{
return QIcon(":/icons/accPlugin.svg");
}
/* /*
QWidget *Accommodation::ui() QWidget *Accommodation::ui()
{ {

@ -27,6 +27,11 @@ protected:
// IPlugin interface // IPlugin interface
public: public:
//QWidget *ui(); //QWidget *ui();
// IPlugin interface
public:
virtual QIcon pluginIcon();
}; };
#endif // ACCOMMODATION_H #endif // ACCOMMODATION_H

@ -67,3 +67,6 @@ else:unix: LIBS += -L$$OUT_PWD/../qdecimal/lib/ -lqdecimal -ldecnumber
INCLUDEPATH += $$PWD/../qdecimal/src INCLUDEPATH += $$PWD/../qdecimal/src
INCLUDEPATH += $$PWD/../qdecimal/decnumber INCLUDEPATH += $$PWD/../qdecimal/decnumber
RESOURCES += \
accrc.qrc

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/">
<file>icons/accPlugin.svg</file>
</qresource>
</RCC>

@ -0,0 +1,7 @@
<?xml version="1.0" ?><svg clip-rule="evenodd" fill-rule="evenodd" image-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" viewBox="0 0 5000 5000" xmlns="http://www.w3.org/2000/svg"><defs><style type="text/css"><![CDATA[
.str1 {stroke:#434242;stroke-width:100}
.str0 {stroke:#434242;stroke-width:300;stroke-linecap:round}
.fil0 {fill:none}
.fil1 {fill:#434242}
.fil2 {fill:url(#id0)}
]]></style><linearGradient gradientUnits="userSpaceOnUse" id="id0" x1="2500.01" x2="2500.01" y1="4260.19" y2="1474.81"><stop offset="0" stop-color="#008BFF"/><stop offset="1" stop-color="#0af"/></linearGradient></defs><g id="Layer_x0020_1"><path class="fil0 str0" d="M300 2000l2050-1600c100-50 200-50 300 0l2050 1500"/><path class="fil1" d="M3500 1022l600 439v-861c0-55-45-100-100-100h-400c-55 0-100 45-100 100v422z"/><path class="fil2 str1" d="M899 4700h901v-1500c0-110 90-200 200-200h900c110 0 200 90 200 200v1500h1001c165 0 300-135 300-300l-1-2000-1776-1328c-33-26-79-37-124-36s-92 14-127 40l-1773 1324-1 2000c0 165 135 300 300 300z"/></g></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -18,6 +18,11 @@ void Addressbook::initServiceUi()
((AddressbookGrid *) m_ui)->setForm(form); ((AddressbookGrid *) m_ui)->setForm(form);
} }
QIcon Addressbook::pluginIcon()
{
return QIcon(":/icons/addressbookPlugin.svg");
}

@ -23,6 +23,11 @@ protected:
// IPlugin interface
public:
virtual QIcon pluginIcon();
}; };
#endif // ADDRESSBOOK_H #endif // ADDRESSBOOK_H

@ -64,3 +64,6 @@ OTHER_FILES += \
FORMS += \ FORMS += \
addressbookform.ui addressbookform.ui
RESOURCES += \
addressbookrc.qrc

@ -2,8 +2,7 @@
#define ADDRESSBOOKFORM_H #define ADDRESSBOOKFORM_H
#include <QWidget> #include <QWidget>
#include <QWidget> #include <autoform.h>
#include "autoform.h"
#include "data/addressbookdata.h" #include "data/addressbookdata.h"
#include "addressbook-odb.hxx" #include "addressbook-odb.hxx"

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/">
<file>icons/addressbookPlugin.svg</file>
</qresource>
</RCC>

@ -4,7 +4,7 @@
#include <QObject> #include <QObject>
#include <QString> #include <QString>
#include <QDate> #include <QDate>
#include "odb/core.hxx" #include <odb/core.hxx>
#pragma db object #pragma db object
class AddressbookData : public QObject class AddressbookData : public QObject

@ -0,0 +1 @@
<?xml version="1.0" ?><svg clip-rule="evenodd" fill-rule="evenodd" image-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient gradientUnits="userSpaceOnUse" id="a" x1="249.999" x2="249.999" y1="112.399" y2="412.599"><stop offset="0" stop-color="#FCFCFD"/><stop offset="1" stop-color="#fff"/></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="b" x1="249.998" x2="249.998" y1="34.201" y2="85.799"><stop offset="0" stop-color="#008BFF"/><stop offset="1" stop-color="#0af"/></linearGradient></defs><g><path d="M95 65h310c8 0 15 7 15 15v365c0 8-7 15-15 15h-310c-8 0-15-7-15-15v-365c0-8 7-15 15-15z" fill="url(#a)" stroke="#434242" stroke-width="10"/><path d="M378 90h-256c-2 0-4-1-5-3 0-2 0-4 2-6l30-30c1-1 2-1 3-1h63c3 0 5-2 5-5v-10c0-3 2-5 5-5h50c3 0 5 2 5 5v10c0 3 2 5 5 5h63c1 0 2 0 3 1l30 30c2 2 2 4 2 6-1 2-3 3-5 3z" fill="url(#b)" stroke="#434242" stroke-width="10"/><path d="M120 140h40v40h-40v-40zm0 80h40v40h-40v-40zm0 80h40v40h-40v-40zm0 80h40v40h-40v-40zm55-210h165v10h-165v-10zm0 80h105v10h-105v-10zm0 80h165v10h-165v-10zm0 80h180v10h-180v-10zm0-265h205v10h-205v-10zm0 80h165v10h-165v-10zm0 80h130v10h-130v-10zm0 80h150v10h-150v-10z" fill="#434242"/></g></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

@ -3,5 +3,6 @@
<file>icons/login_32.png</file> <file>icons/login_32.png</file>
<file>icons/login_64.png</file> <file>icons/login_64.png</file>
<file>style.css</file> <file>style.css</file>
<file>icons/settings.svg</file>
</qresource> </qresource>
</RCC> </RCC>

@ -0,0 +1 @@
<?xml version="1.0" ?><svg clip-rule="evenodd" fill-rule="evenodd" image-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"><defs><radialGradient cx="172" cy="321.205" fx="172" fy="321" gradientUnits="userSpaceOnUse" id="a" r="152"><stop offset="0" stop-color="#0af"/><stop offset="1" stop-color="#008BFF"/></radialGradient><radialGradient cx="358" cy="135.625" fx="358" fy="136" gradientUnits="userSpaceOnUse" id="b" r="121"><stop offset="0" stop-color="#0af"/><stop offset="1" stop-color="#008BFF"/></radialGradient><linearGradient gradientUnits="userSpaceOnUse" id="c" x1="95" x2="249" y1="327" y2="327"><stop offset="0" stop-color="#4C4B4C"/><stop offset="1" stop-color="#1D1F1F"/></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="d" x1="419" x2="298" y1="200" y2="80"><stop offset="0" stop-color="#4C4B4C"/><stop offset="1" stop-color="#1D1F1F"/></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="e" x1="214" x2="129" y1="327" y2="327"><stop offset="0" stop-color="#4C4B4C"/><stop offset="1" stop-color="#1D1F1F"/></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="f" x1="391" x2="325" y1="140" y2="140"><stop offset="0" stop-color="#4C4B4C"/><stop offset="1" stop-color="#1D1F1F"/></linearGradient></defs><g><path d="M289 425l-20 19c-3 4-9 4-13 1l-21-17c-3-3-7-4-11-2-6 4-12 6-19 8-4 1-7 5-7 9l-3 27c0 5-4 9-9 9h-28c-5 0-9-4-10-9l-3-27c0-4-3-8-6-9-7-2-13-4-19-8-4-2-8-1-11 2l-21 17c-4 3-10 3-14-1l-19-19c-4-4-4-10-1-14l17-21c3-3 4-7 2-11-4-6-6-12-8-18-1-4-5-7-9-7l-27-3c-5 0-9-5-9-10v-27c0-6 4-10 9-10l27-3c4 0 8-3 9-7 2-6 4-13 8-19 2-3 1-8-1-11l-18-21c-3-4-3-10 1-13l19-20c4-3 10-4 14 0l21 17c3 3 7 3 11 1 6-3 12-6 19-8 3-1 6-4 6-8l3-27c1-6 5-10 10-10h28c5 0 9 4 9 10l3 27c0 4 3 7 7 8 7 2 13 5 19 8 3 2 8 2 11-1l21-17c4-4 10-3 13 0l20 20c3 3 4 9 0 13l-17 21c-3 3-3 8-1 11 3 6 6 13 8 19 1 4 4 7 8 7l27 3c6 0 10 4 10 10v27c0 5-4 10-10 10l-27 3c-4 0-7 3-8 7-2 6-5 12-8 18-2 4-2 8 1 11l17 21c4 4 3 10 0 14zm-117-142c24 0 44 20 44 44 0 25-20 44-44 44-25 0-44-19-44-44 0-24 19-44 44-44z" fill="url(#a)" stroke="#303030" stroke-width="10"/><path d="M472 96l7 26c0 3-1 5-3 6l-25 10c-2 0-3 2-3 4-1 15-4 29-11 42-1 1-1 4 0 5l17 21c2 2 1 4 0 6l-20 20c-1 1-4 2-6 0l-21-17c-1-1-3-2-5-1-13 7-27 11-42 12-2 0-4 1-4 3l-10 25c0 2-3 3-5 3l-27-7c-2-1-4-3-3-6l4-26c0-2-1-4-2-5-13-8-23-18-31-31-1-1-3-2-5-2l-26 5c-2 0-5-2-6-4l-7-26c0-3 1-6 3-6l25-10c2 0 3-2 3-4 1-15 5-29 12-42 1-1 0-4-1-5l-17-21c-1-2-1-4 1-6l19-20c2-1 5-2 7 0l20 17c2 1 4 1 6 0 12-7 26-10 41-11 2 0 4-1 4-3l10-25c1-2 3-3 6-3l26 7c3 1 4 3 4 6l-5 26c0 2 1 4 3 5 12 8 23 18 30 30 1 2 3 3 5 3l26-5c3 0 5 2 6 4zm-113 8c20 0 36 16 36 36 0 21-16 37-36 37-21 0-37-16-37-37 0-20 16-36 37-36z" fill="url(#b)" stroke="#434242" stroke-width="10"/><path d="M172 250c42 0 77 35 77 77 0 43-35 78-77 78-43 0-78-35-78-78 0-42 35-77 78-77zm0 47c16 0 30 14 30 30 0 17-14 30-30 30-17 0-30-13-30-30 0-16 13-30 30-30z" fill="url(#c)"/><path d="M359 80c33 0 60 27 60 60 0 34-27 61-60 61-34 0-61-27-61-61 0-33 27-60 61-60zm0 37c13 0 23 10 23 23s-10 24-23 24-24-11-24-24 11-23 24-23z" fill="url(#d)"/><path d="M172 285c23 0 42 19 42 42 0 24-19 43-42 43-24 0-43-19-43-43 0-23 19-42 43-42zm0 12c16 0 30 14 30 30 0 17-14 30-30 30-17 0-30-13-30-30 0-16 13-30 30-30z" fill="url(#e)"/><path d="M359 107c18 0 33 15 33 33 0 19-15 34-33 34-19 0-33-15-33-34 0-18 14-33 33-33zm0 10c13 0 23 10 23 23s-10 24-23 24-24-11-24-24 11-23 24-23z" fill="url(#f)"/></g></svg>

After

Width:  |  Height:  |  Size: 3.5 KiB

@ -4,6 +4,7 @@
#include <core.h> #include <core.h>
#include <QPushButton> #include <QPushButton>
#include <QToolButton>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QFileDialog> #include <QFileDialog>
#include <QDebug> #include <QDebug>
@ -41,8 +42,12 @@ MainWindow::MainWindow(QWidget *parent) :
int i = 0; int i = 0;
foreach (IPlugin *plugin, Context::instance().plugins()) { foreach (IPlugin *plugin, Context::instance().plugins()) {
QPushButton *plugButton = new QPushButton(this); QToolButton *plugButton = new QToolButton(this);
plugButton->setText(plugin->pluginName()); plugButton->setText(plugin->pluginName());
plugButton->setIcon(plugin->pluginIcon());
plugButton->setIconSize(QSize(32, 32));
plugButton->setAutoRaise(true);
plugButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
ui->navigation->layout()->addWidget(plugButton); ui->navigation->layout()->addWidget(plugButton);
plugButton->setProperty(PLUGIN_INDEX, i); plugButton->setProperty(PLUGIN_INDEX, i);
i++; i++;
@ -80,7 +85,7 @@ void MainWindow::openPlugin()
} }
} }
ui->tabWidget->addTab(plugin->ui(), QIcon(), plugin->pluginName()); ui->tabWidget->addTab(plugin->ui(), plugin->pluginIcon(), plugin->pluginName());
ui->tabWidget->widget(ui->tabWidget->count() - 1)->setObjectName(plugin->pluginId()); ui->tabWidget->widget(ui->tabWidget->count() - 1)->setObjectName(plugin->pluginId());
ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1); ui->tabWidget->setCurrentIndex(ui->tabWidget->count() - 1);
} }

@ -56,7 +56,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1000</width> <width>1000</width>
<height>19</height> <height>21</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuFile"> <widget class="QMenu" name="menuFile">
@ -101,6 +101,10 @@
</property> </property>
</action> </action>
<action name="actionSettings"> <action name="actionSettings">
<property name="icon">
<iconset resource="appRc.qrc">
<normaloff>:/icons/settings.svg</normaloff>:/icons/settings.svg</iconset>
</property>
<property name="text"> <property name="text">
<string>Settings</string> <string>Settings</string>
</property> </property>

@ -1,5 +1,5 @@
#navigation { #navigation {
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255)); background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(50, 50, 50, 255), stop:1 rgba(190, 190, 190, 255));
} }
#navigation QPushButton { #navigation QPushButton {
@ -14,3 +14,9 @@
min-height: 40px; min-height: 40px;
font: 14px; font: 14px;
} }
#navigation QToolButton {
color: white;
font-weight: bold;
min-width: 80px;
}

@ -0,0 +1,23 @@
#include "commodity.h"
#include "data/commodity-data.h"
#include "commodityform.h"
#include "commoditygrid.h"
Commodity::Commodity()
{
}
void Commodity::initServiceUi()
{
CommodityGrid *grid = new CommodityGrid();
CommodityForm *form = new CommodityForm();
m_service = new Service<CommodityData>;
m_ui = grid;
((CommodityGrid *) m_ui)->setForm(form);
}
QIcon Commodity::pluginIcon()
{
return QIcon(":/icons/commodityPlugin.svg");
}

@ -0,0 +1,27 @@
#ifndef COMMODITY_H
#define COMMODITY_H
#include "commodity_global.h"
#include <core.h>
#include <QObject>
#include <QtPlugin>
class COMMODITYSHARED_EXPORT Commodity : public QObject, IMetaDataPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID PluginInterface_iid FILE "commodity.json")
Q_INTERFACES(IPlugin)
public:
Commodity();
protected:
void initServiceUi() Q_DECL_OVERRIDE;
// IPlugin interface
public:
virtual QIcon pluginIcon();
};
#endif // COMMODITY_H

@ -0,0 +1,33 @@
{
"id" : "COMMODITY",
"name" : {
"default" : "Commodity",
"CZ" : "Zboží"
},
"descriptoin" : {
"default" : "",
"CZ" : ""
},
"schemaVersion" : 1,
"sql" : [
"CREATE TABLE \"CommodityTypeData\" (
\"id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
\"name\" TEXT NULL);
CREATE TABLE \"CommodityData\" (
\"id\" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
\"name\" TEXT NULL,
\"shortName\" TEXT NULL,
\"code\" TEXT NULL,
\"type\" INTEGER NULL,
\"price\" INTEGER NOT NULL,
\"vat\" INTEGER NOT NULL,
\"count\" INTEGER NOT NULL,
CONSTRAINT \"type_fk\"
FOREIGN KEY (\"type\")
REFERENCES \"CommodityTypeData\" (\"id\")
DEFERRABLE INITIALLY DEFERRED);"
],
"dependencies" : []
}

@ -0,0 +1,71 @@
#-------------------------------------------------
#
# Project created by QtCreator 2016-02-09T21:26:14
#
#-------------------------------------------------
QT += widgets sql
QT -= gui
TARGET = commodity
TEMPLATE = lib
DEFINES += COMMODITY_LIBRARY\
_GLIBCXX_USE_CXX11_ABI=1
SOURCES += commodity.cpp \
data/commoditydata.cpp \
data/commoditytypedata.cpp \
commoditytablemodel.cpp \
commodityform.cpp \
commoditygrid.cpp
HEADERS += commodity.h\
commodity_global.h \
data/commoditydata.h \
data/commoditytypedata.h \
data/commodity-data.h \
commoditytablemodel.h \
commodityform.h \
commoditygrid.h
unix {
target.path = /usr/lib
INSTALLS += target
QMAKE_CXXFLAGS += -std=c++11
QMAKE_CXXFLAGS += -Wno-unknown-pragmas
}
win32 {
QMAKE_CXXFLAGS += -wd4995 -wd4068
}
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../core/release/ -lcore
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../core/debug/ -lcore
else:unix: LIBS += -L$$OUT_PWD/../core/ -lcore
INCLUDEPATH += $$PWD/../core
DEPENDPATH += $$PWD/../core
DESTDIR = ../plugins
ODB_FILES = commodity/data/commodity-data.h
H_DIR = $$PWD/data/*.h
include(../odb.pri)
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../qdecimal/lib/ -lqdecimal -ldecnumber
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../qdecimal/lib/ -lqdecimal -ldecnumber
else:unix: LIBS += -L$$OUT_PWD/../qdecimal/lib/ -lqdecimal -ldecnumber
INCLUDEPATH += $$PWD/../qdecimal/src
INCLUDEPATH += $$PWD/../qdecimal/decnumber
DEPENDPATH += $$PWD/../qdecimal/src
OTHER_FILES += \
commodity.json
FORMS += \
commodityform.ui
RESOURCES += \
commodityrc.qrc

@ -0,0 +1,12 @@
#ifndef COMMODITY_GLOBAL_H
#define COMMODITY_GLOBAL_H
#include <QtCore/qglobal.h>
#if defined(COMMODITY_LIBRARY)
# define COMMODITYSHARED_EXPORT Q_DECL_EXPORT
#else
# define COMMODITYSHARED_EXPORT Q_DECL_IMPORT
#endif
#endif // COMMODITY_GLOBAL_H

@ -0,0 +1,37 @@
#include "commodityform.h"
#include "ui_commodityform.h"
#include <combodata.h>
#include <QSharedPointer>
#include <qlist.h>
#include "data/commoditytypedata.h"
CommodityForm::CommodityForm(QWidget *parent) :
AutoForm<CommodityData>(parent),
ui(new Ui::CommodityForm)
{
ui->setupUi(this);
registerBinding(ui->name);
registerBinding(ui->shortName);
registerBinding(ui->code);
registerBinding(ui->price);
QList<ComboData> vt ;
vt << ComboData(Enums::HIGH,tr("High")) << ComboData(Enums::FIRST_LOWER,tr("First Lower")) << ComboData(Enums::SECOND_LOWER,tr("Second Lower"));
registerBinding(ui->vat,vt);
registerBinding(ui->count);
}
CommodityForm::~CommodityForm()
{
delete ui;
}
void CommodityForm::registerCombos()
{
QList<ComboData> ct;
Service<CommodityTypeData> cts;
foreach (QSharedPointer<CommodityTypeData> ctd , cts.all()) {
ComboData cd(ctd);
ct << cd;
}
registerBinding(ui->type,ct);
}

@ -0,0 +1,29 @@
#ifndef COMMODITYFORM_H
#define COMMODITYFORM_H
#include <QWidget>
#include <autoform.h>
#include "data/commoditydata.h"
#include "commodity-odb.hxx"
namespace Ui {
class CommodityForm;
}
class CommodityForm : public AutoForm<CommodityData>
{
Q_OBJECT
public:
explicit CommodityForm(QWidget *parent = 0);
~CommodityForm();
private:
Ui::CommodityForm *ui;
// FormBinder interface
protected:
void registerCombos();
};
#endif // COMMODITYFORM_H

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CommodityForm</class>
<widget class="QWidget" name="CommodityForm">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="name"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Short Name</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="shortName"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Code</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="code"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Type</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Price</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Vat</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Count</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="price"/>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="count"/>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="type"/>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="vat"/>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

@ -0,0 +1,8 @@
#include "commoditygrid.h"
#include "commoditytablemodel.h"
CommodityGrid::CommodityGrid(QWidget *parent)
:GridForm<CommodityData>(parent)
{
setTableModel(new CommodityTableModel());
}

@ -0,0 +1,15 @@
#ifndef COMMODITYGRID_H
#define COMMODITYGRID_H
#include <core.h>
#include "data/commoditydata.h"
#include "commodity-odb.hxx"
class CommodityGrid : public GridForm<CommodityData>
{
Q_OBJECT
public:
CommodityGrid(QWidget *parent = NULL);
};
#endif // COMMODITYGRID_H

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/">
<file>icons/commodityPlugin.svg</file>
</qresource>
</RCC>

@ -0,0 +1,6 @@
#include "commoditytablemodel.h"
CommodityTableModel::CommodityTableModel(QObject *parent)
:AutoTableModel<CommodityData>(parent)
{
}

@ -0,0 +1,13 @@
#ifndef COMMODITYTABLEMODEL_H
#define COMMODITYTABLEMODEL_H
#include <autotablemodel.h>
#include "data/commoditydata.h"
class CommodityTableModel : public AutoTableModel<CommodityData>
{
Q_OBJECT
public:
CommodityTableModel(QObject *parent= NULL);
};
#endif // COMMODITYTABLEMODEL_H

@ -0,0 +1,6 @@
#ifndef COMMODITY_DATA_H
#define COMMODITY_DATA_H
#include "commoditydata.h"
#include "commoditytypedata.h"
#endif // COMMODITY_DATA_H

@ -0,0 +1,89 @@
#include "commoditydata.h"
#include <define.h>
CommodityData::CommodityData(QObject *parent)
:QObject(parent)
{
}
int CommodityData::id() const
{
return m_id;
}
void CommodityData::setId(int id)
{
m_id = id;
}
QString CommodityData::name() const
{
return m_name;
}
void CommodityData::setName(const QString &name)
{
m_name = name;
}
QString CommodityData::shortName() const
{
return m_shortName;
}
void CommodityData::setShortName(const QString &shortName)
{
m_shortName = shortName;
}
QString CommodityData::code() const
{
return m_code;
}
void CommodityData::setCode(const QString &code)
{
m_code = code;
}
QSharedPointer<QObject> CommodityData::type() const
{
return m_type;
}
void CommodityData::setType(const QSharedPointer<QObject> &type)
{
if (qobject_cast<CommodityTypeData*>(type.data()) != NULL) {
m_type = qSharedPointerDynamicCast<CommodityTypeData, QObject>(type);
}
}
QDecDouble CommodityData::price() const
{
return QDecDouble((double)m_price / DEC_MULTIPLE);
}
void CommodityData::setPrice(const QDecDouble &price)
{
m_price = price.toDouble() * DEC_MULTIPLE;
}
Enums::VatType CommodityData::vat() const
{
return m_vat;
}
void CommodityData::setVat(const Enums::VatType &vat)
{
m_vat = vat;
}
int CommodityData::count() const
{
return m_count;
}
void CommodityData::setCount(int count)
{
m_count = count;
}

@ -0,0 +1,64 @@
#ifndef COMMODITYDATA_H
#define COMMODITYDATA_H
#include <QObject>
#include <QString>
#include <odb/core.hxx>
#include "commoditytypedata.h"
#include <QDecDouble.hh>
#include <QSharedDataPointer>
#include <enums.h>
#pragma db object
class CommodityData : public QObject
{
Q_OBJECT
Q_PROPERTY(QString name READ name WRITE setName)
Q_PROPERTY(QString shortName READ shortName WRITE setShortName)
Q_PROPERTY(QString code READ code WRITE setCode)
Q_PROPERTY(QSharedPointer<QObject> type READ type WRITE setType)
Q_PROPERTY(QDecDouble price READ price WRITE setPrice)
Q_PROPERTY(Enums::VatType vat READ vat WRITE setVat)
Q_PROPERTY(int count READ count WRITE setCount)
public:
CommodityData(QObject *parent = 0);
int id() const;
void setId(int id);
QString name() const;
void setName(const QString &name);
QString shortName() const;
void setShortName(const QString &shortName);
QString code() const;
void setCode(const QString &code);
QSharedPointer<QObject> type() const;
void setType(const QSharedPointer<QObject> &type);
QDecDouble price() const;
void setPrice(const QDecDouble &price);
Enums::VatType vat() const;
void setVat(const Enums::VatType &vat);
int count() const;
void setCount(int count);
private:
friend class odb::access;
#pragma db id auto
int m_id;
QString m_name;
QString m_shortName;
QString m_code;
QSharedPointer<CommodityTypeData> m_type;
int m_price;
Enums::VatType m_vat;
int m_count;
};
#endif // COMMODITYDATA_H

@ -0,0 +1,38 @@
#include "commoditytypedata.h"
CommodityTypeData::CommodityTypeData(QObject *parent)
:ComboItem(parent)
{
}
int CommodityTypeData::id() const
{
return m_id;
}
void CommodityTypeData::setId(int id)
{
m_id = id;
}
QString CommodityTypeData::name() const
{
return m_name;
}
void CommodityTypeData::setName(const QString &name)
{
m_name = name;
}
bool CommodityTypeData::eq(ComboItem *other)
{
CommodityTypeData* ct = qobject_cast<CommodityTypeData *> (other);
return ct != NULL && this->id() == ct->id() ;
}
QString CommodityTypeData::toString()
{
return this->name();
}

@ -0,0 +1,36 @@
#ifndef COMMODITYTYPEDATA_H
#define COMMODITYTYPEDATA_H
#include <QObject>
#include <QString>
#include <odb/core.hxx>
#include <data/comboitem.h>
#pragma db object
class CommodityTypeData :public ComboItem
{
Q_OBJECT
Q_PROPERTY(QString name READ name WRITE setName)
public:
CommodityTypeData(QObject *parent = 0);
int id() const;
void setId(int id);
QString name() const;
void setName(const QString &name);
private:
friend class odb::access;
#pragma db id auto
int m_id;
QString m_name;
// ComboItem interface
public:
bool eq(ComboItem *other);
QString toString();
};
#endif // COMMODITYTYPEDATA_H

@ -0,0 +1 @@
<?xml version="1.0" ?><svg clip-rule="evenodd" fill-rule="evenodd" image-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient gradientUnits="userSpaceOnUse" id="a" x1="149.127" x2="149.127" y1="197.032" y2="411.462"><stop offset="0" stop-color="#FCFCFD"/><stop offset="1" stop-color="#fff"/></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="b" x1="305.874" x2="305.874" y1="411.462" y2="197.032"><stop offset="0" stop-color="#FCFCFD"/><stop offset="1" stop-color="#fff"/></linearGradient></defs><g><polygon fill="#E5E5E6" points="268,126 80,163 30,88 218,50" stroke="#434242" stroke-linejoin="round" stroke-width="10"/><polygon fill="#E5E5E6" points="268,126 394,163 463,100 331,63" stroke="#434242" stroke-linejoin="round" stroke-width="10"/><polygon fill="url(#a)" points="80,163 218,201 218,445 80,408" stroke="#434242" stroke-linejoin="round" stroke-width="10"/><polygon fill="url(#b)" points="394,163 218,201 218,445 394,408" stroke="#434242" stroke-linejoin="round" stroke-width="10"/><rect fill="#008BFF" height="20.002" transform="matrix(1.254 -.24 0 1.254 243.174 376.347)" width="100"/><polygon fill="#E5E5E6" points="394,163 218,201 293,282 469,238" stroke="#434242" stroke-linejoin="round" stroke-width="10"/><polygon fill="#E5E5E6" points="80,163 218,201 193,301 55,251" stroke="#434242" stroke-linejoin="round" stroke-width="10"/><polygon fill="#4D4D4D" points="268,126 394,163 218,201 80,163" stroke="#434242" stroke-linejoin="round" stroke-width="10"/></g></svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

@ -16,7 +16,8 @@ template <class T>
class AutoForm : public FormBinder<T> class AutoForm : public FormBinder<T>
{ {
public: public:
explicit AutoForm(QWidget *parent = 0) : FormBinder<T>(parent) { explicit AutoForm(QWidget *parent = 0) {
setParent(parent);
m_serviceConnected = false; m_serviceConnected = false;
m_saved = false; m_saved = false;
} }

@ -11,5 +11,6 @@
#include "combodata.h" #include "combodata.h"
#include "settingsservice.h" #include "settingsservice.h"
#include "settingsform.h" #include "settingsform.h"
#include "enums.h"
#endif // CORE_H #endif // CORE_H

@ -1,6 +1,8 @@
#include "formdialog.h" #include "formdialog.h"
#include "ui_formdialog.h" #include "ui_formdialog.h"
#include <QMessageBox> #include <QMessageBox>
#include "context.h"
#include "iplugin.h"
FormDialog::FormDialog(QWidget *parent) : FormDialog::FormDialog(QWidget *parent) :
QDialog(parent), QDialog(parent),
@ -24,6 +26,8 @@ void FormDialog::setForm(IForm *formWidget)
m_form = formWidget; m_form = formWidget;
connect(m_form, SIGNAL(validationError(QString)), this, SLOT(onValidationError(QString))); connect(m_form, SIGNAL(validationError(QString)), this, SLOT(onValidationError(QString)));
setGeometry(formWidget->geometry()); setGeometry(formWidget->geometry());
ui->labelName->setText(Context::instance().plugin(formWidget->pluginId())->pluginName());
ui->labelIcon->setPixmap(Context::instance().plugin(formWidget->pluginId())->pluginIcon().pixmap(QSize(36, 36)));
} }
} }

@ -30,7 +30,45 @@
<number>9</number> <number>9</number>
</property> </property>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout"/> <layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QFrame" name="frame">
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255);</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="labelIcon">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelName">
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<italic>false</italic>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item> </item>
<item> <item>
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">

@ -0,0 +1,7 @@
<?xml version="1.0" ?><svg clip-rule="evenodd" fill-rule="evenodd" image-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"><defs><style type="text/css"><![CDATA[
.str1 {stroke:#434242;stroke-width:10;stroke-linejoin:round}
.str0 {stroke:#434242;stroke-width:20;stroke-linejoin:round}
.fil2 {fill:none}
.fil0 {fill:#FFFFFF}
.fil1 {fill:url(#id0)}
]]></style><linearGradient gradientUnits="userSpaceOnUse" id="id0" x1="409.997" x2="90.003" y1="190.001" y2="190.001"><stop offset="0" stop-color="#008BFF"/><stop offset="1" stop-color="#0af"/></linearGradient></defs><g id="Layer_x0020_1"><path class="fil0 str0" d="M320 203v248c0 5-5 5-10 0l-55-55c-5-5-5-5-10 0l-55 55c-5 5-10 5-10 0v-248h140z"/><polygon class="fil1 str1" points="137,77 163,77 170,51 195,58 209,35 231,49 250,30 269,49 291,35 305,58 330,51 337,77 363,77 363,103 389,110 382,135 405,149 391,171 410,190 391,209 405,231 382,245 389,270 363,277 363,303 337,303 330,329 305,322 291,345 269,331 250,350 231,331 209,345 195,322 170,329 163,303 137,303 137,277 111,270 118,245 95,231 109,209 90,190 109,171 95,149 118,135 111,110 137,103"/><circle class="fil2 str1" cx="250" cy="190" r="97"/></g></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

@ -0,0 +1 @@
<?xml version="1.0" ?><svg clip-rule="evenodd" fill-rule="evenodd" image-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient gradientUnits="userSpaceOnUse" id="a" x1="249.999" x2="249.999" y1="40.001" y2="213.11"><stop offset="0" stop-color="#008BFF"/><stop offset="1" stop-color="#0af"/></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="b" x1="250" x2="250" y1="420.397" y2="279.594"><stop offset="0" stop-color="#008BFF"/><stop offset="1" stop-color="#0af"/></linearGradient></defs><g stroke="#434242" stroke-width="10"><circle cx="250" cy="127" fill="url(#a)" r="87"/><path d="M283 245l-25 38c-2 3-5 4-8 4s-6-1-8-4l-25-38c-2-3-5-5-9-5-54 3-97 44-97 94v116c0 6 4 10 10 10h258c6 0 10-4 10-10v-116c0-50-43-91-97-94-4 0-7 2-9 5z" fill="url(#b)"/></g></svg>

After

Width:  |  Height:  |  Size: 901 B

@ -6,6 +6,7 @@
#include <QtPlugin> #include <QtPlugin>
#include <QJsonObject> #include <QJsonObject>
#include <QStringList> #include <QStringList>
#include <QIcon>
#include "service.h" #include "service.h"
#include "igridform.h" #include "igridform.h"
@ -70,6 +71,10 @@ public:
return (Service<T>*)m_service; return (Service<T>*)m_service;
} }
virtual QIcon pluginIcon() {
return QIcon();
}
protected: protected:
QWidget *m_ui; QWidget *m_ui;
QWidget *m_settingsUi; QWidget *m_settingsUi;

@ -12,5 +12,7 @@
<file>icons/save.svg</file> <file>icons/save.svg</file>
<file>icons/ok.svg</file> <file>icons/ok.svg</file>
<file>icons/list.svg</file> <file>icons/list.svg</file>
<file>icons/usersPlugin.svg</file>
<file>icons/rolesPlugin.svg</file>
</qresource> </qresource>
</RCC> </RCC>

@ -22,3 +22,8 @@ void Roles::initServiceUi()
m_ui = new RolesUi(); m_ui = new RolesUi();
((RolesUi*)m_ui)->setForm(new RolesForm()); ((RolesUi*)m_ui)->setForm(new RolesForm());
} }
QIcon Roles::pluginIcon()
{
return QIcon(":/icons/rolesPlugin.svg");
}

@ -11,6 +11,10 @@ public:
// IMetaDataPlugin interface // IMetaDataPlugin interface
protected: protected:
void initServiceUi(); void initServiceUi();
// IPlugin interface
public:
virtual QIcon pluginIcon();
}; };
#endif // ROLES_H #endif // ROLES_H

@ -2,7 +2,7 @@
GlobalSettings::GlobalSettings(QObject *parent) : QObject(parent) GlobalSettings::GlobalSettings(QObject *parent) : QObject(parent)
{ {
m_ic = 0;
} }
QString GlobalSettings::firmName() const QString GlobalSettings::firmName() const

@ -4,11 +4,13 @@
#include <QWidget> #include <QWidget>
#include <QDialog> #include <QDialog>
#include "core_global.h"
namespace Ui { namespace Ui {
class SettingsForm; class SettingsForm;
} }
class SettingsForm : public QDialog class CORESHARED_EXPORT SettingsForm : public QDialog
{ {
Q_OBJECT Q_OBJECT

@ -19,3 +19,8 @@ void Users::initServiceUi()
m_ui = new UsersUi; m_ui = new UsersUi;
((UsersUi *) m_ui)->setForm(new UserForm); ((UsersUi *) m_ui)->setForm(new UserForm);
} }
QIcon Users::pluginIcon()
{
return QIcon(":/icons/usersPlugin.svg");
}

@ -12,6 +12,10 @@ public:
// IMetaDataPlugin interface // IMetaDataPlugin interface
protected: protected:
void initServiceUi(); void initServiceUi();
// IPlugin interface
public:
virtual QIcon pluginIcon();
}; };
#endif // USERS_H #endif // USERS_H

@ -5,7 +5,7 @@ SUBDIRS += \
core \ core \
application \ application \
accommodation \ accommodation \
services services \
#commodity \ commodity \
#addressbook addressbook

@ -1,7 +1,8 @@
#include "accservice.h" #include "accservice.h"
#include <define.h> #include <define.h>
AccService::AccService() AccService::AccService(QObject *parent)
:QObject(parent)
{ {
m_price = 0; m_price = 0;
m_active = 1; m_active = 1;

@ -24,7 +24,7 @@ class AccService : public QObject
Q_PROPERTY(Enums::VatType vatType READ vatType WRITE setVatType) Q_PROPERTY(Enums::VatType vatType READ vatType WRITE setVatType)
public: public:
AccService(); AccService(QObject *parent = 0);

@ -0,0 +1,8 @@
<?xml version="1.0" ?><svg clip-rule="evenodd" fill-rule="evenodd" image-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs><style type="text/css"><![CDATA[
.str1 {stroke:#434242;stroke-width:5}
.str0 {stroke:#434242;stroke-width:10;stroke-linejoin:round}
.fil3 {fill:none}
.fil1 {fill:url(#id0)}
.fil2 {fill:url(#id1)}
.fil0 {fill:url(#id2)}
]]></style><linearGradient gradientUnits="userSpaceOnUse" id="id0" x1="250" x2="250" y1="349.998" y2="150.002"><stop offset="0" stop-color="#DDDEDE"/><stop offset="1" stop-color="#B3B4B4"/></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="id1" x1="250" x2="250" y1="190.001" y2="309.999"/><radialGradient cy="48%" fx="50%" fy="48%" id="id2"><stop offset="0" stop-color="#0af"/><stop offset="1" stop-color="#008BFF"/></radialGradient></defs><g id="Layer_x0020_1"><path class="fil0 str0" d="M333 385l41 29c3 2 6 3 9 0l31-31c3-3 2-6 0-9l-29-41c9-14 15-30 19-46l50-8c3-1 6-3 6-7v-44c0-4-3-6-6-7l-50-8c-4-16-11-32-19-45l29-42c2-3 3-6 0-9l-31-31c-3-3-6-2-9 0l-42 29c-14-8-29-15-45-19l-8-50c-1-3-3-6-7-6h-44c-4 0-6 3-7 6l-8 50c-16 4-31 11-45 19l-42-29c-3-2-6-3-9 0l-31 31c-3 3-2 6 0 9l29 42c-8 13-15 29-19 45l-50 8c-3 1-6 3-6 7v44c0 4 3 6 6 7l50 8c4 16 10 32 19 46l-29 41c-2 3-3 6 0 9l31 31c3 3 6 2 9 0l41-29c14 9 30 15 46 19l8 50c1 3 3 6 7 6h44c4 0 6-3 7-6l8-50c16-4 32-10 46-19zm-83-185c-28 0-50 22-50 50s22 50 50 50 50-22 50-50-22-50-50-50z"/><path class="fil1" d="M250 150c-55 0-100 45-100 100s45 100 100 100 100-45 100-100-45-100-100-100zm0 50c-28 0-50 22-50 50s22 50 50 50 50-22 50-50-22-50-50-50z"/><path class="fil2" d="M250 310c33 0 60-27 60-60s-27-60-60-60-60 27-60 60 27 60 60 60zm0-110c-28 0-50 22-50 50s22 50 50 50 50-22 50-50-22-50-50-50z"/><circle class="fil3 str1" cx="250" cy="250" r="100"/></g></svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

@ -19,3 +19,8 @@ void Services::initServiceUi()
((AccServiceGrid *) m_ui)->setForm(form); ((AccServiceGrid *) m_ui)->setForm(form);
} }
QIcon Services::pluginIcon()
{
return QIcon(":icons/servicesPlugin.svg");
}

@ -19,6 +19,10 @@ public:
protected: protected:
void initServiceUi() Q_DECL_OVERRIDE; void initServiceUi() Q_DECL_OVERRIDE;
// IPlugin interface
public:
virtual QIcon pluginIcon();
}; };
#endif // SERVICES_H #endif // SERVICES_H

@ -70,3 +70,6 @@ DEPENDPATH += $$PWD/../qdecimal/src
#else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../qdecimal/src/release/qdecimal.lib #else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../qdecimal/src/release/qdecimal.lib
#else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../qdecimal/src/debug/qdecimal.lib #else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../qdecimal/src/debug/qdecimal.lib
#else:unix: PRE_TARGETDEPS += $$OUT_PWD/../qdecimal/src/libqdecimal.a #else:unix: PRE_TARGETDEPS += $$OUT_PWD/../qdecimal/src/libqdecimal.a
RESOURCES += \
servicesrc.qrc

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/">
<file>icons/servicesPlugin.svg</file>
</qresource>
</RCC>
Loading…
Cancel
Save