diff --git a/application/appRc.qrc b/application/appRc.qrc
index a37b608..afa9743 100644
--- a/application/appRc.qrc
+++ b/application/appRc.qrc
@@ -4,5 +4,6 @@
icons/login_64.png
style.css
icons/settings.svg
+ translations/prodejna_cs_CZ.qm
diff --git a/application/application.pro b/application/application.pro
index 307a02c..eeb2f76 100644
--- a/application/application.pro
+++ b/application/application.pro
@@ -56,3 +56,7 @@ INCLUDEPATH += $$PWD/../qdecimal/decnumber
RESOURCES += \
appRc.qrc
+
+TRANSLATIONS = translations/prodejna_cz.ts
+
+DISTFILES +=
diff --git a/application/main.cpp b/application/main.cpp
index ac8a17e..6b68e87 100644
--- a/application/main.cpp
+++ b/application/main.cpp
@@ -1,12 +1,22 @@
#include "mainwindow.h"
#include
#include
-
-#include
+#include
+#include
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
+
+ QTranslator qtTranslator;
+ qtTranslator.load("qt_" + QLocale::system().name(),
+ QLibraryInfo::location(QLibraryInfo::TranslationsPath));
+ a.installTranslator(&qtTranslator);
+
+ QTranslator myappTranslator;
+ myappTranslator.load(":/translations/prodejna_" + QLocale::system().name());
+ a.installTranslator(&myappTranslator);
+
MainWindow w;
w.move(QApplication::desktop()->screen()->rect().center() - w.rect().center());
w.show();
diff --git a/application/translations/prodejna_cs_CZ.qm b/application/translations/prodejna_cs_CZ.qm
new file mode 100644
index 0000000..9d707a8
Binary files /dev/null and b/application/translations/prodejna_cs_CZ.qm differ
diff --git a/application/translations/prodejna_cz.ts b/application/translations/prodejna_cz.ts
new file mode 100644
index 0000000..d8234ef
--- /dev/null
+++ b/application/translations/prodejna_cz.ts
@@ -0,0 +1,52 @@
+
+
+
+
+ LoginDialog
+
+
+
+
+ Login
+
+
+
+
+ Heslo
+
+
+
+ MainWindow
+
+
+
+ Nastaveni
+
+
+
+
+ Soubor
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/core/autotablemodel.h b/core/autotablemodel.h
index 2e5c309..0866a87 100644
--- a/core/autotablemodel.h
+++ b/core/autotablemodel.h
@@ -89,6 +89,7 @@ public:
for (int i = 0; i < entity->metaObject()->propertyCount(); i++) {
if (i == section) {
QString colName(entity->metaObject()->property(i + 1).name());
+ delete entity;
return tr(colName.toStdString().c_str());
}
}
diff --git a/core/context.cpp b/core/context.cpp
index 2052f57..58c5d22 100644
--- a/core/context.cpp
+++ b/core/context.cpp
@@ -6,6 +6,7 @@
#include
#include
#include
+#include
#include
@@ -49,6 +50,8 @@ void Context::loadPlugins()
m_plugins.append(new Users);
m_plugins.append(new Roles);
+ qApp->installTranslator(corePlugin->translator());
+
QDir pluginsDir(qApp->applicationDirPath() + "/../plugins");
foreach (QString fileName, pluginsDir.entryList(QStringList() << "*.so" << "*.dll")) {
@@ -59,6 +62,9 @@ void Context::loadPlugins()
IPlugin *plugin = qobject_cast(p);
if (plugin != NULL) {
plugin->init(pluginLoader.metaData());
+
+ QTranslator *translator = plugin->translator();
+ qApp->installTranslator(translator);
m_plugins.append(plugin);
}
}
diff --git a/core/core.pro b/core/core.pro
index 370f413..2ed2239 100644
--- a/core/core.pro
+++ b/core/core.pro
@@ -146,3 +146,5 @@ else:unix: LIBS += -L$$OUT_PWD/../qdecimal/lib/ -lqdecimal -ldecnumber
INCLUDEPATH += $$PWD/../qdecimal/src
INCLUDEPATH += $$PWD/../qdecimal/decnumber
+
+TRANSLATIONS = translations/core_cz.ts
diff --git a/core/coreplugin.cpp b/core/coreplugin.cpp
index d36d224..5c96908 100644
--- a/core/coreplugin.cpp
+++ b/core/coreplugin.cpp
@@ -25,3 +25,11 @@ void CorePlugin::initServiceUi()
m_settingsUi = new GlobalSettingsForm();
}
+QTranslator *CorePlugin::translator()
+{
+ QTranslator *trans = new QTranslator();
+ trans->load(":/translations/core_" + QLocale::system().name());
+
+ return trans;
+}
+
diff --git a/core/coreplugin.h b/core/coreplugin.h
index c1b1f29..7186b0d 100644
--- a/core/coreplugin.h
+++ b/core/coreplugin.h
@@ -12,6 +12,10 @@ public:
// IMetaDataPlugin interface
protected:
virtual void initServiceUi();
+
+ // IPlugin interface
+public:
+ QTranslator *translator() override;
};
#endif // COREPLUGIN_H
diff --git a/core/gridform.h b/core/gridform.h
index cb65446..2e18917 100644
--- a/core/gridform.h
+++ b/core/gridform.h
@@ -98,6 +98,12 @@ public slots:
hide.append(var.toInt());
}
+ QMap widths = Context::instance().settings()->value("grids/" + pluginId() + "/widths").toMap();
+ foreach (QString key, widths.keys()) {
+ tableView()->setColumnWidth(key.toInt(), widths[key].toInt());
+ }
+
+ connect(tableView()->horizontalHeader(), SIGNAL(sectionResized(int,int,int)), this, SLOT(widthChanged(int,int,int)));
hideColumns(hide);
}
diff --git a/core/igridform.cpp b/core/igridform.cpp
index ef1d899..f58f52d 100644
--- a/core/igridform.cpp
+++ b/core/igridform.cpp
@@ -2,6 +2,8 @@
#include "ui_gridform.h"
#include
+#include
+#include
#include "context.h"
#include "filterui.h"
@@ -108,6 +110,15 @@ void IGridForm::columnsAccepted()
Context::instance().settings()->setValue("grids/" + pluginId() + "/hide", QVariant::fromValue(varList));
}
+void IGridForm::widthChanged(int logicalIndex, int oldSize, int newSize)
+{
+ Q_UNUSED(oldSize);
+
+ QMap widths = Context::instance().settings()->value("grids/" + pluginId() + "/widths").toMap();
+ widths[QString::number(logicalIndex)] = newSize;
+ Context::instance().settings()->setValue("grids/" + pluginId() + "/widths", QVariant::fromValue(widths));
+}
+
void IGridForm::on_btnFilter_toggled(bool checked)
{
diff --git a/core/igridform.h b/core/igridform.h
index bf22dc6..fb70ab6 100644
--- a/core/igridform.h
+++ b/core/igridform.h
@@ -48,6 +48,7 @@ private slots:
void on_tableView_customContextMenuRequested(const QPoint &pos);
void on_actionSelectColumns_triggered();
void columnsAccepted();
+ void widthChanged(int logicalIndex, int oldSize, int newSize);
void on_btnFilter_toggled(bool checked);
diff --git a/core/iplugin.h b/core/iplugin.h
index bdc0aab..4ce3014 100644
--- a/core/iplugin.h
+++ b/core/iplugin.h
@@ -7,6 +7,7 @@
#include
#include
#include
+#include
#include "service.h"
#include "igridform.h"
@@ -71,9 +72,8 @@ public:
return (Service*)m_service;
}
- virtual QIcon pluginIcon() {
- return QIcon();
- }
+ virtual QTranslator* translator() { return NULL; }
+ virtual QIcon pluginIcon() { return QIcon(); }
protected:
QWidget *m_ui;
diff --git a/core/translations/core_cs_CZ.qm b/core/translations/core_cs_CZ.qm
new file mode 100644
index 0000000..a0aa1c7
Binary files /dev/null and b/core/translations/core_cs_CZ.qm differ
diff --git a/core/translations/core_cs_CZ.ts b/core/translations/core_cs_CZ.ts
new file mode 100644
index 0000000..daf845e
--- /dev/null
+++ b/core/translations/core_cs_CZ.ts
@@ -0,0 +1,330 @@
+
+
+
+
+ ColumnDialog
+
+
+
+ Volba sloupcu
+
+
+
+ FilterDialog
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ FilterUi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ FormDialog
+
+
+
+
+
+
+
+
+
+
+
+
+ GlobalSettingsForm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ GridForm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ RolesForm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ SaveFilterDialog
+
+
+
+
+
+
+
+
+ SettingsForm
+
+
+
+
+
+
+
+ UserForm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+