diff --git a/accommodation/accommodation.cpp b/accommodation/accommodation.cpp index f01ad27..87f8ff4 100644 --- a/accommodation/accommodation.cpp +++ b/accommodation/accommodation.cpp @@ -23,6 +23,11 @@ void Accommodation::initServiceUi() m_service = service; m_ui = grid; } + +QIcon Accommodation::pluginIcon() +{ + return QIcon(":/icons/accPlugin.svg"); +} /* QWidget *Accommodation::ui() { diff --git a/accommodation/accommodation.h b/accommodation/accommodation.h index 7416dda..505f642 100644 --- a/accommodation/accommodation.h +++ b/accommodation/accommodation.h @@ -27,6 +27,11 @@ protected: // IPlugin interface public: //QWidget *ui(); + + // IPlugin interface +public: + virtual QIcon pluginIcon(); + }; #endif // ACCOMMODATION_H diff --git a/accommodation/accommodation.pro b/accommodation/accommodation.pro index 3ea824e..5d311ef 100644 --- a/accommodation/accommodation.pro +++ b/accommodation/accommodation.pro @@ -67,3 +67,6 @@ else:unix: LIBS += -L$$OUT_PWD/../qdecimal/lib/ -lqdecimal -ldecnumber INCLUDEPATH += $$PWD/../qdecimal/src INCLUDEPATH += $$PWD/../qdecimal/decnumber +RESOURCES += \ + accrc.qrc + diff --git a/accommodation/accrc.qrc b/accommodation/accrc.qrc new file mode 100644 index 0000000..4ac8ed9 --- /dev/null +++ b/accommodation/accrc.qrc @@ -0,0 +1,5 @@ + + + icons/accPlugin.svg + + diff --git a/accommodation/icons/accPlugin.svg b/accommodation/icons/accPlugin.svg new file mode 100644 index 0000000..88f894a --- /dev/null +++ b/accommodation/icons/accPlugin.svg @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/addressbook/addressbook.cpp b/addressbook/addressbook.cpp index 6d7ebe2..552ee2d 100644 --- a/addressbook/addressbook.cpp +++ b/addressbook/addressbook.cpp @@ -18,6 +18,11 @@ void Addressbook::initServiceUi() ((AddressbookGrid *) m_ui)->setForm(form); } +QIcon Addressbook::pluginIcon() +{ + return QIcon(":/icons/addressbookPlugin.svg"); +} + diff --git a/addressbook/addressbook.h b/addressbook/addressbook.h index c5e8916..b07b982 100644 --- a/addressbook/addressbook.h +++ b/addressbook/addressbook.h @@ -23,6 +23,11 @@ protected: + + // IPlugin interface +public: + virtual QIcon pluginIcon(); + }; #endif // ADDRESSBOOK_H diff --git a/addressbook/addressbook.pro b/addressbook/addressbook.pro index 7e00357..a901d68 100644 --- a/addressbook/addressbook.pro +++ b/addressbook/addressbook.pro @@ -64,3 +64,6 @@ OTHER_FILES += \ FORMS += \ addressbookform.ui + +RESOURCES += \ + addressbookrc.qrc diff --git a/addressbook/addressbookform.h b/addressbook/addressbookform.h index 4c1a377..7888b7d 100644 --- a/addressbook/addressbookform.h +++ b/addressbook/addressbookform.h @@ -2,8 +2,7 @@ #define ADDRESSBOOKFORM_H #include -#include -#include "autoform.h" +#include #include "data/addressbookdata.h" #include "addressbook-odb.hxx" diff --git a/addressbook/addressbookrc.qrc b/addressbook/addressbookrc.qrc new file mode 100644 index 0000000..f9a5431 --- /dev/null +++ b/addressbook/addressbookrc.qrc @@ -0,0 +1,5 @@ + + + icons/addressbookPlugin.svg + + diff --git a/addressbook/data/addressbookdata.h b/addressbook/data/addressbookdata.h index 07fba57..cc0f2b8 100644 --- a/addressbook/data/addressbookdata.h +++ b/addressbook/data/addressbookdata.h @@ -4,7 +4,7 @@ #include #include #include -#include "odb/core.hxx" +#include #pragma db object class AddressbookData : public QObject @@ -58,7 +58,7 @@ public: private: friend class odb::access; -#pragma db id auto + #pragma db id auto int m_id; QString m_title; QString m_firstName; diff --git a/addressbook/icons/addressbookPlugin.svg b/addressbook/icons/addressbookPlugin.svg new file mode 100644 index 0000000..8f2b8d2 --- /dev/null +++ b/addressbook/icons/addressbookPlugin.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/application/appRc.qrc b/application/appRc.qrc index dda944f..a37b608 100644 --- a/application/appRc.qrc +++ b/application/appRc.qrc @@ -3,5 +3,6 @@ icons/login_32.png icons/login_64.png style.css + icons/settings.svg diff --git a/application/icons/settings.svg b/application/icons/settings.svg new file mode 100644 index 0000000..b47999d --- /dev/null +++ b/application/icons/settings.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/application/mainwindow.cpp b/application/mainwindow.cpp index d8134fd..77e7e89 100644 --- a/application/mainwindow.cpp +++ b/application/mainwindow.cpp @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -41,8 +42,12 @@ MainWindow::MainWindow(QWidget *parent) : int i = 0; foreach (IPlugin *plugin, Context::instance().plugins()) { - QPushButton *plugButton = new QPushButton(this); + QToolButton *plugButton = new QToolButton(this); 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); plugButton->setProperty(PLUGIN_INDEX, 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->setCurrentIndex(ui->tabWidget->count() - 1); } diff --git a/application/mainwindow.ui b/application/mainwindow.ui index f8efb33..4a52742 100644 --- a/application/mainwindow.ui +++ b/application/mainwindow.ui @@ -56,7 +56,7 @@ 0 0 1000 - 19 + 21 @@ -101,6 +101,10 @@ + + + :/icons/settings.svg:/icons/settings.svg + Settings diff --git a/application/style.css b/application/style.css index 7125770..b2628ea 100644 --- a/application/style.css +++ b/application/style.css @@ -1,5 +1,5 @@ #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 { @@ -14,3 +14,9 @@ min-height: 40px; font: 14px; } + +#navigation QToolButton { + color: white; + font-weight: bold; + min-width: 80px; +} diff --git a/commodity/commodity.cpp b/commodity/commodity.cpp new file mode 100644 index 0000000..1a3d863 --- /dev/null +++ b/commodity/commodity.cpp @@ -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; + m_ui = grid; + ((CommodityGrid *) m_ui)->setForm(form); +} + +QIcon Commodity::pluginIcon() +{ + return QIcon(":/icons/commodityPlugin.svg"); +} diff --git a/commodity/commodity.h b/commodity/commodity.h new file mode 100644 index 0000000..34c80ec --- /dev/null +++ b/commodity/commodity.h @@ -0,0 +1,27 @@ +#ifndef COMMODITY_H +#define COMMODITY_H + +#include "commodity_global.h" +#include +#include +#include + +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 diff --git a/commodity/commodity.json b/commodity/commodity.json new file mode 100644 index 0000000..4c5ab93 --- /dev/null +++ b/commodity/commodity.json @@ -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" : [] +} diff --git a/commodity/commodity.pro b/commodity/commodity.pro new file mode 100644 index 0000000..f678276 --- /dev/null +++ b/commodity/commodity.pro @@ -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 diff --git a/commodity/commodity_global.h b/commodity/commodity_global.h new file mode 100644 index 0000000..4d422a0 --- /dev/null +++ b/commodity/commodity_global.h @@ -0,0 +1,12 @@ +#ifndef COMMODITY_GLOBAL_H +#define COMMODITY_GLOBAL_H + +#include + +#if defined(COMMODITY_LIBRARY) +# define COMMODITYSHARED_EXPORT Q_DECL_EXPORT +#else +# define COMMODITYSHARED_EXPORT Q_DECL_IMPORT +#endif + +#endif // COMMODITY_GLOBAL_H diff --git a/commodity/commodityform.cpp b/commodity/commodityform.cpp new file mode 100644 index 0000000..eac189c --- /dev/null +++ b/commodity/commodityform.cpp @@ -0,0 +1,37 @@ +#include "commodityform.h" +#include "ui_commodityform.h" +#include +#include +#include +#include "data/commoditytypedata.h" + +CommodityForm::CommodityForm(QWidget *parent) : + AutoForm(parent), + ui(new Ui::CommodityForm) +{ + ui->setupUi(this); + registerBinding(ui->name); + registerBinding(ui->shortName); + registerBinding(ui->code); + registerBinding(ui->price); + QList 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 ct; + Service cts; + foreach (QSharedPointer ctd , cts.all()) { + ComboData cd(ctd); + ct << cd; + } + registerBinding(ui->type,ct); +} diff --git a/commodity/commodityform.h b/commodity/commodityform.h new file mode 100644 index 0000000..8161ed6 --- /dev/null +++ b/commodity/commodityform.h @@ -0,0 +1,29 @@ +#ifndef COMMODITYFORM_H +#define COMMODITYFORM_H + +#include +#include +#include "data/commoditydata.h" +#include "commodity-odb.hxx" + +namespace Ui { +class CommodityForm; +} + +class CommodityForm : public AutoForm +{ + Q_OBJECT + +public: + explicit CommodityForm(QWidget *parent = 0); + ~CommodityForm(); + +private: + Ui::CommodityForm *ui; + + // FormBinder interface +protected: + void registerCombos(); +}; + +#endif // COMMODITYFORM_H diff --git a/commodity/commodityform.ui b/commodity/commodityform.ui new file mode 100644 index 0000000..e730f81 --- /dev/null +++ b/commodity/commodityform.ui @@ -0,0 +1,91 @@ + + + CommodityForm + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + Name + + + + + + + + + + Short Name + + + + + + + + + + Code + + + + + + + + + + Type + + + + + + + Price + + + + + + + Vat + + + + + + + Count + + + + + + + + + + + + + + + + + + + + diff --git a/commodity/commoditygrid.cpp b/commodity/commoditygrid.cpp new file mode 100644 index 0000000..217b11e --- /dev/null +++ b/commodity/commoditygrid.cpp @@ -0,0 +1,8 @@ +#include "commoditygrid.h" +#include "commoditytablemodel.h" + +CommodityGrid::CommodityGrid(QWidget *parent) + :GridForm(parent) +{ + setTableModel(new CommodityTableModel()); +} diff --git a/commodity/commoditygrid.h b/commodity/commoditygrid.h new file mode 100644 index 0000000..f29b6cd --- /dev/null +++ b/commodity/commoditygrid.h @@ -0,0 +1,15 @@ +#ifndef COMMODITYGRID_H +#define COMMODITYGRID_H + +#include +#include "data/commoditydata.h" +#include "commodity-odb.hxx" + +class CommodityGrid : public GridForm +{ + Q_OBJECT +public: + CommodityGrid(QWidget *parent = NULL); +}; + +#endif // COMMODITYGRID_H diff --git a/commodity/commodityrc.qrc b/commodity/commodityrc.qrc new file mode 100644 index 0000000..76f76ad --- /dev/null +++ b/commodity/commodityrc.qrc @@ -0,0 +1,5 @@ + + + icons/commodityPlugin.svg + + diff --git a/commodity/commoditytablemodel.cpp b/commodity/commoditytablemodel.cpp new file mode 100644 index 0000000..fb4af00 --- /dev/null +++ b/commodity/commoditytablemodel.cpp @@ -0,0 +1,6 @@ +#include "commoditytablemodel.h" + +CommodityTableModel::CommodityTableModel(QObject *parent) + :AutoTableModel(parent) +{ +} diff --git a/commodity/commoditytablemodel.h b/commodity/commoditytablemodel.h new file mode 100644 index 0000000..9d33c2e --- /dev/null +++ b/commodity/commoditytablemodel.h @@ -0,0 +1,13 @@ +#ifndef COMMODITYTABLEMODEL_H +#define COMMODITYTABLEMODEL_H +#include +#include "data/commoditydata.h" + +class CommodityTableModel : public AutoTableModel +{ + Q_OBJECT +public: + CommodityTableModel(QObject *parent= NULL); +}; + +#endif // COMMODITYTABLEMODEL_H diff --git a/commodity/data/commodity-data.h b/commodity/data/commodity-data.h new file mode 100644 index 0000000..2f2b967 --- /dev/null +++ b/commodity/data/commodity-data.h @@ -0,0 +1,6 @@ +#ifndef COMMODITY_DATA_H +#define COMMODITY_DATA_H +#include "commoditydata.h" +#include "commoditytypedata.h" + +#endif // COMMODITY_DATA_H diff --git a/commodity/data/commoditydata.cpp b/commodity/data/commoditydata.cpp new file mode 100644 index 0000000..fe2b6ff --- /dev/null +++ b/commodity/data/commoditydata.cpp @@ -0,0 +1,89 @@ +#include "commoditydata.h" +#include + +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 CommodityData::type() const +{ + return m_type; +} + +void CommodityData::setType(const QSharedPointer &type) +{ + if (qobject_cast(type.data()) != NULL) { + m_type = qSharedPointerDynamicCast(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; +} + + + + + + + + diff --git a/commodity/data/commoditydata.h b/commodity/data/commoditydata.h new file mode 100644 index 0000000..7ac5e48 --- /dev/null +++ b/commodity/data/commoditydata.h @@ -0,0 +1,64 @@ +#ifndef COMMODITYDATA_H +#define COMMODITYDATA_H + +#include +#include +#include +#include "commoditytypedata.h" +#include +#include +#include + +#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 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 type() const; + void setType(const QSharedPointer &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 m_type; + int m_price; + Enums::VatType m_vat; + int m_count; +}; + +#endif // COMMODITYDATA_H diff --git a/commodity/data/commoditytypedata.cpp b/commodity/data/commoditytypedata.cpp new file mode 100644 index 0000000..cd4d9f2 --- /dev/null +++ b/commodity/data/commoditytypedata.cpp @@ -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 (other); + + return ct != NULL && this->id() == ct->id() ; +} + +QString CommodityTypeData::toString() +{ + return this->name(); +} + + diff --git a/commodity/data/commoditytypedata.h b/commodity/data/commoditytypedata.h new file mode 100644 index 0000000..95aed64 --- /dev/null +++ b/commodity/data/commoditytypedata.h @@ -0,0 +1,36 @@ +#ifndef COMMODITYTYPEDATA_H +#define COMMODITYTYPEDATA_H + +#include +#include +#include +#include + +#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 diff --git a/commodity/icons/commodityPlugin.svg b/commodity/icons/commodityPlugin.svg new file mode 100644 index 0000000..a826d46 --- /dev/null +++ b/commodity/icons/commodityPlugin.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/core/autoform.h b/core/autoform.h index 9895c83..7de9d38 100644 --- a/core/autoform.h +++ b/core/autoform.h @@ -16,7 +16,8 @@ template class AutoForm : public FormBinder { public: - explicit AutoForm(QWidget *parent = 0) : FormBinder(parent) { + explicit AutoForm(QWidget *parent = 0) { + setParent(parent); m_serviceConnected = false; m_saved = false; } diff --git a/core/core.h b/core/core.h index cc8ae69..7b5f590 100644 --- a/core/core.h +++ b/core/core.h @@ -11,5 +11,6 @@ #include "combodata.h" #include "settingsservice.h" #include "settingsform.h" +#include "enums.h" #endif // CORE_H diff --git a/core/formdialog.cpp b/core/formdialog.cpp index 5d36b6e..bdc2c74 100644 --- a/core/formdialog.cpp +++ b/core/formdialog.cpp @@ -1,6 +1,8 @@ #include "formdialog.h" #include "ui_formdialog.h" #include +#include "context.h" +#include "iplugin.h" FormDialog::FormDialog(QWidget *parent) : QDialog(parent), @@ -24,6 +26,8 @@ void FormDialog::setForm(IForm *formWidget) m_form = formWidget; connect(m_form, SIGNAL(validationError(QString)), this, SLOT(onValidationError(QString))); 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))); } } diff --git a/core/formdialog.ui b/core/formdialog.ui index faae3c5..f80cb74 100644 --- a/core/formdialog.ui +++ b/core/formdialog.ui @@ -30,7 +30,45 @@ 9 - + + + + + background-color: rgb(255, 255, 255); + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + + + + + + + 10 + 75 + false + true + + + + TextLabel + + + + + + + diff --git a/core/icons/rolesPlugin.svg b/core/icons/rolesPlugin.svg new file mode 100644 index 0000000..5ce968c --- /dev/null +++ b/core/icons/rolesPlugin.svg @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/core/icons/usersPlugin.svg b/core/icons/usersPlugin.svg new file mode 100644 index 0000000..6fbc496 --- /dev/null +++ b/core/icons/usersPlugin.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/core/iplugin.h b/core/iplugin.h index 536bc19..bdc0aab 100644 --- a/core/iplugin.h +++ b/core/iplugin.h @@ -6,6 +6,7 @@ #include #include #include +#include #include "service.h" #include "igridform.h" @@ -70,6 +71,10 @@ public: return (Service*)m_service; } + virtual QIcon pluginIcon() { + return QIcon(); + } + protected: QWidget *m_ui; QWidget *m_settingsUi; diff --git a/core/rc.qrc b/core/rc.qrc index 2bd5c27..420e891 100644 --- a/core/rc.qrc +++ b/core/rc.qrc @@ -12,5 +12,7 @@ icons/save.svg icons/ok.svg icons/list.svg + icons/usersPlugin.svg + icons/rolesPlugin.svg diff --git a/core/roles/roles.cpp b/core/roles/roles.cpp index 7e74a5e..23d9f2a 100644 --- a/core/roles/roles.cpp +++ b/core/roles/roles.cpp @@ -22,3 +22,8 @@ void Roles::initServiceUi() m_ui = new RolesUi(); ((RolesUi*)m_ui)->setForm(new RolesForm()); } + +QIcon Roles::pluginIcon() +{ + return QIcon(":/icons/rolesPlugin.svg"); +} diff --git a/core/roles/roles.h b/core/roles/roles.h index 6bdb164..3323baa 100644 --- a/core/roles/roles.h +++ b/core/roles/roles.h @@ -11,6 +11,10 @@ public: // IMetaDataPlugin interface protected: void initServiceUi(); + + // IPlugin interface +public: + virtual QIcon pluginIcon(); }; #endif // ROLES_H diff --git a/core/settings/globalsettings.cpp b/core/settings/globalsettings.cpp index 1e66133..c2cf97d 100644 --- a/core/settings/globalsettings.cpp +++ b/core/settings/globalsettings.cpp @@ -2,7 +2,7 @@ GlobalSettings::GlobalSettings(QObject *parent) : QObject(parent) { - + m_ic = 0; } QString GlobalSettings::firmName() const diff --git a/core/settingsform.h b/core/settingsform.h index 0dd45ae..abdbd18 100644 --- a/core/settingsform.h +++ b/core/settingsform.h @@ -4,11 +4,13 @@ #include #include +#include "core_global.h" + namespace Ui { class SettingsForm; } -class SettingsForm : public QDialog +class CORESHARED_EXPORT SettingsForm : public QDialog { Q_OBJECT diff --git a/core/users/users.cpp b/core/users/users.cpp index 0ccf2a4..aef1a6c 100644 --- a/core/users/users.cpp +++ b/core/users/users.cpp @@ -19,3 +19,8 @@ void Users::initServiceUi() m_ui = new UsersUi; ((UsersUi *) m_ui)->setForm(new UserForm); } + +QIcon Users::pluginIcon() +{ + return QIcon(":/icons/usersPlugin.svg"); +} diff --git a/core/users/users.h b/core/users/users.h index 0d2a362..9ef680c 100644 --- a/core/users/users.h +++ b/core/users/users.h @@ -12,6 +12,10 @@ public: // IMetaDataPlugin interface protected: void initServiceUi(); + + // IPlugin interface +public: + virtual QIcon pluginIcon(); }; #endif // USERS_H diff --git a/prodejna.pro b/prodejna.pro index 67c41f1..f297667 100644 --- a/prodejna.pro +++ b/prodejna.pro @@ -5,7 +5,7 @@ SUBDIRS += \ core \ application \ accommodation \ - services - #commodity \ - #addressbook + services \ + commodity \ + addressbook diff --git a/services/data/accservice.cpp b/services/data/accservice.cpp index b3aa13c..d6c0a65 100644 --- a/services/data/accservice.cpp +++ b/services/data/accservice.cpp @@ -1,7 +1,8 @@ #include "accservice.h" #include -AccService::AccService() +AccService::AccService(QObject *parent) + :QObject(parent) { m_price = 0; m_active = 1; diff --git a/services/data/accservice.h b/services/data/accservice.h index af512ba..cda12f9 100644 --- a/services/data/accservice.h +++ b/services/data/accservice.h @@ -24,7 +24,7 @@ class AccService : public QObject Q_PROPERTY(Enums::VatType vatType READ vatType WRITE setVatType) public: - AccService(); + AccService(QObject *parent = 0); diff --git a/services/icons/servicesPlugin.svg b/services/icons/servicesPlugin.svg new file mode 100644 index 0000000..bb3d19c --- /dev/null +++ b/services/icons/servicesPlugin.svg @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/services/services.cpp b/services/services.cpp index 414443d..7458acc 100644 --- a/services/services.cpp +++ b/services/services.cpp @@ -19,3 +19,8 @@ void Services::initServiceUi() ((AccServiceGrid *) m_ui)->setForm(form); } +QIcon Services::pluginIcon() +{ + return QIcon(":icons/servicesPlugin.svg"); +} + diff --git a/services/services.h b/services/services.h index eedd362..12f73cf 100644 --- a/services/services.h +++ b/services/services.h @@ -19,6 +19,10 @@ public: protected: void initServiceUi() Q_DECL_OVERRIDE; + + // IPlugin interface +public: + virtual QIcon pluginIcon(); }; #endif // SERVICES_H diff --git a/services/services.pro b/services/services.pro index 05b4c7e..1ca5d8c 100644 --- a/services/services.pro +++ b/services/services.pro @@ -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(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../qdecimal/src/debug/qdecimal.lib #else:unix: PRE_TARGETDEPS += $$OUT_PWD/../qdecimal/src/libqdecimal.a + +RESOURCES += \ + servicesrc.qrc diff --git a/services/servicesrc.qrc b/services/servicesrc.qrc new file mode 100644 index 0000000..34a1378 --- /dev/null +++ b/services/servicesrc.qrc @@ -0,0 +1,5 @@ + + + icons/servicesPlugin.svg + +