From c12a1231c0ac1b138b17725c96f6038311091cb0 Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Thu, 3 Mar 2016 15:03:51 +0100 Subject: [PATCH] Fixed MSVS build. Added plugin icons, improved UI. --- accommodation/accommodation.cpp | 5 ++++ accommodation/accommodation.h | 5 ++++ accommodation/accommodation.pro | 3 ++ accommodation/accrc.qrc | 5 ++++ accommodation/icons/accPlugin.svg | 7 +++++ addressbook/addressbook.cpp | 5 ++++ addressbook/addressbook.h | 5 ++++ addressbook/addressbook.pro | 3 ++ addressbook/addressbookrc.qrc | 5 ++++ addressbook/icons/addressbookPlugin.svg | 1 + application/appRc.qrc | 1 + application/icons/settings.svg | 1 + application/mainwindow.cpp | 9 ++++-- application/mainwindow.ui | 6 +++- application/style.css | 8 ++++- commodity/commodity.cpp | 5 ++++ commodity/commodity.h | 4 +++ commodity/commodity.pro | 3 ++ commodity/commodityrc.qrc | 5 ++++ commodity/icons/commodityPlugin.svg | 1 + core/autoform.h | 3 +- core/formdialog.cpp | 4 +++ core/formdialog.ui | 40 ++++++++++++++++++++++++- core/icons/rolesPlugin.svg | 7 +++++ core/icons/usersPlugin.svg | 1 + core/iplugin.h | 5 ++++ core/rc.qrc | 2 ++ core/roles/roles.cpp | 5 ++++ core/roles/roles.h | 4 +++ core/settingsform.h | 4 ++- core/users/users.cpp | 5 ++++ core/users/users.h | 4 +++ services/icons/servicesPlugin.svg | 8 +++++ services/services.cpp | 5 ++++ services/services.h | 4 +++ services/services.pro | 3 ++ services/servicesrc.qrc | 5 ++++ 37 files changed, 189 insertions(+), 7 deletions(-) create mode 100644 accommodation/accrc.qrc create mode 100644 accommodation/icons/accPlugin.svg create mode 100644 addressbook/addressbookrc.qrc create mode 100644 addressbook/icons/addressbookPlugin.svg create mode 100644 application/icons/settings.svg create mode 100644 commodity/commodityrc.qrc create mode 100644 commodity/icons/commodityPlugin.svg create mode 100644 core/icons/rolesPlugin.svg create mode 100644 core/icons/usersPlugin.svg create mode 100644 services/icons/servicesPlugin.svg create mode 100644 services/servicesrc.qrc 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/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/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 index c1bf0f5..1a3d863 100644 --- a/commodity/commodity.cpp +++ b/commodity/commodity.cpp @@ -16,3 +16,8 @@ void Commodity::initServiceUi() 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 index 484cc77..34c80ec 100644 --- a/commodity/commodity.h +++ b/commodity/commodity.h @@ -18,6 +18,10 @@ public: protected: void initServiceUi() Q_DECL_OVERRIDE; + + // IPlugin interface +public: + virtual QIcon pluginIcon(); }; #endif // COMMODITY_H diff --git a/commodity/commodity.pro b/commodity/commodity.pro index cb3fc46..f678276 100644 --- a/commodity/commodity.pro +++ b/commodity/commodity.pro @@ -66,3 +66,6 @@ OTHER_FILES += \ FORMS += \ commodityform.ui + +RESOURCES += \ + commodityrc.qrc 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/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/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/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/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 + +