Added settings for seasons and number series. Added static method
ComboData::createComboData for easier combo bindings.
This commit is contained in:
@@ -30,11 +30,6 @@ CommodityForm::~CommodityForm()
|
||||
|
||||
void CommodityForm::registerCombos()
|
||||
{
|
||||
QList<ComboData> ct;
|
||||
Service<CommodityTypeData> cts;
|
||||
foreach (QSharedPointer<CommodityTypeData> ctd , cts.all()) {
|
||||
ComboData cd(ctd);
|
||||
ct << cd;
|
||||
}
|
||||
registerBinding(ui->type,ct);
|
||||
Service<CommodityTypeData> srvComTypes;
|
||||
registerBinding(ui->type, ComboData::createComboData(srvComTypes.all()));
|
||||
}
|
||||
|
||||
@@ -20,6 +20,20 @@ public:
|
||||
QString label() const;
|
||||
void setLabel(const QString &label);
|
||||
|
||||
template<class T>
|
||||
static QList<ComboData> createComboData(QList<QSharedPointer<T> > list) {
|
||||
QList<ComboData> data;
|
||||
foreach (QSharedPointer<T> item, list) {
|
||||
QSharedPointer<QObject> qObj = qSharedPointerDynamicCast<QObject, T>(item);
|
||||
if (!qObj.isNull())
|
||||
{
|
||||
data << ComboData(qObj);
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private:
|
||||
QVariant m_index;
|
||||
QString m_label;
|
||||
|
||||
@@ -125,6 +125,16 @@ Context::Context()
|
||||
m_dbOpened = false;
|
||||
}
|
||||
|
||||
SeasonPtr Context::currentSeason() const
|
||||
{
|
||||
return m_currentSeason;
|
||||
}
|
||||
|
||||
void Context::setCurrentSeason(const SeasonPtr ¤tSeason)
|
||||
{
|
||||
m_currentSeason = currentSeason;
|
||||
}
|
||||
|
||||
QSharedPointer<User> Context::currentUser() const
|
||||
{
|
||||
return m_currentUser;
|
||||
@@ -271,6 +281,8 @@ void Context::checkSeason()
|
||||
season->setActive(true);
|
||||
srv.save(season);
|
||||
}
|
||||
|
||||
m_currentSeason = season;
|
||||
}
|
||||
|
||||
void Context::checkNumberSeries()
|
||||
|
||||
+6
-1
@@ -39,6 +39,11 @@ public:
|
||||
|
||||
odb::session &session();
|
||||
|
||||
SeasonPtr currentSeason() const;
|
||||
void setCurrentSeason(const SeasonPtr ¤tSeason);
|
||||
|
||||
void checkNumberSeries();
|
||||
|
||||
private:
|
||||
Context();
|
||||
QList<IPlugin*> m_plugins;
|
||||
@@ -47,6 +52,7 @@ private:
|
||||
bool m_dbOpened;
|
||||
odb::session m_session;
|
||||
QSharedPointer<User> m_currentUser;
|
||||
SeasonPtr m_currentSeason;
|
||||
|
||||
QStringList m_solved;
|
||||
|
||||
@@ -56,7 +62,6 @@ private:
|
||||
void createSchema(IPlugin *plugin, const QSqlDatabase &db, const QMap<QString, int> &schemaMap);
|
||||
void checkPermissions();
|
||||
void checkSeason();
|
||||
void checkNumberSeries();
|
||||
};
|
||||
|
||||
#endif // CONTEXT_H
|
||||
|
||||
+9
-3
@@ -56,7 +56,8 @@ SOURCES += \
|
||||
data/numberseries.cpp \
|
||||
data/season.cpp \
|
||||
seasonservice.cpp \
|
||||
numberseriesservice.cpp
|
||||
numberseriesservice.cpp \
|
||||
settings/seasonnamedialog.cpp
|
||||
|
||||
HEADERS += core.h\
|
||||
core_global.h \
|
||||
@@ -112,7 +113,8 @@ HEADERS += core.h\
|
||||
data/numberseries.h \
|
||||
data/season.h \
|
||||
seasonservice.h \
|
||||
numberseriesservice.h
|
||||
numberseriesservice.h \
|
||||
settings/seasonnamedialog.h
|
||||
|
||||
unix {
|
||||
target.path = /usr/lib
|
||||
@@ -146,7 +148,8 @@ FORMS += \
|
||||
savefilterdialog.ui \
|
||||
filterdialog.ui \
|
||||
settingsform.ui \
|
||||
settings/globalsettingsform.ui
|
||||
settings/globalsettingsform.ui \
|
||||
settings/seasonnamedialog.ui
|
||||
|
||||
OTHER_FILES += \
|
||||
users/metaData.json \
|
||||
@@ -154,6 +157,9 @@ OTHER_FILES += \
|
||||
|
||||
CONFIG(debug, release|debug):DEFINES += _DEBUG
|
||||
|
||||
win32:CONFIG(release, debug|release):DEFINES += PLUGIN_ROOT=\\\"/plugins\\\"
|
||||
else:unix:CONFIG(release, debug|release):DEFINES += PLUGIN_ROOT=\\\"/usr/lib/prodejna/plugins\\\"
|
||||
|
||||
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
|
||||
|
||||
@@ -49,4 +49,6 @@ private:
|
||||
QSharedPointer<Season> m_season;
|
||||
};
|
||||
|
||||
typedef QSharedPointer<NumberSeries> NumberSeriesPtr;
|
||||
|
||||
#endif // NUMBERSERIES_H
|
||||
|
||||
@@ -46,4 +46,6 @@ private:
|
||||
bool m_active;
|
||||
};
|
||||
|
||||
typedef QSharedPointer<Season> SeasonPtr;
|
||||
|
||||
#endif // SEASON_H
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
#include "globalsettingsform.h"
|
||||
#include "ui_globalsettingsform.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "seasonnamedialog.h"
|
||||
#include "globalsettings.h"
|
||||
#include "../settingsservice.h"
|
||||
#include "../seasonservice.h"
|
||||
#include "../numberseriesservice.h"
|
||||
#include "core-odb.hxx"
|
||||
|
||||
GlobalSettingsForm::GlobalSettingsForm(QWidget *parent) :
|
||||
FormBinder<GlobalSettings>(parent),
|
||||
@@ -21,6 +27,10 @@ GlobalSettingsForm::GlobalSettingsForm(QWidget *parent) :
|
||||
registerBinding(ui->vatHigh);
|
||||
registerBinding(ui->vatFirstLower);
|
||||
registerBinding(ui->vatSecondLower);
|
||||
|
||||
m_seriesModel = new AutoTableModel<NumberSeries>(this);
|
||||
m_seriesModel->setEditableCols(QList<int>() << 0);
|
||||
ui->tableNumSer->setModel(m_seriesModel);
|
||||
}
|
||||
|
||||
GlobalSettingsForm::~GlobalSettingsForm()
|
||||
@@ -28,8 +38,61 @@ GlobalSettingsForm::~GlobalSettingsForm()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void GlobalSettingsForm::loadSeasons()
|
||||
{
|
||||
ui->season->clear();
|
||||
SeasonService srv;
|
||||
m_seasons = srv.all();
|
||||
|
||||
foreach (SeasonPtr season, m_seasons) {
|
||||
ui->season->addItem(season->name());
|
||||
|
||||
if (season->active())
|
||||
{
|
||||
ui->season->setCurrentIndex(ui->season->count() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GlobalSettingsForm::loadNumSeries()
|
||||
{
|
||||
NumberSeriesService srvNumSer;
|
||||
SeasonService srvSeason;
|
||||
|
||||
if (ui->season->currentIndex() >= 0)
|
||||
{
|
||||
SeasonPtr currentSeason = m_seasons[ui->season->currentIndex()];
|
||||
m_seriesModel->setData(srvNumSer.allForSeason(currentSeason));
|
||||
}
|
||||
}
|
||||
|
||||
bool GlobalSettingsForm::saveRecord()
|
||||
{
|
||||
SeasonService srvSeason;
|
||||
NumberSeriesService srvNumSer;
|
||||
|
||||
SeasonPtr selSeason = m_seasons[ui->season->currentIndex()];
|
||||
if (selSeason->id() != Context::instance().currentSeason()->id())
|
||||
{
|
||||
if (QMessageBox::question(this, tr("Switch season"), tr("Realy switch active season?")) == QMessageBox::Yes)
|
||||
{
|
||||
srvSeason.activate(selSeason);
|
||||
Context::instance().setCurrentSeason(selSeason);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (SeasonPtr season, m_seasons) {
|
||||
srvSeason.update(season);
|
||||
}
|
||||
|
||||
foreach (NumberSeriesPtr numSer, m_seriesModel->list()) {
|
||||
srvNumSer.update(numSer);
|
||||
}
|
||||
|
||||
bindToData();
|
||||
SettingsService srv("CORE");
|
||||
srv.saveSettings(entity());
|
||||
@@ -43,9 +106,52 @@ void GlobalSettingsForm::loadEntity()
|
||||
QSharedPointer<GlobalSettings> settings = srv.loadSettings<GlobalSettings>();
|
||||
setEntity(settings);
|
||||
ui->grpVat->setEnabled(settings->vatPayer());
|
||||
|
||||
loadSeasons();
|
||||
loadNumSeries();
|
||||
}
|
||||
|
||||
void GlobalSettingsForm::on_vatPayer_toggled(bool checked)
|
||||
{
|
||||
ui->grpVat->setEnabled(checked);
|
||||
}
|
||||
|
||||
void GlobalSettingsForm::on_season_currentIndexChanged(int)
|
||||
{
|
||||
loadNumSeries();
|
||||
}
|
||||
|
||||
void GlobalSettingsForm::on_btnEditName_clicked()
|
||||
{
|
||||
SeasonPtr selSeason = m_seasons[ui->season->currentIndex()];
|
||||
SeasonNameDialog *dialog = new SeasonNameDialog(selSeason, this);
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dialog->show();
|
||||
|
||||
connect(dialog, &QDialog::accepted, [this](){
|
||||
this->loadSeasons();
|
||||
});
|
||||
}
|
||||
|
||||
void GlobalSettingsForm::on_btnNew_clicked()
|
||||
{
|
||||
if (QMessageBox::question(this, tr("New season"), tr("Realy create new season and switch to it?")) == QMessageBox::Yes)
|
||||
{
|
||||
SeasonPtr newSeason = SeasonPtr(new Season);
|
||||
SeasonNameDialog *dialog = new SeasonNameDialog(newSeason, this);
|
||||
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
dialog->show();
|
||||
|
||||
connect(dialog, &QDialog::accepted, [this, newSeason](){
|
||||
SeasonService srv;
|
||||
newSeason->setValidFrom(QDate::currentDate());
|
||||
srv.save(newSeason);
|
||||
srv.activate(newSeason);
|
||||
Context::instance().setCurrentSeason(newSeason);
|
||||
Context::instance().checkNumberSeries();
|
||||
|
||||
this->loadSeasons();
|
||||
this->loadNumSeries();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include <QWidget>
|
||||
#include "../formbinder.h"
|
||||
#include "globalsettings.h"
|
||||
#include "../autotablemodel.h"
|
||||
#include "../data/numberseries.h"
|
||||
|
||||
namespace Ui {
|
||||
class GlobalSettingsForm;
|
||||
@@ -19,6 +21,11 @@ public:
|
||||
|
||||
private:
|
||||
Ui::GlobalSettingsForm *ui;
|
||||
AutoTableModel<NumberSeries> *m_seriesModel;
|
||||
QList<SeasonPtr> m_seasons;
|
||||
|
||||
void loadSeasons();
|
||||
void loadNumSeries();
|
||||
|
||||
// IForm interface
|
||||
public slots:
|
||||
@@ -29,6 +36,9 @@ public:
|
||||
void loadEntity() override;
|
||||
private slots:
|
||||
void on_vatPayer_toggled(bool checked);
|
||||
void on_season_currentIndexChanged(int index);
|
||||
void on_btnEditName_clicked();
|
||||
void on_btnNew_clicked();
|
||||
};
|
||||
|
||||
#endif // GLOBALSETTINGSFORM_H
|
||||
|
||||
+275
-176
@@ -6,194 +6,293 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>586</width>
|
||||
<height>419</height>
|
||||
<width>759</width>
|
||||
<height>552</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Company info</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>IC</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="ic"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>VAT number</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="dic"/>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="vatPayer">
|
||||
<property name="text">
|
||||
<string>VAT payer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="grpVat">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>VAT rates</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>High</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="vatHigh">
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>First lower</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="vatFirstLower">
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Second lower</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="vatSecondLower">
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Contact</string>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="tabPosition">
|
||||
<enum>QTabWidget::North</enum>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Firm Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="firmName"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Street</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="street"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>House Number</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="houseNumber"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>City</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="city"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>ZIP code</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="zipCode"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Logo</string>
|
||||
<property name="tabShape">
|
||||
<enum>QTabWidget::Rounded</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Logo</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Select file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="elideMode">
|
||||
<enum>Qt::ElideNone</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabBase">
|
||||
<attribute name="title">
|
||||
<string>Base settings</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Contact</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Firm Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="firmName"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Street</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="street"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>House Number</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="houseNumber"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>City</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="city"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>ZIP code</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="zipCode"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Logo</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Logo</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Select file</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Company info</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>IC</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="ic"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>VAT number</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="dic"/>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="vatPayer">
|
||||
<property name="text">
|
||||
<string>VAT payer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="grpVat">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>VAT rates</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>High</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="vatHigh">
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>First lower</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="vatFirstLower">
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Second lower</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="vatSecondLower">
|
||||
<property name="buttonSymbols">
|
||||
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabNumSer">
|
||||
<attribute name="title">
|
||||
<string>Number series</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="4">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="season">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="btnEditName">
|
||||
<property name="text">
|
||||
<string>Edit name</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../rc.qrc">
|
||||
<normaloff>:/icons/edit.svg</normaloff>:/icons/edit.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Season</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="btnNew">
|
||||
<property name="text">
|
||||
<string>Create new</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../rc.qrc">
|
||||
<normaloff>:/icons/new.svg</normaloff>:/icons/new.svg</iconset>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="5">
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="title">
|
||||
<string>Number series</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QTableView" name="tableNumSer"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="../rc.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
#include "seasonnamedialog.h"
|
||||
#include "ui_seasonnamedialog.h"
|
||||
|
||||
SeasonNameDialog::SeasonNameDialog(SeasonPtr season, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::SeasonNameDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
m_binder.registerBinding(ui->name);
|
||||
m_binder.setData(season.data());
|
||||
m_binder.bindToUi();
|
||||
}
|
||||
|
||||
SeasonNameDialog::~SeasonNameDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void SeasonNameDialog::accept()
|
||||
{
|
||||
m_binder.bindToData();
|
||||
QDialog::accept();
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
#ifndef SEASONNAMEDIALOG_H
|
||||
#define SEASONNAMEDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "../data/season.h"
|
||||
#include "../objectbinder.h"
|
||||
|
||||
namespace Ui {
|
||||
class SeasonNameDialog;
|
||||
}
|
||||
|
||||
class SeasonNameDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SeasonNameDialog(SeasonPtr season, QWidget *parent = 0);
|
||||
~SeasonNameDialog();
|
||||
|
||||
private:
|
||||
Ui::SeasonNameDialog *ui;
|
||||
ObjectBinder m_binder;
|
||||
|
||||
// QDialog interface
|
||||
public slots:
|
||||
void accept();
|
||||
};
|
||||
|
||||
#endif // SEASONNAMEDIALOG_H
|
||||
@@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SeasonNameDialog</class>
|
||||
<widget class="QDialog" name="SeasonNameDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>406</width>
|
||||
<height>82</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Season</string>
|
||||
</property>
|
||||
<property name="modal">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Season name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="name"/>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>SeasonNameDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>SeasonNameDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -16,6 +16,10 @@
|
||||
<property name="windowTitle">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../application/appRc.qrc">
|
||||
<normaloff>:/icons/settings.svg</normaloff>:/icons/settings.svg</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
@@ -39,6 +43,8 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="../application/appRc.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -44,14 +44,9 @@ ReceiptSaveForm::ReceiptSaveForm(QWidget *parent) :
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!text.isEmpty());
|
||||
});
|
||||
|
||||
AddressBookService srvAdb;
|
||||
QList<ComboData> comboData;
|
||||
foreach (QSharedPointer<AddressbookData> adb, srvAdb.all()) {
|
||||
comboData << ComboData(adb);
|
||||
}
|
||||
|
||||
m_binder.setData(new Voucher);
|
||||
m_binder.registerBinding(ui->contact, comboData);
|
||||
AddressBookService srvAdb;
|
||||
m_binder.registerBinding(ui->contact, ComboData::createComboData(srvAdb.all()));
|
||||
m_binder.bindToUi();
|
||||
|
||||
ui->contact->completer()->setCompletionMode(QCompleter::PopupCompletion);
|
||||
|
||||
Reference in New Issue
Block a user