Merge branch 'master' of https://git.bukova.info/repos/git/prodejna
This commit is contained in:
+61
-17
@@ -42,7 +42,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
int i = 0;
|
||||
|
||||
foreach (IPlugin *plugin, Context::instance().plugins()) {
|
||||
if (plugin->pluginId() != "CORE")
|
||||
if (plugin->pluginId() != "CORE" && plugin->showIcon())
|
||||
{
|
||||
QToolButton *plugButton = new QToolButton(this);
|
||||
plugButton->setText(plugin->pluginName());
|
||||
@@ -81,26 +81,16 @@ void MainWindow::openPlugin()
|
||||
QVariant var = QObject::sender()->property(PLUGIN_INDEX);
|
||||
IPlugin *plugin = Context::instance().plugins().at(var.toInt());
|
||||
|
||||
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
||||
if (ui->tabWidget->widget(i)->objectName() == plugin->pluginId()) {
|
||||
ui->tabWidget->setCurrentIndex(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin->ui() != NULL)
|
||||
{
|
||||
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);
|
||||
}
|
||||
openPlugin(plugin);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionOpen_database_triggered()
|
||||
{
|
||||
/*QFileDialog dialog(this);
|
||||
dialog.setNameFilter(tr("Database Files (*.db)"));
|
||||
dialog.setWindowTitle(tr("Open Database"));*/
|
||||
int tabCount = ui->tabWidget->count();
|
||||
for (int i = 0; i < tabCount; i++)
|
||||
{
|
||||
ui->tabWidget->removeTab(0);
|
||||
}
|
||||
|
||||
QString dbFile = QFileDialog::getOpenFileName(this, "Open Database", "", "Database Files (*.db)");
|
||||
if (!dbFile.isEmpty())
|
||||
@@ -118,6 +108,12 @@ void MainWindow::on_tabWidget_tabCloseRequested(int index)
|
||||
|
||||
void MainWindow::on_actionLogin_triggered()
|
||||
{
|
||||
int tabCount = ui->tabWidget->count();
|
||||
for (int i = 0; i < tabCount; i++)
|
||||
{
|
||||
ui->tabWidget->removeTab(0);
|
||||
}
|
||||
|
||||
QSharedPointer<User> u;
|
||||
Context::instance().setCurrentUser(u);
|
||||
m_lblUser->setText("");
|
||||
@@ -144,3 +140,51 @@ void MainWindow::on_actionSettings_triggered()
|
||||
SettingsForm *settings = new SettingsForm(this);
|
||||
settings->show();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionPost_register_triggered()
|
||||
{
|
||||
IPlugin *plugZipCodes = Context::instance().plugin("POSTREGISTER");
|
||||
|
||||
if (plugZipCodes != NULL)
|
||||
{
|
||||
openPlugin(plugZipCodes);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::openPlugin(IPlugin *plugin)
|
||||
{
|
||||
for (int i = 0; i < ui->tabWidget->count(); i++) {
|
||||
if (ui->tabWidget->widget(i)->objectName() == plugin->pluginId()) {
|
||||
ui->tabWidget->setCurrentIndex(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin->ui() != NULL)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_actionCountry_register_triggered()
|
||||
{
|
||||
IPlugin *plugCountryReg = Context::instance().plugin("COUNTRYREGISTER");
|
||||
|
||||
if (plugCountryReg != NULL)
|
||||
{
|
||||
openPlugin(plugCountryReg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::on_actionAbout_Qt_triggered()
|
||||
{
|
||||
QMessageBox::aboutQt(this);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionAbout_triggered()
|
||||
{
|
||||
QMessageBox::about(this, tr("About prodejna"), tr("Modular cash register software under GPL license.\n(C) 2015 - 2017 Josef Rokos, Zdenek Jonák"));
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#define PLUGIN_INDEX "plug_index"
|
||||
|
||||
class IPlugin;
|
||||
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
@@ -33,10 +35,19 @@ private slots:
|
||||
|
||||
void on_actionSettings_triggered();
|
||||
|
||||
void on_actionPost_register_triggered();
|
||||
|
||||
void on_actionCountry_register_triggered();
|
||||
|
||||
void on_actionAbout_Qt_triggered();
|
||||
|
||||
void on_actionAbout_triggered();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
LoginDialog *m_loginDialog;
|
||||
QLabel *m_lblUser;
|
||||
void openPlugin(IPlugin *plugin);
|
||||
|
||||
// QWidget interface
|
||||
protected:
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1000</width>
|
||||
<height>19</height>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
@@ -72,7 +72,23 @@
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionExit"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuRegisters">
|
||||
<property name="title">
|
||||
<string>&Registers</string>
|
||||
</property>
|
||||
<addaction name="actionPost_register"/>
|
||||
<addaction name="actionCountry_register"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuHelp">
|
||||
<property name="title">
|
||||
<string>Help</string>
|
||||
</property>
|
||||
<addaction name="actionAbout"/>
|
||||
<addaction name="actionAbout_Qt"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
<addaction name="menuRegisters"/>
|
||||
<addaction name="menuHelp"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="mainToolBar">
|
||||
<attribute name="toolBarArea">
|
||||
@@ -116,6 +132,26 @@
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPost_register">
|
||||
<property name="text">
|
||||
<string>&Post register</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCountry_register">
|
||||
<property name="text">
|
||||
<string>&Country register</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAbout">
|
||||
<property name="text">
|
||||
<string>About</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAbout_Qt">
|
||||
<property name="text">
|
||||
<string>About Qt</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources>
|
||||
|
||||
Binary file not shown.
@@ -28,20 +28,54 @@
|
||||
<translation>&Soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="90"/>
|
||||
<location filename="../mainwindow.ui" line="77"/>
|
||||
<source>&Registers</source>
|
||||
<translation>Číse&lníky</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="84"/>
|
||||
<source>Help</source>
|
||||
<translation>Pomoc</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="106"/>
|
||||
<source>&Exit</source>
|
||||
<translation>&Konec</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="95"/>
|
||||
<location filename="../mainwindow.ui" line="111"/>
|
||||
<source>&Open database...</source>
|
||||
<translation>&Otevřít databázi...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="104"/>
|
||||
<location filename="../mainwindow.ui" line="120"/>
|
||||
<source>&Login...</source>
|
||||
<translation>&Přihlásit...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="137"/>
|
||||
<source>&Post register</source>
|
||||
<translation>Číselník PSČ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="142"/>
|
||||
<source>&Country register</source>
|
||||
<translation>Číselník států</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="147"/>
|
||||
<source>About</source>
|
||||
<translation>O aplikaci</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="152"/>
|
||||
<source>About Qt</source>
|
||||
<translation>O QT</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Post register</source>
|
||||
<translation type="vanished">Číselník adres</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>File</source>
|
||||
<translation type="vanished">Soubor</translation>
|
||||
@@ -59,10 +93,22 @@
|
||||
<translation type="vanished">Přihlásit se...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="113"/>
|
||||
<location filename="../mainwindow.ui" line="116"/>
|
||||
<location filename="../mainwindow.ui" line="129"/>
|
||||
<location filename="../mainwindow.ui" line="132"/>
|
||||
<source>Settings</source>
|
||||
<translation>Nastavení</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="189"/>
|
||||
<source>About prodejna</source>
|
||||
<translation>O aplikaci prodejna</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="189"/>
|
||||
<source>Modular cash register software under GPL license.
|
||||
(C) 2015 - 2017 Josef Rokos, Zdenek Jonák</source>
|
||||
<translation>Modulární pokladní aplikace pod GPL license.
|
||||
(C) 2015 - 2017 Josef Rokos, Zdenek Jonák</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
||||
Reference in New Issue
Block a user