Restrukturering av filsystem
This commit is contained in:
parent
137a1e55fd
commit
c548c6b68c
|
|
@ -1,5 +1,17 @@
|
|||
TEMPLATE = subdirs
|
||||
QT += core gui
|
||||
|
||||
CONFIG += ordered
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
SUBDIRS += src
|
||||
CONFIG += c++11
|
||||
RC_ICONS = saeterprosjekt.ico
|
||||
|
||||
include(src/core/core.pri)
|
||||
include(src/mainwidgets/mainwidgets.pri)
|
||||
include(src/uidialogs/maindialogs/maindialogs.pri)
|
||||
include(src/uidialogs/widgetdialogs/kunde/kundedialoger.pri)
|
||||
include(src/uidialogs/widgetdialogs/prosjekt/prosjektdialoger.pri)
|
||||
|
||||
# Default rules for deployment.
|
||||
qnx: target.path = /tmp/$${TARGET}/bin
|
||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||
!isEmpty(target.path): INSTALLS += target
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.15.0, 2021-09-21T11:59:51. -->
|
||||
<!-- Written by QtCreator 4.15.0, 2021-09-28T22:59:07. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
|
@ -99,8 +99,8 @@
|
|||
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="int" key="EnableQmlDebugging">0</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\heno\Documents\build-Saeterprosjekt-Desktop_Qt_5_15_2_MinGW_64_bit-Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/heno/Documents/build-Saeterprosjekt-Desktop_Qt_5_15_2_MinGW_64_bit-Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\heno\Documents\qt prosjekter\build-Saeterprosjekt-Desktop_Qt_5_15_2_MinGW_64_bit-Debug</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/heno/Documents/qt prosjekter/build-Saeterprosjekt-Desktop_Qt_5_15_2_MinGW_64_bit-Debug</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
|
|
@ -137,8 +137,8 @@
|
|||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\heno\Documents\build-Saeterprosjekt-Desktop_Qt_5_15_2_MinGW_64_bit-Release</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/heno/Documents/build-Saeterprosjekt-Desktop_Qt_5_15_2_MinGW_64_bit-Release</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\heno\Documents\qt prosjekter\build-Saeterprosjekt-Desktop_Qt_5_15_2_MinGW_64_bit-Release</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/heno/Documents/qt prosjekter/build-Saeterprosjekt-Desktop_Qt_5_15_2_MinGW_64_bit-Release</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
|
|
@ -177,8 +177,8 @@
|
|||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
||||
<value type="int" key="EnableQmlDebugging">0</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\heno\Documents\build-Saeterprosjekt-Desktop_Qt_5_15_2_MinGW_64_bit-Profile</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/heno/Documents/build-Saeterprosjekt-Desktop_Qt_5_15_2_MinGW_64_bit-Profile</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\heno\Documents\qt prosjekter\build-Saeterprosjekt-Desktop_Qt_5_15_2_MinGW_64_bit-Profile</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/heno/Documents/qt prosjekter/build-Saeterprosjekt-Desktop_Qt_5_15_2_MinGW_64_bit-Profile</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
|
|
@ -294,14 +294,14 @@
|
|||
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/heno/Documents/qt prosjekter/Saeterprosjekt/src/core/core.pro</value>
|
||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">C:/Users/heno/Documents/qt prosjekter/Saeterprosjekt/src/core/core.pro</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/heno/Documents/qt prosjekter/Saeterprosjekt/Saeterprosjekt.pro</value>
|
||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">C:/Users/heno/Documents/qt prosjekter/Saeterprosjekt/Saeterprosjekt.pro</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">C:/Users/heno/Documents/build-Saeterprosjekt-Desktop_Qt_5_15_2_MinGW_64_bit-Debug/src/core</value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">C:/Users/heno/Documents/qt prosjekter/build-Saeterprosjekt-Desktop_Qt_5_15_2_MinGW_64_bit-Debug</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||
</valuemap>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
31
src/core/core.pri
Normal file
31
src/core/core.pri
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
INCLUDEPATH += \
|
||||
$$PWD/../mainwidgets \
|
||||
$$PWD/../uidialogs/maindialogs \
|
||||
$$PWD/../uidialogs/widgetdialogs/kunde \
|
||||
$$PWD/../uidialogs/widgetdialogs/prosjekt
|
||||
DEPENDPATH += \
|
||||
$$PWD/../mainwidgets \
|
||||
$$PWD/../uidialogs/maindialogs \
|
||||
$$PWD/../uidialogs/widgetdialogs/kunde \
|
||||
$$PWD/../uidialogs/widgetdialogs/prosjekt
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/main.cpp \
|
||||
$$PWD/mainwindow.cpp \
|
||||
$$PWD/arbeidshest.cpp \
|
||||
$$PWD/datahandler.cpp \
|
||||
$$PWD/datatypes.cpp \
|
||||
$$PWD/globals.cpp
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/mainwindow.h \
|
||||
$$PWD/arbeidshest.h \
|
||||
$$PWD/datahandler.h \
|
||||
$$PWD/datatypes.h \
|
||||
$$PWD/globals.h
|
||||
|
||||
FORMS += \
|
||||
$$PWD/mainwindow.ui
|
||||
|
||||
RESOURCES += \
|
||||
$$PWD/../../resources.qrc
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
QT += core gui
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
CONFIG += c++11
|
||||
RC_ICONS = saeterprosjekt.ico
|
||||
|
||||
# You can make your code fail to compile if it uses deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/main.cpp \
|
||||
$$PWD/mainwindow.cpp \
|
||||
arbeidshest.cpp \
|
||||
datahandler.cpp \
|
||||
datatypes.cpp \
|
||||
globals.cpp \
|
||||
innstillingdialog.cpp \
|
||||
kundewidget.cpp \
|
||||
nykundedialog.cpp \
|
||||
nyttprosjektdialog.cpp \
|
||||
omdialog.cpp \
|
||||
prosjektwidget.cpp \
|
||||
redigerkundedialog.cpp \
|
||||
redigerprosjektdialog.cpp \
|
||||
varsledialog.cpp \
|
||||
velgkundeprosjektdialog.cpp
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/mainwindow.h \
|
||||
arbeidshest.h \
|
||||
datahandler.h \
|
||||
datatypes.h \
|
||||
globals.h \
|
||||
innstillingdialog.h \
|
||||
kundewidget.h \
|
||||
nykundedialog.h \
|
||||
nyttprosjektdialog.h \
|
||||
omdialog.h \
|
||||
prosjektwidget.h \
|
||||
redigerkundedialog.h \
|
||||
redigerprosjektdialog.h \
|
||||
varsledialog.h \
|
||||
velgkundeprosjektdialog.h
|
||||
|
||||
FORMS += \
|
||||
$$PWD/mainwindow.ui \
|
||||
innstillingdialog.ui \
|
||||
kundewidget.ui \
|
||||
nykundedialog.ui \
|
||||
nyttprosjektdialog.ui \
|
||||
omdialog.ui \
|
||||
prosjektwidget.ui \
|
||||
redigerkundedialog.ui \
|
||||
redigerprosjektdialog.ui \
|
||||
varsledialog.ui \
|
||||
velgkundeprosjektdialog.ui
|
||||
|
||||
# Default rules for deployment.
|
||||
qnx: target.path = /tmp/$${TARGET}/bin
|
||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||
!isEmpty(target.path): INSTALLS += target
|
||||
|
||||
RESOURCES += \
|
||||
$$PWD/../../resources.qrc
|
||||
|
|
@ -1,93 +1,93 @@
|
|||
#include "kundewidget.h"
|
||||
#include "ui_kundewidget.h"
|
||||
|
||||
KundeWidget::KundeWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::KundeWidget) {
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
KundeWidget::~KundeWidget() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void KundeWidget::lagKundeTabell(KundeKartotek &kundeKart) {
|
||||
ui->kundeTabell->clear();
|
||||
|
||||
connect(ui->kundeTabell, SIGNAL(itemClicked(QTableWidgetItem*)), this, SLOT(celleKlikk(QTableWidgetItem*)));
|
||||
|
||||
// Sett aktive poster i et eget kartotek
|
||||
KundeKartotek aktivKartotek;
|
||||
for (int i = 0; i < kundeKart.size(); ++i) {
|
||||
if (kundeKart.at(i).value("active").toBool()) {
|
||||
aktivKartotek << kundeKart.at(i);
|
||||
}
|
||||
}
|
||||
|
||||
QStringList overskrifter;
|
||||
overskrifter << "Kundenummer" << "Fornavn" << "Etternavn" << "Firmanavn" <<"Telefonnr" <<"Epostadresse";
|
||||
ui->kundeTabell->setRowCount(aktivKartotek.size());
|
||||
ui->kundeTabell->setColumnCount(6);
|
||||
ui->kundeTabell->setHorizontalHeaderLabels(overskrifter);
|
||||
|
||||
for (int i = 0; i < aktivKartotek.size(); ++i) {
|
||||
QTableWidgetItem *kundeID = new QTableWidgetItem(aktivKartotek.at(i).value("id").toString());
|
||||
kundeID->setFlags(kundeID->flags() ^ Qt::ItemIsEditable);
|
||||
kundeID->setData(Qt::UserRole, aktivKartotek.at(i).value("id").toInt());
|
||||
|
||||
QTableWidgetItem *fornavn = new QTableWidgetItem(aktivKartotek.at(i).value("fornavn").toString());
|
||||
fornavn->setFlags(fornavn->flags() ^ Qt::ItemIsEditable);
|
||||
fornavn->setData(Qt::UserRole, aktivKartotek.at(i).value("id").toInt());
|
||||
|
||||
QTableWidgetItem *etternavn = new QTableWidgetItem(aktivKartotek.at(i).value("etternavn").toString());
|
||||
etternavn->setFlags(etternavn->flags() ^ Qt::ItemIsEditable);
|
||||
etternavn->setData(Qt::UserRole, aktivKartotek.at(i).value("id").toInt());
|
||||
|
||||
QTableWidgetItem *firmanavn = new QTableWidgetItem(aktivKartotek.at(i).value("firmanavn").toString());
|
||||
firmanavn->setFlags(firmanavn->flags() ^ Qt::ItemIsEditable);
|
||||
firmanavn->setData(Qt::UserRole, aktivKartotek.at(i).value("id").toInt());
|
||||
|
||||
QTableWidgetItem *telefon = new QTableWidgetItem(aktivKartotek.at(i).value("tlf").toString());
|
||||
telefon->setFlags(telefon->flags() ^ Qt::ItemIsEditable);
|
||||
telefon->setData(Qt::UserRole, aktivKartotek.at(i).value("id").toInt());
|
||||
|
||||
QTableWidgetItem *epost = new QTableWidgetItem(aktivKartotek.at(i).value("epost").toString());
|
||||
epost->setFlags(epost->flags() ^ Qt::ItemIsEditable);
|
||||
epost->setData(Qt::UserRole, aktivKartotek.at(i).value("id").toInt());
|
||||
|
||||
ui->kundeTabell->setItem(i, 0, kundeID);
|
||||
ui->kundeTabell->setItem(i, 1, fornavn);
|
||||
ui->kundeTabell->setItem(i, 2, etternavn);
|
||||
ui->kundeTabell->setItem(i, 3, firmanavn);
|
||||
ui->kundeTabell->setItem(i, 4, telefon);
|
||||
ui->kundeTabell->setItem(i, 5, epost);
|
||||
}
|
||||
}
|
||||
|
||||
void KundeWidget::on_pushNyKunde_clicked() {
|
||||
emit opprettKunde();
|
||||
}
|
||||
|
||||
void KundeWidget::on_pushRediger_clicked() {
|
||||
emit redigerKunde(kundeNummer);
|
||||
}
|
||||
|
||||
void KundeWidget::celleKlikk(QTableWidgetItem *celleGjenstand) {
|
||||
kundeNummer = celleGjenstand->data(Qt::UserRole).toInt();
|
||||
|
||||
ui->pushRediger->setEnabled(true);
|
||||
ui->pushSlett->setEnabled(true);
|
||||
ui->pushProsjekt->setEnabled(true);
|
||||
|
||||
ui->labelValgteKundeVerdi->setText(tr("kundenr. %1").arg(QString::number(kundeNummer)));
|
||||
}
|
||||
|
||||
void KundeWidget::on_pushSlett_clicked() {
|
||||
emit slettKunde(kundeNummer);
|
||||
}
|
||||
|
||||
|
||||
void KundeWidget::on_pushProsjekt_clicked() {
|
||||
emit tilordneProsjekt(kundeNummer);
|
||||
}
|
||||
|
||||
#include "kundewidget.h"
|
||||
#include "ui_kundewidget.h"
|
||||
|
||||
KundeWidget::KundeWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::KundeWidget) {
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
KundeWidget::~KundeWidget() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void KundeWidget::lagKundeTabell(KundeKartotek &kundeKart) {
|
||||
ui->kundeTabell->clear();
|
||||
|
||||
connect(ui->kundeTabell, SIGNAL(itemClicked(QTableWidgetItem*)), this, SLOT(celleKlikk(QTableWidgetItem*)));
|
||||
|
||||
// Sett aktive poster i et eget kartotek
|
||||
KundeKartotek aktivKartotek;
|
||||
for (int i = 0; i < kundeKart.size(); ++i) {
|
||||
if (kundeKart.at(i).value("active").toBool()) {
|
||||
aktivKartotek << kundeKart.at(i);
|
||||
}
|
||||
}
|
||||
|
||||
QStringList overskrifter;
|
||||
overskrifter << "Kundenummer" << "Fornavn" << "Etternavn" << "Firmanavn" <<"Telefonnr" <<"Epostadresse";
|
||||
ui->kundeTabell->setRowCount(aktivKartotek.size());
|
||||
ui->kundeTabell->setColumnCount(6);
|
||||
ui->kundeTabell->setHorizontalHeaderLabels(overskrifter);
|
||||
|
||||
for (int i = 0; i < aktivKartotek.size(); ++i) {
|
||||
QTableWidgetItem *kundeID = new QTableWidgetItem(aktivKartotek.at(i).value("id").toString());
|
||||
kundeID->setFlags(kundeID->flags() ^ Qt::ItemIsEditable);
|
||||
kundeID->setData(Qt::UserRole, aktivKartotek.at(i).value("id").toInt());
|
||||
|
||||
QTableWidgetItem *fornavn = new QTableWidgetItem(aktivKartotek.at(i).value("fornavn").toString());
|
||||
fornavn->setFlags(fornavn->flags() ^ Qt::ItemIsEditable);
|
||||
fornavn->setData(Qt::UserRole, aktivKartotek.at(i).value("id").toInt());
|
||||
|
||||
QTableWidgetItem *etternavn = new QTableWidgetItem(aktivKartotek.at(i).value("etternavn").toString());
|
||||
etternavn->setFlags(etternavn->flags() ^ Qt::ItemIsEditable);
|
||||
etternavn->setData(Qt::UserRole, aktivKartotek.at(i).value("id").toInt());
|
||||
|
||||
QTableWidgetItem *firmanavn = new QTableWidgetItem(aktivKartotek.at(i).value("firmanavn").toString());
|
||||
firmanavn->setFlags(firmanavn->flags() ^ Qt::ItemIsEditable);
|
||||
firmanavn->setData(Qt::UserRole, aktivKartotek.at(i).value("id").toInt());
|
||||
|
||||
QTableWidgetItem *telefon = new QTableWidgetItem(aktivKartotek.at(i).value("tlf").toString());
|
||||
telefon->setFlags(telefon->flags() ^ Qt::ItemIsEditable);
|
||||
telefon->setData(Qt::UserRole, aktivKartotek.at(i).value("id").toInt());
|
||||
|
||||
QTableWidgetItem *epost = new QTableWidgetItem(aktivKartotek.at(i).value("epost").toString());
|
||||
epost->setFlags(epost->flags() ^ Qt::ItemIsEditable);
|
||||
epost->setData(Qt::UserRole, aktivKartotek.at(i).value("id").toInt());
|
||||
|
||||
ui->kundeTabell->setItem(i, 0, kundeID);
|
||||
ui->kundeTabell->setItem(i, 1, fornavn);
|
||||
ui->kundeTabell->setItem(i, 2, etternavn);
|
||||
ui->kundeTabell->setItem(i, 3, firmanavn);
|
||||
ui->kundeTabell->setItem(i, 4, telefon);
|
||||
ui->kundeTabell->setItem(i, 5, epost);
|
||||
}
|
||||
}
|
||||
|
||||
void KundeWidget::on_pushNyKunde_clicked() {
|
||||
emit opprettKunde();
|
||||
}
|
||||
|
||||
void KundeWidget::on_pushRediger_clicked() {
|
||||
emit redigerKunde(kundeNummer);
|
||||
}
|
||||
|
||||
void KundeWidget::celleKlikk(QTableWidgetItem *celleGjenstand) {
|
||||
kundeNummer = celleGjenstand->data(Qt::UserRole).toInt();
|
||||
|
||||
ui->pushRediger->setEnabled(true);
|
||||
ui->pushSlett->setEnabled(true);
|
||||
ui->pushProsjekt->setEnabled(true);
|
||||
|
||||
ui->labelValgteKundeVerdi->setText(tr("kundenr. %1").arg(QString::number(kundeNummer)));
|
||||
}
|
||||
|
||||
void KundeWidget::on_pushSlett_clicked() {
|
||||
emit slettKunde(kundeNummer);
|
||||
}
|
||||
|
||||
|
||||
void KundeWidget::on_pushProsjekt_clicked() {
|
||||
emit tilordneProsjekt(kundeNummer);
|
||||
}
|
||||
|
||||
|
|
@ -1,42 +1,42 @@
|
|||
#ifndef KUNDEWIDGET_H
|
||||
#define KUNDEWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTableWidgetItem>
|
||||
|
||||
#include "datahandler.h"
|
||||
#include "datatypes.h"
|
||||
|
||||
namespace Ui {
|
||||
class KundeWidget;
|
||||
}
|
||||
|
||||
class KundeWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit KundeWidget(QWidget *parent = nullptr);
|
||||
~KundeWidget();
|
||||
|
||||
void lagKundeTabell(KundeKartotek &kundeKart);
|
||||
|
||||
signals:
|
||||
void opprettKunde();
|
||||
void redigerKunde(int posisjon);
|
||||
void slettKunde(int posisjon);
|
||||
void tilordneProsjekt(int posisjon);
|
||||
|
||||
private slots:
|
||||
void on_pushNyKunde_clicked();
|
||||
void celleKlikk(QTableWidgetItem *celleGjenstand);
|
||||
void on_pushRediger_clicked();
|
||||
void on_pushSlett_clicked();
|
||||
void on_pushProsjekt_clicked();
|
||||
|
||||
private:
|
||||
Ui::KundeWidget *ui;
|
||||
int kundeNummer;
|
||||
};
|
||||
|
||||
#endif // KUNDEWIDGET_H
|
||||
#ifndef KUNDEWIDGET_H
|
||||
#define KUNDEWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTableWidgetItem>
|
||||
|
||||
#include "datahandler.h"
|
||||
#include "datatypes.h"
|
||||
|
||||
namespace Ui {
|
||||
class KundeWidget;
|
||||
}
|
||||
|
||||
class KundeWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit KundeWidget(QWidget *parent = nullptr);
|
||||
~KundeWidget();
|
||||
|
||||
void lagKundeTabell(KundeKartotek &kundeKart);
|
||||
|
||||
signals:
|
||||
void opprettKunde();
|
||||
void redigerKunde(int posisjon);
|
||||
void slettKunde(int posisjon);
|
||||
void tilordneProsjekt(int posisjon);
|
||||
|
||||
private slots:
|
||||
void on_pushNyKunde_clicked();
|
||||
void celleKlikk(QTableWidgetItem *celleGjenstand);
|
||||
void on_pushRediger_clicked();
|
||||
void on_pushSlett_clicked();
|
||||
void on_pushProsjekt_clicked();
|
||||
|
||||
private:
|
||||
Ui::KundeWidget *ui;
|
||||
int kundeNummer;
|
||||
};
|
||||
|
||||
#endif // KUNDEWIDGET_H
|
||||
|
|
@ -1,189 +1,189 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>KundeWidget</class>
|
||||
<widget class="QWidget" name="KundeWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>543</width>
|
||||
<height>499</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<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>
|
||||
<widget class="QLabel" name="labelHeadline">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Kundeliste</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<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>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="kundeTabell">
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<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>
|
||||
<widget class="QLabel" name="labelValgteKunde">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Valgte kunde: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelValgteKundeVerdi">
|
||||
<property name="text">
|
||||
<string>Ingen kunde valgt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<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>
|
||||
<widget class="QPushButton" name="pushNyKunde">
|
||||
<property name="text">
|
||||
<string>Ny kunde</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushRediger">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rediger kunde</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushSlett">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Slett kunde</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushProsjekt">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Tilordne prosjekt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>KundeWidget</class>
|
||||
<widget class="QWidget" name="KundeWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>543</width>
|
||||
<height>499</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<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>
|
||||
<widget class="QLabel" name="labelHeadline">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Kundeliste</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<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>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="kundeTabell">
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<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>
|
||||
<widget class="QLabel" name="labelValgteKunde">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Valgte kunde: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelValgteKundeVerdi">
|
||||
<property name="text">
|
||||
<string>Ingen kunde valgt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<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>
|
||||
<widget class="QPushButton" name="pushNyKunde">
|
||||
<property name="text">
|
||||
<string>Ny kunde</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushRediger">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rediger kunde</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushSlett">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Slett kunde</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushProsjekt">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Tilordne prosjekt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
21
src/mainwidgets/mainwidgets.pri
Normal file
21
src/mainwidgets/mainwidgets.pri
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
INCLUDEPATH += \
|
||||
$$PWD/../core \
|
||||
$$PWD/../uidialogs/widgetdialogs/kunde
|
||||
DEPENDPATH += \
|
||||
$$PWD/../core \
|
||||
$$PWD/../uidialogs/widgetdialogs/kunde
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/kundewidget.cpp \
|
||||
$$PWD/prosjektwidget.cpp
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/kundewidget.h \
|
||||
$$PWD/prosjektwidget.h
|
||||
|
||||
FORMS += \
|
||||
$$PWD/kundewidget.ui \
|
||||
$$PWD/prosjektwidget.ui
|
||||
|
||||
RESOURCES += \
|
||||
$$PWD/../../resources.qrc
|
||||
|
|
@ -1,140 +1,140 @@
|
|||
#include "prosjektwidget.h"
|
||||
#include "ui_prosjektwidget.h"
|
||||
|
||||
ProsjektWidget::ProsjektWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::ProsjektWidget) {
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
ProsjektWidget::~ProsjektWidget() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ProsjektWidget::oppdaterProsjektListe(ProsjektKartotek &kartotek, ProsjektBindinger &bindinger, KundeKartotek &kundeKart) {
|
||||
ui->prosjektTre->clear();
|
||||
ui->prosjektTre->setColumnCount(1);
|
||||
|
||||
connect(ui->prosjektTre, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(gjenstandKlikk(QTreeWidgetItem*,int)));
|
||||
|
||||
QList<QTreeWidgetItem *> prosjektListe;
|
||||
QIcon prosjektIkon(":/res/clipboard.svg");
|
||||
QIcon prosjektFerdigIkon(":/res/check.svg");
|
||||
QIcon kundeIkon(":/res/user.svg");
|
||||
|
||||
for (int i = 0; i < kartotek.size(); ++i) {
|
||||
bool aktiv = kartotek.at(i).value("active").toBool();
|
||||
if (aktiv) {
|
||||
bool ferdig = kartotek.at(i).value("ferdig").toBool();
|
||||
QTreeWidgetItem *prosjektGjenstand = new QTreeWidgetItem(QTreeWidgetItem::Type);
|
||||
prosjektGjenstand->setText(0, kartotek.at(i).value("prosjektnavn").toString());
|
||||
|
||||
if (ferdig)
|
||||
prosjektGjenstand->setIcon(0,prosjektFerdigIkon);
|
||||
else
|
||||
prosjektGjenstand->setIcon(0, prosjektIkon);
|
||||
|
||||
int ordrenummer = kartotek.at(i).value("ordrenummer").toInt();
|
||||
QList<QTreeWidgetItem *> kundeGjenstander;
|
||||
if (bindinger.contains(ordrenummer)) {
|
||||
QList<int> kunder = bindinger.value(ordrenummer);
|
||||
for (int x = 0; x < kunder.size(); ++x) {
|
||||
QString kundeFornavn, kundeEtternavn, kundeFirmanavn;
|
||||
for (int z = 0; z < kundeKart.size(); ++z) {
|
||||
if (kundeKart.at(z).value("id").toInt() == kunder.at(x)) {
|
||||
kundeFornavn = kundeKart.at(z).value("fornavn").toString();
|
||||
kundeEtternavn = kundeKart.at(z).value("etternavn").toString();
|
||||
if (!kundeKart.at(z).value("firmanavn").toString().isEmpty()) {
|
||||
kundeFirmanavn = QString(tr("(%1)").arg(kundeKart.at(z).value("firmanavn").toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
QTreeWidgetItem *kunde = new QTreeWidgetItem(QTreeWidgetItem::UserType);
|
||||
kunde->setText(0, tr("%1 %2 %3").arg(kundeFornavn, kundeEtternavn, kundeFirmanavn));
|
||||
kunde->setIcon(0, kundeIkon);
|
||||
kunde->setData(0, Qt::UserRole, kunder.at(x));
|
||||
kundeGjenstander.append(kunde);
|
||||
}
|
||||
prosjektGjenstand->addChildren(kundeGjenstander);
|
||||
}
|
||||
|
||||
prosjektGjenstand->setData(0, Qt::UserRole, i);
|
||||
prosjektListe.append(prosjektGjenstand);
|
||||
}
|
||||
}
|
||||
|
||||
ui->prosjektTre->addTopLevelItems(prosjektListe);
|
||||
}
|
||||
|
||||
void ProsjektWidget::settGjeldendeProsjekt(ProsjektFil prosjekt) {
|
||||
valgtProsjekt = prosjekt;
|
||||
}
|
||||
|
||||
void ProsjektWidget::on_pushNy_clicked() {
|
||||
emit opprettProsjekt();
|
||||
}
|
||||
|
||||
void ProsjektWidget::gjenstandKlikk(QTreeWidgetItem *gjenstand, int kolonne) {
|
||||
if (gjenstand->type() == QTreeWidgetItem::Type) {
|
||||
emit hentProsjektFil(gjenstand->data(kolonne, Qt::UserRole).toInt());
|
||||
kartotekPosisjon = gjenstand->data(kolonne, Qt::UserRole).toInt();
|
||||
|
||||
ui->labelProsjektNavn->setText(valgtProsjekt.value("prosjektnavn").toString());
|
||||
ui->labelOrdrenrValue->setText(valgtProsjekt.value("ordrenummer").toString());
|
||||
ui->ordreText->setHtml(valgtProsjekt.value("prosjektbeskrivelse").toString());
|
||||
|
||||
quint64 prosjektStart = valgtProsjekt.value("prosjektstart").toULongLong();
|
||||
quint64 prosjektSlutt = valgtProsjekt.value("prosjektslutt").toULongLong();
|
||||
QDateTime tProsjektStart(QDateTime::fromMSecsSinceEpoch(prosjektStart));
|
||||
QDateTime tProsjektSlutt(QDateTime::fromMSecsSinceEpoch(prosjektSlutt));
|
||||
ui->labelBegynnerValue->setText(tProsjektStart.toString("dd.MM.yyyy hh:mm"));
|
||||
ui->labelSlutterValue->setText(tProsjektSlutt.toString("dd.MM.yyyy hh:mm"));
|
||||
|
||||
prosjektUI();
|
||||
} else {
|
||||
QTreeWidgetItem *forelder = gjenstand->parent();
|
||||
kartotekPosisjon = forelder->data(kolonne, Qt::UserRole).toInt();
|
||||
kundeID = gjenstand->data(kolonne, Qt::UserRole).toInt();
|
||||
ui->labelProsjektNavn->setText("Ingen prosjekt valgt");
|
||||
ui->labelOrdrenrValue->setText("-");
|
||||
ui->labelBegynnerValue->setText("-");
|
||||
ui->labelSlutterValue->setText("-");
|
||||
ui->ordreText->clear();
|
||||
|
||||
kundeUI();
|
||||
}
|
||||
}
|
||||
|
||||
void ProsjektWidget::prosjektUI() {
|
||||
ui->pushFjernKunde->setEnabled(false);
|
||||
ui->pushRediger->setEnabled(true);
|
||||
ui->pushSlett->setEnabled(true);
|
||||
ui->pushMerkFerdig->setEnabled(true);
|
||||
}
|
||||
|
||||
void ProsjektWidget::kundeUI() {
|
||||
ui->pushFjernKunde->setEnabled(true);
|
||||
ui->pushRediger->setEnabled(false);
|
||||
ui->pushSlett->setEnabled(false);
|
||||
ui->pushMerkFerdig->setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
void ProsjektWidget::on_pushRediger_clicked() {
|
||||
emit redigerProsjekt(kartotekPosisjon);
|
||||
}
|
||||
|
||||
|
||||
void ProsjektWidget::on_pushSlett_clicked() {
|
||||
emit slettProsjekt(kartotekPosisjon);
|
||||
}
|
||||
|
||||
|
||||
void ProsjektWidget::on_pushMerkFerdig_clicked() {
|
||||
emit settAktiv(kartotekPosisjon);
|
||||
}
|
||||
|
||||
|
||||
void ProsjektWidget::on_pushFjernKunde_clicked() {
|
||||
emit fjernKunde(kartotekPosisjon, kundeID);
|
||||
}
|
||||
#include "prosjektwidget.h"
|
||||
#include "ui_prosjektwidget.h"
|
||||
|
||||
ProsjektWidget::ProsjektWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::ProsjektWidget) {
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
ProsjektWidget::~ProsjektWidget() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ProsjektWidget::oppdaterProsjektListe(ProsjektKartotek &kartotek, ProsjektBindinger &bindinger, KundeKartotek &kundeKart) {
|
||||
ui->prosjektTre->clear();
|
||||
ui->prosjektTre->setColumnCount(1);
|
||||
|
||||
connect(ui->prosjektTre, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(gjenstandKlikk(QTreeWidgetItem*,int)));
|
||||
|
||||
QList<QTreeWidgetItem *> prosjektListe;
|
||||
QIcon prosjektIkon(":/res/clipboard.svg");
|
||||
QIcon prosjektFerdigIkon(":/res/check.svg");
|
||||
QIcon kundeIkon(":/res/user.svg");
|
||||
|
||||
for (int i = 0; i < kartotek.size(); ++i) {
|
||||
bool aktiv = kartotek.at(i).value("active").toBool();
|
||||
if (aktiv) {
|
||||
bool ferdig = kartotek.at(i).value("ferdig").toBool();
|
||||
QTreeWidgetItem *prosjektGjenstand = new QTreeWidgetItem(QTreeWidgetItem::Type);
|
||||
prosjektGjenstand->setText(0, kartotek.at(i).value("prosjektnavn").toString());
|
||||
|
||||
if (ferdig)
|
||||
prosjektGjenstand->setIcon(0,prosjektFerdigIkon);
|
||||
else
|
||||
prosjektGjenstand->setIcon(0, prosjektIkon);
|
||||
|
||||
int ordrenummer = kartotek.at(i).value("ordrenummer").toInt();
|
||||
QList<QTreeWidgetItem *> kundeGjenstander;
|
||||
if (bindinger.contains(ordrenummer)) {
|
||||
QList<int> kunder = bindinger.value(ordrenummer);
|
||||
for (int x = 0; x < kunder.size(); ++x) {
|
||||
QString kundeFornavn, kundeEtternavn, kundeFirmanavn;
|
||||
for (int z = 0; z < kundeKart.size(); ++z) {
|
||||
if (kundeKart.at(z).value("id").toInt() == kunder.at(x)) {
|
||||
kundeFornavn = kundeKart.at(z).value("fornavn").toString();
|
||||
kundeEtternavn = kundeKart.at(z).value("etternavn").toString();
|
||||
if (!kundeKart.at(z).value("firmanavn").toString().isEmpty()) {
|
||||
kundeFirmanavn = QString(tr("(%1)").arg(kundeKart.at(z).value("firmanavn").toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
QTreeWidgetItem *kunde = new QTreeWidgetItem(QTreeWidgetItem::UserType);
|
||||
kunde->setText(0, tr("%1 %2 %3").arg(kundeFornavn, kundeEtternavn, kundeFirmanavn));
|
||||
kunde->setIcon(0, kundeIkon);
|
||||
kunde->setData(0, Qt::UserRole, kunder.at(x));
|
||||
kundeGjenstander.append(kunde);
|
||||
}
|
||||
prosjektGjenstand->addChildren(kundeGjenstander);
|
||||
}
|
||||
|
||||
prosjektGjenstand->setData(0, Qt::UserRole, i);
|
||||
prosjektListe.append(prosjektGjenstand);
|
||||
}
|
||||
}
|
||||
|
||||
ui->prosjektTre->addTopLevelItems(prosjektListe);
|
||||
}
|
||||
|
||||
void ProsjektWidget::settGjeldendeProsjekt(ProsjektFil prosjekt) {
|
||||
valgtProsjekt = prosjekt;
|
||||
}
|
||||
|
||||
void ProsjektWidget::on_pushNy_clicked() {
|
||||
emit opprettProsjekt();
|
||||
}
|
||||
|
||||
void ProsjektWidget::gjenstandKlikk(QTreeWidgetItem *gjenstand, int kolonne) {
|
||||
if (gjenstand->type() == QTreeWidgetItem::Type) {
|
||||
emit hentProsjektFil(gjenstand->data(kolonne, Qt::UserRole).toInt());
|
||||
kartotekPosisjon = gjenstand->data(kolonne, Qt::UserRole).toInt();
|
||||
|
||||
ui->labelProsjektNavn->setText(valgtProsjekt.value("prosjektnavn").toString());
|
||||
ui->labelOrdrenrValue->setText(valgtProsjekt.value("ordrenummer").toString());
|
||||
ui->ordreText->setHtml(valgtProsjekt.value("prosjektbeskrivelse").toString());
|
||||
|
||||
quint64 prosjektStart = valgtProsjekt.value("prosjektstart").toULongLong();
|
||||
quint64 prosjektSlutt = valgtProsjekt.value("prosjektslutt").toULongLong();
|
||||
QDateTime tProsjektStart(QDateTime::fromMSecsSinceEpoch(prosjektStart));
|
||||
QDateTime tProsjektSlutt(QDateTime::fromMSecsSinceEpoch(prosjektSlutt));
|
||||
ui->labelBegynnerValue->setText(tProsjektStart.toString("dd.MM.yyyy hh:mm"));
|
||||
ui->labelSlutterValue->setText(tProsjektSlutt.toString("dd.MM.yyyy hh:mm"));
|
||||
|
||||
prosjektUI();
|
||||
} else {
|
||||
QTreeWidgetItem *forelder = gjenstand->parent();
|
||||
kartotekPosisjon = forelder->data(kolonne, Qt::UserRole).toInt();
|
||||
kundeID = gjenstand->data(kolonne, Qt::UserRole).toInt();
|
||||
ui->labelProsjektNavn->setText("Ingen prosjekt valgt");
|
||||
ui->labelOrdrenrValue->setText("-");
|
||||
ui->labelBegynnerValue->setText("-");
|
||||
ui->labelSlutterValue->setText("-");
|
||||
ui->ordreText->clear();
|
||||
|
||||
kundeUI();
|
||||
}
|
||||
}
|
||||
|
||||
void ProsjektWidget::prosjektUI() {
|
||||
ui->pushFjernKunde->setEnabled(false);
|
||||
ui->pushRediger->setEnabled(true);
|
||||
ui->pushSlett->setEnabled(true);
|
||||
ui->pushMerkFerdig->setEnabled(true);
|
||||
}
|
||||
|
||||
void ProsjektWidget::kundeUI() {
|
||||
ui->pushFjernKunde->setEnabled(true);
|
||||
ui->pushRediger->setEnabled(false);
|
||||
ui->pushSlett->setEnabled(false);
|
||||
ui->pushMerkFerdig->setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
void ProsjektWidget::on_pushRediger_clicked() {
|
||||
emit redigerProsjekt(kartotekPosisjon);
|
||||
}
|
||||
|
||||
|
||||
void ProsjektWidget::on_pushSlett_clicked() {
|
||||
emit slettProsjekt(kartotekPosisjon);
|
||||
}
|
||||
|
||||
|
||||
void ProsjektWidget::on_pushMerkFerdig_clicked() {
|
||||
emit settAktiv(kartotekPosisjon);
|
||||
}
|
||||
|
||||
|
||||
void ProsjektWidget::on_pushFjernKunde_clicked() {
|
||||
emit fjernKunde(kartotekPosisjon, kundeID);
|
||||
}
|
||||
|
|
@ -1,49 +1,49 @@
|
|||
#ifndef PROSJEKTWIDGET_H
|
||||
#define PROSJEKTWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTreeWidgetItem>
|
||||
#include "datatypes.h"
|
||||
|
||||
namespace Ui {
|
||||
class ProsjektWidget;
|
||||
}
|
||||
|
||||
class ProsjektWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ProsjektWidget(QWidget *parent = nullptr);
|
||||
~ProsjektWidget();
|
||||
|
||||
void oppdaterProsjektListe(ProsjektKartotek &kartotek, ProsjektBindinger &bindinger, KundeKartotek &kundeKart);
|
||||
void settGjeldendeProsjekt(ProsjektFil prosjekt);
|
||||
|
||||
signals:
|
||||
void opprettProsjekt();
|
||||
void hentProsjektFil(int kartotekPlassering);
|
||||
void redigerProsjekt(int kartotekPlassering);
|
||||
void slettProsjekt(int kartotekPlassering);
|
||||
void settAktiv(int kartotekPlassering);
|
||||
void fjernKunde(int prosjektKartotekPosisjon, int kundeID);
|
||||
|
||||
private slots:
|
||||
void on_pushNy_clicked();
|
||||
void gjenstandKlikk(QTreeWidgetItem *gjenstand, int kolonne);
|
||||
void on_pushRediger_clicked();
|
||||
void on_pushSlett_clicked();
|
||||
void on_pushMerkFerdig_clicked();
|
||||
void on_pushFjernKunde_clicked();
|
||||
|
||||
private:
|
||||
Ui::ProsjektWidget *ui;
|
||||
ProsjektFil valgtProsjekt;
|
||||
|
||||
void prosjektUI();
|
||||
void kundeUI();
|
||||
|
||||
int kartotekPosisjon, kundeID;
|
||||
};
|
||||
|
||||
#endif // PROSJEKTWIDGET_H
|
||||
#ifndef PROSJEKTWIDGET_H
|
||||
#define PROSJEKTWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTreeWidgetItem>
|
||||
#include "datatypes.h"
|
||||
|
||||
namespace Ui {
|
||||
class ProsjektWidget;
|
||||
}
|
||||
|
||||
class ProsjektWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ProsjektWidget(QWidget *parent = nullptr);
|
||||
~ProsjektWidget();
|
||||
|
||||
void oppdaterProsjektListe(ProsjektKartotek &kartotek, ProsjektBindinger &bindinger, KundeKartotek &kundeKart);
|
||||
void settGjeldendeProsjekt(ProsjektFil prosjekt);
|
||||
|
||||
signals:
|
||||
void opprettProsjekt();
|
||||
void hentProsjektFil(int kartotekPlassering);
|
||||
void redigerProsjekt(int kartotekPlassering);
|
||||
void slettProsjekt(int kartotekPlassering);
|
||||
void settAktiv(int kartotekPlassering);
|
||||
void fjernKunde(int prosjektKartotekPosisjon, int kundeID);
|
||||
|
||||
private slots:
|
||||
void on_pushNy_clicked();
|
||||
void gjenstandKlikk(QTreeWidgetItem *gjenstand, int kolonne);
|
||||
void on_pushRediger_clicked();
|
||||
void on_pushSlett_clicked();
|
||||
void on_pushMerkFerdig_clicked();
|
||||
void on_pushFjernKunde_clicked();
|
||||
|
||||
private:
|
||||
Ui::ProsjektWidget *ui;
|
||||
ProsjektFil valgtProsjekt;
|
||||
|
||||
void prosjektUI();
|
||||
void kundeUI();
|
||||
|
||||
int kartotekPosisjon, kundeID;
|
||||
};
|
||||
|
||||
#endif // PROSJEKTWIDGET_H
|
||||
|
|
@ -1,351 +1,351 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ProsjektWidget</class>
|
||||
<widget class="QWidget" name="ProsjektWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>605</width>
|
||||
<height>427</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<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>
|
||||
<widget class="QLabel" name="labelHeadline">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Prosjektliste</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="prosjektTre">
|
||||
<attribute name="headerVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string notr="true">1</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="prosjektDetaljGruppe">
|
||||
<property name="title">
|
||||
<string>Prosjektdetaljer</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<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>
|
||||
<widget class="QLabel" name="labelProsjektNavn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Ingen prosjekt valgt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelOrdrenr">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Ordrenummer:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<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>
|
||||
<widget class="QLabel" name="labelOrdrenrValue">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelBegynner">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Startdato:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<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>
|
||||
<widget class="QLabel" name="labelBegynnerValue">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelSlutter">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sluttdato:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<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>
|
||||
<widget class="QLabel" name="labelSlutterValue">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBeskrivelse">
|
||||
<property name="title">
|
||||
<string>Ordrebeskrivelse</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="ordreText"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_9">
|
||||
<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>
|
||||
<widget class="QPushButton" name="pushNy">
|
||||
<property name="text">
|
||||
<string>Nytt prosjekt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushRediger">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rediger prosjekt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushSlett">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Slett prosjekt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushMerkFerdig">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Marker som avsluttet/startet</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushFjernKunde">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fjern kunde</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ProsjektWidget</class>
|
||||
<widget class="QWidget" name="ProsjektWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>605</width>
|
||||
<height>427</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<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>
|
||||
<widget class="QLabel" name="labelHeadline">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Prosjektliste</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="prosjektTre">
|
||||
<attribute name="headerVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string notr="true">1</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="prosjektDetaljGruppe">
|
||||
<property name="title">
|
||||
<string>Prosjektdetaljer</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<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>
|
||||
<widget class="QLabel" name="labelProsjektNavn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Ingen prosjekt valgt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelOrdrenr">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Ordrenummer:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<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>
|
||||
<widget class="QLabel" name="labelOrdrenrValue">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelBegynner">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Startdato:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<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>
|
||||
<widget class="QLabel" name="labelBegynnerValue">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelSlutter">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sluttdato:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<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>
|
||||
<widget class="QLabel" name="labelSlutterValue">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBeskrivelse">
|
||||
<property name="title">
|
||||
<string>Ordrebeskrivelse</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="ordreText"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_9">
|
||||
<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>
|
||||
<widget class="QPushButton" name="pushNy">
|
||||
<property name="text">
|
||||
<string>Nytt prosjekt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushRediger">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rediger prosjekt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushSlett">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Slett prosjekt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushMerkFerdig">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Marker som avsluttet/startet</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushFjernKunde">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fjern kunde</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
TEMPLATE = subdirs
|
||||
|
||||
SUBDIRS += core
|
||||
|
|
@ -1,55 +1,55 @@
|
|||
#include "innstillingdialog.h"
|
||||
#include "ui_innstillingdialog.h"
|
||||
|
||||
InnstillingDialog::InnstillingDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::InnstillingDialog) {
|
||||
ui->setupUi(this);
|
||||
|
||||
QCoreApplication::setOrganizationName("Arctic Software");
|
||||
QCoreApplication::setOrganizationDomain("arcticsoftware.no");
|
||||
QCoreApplication::setApplicationName("Saeterprosjekt");
|
||||
|
||||
QSettings settings;
|
||||
|
||||
if (!settings.contains("yellowcondition")) {
|
||||
settings.setValue("yellowcondition", 50);
|
||||
}
|
||||
|
||||
if (!settings.contains("redcondition")) {
|
||||
settings.setValue("redcondition", 90);
|
||||
}
|
||||
|
||||
ui->dialGul->setValue(settings.value("yellowcondition").toInt());
|
||||
ui->dialRod->setValue(settings.value("redcondition").toInt());
|
||||
|
||||
ui->labelGulVerdi->setText(tr("%1% av tiden gått før kondisjon").arg(settings.value("yellowcondition").toString()));
|
||||
ui->labelRodVerdi->setText(tr("%1% av tiden gått før kondisjon").arg(settings.value("redcondition").toString()));
|
||||
}
|
||||
|
||||
InnstillingDialog::~InnstillingDialog() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void InnstillingDialog::on_dialGul_sliderMoved(int position) {
|
||||
ui->labelGulVerdi->setText(tr("%1% av tiden gått før kondisjon").arg(QString::number(position)));
|
||||
}
|
||||
|
||||
|
||||
void InnstillingDialog::on_dialRod_sliderMoved(int position) {
|
||||
ui->labelRodVerdi->setText(tr("%1% av tiden gått før kondisjon").arg(QString::number(position)));
|
||||
}
|
||||
|
||||
|
||||
void InnstillingDialog::on_pushAvbryt_clicked() {
|
||||
QDialog::close();
|
||||
}
|
||||
|
||||
|
||||
void InnstillingDialog::on_pushLagre_clicked() {
|
||||
QSettings settings;
|
||||
settings.setValue("yellowcondition", ui->dialGul->value());
|
||||
settings.setValue("redcondition", ui->dialRod->value());
|
||||
QDialog::close();
|
||||
}
|
||||
|
||||
#include "innstillingdialog.h"
|
||||
#include "ui_innstillingdialog.h"
|
||||
|
||||
InnstillingDialog::InnstillingDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::InnstillingDialog) {
|
||||
ui->setupUi(this);
|
||||
|
||||
QCoreApplication::setOrganizationName("Arctic Software");
|
||||
QCoreApplication::setOrganizationDomain("arcticsoftware.no");
|
||||
QCoreApplication::setApplicationName("Saeterprosjekt");
|
||||
|
||||
QSettings settings;
|
||||
|
||||
if (!settings.contains("yellowcondition")) {
|
||||
settings.setValue("yellowcondition", 50);
|
||||
}
|
||||
|
||||
if (!settings.contains("redcondition")) {
|
||||
settings.setValue("redcondition", 90);
|
||||
}
|
||||
|
||||
ui->dialGul->setValue(settings.value("yellowcondition").toInt());
|
||||
ui->dialRod->setValue(settings.value("redcondition").toInt());
|
||||
|
||||
ui->labelGulVerdi->setText(tr("%1% av tiden gått før kondisjon").arg(settings.value("yellowcondition").toString()));
|
||||
ui->labelRodVerdi->setText(tr("%1% av tiden gått før kondisjon").arg(settings.value("redcondition").toString()));
|
||||
}
|
||||
|
||||
InnstillingDialog::~InnstillingDialog() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void InnstillingDialog::on_dialGul_sliderMoved(int position) {
|
||||
ui->labelGulVerdi->setText(tr("%1% av tiden gått før kondisjon").arg(QString::number(position)));
|
||||
}
|
||||
|
||||
|
||||
void InnstillingDialog::on_dialRod_sliderMoved(int position) {
|
||||
ui->labelRodVerdi->setText(tr("%1% av tiden gått før kondisjon").arg(QString::number(position)));
|
||||
}
|
||||
|
||||
|
||||
void InnstillingDialog::on_pushAvbryt_clicked() {
|
||||
QDialog::close();
|
||||
}
|
||||
|
||||
|
||||
void InnstillingDialog::on_pushLagre_clicked() {
|
||||
QSettings settings;
|
||||
settings.setValue("yellowcondition", ui->dialGul->value());
|
||||
settings.setValue("redcondition", ui->dialRod->value());
|
||||
QDialog::close();
|
||||
}
|
||||
|
||||
|
|
@ -1,33 +1,33 @@
|
|||
#ifndef INNSTILLINGDIALOG_H
|
||||
#define INNSTILLINGDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QSettings>
|
||||
#include <QtDebug>
|
||||
|
||||
namespace Ui {
|
||||
class InnstillingDialog;
|
||||
}
|
||||
|
||||
class InnstillingDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit InnstillingDialog(QWidget *parent = nullptr);
|
||||
~InnstillingDialog();
|
||||
|
||||
private slots:
|
||||
void on_dialGul_sliderMoved(int position);
|
||||
|
||||
void on_dialRod_sliderMoved(int position);
|
||||
|
||||
void on_pushAvbryt_clicked();
|
||||
|
||||
void on_pushLagre_clicked();
|
||||
|
||||
private:
|
||||
Ui::InnstillingDialog *ui;
|
||||
};
|
||||
|
||||
#endif // INNSTILLINGDIALOG_H
|
||||
#ifndef INNSTILLINGDIALOG_H
|
||||
#define INNSTILLINGDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QSettings>
|
||||
#include <QtDebug>
|
||||
|
||||
namespace Ui {
|
||||
class InnstillingDialog;
|
||||
}
|
||||
|
||||
class InnstillingDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit InnstillingDialog(QWidget *parent = nullptr);
|
||||
~InnstillingDialog();
|
||||
|
||||
private slots:
|
||||
void on_dialGul_sliderMoved(int position);
|
||||
|
||||
void on_dialRod_sliderMoved(int position);
|
||||
|
||||
void on_pushAvbryt_clicked();
|
||||
|
||||
void on_pushLagre_clicked();
|
||||
|
||||
private:
|
||||
Ui::InnstillingDialog *ui;
|
||||
};
|
||||
|
||||
#endif // INNSTILLINGDIALOG_H
|
||||
|
|
@ -1,186 +1,186 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>InnstillingDialog</class>
|
||||
<widget class="QDialog" name="InnstillingDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>446</width>
|
||||
<height>335</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Juster innstillinger for Sæterprosjekt</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupKondisjoner">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Innstillinger for kondisjons terskler</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelKondisjonGul">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Kondisjon gul:</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDial" name="dialGul">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelGulVerdi">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>% igjen av varslingstid</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelKondisjonRod">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Kondisjon rød:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDial" name="dialRod">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelRodVerdi">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>% igjen av varslingstid</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<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>
|
||||
<widget class="QPushButton" name="pushAvbryt">
|
||||
<property name="text">
|
||||
<string>Avbryt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushLagre">
|
||||
<property name="text">
|
||||
<string>Lagre</string>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>InnstillingDialog</class>
|
||||
<widget class="QDialog" name="InnstillingDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>446</width>
|
||||
<height>335</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Juster innstillinger for Sæterprosjekt</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupKondisjoner">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Innstillinger for kondisjons terskler</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelKondisjonGul">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Kondisjon gul:</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDial" name="dialGul">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelGulVerdi">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>% igjen av varslingstid</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelKondisjonRod">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Kondisjon rød:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDial" name="dialRod">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelRodVerdi">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>% igjen av varslingstid</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<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>
|
||||
<widget class="QPushButton" name="pushAvbryt">
|
||||
<property name="text">
|
||||
<string>Avbryt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushLagre">
|
||||
<property name="text">
|
||||
<string>Lagre</string>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
24
src/uidialogs/maindialogs/maindialogs.pri
Normal file
24
src/uidialogs/maindialogs/maindialogs.pri
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
INCLUDEPATH += \
|
||||
$$PWD/../../core \
|
||||
$$PWD/../../mainwidgets
|
||||
DEPENDPATH += \
|
||||
$$PWD/../../core \
|
||||
$$PWD/../../mainwidgets
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/innstillingdialog.cpp \
|
||||
$$PWD/omdialog.cpp \
|
||||
$$PWD/varsledialog.cpp
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/innstillingdialog.h \
|
||||
$$PWD/omdialog.h \
|
||||
$$PWD/varsledialog.h
|
||||
|
||||
FORMS += \
|
||||
$$PWD/innstillingdialog.ui \
|
||||
$$PWD/omdialog.ui \
|
||||
$$PWD/varsledialog.ui
|
||||
|
||||
RESOURCES += \
|
||||
$$PWD/../../../resources.qrc
|
||||
|
|
@ -1,21 +1,21 @@
|
|||
#include "omdialog.h"
|
||||
#include "ui_omdialog.h"
|
||||
|
||||
OmDialog::OmDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::OmDialog) {
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
OmDialog::~OmDialog() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OmDialog::setVersjon(qreal versjon) {
|
||||
ui->labelVersjon->setText(tr("Versjon %1").arg(versjon));
|
||||
}
|
||||
|
||||
void OmDialog::on_pushOk_clicked() {
|
||||
QDialog::close();
|
||||
}
|
||||
|
||||
#include "omdialog.h"
|
||||
#include "ui_omdialog.h"
|
||||
|
||||
OmDialog::OmDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::OmDialog) {
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
OmDialog::~OmDialog() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OmDialog::setVersjon(qreal versjon) {
|
||||
ui->labelVersjon->setText(tr("Versjon %1").arg(versjon));
|
||||
}
|
||||
|
||||
void OmDialog::on_pushOk_clicked() {
|
||||
QDialog::close();
|
||||
}
|
||||
|
||||
|
|
@ -1,27 +1,27 @@
|
|||
#ifndef OMDIALOG_H
|
||||
#define OMDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class OmDialog;
|
||||
}
|
||||
|
||||
class OmDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OmDialog(QWidget *parent = nullptr);
|
||||
~OmDialog();
|
||||
|
||||
void setVersjon(qreal versjon);
|
||||
|
||||
private slots:
|
||||
void on_pushOk_clicked();
|
||||
|
||||
private:
|
||||
Ui::OmDialog *ui;
|
||||
};
|
||||
|
||||
#endif // OMDIALOG_H
|
||||
#ifndef OMDIALOG_H
|
||||
#define OMDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class OmDialog;
|
||||
}
|
||||
|
||||
class OmDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OmDialog(QWidget *parent = nullptr);
|
||||
~OmDialog();
|
||||
|
||||
void setVersjon(qreal versjon);
|
||||
|
||||
private slots:
|
||||
void on_pushOk_clicked();
|
||||
|
||||
private:
|
||||
Ui::OmDialog *ui;
|
||||
};
|
||||
|
||||
#endif // OMDIALOG_H
|
||||
|
|
@ -1,146 +1,146 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OmDialog</class>
|
||||
<widget class="QDialog" name="OmDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>386</width>
|
||||
<height>257</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Om dette programmet</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelAppHeadline">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-size:18pt; font-weight:600; color:#ff0000;">Sæte</span><span style=" font-size:18pt; font-weight:600; color:#004add;">rp</span><span style=" font-size:18pt; font-weight:600; color:#ffffff;">r</span><span style=" font-size:18pt; font-weight:600; color:#004add;">os</span><span style=" font-size:18pt; font-weight:600; color:#ff0000;">jekt</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignHCenter|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelVersjon">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignHCenter|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelCopyright">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Kopirett(c) av Helge-Mikael Nordgård</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignHCenter|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelDesc">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Dette programmet er kopibeskyttet og lisensiert under GPLv3 (GNU General Public License versjon 3). Programmet er åpen og fri kildekode og kan modifiseres og redistribueres under visse betingelser. </p><p><a href="https://www.gnu.org/licenses/gpl-3.0.html"><span style=" text-decoration: underline; color:#0000ff;">Du kan lese lisensen i sin helhet her.</span></a></p><p>For å laste ned kildekoden, nye utgivelser, rapportere bugs m.m. kan du besøke <a href="https://git.outlands.no/heno/Saeterprosjekt"><span style=" text-decoration: underline; color:#0000ff;">prosjektets hjemmeside</span></a>.</p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<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>
|
||||
<widget class="QPushButton" name="pushOk">
|
||||
<property name="text">
|
||||
<string>Ok</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OmDialog</class>
|
||||
<widget class="QDialog" name="OmDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>386</width>
|
||||
<height>257</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Om dette programmet</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelAppHeadline">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-size:18pt; font-weight:600; color:#ff0000;">Sæte</span><span style=" font-size:18pt; font-weight:600; color:#004add;">rp</span><span style=" font-size:18pt; font-weight:600; color:#ffffff;">r</span><span style=" font-size:18pt; font-weight:600; color:#004add;">os</span><span style=" font-size:18pt; font-weight:600; color:#ff0000;">jekt</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignHCenter|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelVersjon">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignHCenter|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelCopyright">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Kopirett(c) av Helge-Mikael Nordgård</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignHCenter|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelDesc">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Dette programmet er kopibeskyttet og lisensiert under GPLv3 (GNU General Public License versjon 3). Programmet er åpen og fri kildekode og kan modifiseres og redistribueres under visse betingelser. </p><p><a href="https://www.gnu.org/licenses/gpl-3.0.html"><span style=" text-decoration: underline; color:#0000ff;">Du kan lese lisensen i sin helhet her.</span></a></p><p>For å laste ned kildekoden, nye utgivelser, rapportere bugs m.m. kan du besøke <a href="https://git.outlands.no/heno/Saeterprosjekt"><span style=" text-decoration: underline; color:#0000ff;">prosjektets hjemmeside</span></a>.</p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<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>
|
||||
<widget class="QPushButton" name="pushOk">
|
||||
<property name="text">
|
||||
<string>Ok</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
@ -1,65 +1,65 @@
|
|||
#include "varsledialog.h"
|
||||
#include "ui_varsledialog.h"
|
||||
|
||||
VarsleDialog::VarsleDialog(QWidget *parent, AlertConditions alertCondition) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::VarsleDialog) {
|
||||
ui->setupUi(this);
|
||||
|
||||
condition = alertCondition;
|
||||
|
||||
switch (condition) {
|
||||
case AlertConditions::CONDITION_GREEN:
|
||||
setConditionGreen();
|
||||
break;
|
||||
case AlertConditions::CONDITION_YELLOW:
|
||||
setConditionYellow();
|
||||
break;
|
||||
case AlertConditions::CONDITION_RED:
|
||||
setConditionRed();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
VarsleDialog::~VarsleDialog() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void VarsleDialog::settProsjektNavn(QString navn) {
|
||||
ui->labelProsjektNavnVerdi->setText(navn);
|
||||
}
|
||||
|
||||
void VarsleDialog::settStart(quint64 epoch) {
|
||||
QDateTime tProsjektStart(QDateTime::fromMSecsSinceEpoch(epoch));
|
||||
ui->labelStartVerdi->setText(tProsjektStart.toString("dd.MM.yyyy hh:mm"));
|
||||
}
|
||||
|
||||
void VarsleDialog::settSlutt(quint64 epoch) {
|
||||
QDateTime tProsjektStart(QDateTime::fromMSecsSinceEpoch(epoch));
|
||||
ui->labelSluttVerdi->setText(tProsjektStart.toString("dd.MM.yyyy hh:mm"));
|
||||
}
|
||||
|
||||
void VarsleDialog::setConditionGreen() {
|
||||
QString kText = "<html><head/><body><p>Kondisjon: <span style=\"color:#00c800;\">Grønn</span></p></body></html>";
|
||||
ui->labelKondisjonVerdi->setTextFormat(Qt::RichText);
|
||||
ui->labelKondisjonVerdi->setText(kText);
|
||||
}
|
||||
|
||||
void VarsleDialog::setConditionYellow() {
|
||||
QString kText = "<html><head/><body><p>Kondisjon: <span style=\"color:#f1f100;\">! Gul !</span></p></body></html>";
|
||||
ui->labelKondisjonVerdi->setTextFormat(Qt::RichText);
|
||||
ui->labelKondisjonVerdi->setText(kText);
|
||||
}
|
||||
|
||||
void VarsleDialog::setConditionRed() {
|
||||
QString kText = "<html><head/><body><p>Kondisjon: <span style=\"color:#da0000;\">!!! RØD !!!</span></p></body></html>";
|
||||
ui->labelKondisjonVerdi->setTextFormat(Qt::RichText);
|
||||
ui->labelKondisjonVerdi->setText(kText);
|
||||
}
|
||||
|
||||
void VarsleDialog::on_pushOk_clicked() {
|
||||
QDialog::close();
|
||||
}
|
||||
|
||||
#include "varsledialog.h"
|
||||
#include "ui_varsledialog.h"
|
||||
|
||||
VarsleDialog::VarsleDialog(QWidget *parent, AlertConditions alertCondition) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::VarsleDialog) {
|
||||
ui->setupUi(this);
|
||||
|
||||
condition = alertCondition;
|
||||
|
||||
switch (condition) {
|
||||
case AlertConditions::CONDITION_GREEN:
|
||||
setConditionGreen();
|
||||
break;
|
||||
case AlertConditions::CONDITION_YELLOW:
|
||||
setConditionYellow();
|
||||
break;
|
||||
case AlertConditions::CONDITION_RED:
|
||||
setConditionRed();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
VarsleDialog::~VarsleDialog() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void VarsleDialog::settProsjektNavn(QString navn) {
|
||||
ui->labelProsjektNavnVerdi->setText(navn);
|
||||
}
|
||||
|
||||
void VarsleDialog::settStart(quint64 epoch) {
|
||||
QDateTime tProsjektStart(QDateTime::fromMSecsSinceEpoch(epoch));
|
||||
ui->labelStartVerdi->setText(tProsjektStart.toString("dd.MM.yyyy hh:mm"));
|
||||
}
|
||||
|
||||
void VarsleDialog::settSlutt(quint64 epoch) {
|
||||
QDateTime tProsjektStart(QDateTime::fromMSecsSinceEpoch(epoch));
|
||||
ui->labelSluttVerdi->setText(tProsjektStart.toString("dd.MM.yyyy hh:mm"));
|
||||
}
|
||||
|
||||
void VarsleDialog::setConditionGreen() {
|
||||
QString kText = "<html><head/><body><p>Kondisjon: <span style=\"color:#00c800;\">Grønn</span></p></body></html>";
|
||||
ui->labelKondisjonVerdi->setTextFormat(Qt::RichText);
|
||||
ui->labelKondisjonVerdi->setText(kText);
|
||||
}
|
||||
|
||||
void VarsleDialog::setConditionYellow() {
|
||||
QString kText = "<html><head/><body><p>Kondisjon: <span style=\"color:#f1f100;\">! Gul !</span></p></body></html>";
|
||||
ui->labelKondisjonVerdi->setTextFormat(Qt::RichText);
|
||||
ui->labelKondisjonVerdi->setText(kText);
|
||||
}
|
||||
|
||||
void VarsleDialog::setConditionRed() {
|
||||
QString kText = "<html><head/><body><p>Kondisjon: <span style=\"color:#da0000;\">!!! RØD !!!</span></p></body></html>";
|
||||
ui->labelKondisjonVerdi->setTextFormat(Qt::RichText);
|
||||
ui->labelKondisjonVerdi->setText(kText);
|
||||
}
|
||||
|
||||
void VarsleDialog::on_pushOk_clicked() {
|
||||
QDialog::close();
|
||||
}
|
||||
|
||||
|
|
@ -1,35 +1,35 @@
|
|||
#ifndef VARSLEDIALOG_H
|
||||
#define VARSLEDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "datatypes.h"
|
||||
|
||||
namespace Ui {
|
||||
class VarsleDialog;
|
||||
}
|
||||
|
||||
class VarsleDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit VarsleDialog(QWidget *parent = nullptr, AlertConditions alertCondition = AlertConditions::CONDITION_GREEN);
|
||||
~VarsleDialog();
|
||||
|
||||
void settProsjektNavn(QString navn);
|
||||
void settStart(quint64 epoch);
|
||||
void settSlutt(quint64 epoch);
|
||||
|
||||
private slots:
|
||||
void on_pushOk_clicked();
|
||||
|
||||
private:
|
||||
Ui::VarsleDialog *ui;
|
||||
AlertConditions condition;
|
||||
|
||||
void setConditionGreen();
|
||||
void setConditionYellow();
|
||||
void setConditionRed();
|
||||
};
|
||||
|
||||
#endif // VARSLEDIALOG_H
|
||||
#ifndef VARSLEDIALOG_H
|
||||
#define VARSLEDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "datatypes.h"
|
||||
|
||||
namespace Ui {
|
||||
class VarsleDialog;
|
||||
}
|
||||
|
||||
class VarsleDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit VarsleDialog(QWidget *parent = nullptr, AlertConditions alertCondition = AlertConditions::CONDITION_GREEN);
|
||||
~VarsleDialog();
|
||||
|
||||
void settProsjektNavn(QString navn);
|
||||
void settStart(quint64 epoch);
|
||||
void settSlutt(quint64 epoch);
|
||||
|
||||
private slots:
|
||||
void on_pushOk_clicked();
|
||||
|
||||
private:
|
||||
Ui::VarsleDialog *ui;
|
||||
AlertConditions condition;
|
||||
|
||||
void setConditionGreen();
|
||||
void setConditionYellow();
|
||||
void setConditionRed();
|
||||
};
|
||||
|
||||
#endif // VARSLEDIALOG_H
|
||||
|
|
@ -1,251 +1,251 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>VarsleDialog</class>
|
||||
<widget class="QDialog" name="VarsleDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>422</width>
|
||||
<height>311</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Varsel om prosjekt</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<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>
|
||||
<widget class="QLabel" name="labelVarselHeading">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>16</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Varsel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<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>
|
||||
<widget class="QLabel" name="labelKondisjonVerdi">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Kondisjon: <span style=" color:#00c800;">Grønn</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelProsjektnavn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Prosjektnavn:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<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>
|
||||
<widget class="QLabel" name="labelProsjektNavnVerdi">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelStart">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<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>
|
||||
<widget class="QLabel" name="labelStartVerdi">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelSlutt">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Slutt:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<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>
|
||||
<widget class="QLabel" name="labelSluttVerdi">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushOk">
|
||||
<property name="text">
|
||||
<string>Lukk varsel</string>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>VarsleDialog</class>
|
||||
<widget class="QDialog" name="VarsleDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>422</width>
|
||||
<height>311</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Varsel om prosjekt</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<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>
|
||||
<widget class="QLabel" name="labelVarselHeading">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>16</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Varsel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<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>
|
||||
<widget class="QLabel" name="labelKondisjonVerdi">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Kondisjon: <span style=" color:#00c800;">Grønn</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelProsjektnavn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Prosjektnavn:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<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>
|
||||
<widget class="QLabel" name="labelProsjektNavnVerdi">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelStart">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Start:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<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>
|
||||
<widget class="QLabel" name="labelStartVerdi">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelSlutt">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Slutt:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<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>
|
||||
<widget class="QLabel" name="labelSluttVerdi">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushOk">
|
||||
<property name="text">
|
||||
<string>Lukk varsel</string>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
24
src/uidialogs/widgetdialogs/kunde/kundedialoger.pri
Normal file
24
src/uidialogs/widgetdialogs/kunde/kundedialoger.pri
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
INCLUDEPATH += \
|
||||
$$PWD/../../core \
|
||||
$$PWD/../../mainwidgets
|
||||
DEPENDPATH += \
|
||||
$$PWD/../../core \
|
||||
$$PWD/../../mainwidgets
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/nykundedialog.cpp \
|
||||
$$PWD/redigerkundedialog.cpp \
|
||||
$$PWD/velgkundeprosjektdialog.cpp
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/nykundedialog.h \
|
||||
$$PWD/redigerkundedialog.h \
|
||||
$$PWD/velgkundeprosjektdialog.h
|
||||
|
||||
FORMS += \
|
||||
$$PWD/nykundedialog.ui \
|
||||
$$PWD/redigerkundedialog.ui \
|
||||
$$PWD/velgkundeprosjektdialog.ui
|
||||
|
||||
RESOURCES += \
|
||||
$$PWD/../../../../resources.qrc
|
||||
|
|
@ -1,67 +1,67 @@
|
|||
#include "nykundedialog.h"
|
||||
#include "ui_nykundedialog.h"
|
||||
|
||||
NyKundeDialog::NyKundeDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::NyKundeDialog) {
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->lineTlf->setValidator(new QIntValidator(10000000, 99999999, this));
|
||||
ui->linePostnr->setValidator(new QIntValidator(1000, 9999, this));
|
||||
ui->labelFeilMelding->setText("");
|
||||
}
|
||||
|
||||
NyKundeDialog::~NyKundeDialog() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void NyKundeDialog::startTopp() {
|
||||
ui->lineFornavn->setFocus();
|
||||
}
|
||||
|
||||
void NyKundeDialog::nyKundeId(quint64 id) {
|
||||
ui->lineKundenummer->setText(QString::number(id));
|
||||
}
|
||||
|
||||
void NyKundeDialog::fokuserElement(UIElementer element) {
|
||||
switch (element) {
|
||||
case UIElementer::FORNAVN:
|
||||
ui->lineFornavn->selectAll();
|
||||
ui->lineFornavn->setFocus();
|
||||
break;
|
||||
case UIElementer::ETTERNAVN:
|
||||
ui->lineEtternavn->selectAll();
|
||||
ui->lineEtternavn->setFocus();
|
||||
break;
|
||||
case UIElementer::FIRMANAVN:
|
||||
ui->lineFirmanavn->selectAll();
|
||||
ui->lineFirmanavn->setFocus();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void NyKundeDialog::settFeilMelding(QString feilMelding) {
|
||||
ui->labelFeilMelding->setText(tr("<span style=\"font-weight:600; color:#ff0000;\">Feil: </span><span style=\"font-weight:600;\"/><span style=\"color:#000000;\">%1</span>").arg(feilMelding));
|
||||
}
|
||||
|
||||
void NyKundeDialog::on_pushAvbryt_clicked() {
|
||||
QDialog::close();
|
||||
}
|
||||
|
||||
|
||||
void NyKundeDialog::on_pushButton_clicked() {
|
||||
KundeFil nyKunde;
|
||||
nyKunde.insert("fornavn", ui->lineFornavn->text());
|
||||
nyKunde.insert("etternavn", ui->lineEtternavn->text());
|
||||
nyKunde.insert("firmanavn", ui->lineFirmanavn->text());
|
||||
nyKunde.insert("adresse", ui->lineGate->text());
|
||||
nyKunde.insert("postnr", ui->linePostnr->text().toInt());
|
||||
nyKunde.insert("sted", ui->lineSted->text());
|
||||
nyKunde.insert("epost", ui->lineEpost->text());
|
||||
nyKunde.insert("tlf", ui->lineTlf->text().toInt());
|
||||
nyKunde.insert("id", ui->lineKundenummer->text().toInt());
|
||||
nyKunde.insert("active", true);
|
||||
|
||||
emit leggTilKunde(nyKunde);
|
||||
}
|
||||
|
||||
#include "nykundedialog.h"
|
||||
#include "ui_nykundedialog.h"
|
||||
|
||||
NyKundeDialog::NyKundeDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::NyKundeDialog) {
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->lineTlf->setValidator(new QIntValidator(10000000, 99999999, this));
|
||||
ui->linePostnr->setValidator(new QIntValidator(1000, 9999, this));
|
||||
ui->labelFeilMelding->setText("");
|
||||
}
|
||||
|
||||
NyKundeDialog::~NyKundeDialog() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void NyKundeDialog::startTopp() {
|
||||
ui->lineFornavn->setFocus();
|
||||
}
|
||||
|
||||
void NyKundeDialog::nyKundeId(quint64 id) {
|
||||
ui->lineKundenummer->setText(QString::number(id));
|
||||
}
|
||||
|
||||
void NyKundeDialog::fokuserElement(UIElementer element) {
|
||||
switch (element) {
|
||||
case UIElementer::FORNAVN:
|
||||
ui->lineFornavn->selectAll();
|
||||
ui->lineFornavn->setFocus();
|
||||
break;
|
||||
case UIElementer::ETTERNAVN:
|
||||
ui->lineEtternavn->selectAll();
|
||||
ui->lineEtternavn->setFocus();
|
||||
break;
|
||||
case UIElementer::FIRMANAVN:
|
||||
ui->lineFirmanavn->selectAll();
|
||||
ui->lineFirmanavn->setFocus();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void NyKundeDialog::settFeilMelding(QString feilMelding) {
|
||||
ui->labelFeilMelding->setText(tr("<span style=\"font-weight:600; color:#ff0000;\">Feil: </span><span style=\"font-weight:600;\"/><span style=\"color:#000000;\">%1</span>").arg(feilMelding));
|
||||
}
|
||||
|
||||
void NyKundeDialog::on_pushAvbryt_clicked() {
|
||||
QDialog::close();
|
||||
}
|
||||
|
||||
|
||||
void NyKundeDialog::on_pushButton_clicked() {
|
||||
KundeFil nyKunde;
|
||||
nyKunde.insert("fornavn", ui->lineFornavn->text());
|
||||
nyKunde.insert("etternavn", ui->lineEtternavn->text());
|
||||
nyKunde.insert("firmanavn", ui->lineFirmanavn->text());
|
||||
nyKunde.insert("adresse", ui->lineGate->text());
|
||||
nyKunde.insert("postnr", ui->linePostnr->text().toInt());
|
||||
nyKunde.insert("sted", ui->lineSted->text());
|
||||
nyKunde.insert("epost", ui->lineEpost->text());
|
||||
nyKunde.insert("tlf", ui->lineTlf->text().toInt());
|
||||
nyKunde.insert("id", ui->lineKundenummer->text().toInt());
|
||||
nyKunde.insert("active", true);
|
||||
|
||||
emit leggTilKunde(nyKunde);
|
||||
}
|
||||
|
||||
|
|
@ -1,37 +1,37 @@
|
|||
#ifndef NYKUNDEDIALOG_H
|
||||
#define NYKUNDEDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QIntValidator>
|
||||
#include "datatypes.h"
|
||||
|
||||
namespace Ui {
|
||||
class NyKundeDialog;
|
||||
}
|
||||
|
||||
class NyKundeDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit NyKundeDialog(QWidget *parent = nullptr);
|
||||
~NyKundeDialog();
|
||||
|
||||
void startTopp();
|
||||
void nyKundeId(quint64 id);
|
||||
|
||||
void fokuserElement(UIElementer element);
|
||||
void settFeilMelding(QString feilMelding);
|
||||
|
||||
signals:
|
||||
void leggTilKunde(KundeFil kunde);
|
||||
|
||||
private slots:
|
||||
void on_pushAvbryt_clicked();
|
||||
void on_pushButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::NyKundeDialog *ui;
|
||||
};
|
||||
|
||||
#endif // NYKUNDEDIALOG_H
|
||||
#ifndef NYKUNDEDIALOG_H
|
||||
#define NYKUNDEDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QIntValidator>
|
||||
#include "datatypes.h"
|
||||
|
||||
namespace Ui {
|
||||
class NyKundeDialog;
|
||||
}
|
||||
|
||||
class NyKundeDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit NyKundeDialog(QWidget *parent = nullptr);
|
||||
~NyKundeDialog();
|
||||
|
||||
void startTopp();
|
||||
void nyKundeId(quint64 id);
|
||||
|
||||
void fokuserElement(UIElementer element);
|
||||
void settFeilMelding(QString feilMelding);
|
||||
|
||||
signals:
|
||||
void leggTilKunde(KundeFil kunde);
|
||||
|
||||
private slots:
|
||||
void on_pushAvbryt_clicked();
|
||||
void on_pushButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::NyKundeDialog *ui;
|
||||
};
|
||||
|
||||
#endif // NYKUNDEDIALOG_H
|
||||
|
|
@ -1,259 +1,259 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>NyKundeDialog</class>
|
||||
<widget class="QDialog" name="NyKundeDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>474</width>
|
||||
<height>358</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Opprett ny kunde</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelFornavn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fornavn:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineFornavn"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelEtternavn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Etternavn:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEtternavn"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelFirmanavn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Firmanavn:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineFirmanavn"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelGateadresse">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Gateadresse:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineGate"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelPostnr">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Postnr:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="linePostnr"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelSted">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sted:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineSted"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="labelTlf">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Telefon:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="lineTlf"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="labelEpost">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Epost:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="lineEpost"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelID">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Kundenummer:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineKundenummer">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelFeilMelding">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-weight:600; color:#ff0000;">Feil: </span><span style=" font-weight:600;"/><span style=" color:#000000;">TextLabel</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<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>
|
||||
<widget class="QPushButton" name="pushAvbryt">
|
||||
<property name="text">
|
||||
<string>Avbryt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Lagre</string>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>NyKundeDialog</class>
|
||||
<widget class="QDialog" name="NyKundeDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>474</width>
|
||||
<height>358</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Opprett ny kunde</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelFornavn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fornavn:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineFornavn"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelEtternavn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Etternavn:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEtternavn"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelFirmanavn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Firmanavn:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineFirmanavn"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelGateadresse">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Gateadresse:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineGate"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelPostnr">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Postnr:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="linePostnr"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelSted">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sted:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineSted"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="labelTlf">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Telefon:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="lineTlf"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="labelEpost">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Epost:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="lineEpost"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelID">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Kundenummer:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineKundenummer">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelFeilMelding">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-weight:600; color:#ff0000;">Feil: </span><span style=" font-weight:600;"/><span style=" color:#000000;">TextLabel</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<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>
|
||||
<widget class="QPushButton" name="pushAvbryt">
|
||||
<property name="text">
|
||||
<string>Avbryt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Lagre</string>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
@ -1,73 +1,73 @@
|
|||
#include "redigerkundedialog.h"
|
||||
#include "ui_redigerkundedialog.h"
|
||||
|
||||
RedigerKundeDialog::RedigerKundeDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::RedigerKundeDialog) {
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->labelFeilMelding->setText("");
|
||||
}
|
||||
|
||||
RedigerKundeDialog::~RedigerKundeDialog() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void RedigerKundeDialog::settInnGamleVerdier(KundeFil gjeldendeKundeFil) {
|
||||
ui->lineKundenummer->setText(gjeldendeKundeFil.value("id").toString());
|
||||
|
||||
ui->lineFornavn->setText(gjeldendeKundeFil.value("fornavn").toString());
|
||||
ui->lineEtternavn->setText(gjeldendeKundeFil.value("etternavn").toString());
|
||||
ui->lineFirmanavn->setText(gjeldendeKundeFil.value("firmanavn").toString());
|
||||
ui->lineGate->setText(gjeldendeKundeFil.value("adresse").toString());
|
||||
ui->linePostnr->setText(gjeldendeKundeFil.value("postnr").toString());
|
||||
ui->lineSted->setText(gjeldendeKundeFil.value("sted").toString());
|
||||
ui->lineEpost->setText(gjeldendeKundeFil.value("epost").toString());
|
||||
ui->lineTlf->setText(gjeldendeKundeFil.value("tlf").toString());
|
||||
|
||||
ui->lineFornavn->selectAll();
|
||||
ui->lineFornavn->setFocus();
|
||||
}
|
||||
|
||||
void RedigerKundeDialog::fokuserElement(UIElementer element) {
|
||||
switch (element) {
|
||||
case UIElementer::FORNAVN:
|
||||
ui->lineFornavn->selectAll();
|
||||
ui->lineFornavn->setFocus();
|
||||
break;
|
||||
case UIElementer::ETTERNAVN:
|
||||
ui->lineEtternavn->selectAll();
|
||||
ui->lineEtternavn->setFocus();
|
||||
break;
|
||||
case UIElementer::FIRMANAVN:
|
||||
ui->lineFirmanavn->selectAll();
|
||||
ui->lineFirmanavn->setFocus();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void RedigerKundeDialog::settFeilMelding(QString feilMelding) {
|
||||
ui->labelFeilMelding->setText(tr("<span style=\"font-weight:600; color:#ff0000;\">Feil: </span><span style=\"font-weight:600;\"/><span style=\"color:#000000;\">%1</span>").arg(feilMelding));
|
||||
}
|
||||
|
||||
void RedigerKundeDialog::on_pushAvbryt_clicked() {
|
||||
QDialog::close();
|
||||
}
|
||||
|
||||
|
||||
void RedigerKundeDialog::on_pushButton_clicked() {
|
||||
KundeFil oppdatertFil;
|
||||
oppdatertFil.insert("id", ui->lineKundenummer->text().toInt());
|
||||
oppdatertFil.insert("fornavn", ui->lineFornavn->text());
|
||||
oppdatertFil.insert("etternavn", ui->lineEtternavn->text());
|
||||
oppdatertFil.insert("firmanavn", ui->lineFirmanavn->text());
|
||||
oppdatertFil.insert("adresse", ui->lineGate->text());
|
||||
oppdatertFil.insert("postnr", ui->linePostnr->text().toInt());
|
||||
oppdatertFil.insert("sted", ui->lineSted->text());
|
||||
oppdatertFil.insert("epost", ui->lineEpost->text());
|
||||
oppdatertFil.insert("tlf", ui->lineTlf->text().toInt());
|
||||
oppdatertFil.insert("active", true);
|
||||
|
||||
emit oppdaterKundeFil(oppdatertFil);
|
||||
}
|
||||
|
||||
#include "redigerkundedialog.h"
|
||||
#include "ui_redigerkundedialog.h"
|
||||
|
||||
RedigerKundeDialog::RedigerKundeDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::RedigerKundeDialog) {
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->labelFeilMelding->setText("");
|
||||
}
|
||||
|
||||
RedigerKundeDialog::~RedigerKundeDialog() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void RedigerKundeDialog::settInnGamleVerdier(KundeFil gjeldendeKundeFil) {
|
||||
ui->lineKundenummer->setText(gjeldendeKundeFil.value("id").toString());
|
||||
|
||||
ui->lineFornavn->setText(gjeldendeKundeFil.value("fornavn").toString());
|
||||
ui->lineEtternavn->setText(gjeldendeKundeFil.value("etternavn").toString());
|
||||
ui->lineFirmanavn->setText(gjeldendeKundeFil.value("firmanavn").toString());
|
||||
ui->lineGate->setText(gjeldendeKundeFil.value("adresse").toString());
|
||||
ui->linePostnr->setText(gjeldendeKundeFil.value("postnr").toString());
|
||||
ui->lineSted->setText(gjeldendeKundeFil.value("sted").toString());
|
||||
ui->lineEpost->setText(gjeldendeKundeFil.value("epost").toString());
|
||||
ui->lineTlf->setText(gjeldendeKundeFil.value("tlf").toString());
|
||||
|
||||
ui->lineFornavn->selectAll();
|
||||
ui->lineFornavn->setFocus();
|
||||
}
|
||||
|
||||
void RedigerKundeDialog::fokuserElement(UIElementer element) {
|
||||
switch (element) {
|
||||
case UIElementer::FORNAVN:
|
||||
ui->lineFornavn->selectAll();
|
||||
ui->lineFornavn->setFocus();
|
||||
break;
|
||||
case UIElementer::ETTERNAVN:
|
||||
ui->lineEtternavn->selectAll();
|
||||
ui->lineEtternavn->setFocus();
|
||||
break;
|
||||
case UIElementer::FIRMANAVN:
|
||||
ui->lineFirmanavn->selectAll();
|
||||
ui->lineFirmanavn->setFocus();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void RedigerKundeDialog::settFeilMelding(QString feilMelding) {
|
||||
ui->labelFeilMelding->setText(tr("<span style=\"font-weight:600; color:#ff0000;\">Feil: </span><span style=\"font-weight:600;\"/><span style=\"color:#000000;\">%1</span>").arg(feilMelding));
|
||||
}
|
||||
|
||||
void RedigerKundeDialog::on_pushAvbryt_clicked() {
|
||||
QDialog::close();
|
||||
}
|
||||
|
||||
|
||||
void RedigerKundeDialog::on_pushButton_clicked() {
|
||||
KundeFil oppdatertFil;
|
||||
oppdatertFil.insert("id", ui->lineKundenummer->text().toInt());
|
||||
oppdatertFil.insert("fornavn", ui->lineFornavn->text());
|
||||
oppdatertFil.insert("etternavn", ui->lineEtternavn->text());
|
||||
oppdatertFil.insert("firmanavn", ui->lineFirmanavn->text());
|
||||
oppdatertFil.insert("adresse", ui->lineGate->text());
|
||||
oppdatertFil.insert("postnr", ui->linePostnr->text().toInt());
|
||||
oppdatertFil.insert("sted", ui->lineSted->text());
|
||||
oppdatertFil.insert("epost", ui->lineEpost->text());
|
||||
oppdatertFil.insert("tlf", ui->lineTlf->text().toInt());
|
||||
oppdatertFil.insert("active", true);
|
||||
|
||||
emit oppdaterKundeFil(oppdatertFil);
|
||||
}
|
||||
|
||||
|
|
@ -1,34 +1,34 @@
|
|||
#ifndef REDIGERKUNDEDIALOG_H
|
||||
#define REDIGERKUNDEDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "datatypes.h"
|
||||
|
||||
namespace Ui {
|
||||
class RedigerKundeDialog;
|
||||
}
|
||||
|
||||
class RedigerKundeDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RedigerKundeDialog(QWidget *parent = nullptr);
|
||||
~RedigerKundeDialog();
|
||||
|
||||
void settInnGamleVerdier(KundeFil gjeldendeKundeFil);
|
||||
void fokuserElement(UIElementer element);
|
||||
void settFeilMelding(QString feilMelding);
|
||||
|
||||
signals:
|
||||
void oppdaterKundeFil(KundeFil redigertKundeFil);
|
||||
|
||||
private slots:
|
||||
void on_pushAvbryt_clicked();
|
||||
void on_pushButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::RedigerKundeDialog *ui;
|
||||
};
|
||||
|
||||
#endif // REDIGERKUNDEDIALOG_H
|
||||
#ifndef REDIGERKUNDEDIALOG_H
|
||||
#define REDIGERKUNDEDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "datatypes.h"
|
||||
|
||||
namespace Ui {
|
||||
class RedigerKundeDialog;
|
||||
}
|
||||
|
||||
class RedigerKundeDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RedigerKundeDialog(QWidget *parent = nullptr);
|
||||
~RedigerKundeDialog();
|
||||
|
||||
void settInnGamleVerdier(KundeFil gjeldendeKundeFil);
|
||||
void fokuserElement(UIElementer element);
|
||||
void settFeilMelding(QString feilMelding);
|
||||
|
||||
signals:
|
||||
void oppdaterKundeFil(KundeFil redigertKundeFil);
|
||||
|
||||
private slots:
|
||||
void on_pushAvbryt_clicked();
|
||||
void on_pushButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::RedigerKundeDialog *ui;
|
||||
};
|
||||
|
||||
#endif // REDIGERKUNDEDIALOG_H
|
||||
|
|
@ -1,256 +1,256 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>RedigerKundeDialog</class>
|
||||
<widget class="QDialog" name="RedigerKundeDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>359</width>
|
||||
<height>365</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Rediger Kunde</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelFornavn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fornavn:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineFornavn"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelEtternavn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Etternavn:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEtternavn"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelFirmanavn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Firmanavn:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineFirmanavn"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelGateadresse">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Gateadresse:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineGate"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelPostnr">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Postnr:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="linePostnr"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelSted">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sted:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineSted"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="labelTlf">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Telefon:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="lineTlf"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="labelEpost">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Epost:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="lineEpost"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelID">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Kundenummer:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineKundenummer">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelFeilMelding">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<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>
|
||||
<widget class="QPushButton" name="pushAvbryt">
|
||||
<property name="text">
|
||||
<string>Avbryt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Lagre</string>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>RedigerKundeDialog</class>
|
||||
<widget class="QDialog" name="RedigerKundeDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>359</width>
|
||||
<height>365</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Rediger Kunde</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelFornavn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fornavn:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineFornavn"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelEtternavn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Etternavn:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEtternavn"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelFirmanavn">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Firmanavn:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineFirmanavn"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelGateadresse">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Gateadresse:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineGate"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelPostnr">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Postnr:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="linePostnr"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelSted">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sted:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineSted"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="labelTlf">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Telefon:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="lineTlf"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="labelEpost">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Epost:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="lineEpost"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelID">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Kundenummer:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineKundenummer">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelFeilMelding">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<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>
|
||||
<widget class="QPushButton" name="pushAvbryt">
|
||||
<property name="text">
|
||||
<string>Avbryt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Lagre</string>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
@ -1,47 +1,47 @@
|
|||
#include "velgkundeprosjektdialog.h"
|
||||
#include "ui_velgkundeprosjektdialog.h"
|
||||
|
||||
VelgKundeProsjektDialog::VelgKundeProsjektDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::VelgKundeProsjektDialog) {
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
VelgKundeProsjektDialog::~VelgKundeProsjektDialog() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void VelgKundeProsjektDialog::settKundeID(int id) {
|
||||
kundeID = id;
|
||||
}
|
||||
|
||||
int VelgKundeProsjektDialog::hentKundeID() {
|
||||
return kundeID;
|
||||
}
|
||||
|
||||
void VelgKundeProsjektDialog::hentProsjekter(ProsjektKartotek &kartotek, ProsjektBindinger &bindinger) {
|
||||
for (int i = 0; i < kartotek.size(); ++i) {
|
||||
QList<int> prosjektMedlemmer = bindinger.value(kartotek.at(i).value("ordrenummer").toInt());
|
||||
if (!prosjektMedlemmer.contains(kundeID)) {
|
||||
QListWidgetItem *prosjekt = new QListWidgetItem(kartotek.at(i).value("prosjektnavn").toString());
|
||||
prosjekt->setData(Qt::UserRole, kartotek.at(i).value("ordrenummer").toInt());
|
||||
ui->prosjektListe->addItem(prosjekt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VelgKundeProsjektDialog::on_pushAvbryt_clicked() {
|
||||
QDialog::close();
|
||||
}
|
||||
|
||||
|
||||
void VelgKundeProsjektDialog::on_prosjektListe_itemClicked(QListWidgetItem *item) {
|
||||
ui->pushVelg->setEnabled(true);
|
||||
prosjektID = item->data(Qt::UserRole).toInt();
|
||||
}
|
||||
|
||||
|
||||
void VelgKundeProsjektDialog::on_pushVelg_clicked() {
|
||||
emit opprettBinding(kundeID, prosjektID);
|
||||
}
|
||||
|
||||
#include "velgkundeprosjektdialog.h"
|
||||
#include "ui_velgkundeprosjektdialog.h"
|
||||
|
||||
VelgKundeProsjektDialog::VelgKundeProsjektDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::VelgKundeProsjektDialog) {
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
VelgKundeProsjektDialog::~VelgKundeProsjektDialog() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void VelgKundeProsjektDialog::settKundeID(int id) {
|
||||
kundeID = id;
|
||||
}
|
||||
|
||||
int VelgKundeProsjektDialog::hentKundeID() {
|
||||
return kundeID;
|
||||
}
|
||||
|
||||
void VelgKundeProsjektDialog::hentProsjekter(ProsjektKartotek &kartotek, ProsjektBindinger &bindinger) {
|
||||
for (int i = 0; i < kartotek.size(); ++i) {
|
||||
QList<int> prosjektMedlemmer = bindinger.value(kartotek.at(i).value("ordrenummer").toInt());
|
||||
if (!prosjektMedlemmer.contains(kundeID)) {
|
||||
QListWidgetItem *prosjekt = new QListWidgetItem(kartotek.at(i).value("prosjektnavn").toString());
|
||||
prosjekt->setData(Qt::UserRole, kartotek.at(i).value("ordrenummer").toInt());
|
||||
ui->prosjektListe->addItem(prosjekt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VelgKundeProsjektDialog::on_pushAvbryt_clicked() {
|
||||
QDialog::close();
|
||||
}
|
||||
|
||||
|
||||
void VelgKundeProsjektDialog::on_prosjektListe_itemClicked(QListWidgetItem *item) {
|
||||
ui->pushVelg->setEnabled(true);
|
||||
prosjektID = item->data(Qt::UserRole).toInt();
|
||||
}
|
||||
|
||||
|
||||
void VelgKundeProsjektDialog::on_pushVelg_clicked() {
|
||||
emit opprettBinding(kundeID, prosjektID);
|
||||
}
|
||||
|
||||
|
|
@ -1,39 +1,39 @@
|
|||
#ifndef VELGKUNDEPROSJEKTDIALOG_H
|
||||
#define VELGKUNDEPROSJEKTDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QListWidgetItem>
|
||||
#include "datatypes.h"
|
||||
|
||||
namespace Ui {
|
||||
class VelgKundeProsjektDialog;
|
||||
}
|
||||
|
||||
class VelgKundeProsjektDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit VelgKundeProsjektDialog(QWidget *parent = nullptr);
|
||||
~VelgKundeProsjektDialog();
|
||||
|
||||
void settKundeID(int id);
|
||||
int hentKundeID();
|
||||
|
||||
void hentProsjekter(ProsjektKartotek &kartotek, ProsjektBindinger &bindinger);
|
||||
|
||||
signals:
|
||||
void opprettBinding(int kunde, int prosjekt);
|
||||
|
||||
private slots:
|
||||
void on_pushAvbryt_clicked();
|
||||
void on_prosjektListe_itemClicked(QListWidgetItem *item);
|
||||
|
||||
void on_pushVelg_clicked();
|
||||
|
||||
private:
|
||||
Ui::VelgKundeProsjektDialog *ui;
|
||||
int kundeID, prosjektID;
|
||||
};
|
||||
|
||||
#endif // VELGKUNDEPROSJEKTDIALOG_H
|
||||
#ifndef VELGKUNDEPROSJEKTDIALOG_H
|
||||
#define VELGKUNDEPROSJEKTDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QListWidgetItem>
|
||||
#include "datatypes.h"
|
||||
|
||||
namespace Ui {
|
||||
class VelgKundeProsjektDialog;
|
||||
}
|
||||
|
||||
class VelgKundeProsjektDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit VelgKundeProsjektDialog(QWidget *parent = nullptr);
|
||||
~VelgKundeProsjektDialog();
|
||||
|
||||
void settKundeID(int id);
|
||||
int hentKundeID();
|
||||
|
||||
void hentProsjekter(ProsjektKartotek &kartotek, ProsjektBindinger &bindinger);
|
||||
|
||||
signals:
|
||||
void opprettBinding(int kunde, int prosjekt);
|
||||
|
||||
private slots:
|
||||
void on_pushAvbryt_clicked();
|
||||
void on_prosjektListe_itemClicked(QListWidgetItem *item);
|
||||
|
||||
void on_pushVelg_clicked();
|
||||
|
||||
private:
|
||||
Ui::VelgKundeProsjektDialog *ui;
|
||||
int kundeID, prosjektID;
|
||||
};
|
||||
|
||||
#endif // VELGKUNDEPROSJEKTDIALOG_H
|
||||
|
|
@ -1,61 +1,61 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>VelgKundeProsjektDialog</class>
|
||||
<widget class="QDialog" name="VelgKundeProsjektDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Velg et prosjekt for kunden</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QListWidget" name="prosjektListe"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<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>
|
||||
<widget class="QPushButton" name="pushAvbryt">
|
||||
<property name="text">
|
||||
<string>Avbryt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushVelg">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Velg prosjekt</string>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>VelgKundeProsjektDialog</class>
|
||||
<widget class="QDialog" name="VelgKundeProsjektDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Velg et prosjekt for kunden</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QListWidget" name="prosjektListe"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<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>
|
||||
<widget class="QPushButton" name="pushAvbryt">
|
||||
<property name="text">
|
||||
<string>Avbryt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushVelg">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Velg prosjekt</string>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
@ -1,91 +1,91 @@
|
|||
#include "nyttprosjektdialog.h"
|
||||
#include "ui_nyttprosjektdialog.h"
|
||||
|
||||
NyttProsjektDialog::NyttProsjektDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::NyttProsjektDialog) {
|
||||
ui->setupUi(this);
|
||||
|
||||
QDateTime iDag = QDateTime::currentDateTime();
|
||||
QDate dagensDato = iDag.date();
|
||||
|
||||
ui->dateStart->setMinimumDate(dagensDato);
|
||||
ui->dateSlutt->setMinimumDate(dagensDato);
|
||||
}
|
||||
|
||||
NyttProsjektDialog::~NyttProsjektDialog() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void NyttProsjektDialog::opprettOrdreNr(int ordreNr) {
|
||||
ui->lineOrdrenummer->setText(QString::number(ordreNr));
|
||||
}
|
||||
|
||||
void NyttProsjektDialog::fokusStart() {
|
||||
ui->lineProsjektNavn->setFocus();
|
||||
}
|
||||
|
||||
void NyttProsjektDialog::on_pushAvbryt_clicked() {
|
||||
QDialog::close();
|
||||
}
|
||||
|
||||
|
||||
void NyttProsjektDialog::on_pushLagre_clicked() {
|
||||
ProsjektFil nyttProsjekt;
|
||||
|
||||
nyttProsjekt.insert("prosjektnavn", ui->lineProsjektNavn->text());
|
||||
nyttProsjekt.insert("ordrenummer", ui->lineOrdrenummer->text().toInt());
|
||||
nyttProsjekt.insert("prosjektbeskrivelse", ui->textEditProsjektBeskrivelse->toHtml());
|
||||
nyttProsjekt.insert("varslestart", ui->checkVarsleStart->isChecked());
|
||||
nyttProsjekt.insert("varsleslutt", ui->checkVarsleSlutt->isChecked());
|
||||
|
||||
QDateTime prosjektStartDato = ui->dateStart->dateTime();
|
||||
quint64 mSekStart = prosjektStartDato.toMSecsSinceEpoch() + ui->timeStart->time().msecsSinceStartOfDay();
|
||||
|
||||
QDateTime prosjektSluttDato = ui->dateSlutt->dateTime();
|
||||
quint64 mSekSlutt = prosjektSluttDato.toMSecsSinceEpoch() + ui->timeSlutt->time().msecsSinceStartOfDay();
|
||||
|
||||
nyttProsjekt.insert("prosjektstart", mSekStart);
|
||||
nyttProsjekt.insert("prosjektslutt", mSekSlutt);
|
||||
|
||||
int dognVarselStart = ui->spinBoxAntallDognVarslingStart->value();
|
||||
int timerVarselStart = ui->spinBoxTimerForStart->value();
|
||||
quint64 epochVarselDognStart = dognVarselStart * 24 * 60 * 60 * 1000;
|
||||
quint64 epochVarselTimerStart = timerVarselStart * 60 * 60 * 1000;
|
||||
quint64 epochVarselStart = epochVarselDognStart + epochVarselTimerStart;
|
||||
|
||||
int dognVarselSlutt = ui->spinBoxAntallDognVarslingSlutt->value();
|
||||
int timerVarselSlutt = ui->spinBoxTimerForSlutt->value();
|
||||
quint64 epochVarselDognSlutt = dognVarselSlutt * 24 * 60 * 60 * 1000;
|
||||
quint64 epochVarselTimerSlutt = timerVarselSlutt * 60 * 60 * 1000;
|
||||
quint64 epochVarselSlutt = epochVarselDognSlutt + epochVarselTimerSlutt;
|
||||
|
||||
nyttProsjekt.insert("varselstart", epochVarselStart);
|
||||
nyttProsjekt.insert("varselslutt", epochVarselSlutt);
|
||||
nyttProsjekt.insert("dognvarselstart", ui->spinBoxAntallDognVarslingStart->value());
|
||||
nyttProsjekt.insert("dognvarselslutt", ui->spinBoxAntallDognVarslingSlutt->value());
|
||||
nyttProsjekt.insert("timervarselstart", ui->spinBoxTimerForStart->value());
|
||||
nyttProsjekt.insert("timercarselslutt", ui->spinBoxTimerForSlutt->value());
|
||||
|
||||
nyttProsjekt.insert("active", true);
|
||||
nyttProsjekt.insert("ferdig", false);
|
||||
|
||||
emit leggTilProsjekt(nyttProsjekt);
|
||||
}
|
||||
|
||||
|
||||
void NyttProsjektDialog::on_checkVarsleStart_clicked() {
|
||||
endreVarselStatus();
|
||||
}
|
||||
|
||||
|
||||
void NyttProsjektDialog::on_checkVarsleSlutt_clicked() {
|
||||
endreVarselStatus();
|
||||
}
|
||||
|
||||
void NyttProsjektDialog::endreVarselStatus() {
|
||||
ui->spinBoxAntallDognVarslingSlutt->setEnabled(ui->checkVarsleSlutt->isChecked());
|
||||
ui->spinBoxTimerForSlutt->setEnabled(ui->checkVarsleSlutt->isChecked());
|
||||
ui->spinBoxAntallDognVarslingStart->setEnabled(ui->checkVarsleStart->isChecked());
|
||||
ui->spinBoxTimerForStart->setEnabled(ui->checkVarsleStart->isChecked());
|
||||
}
|
||||
#include "nyttprosjektdialog.h"
|
||||
#include "ui_nyttprosjektdialog.h"
|
||||
|
||||
NyttProsjektDialog::NyttProsjektDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::NyttProsjektDialog) {
|
||||
ui->setupUi(this);
|
||||
|
||||
QDateTime iDag = QDateTime::currentDateTime();
|
||||
QDate dagensDato = iDag.date();
|
||||
|
||||
ui->dateStart->setMinimumDate(dagensDato);
|
||||
ui->dateSlutt->setMinimumDate(dagensDato);
|
||||
}
|
||||
|
||||
NyttProsjektDialog::~NyttProsjektDialog() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void NyttProsjektDialog::opprettOrdreNr(int ordreNr) {
|
||||
ui->lineOrdrenummer->setText(QString::number(ordreNr));
|
||||
}
|
||||
|
||||
void NyttProsjektDialog::fokusStart() {
|
||||
ui->lineProsjektNavn->setFocus();
|
||||
}
|
||||
|
||||
void NyttProsjektDialog::on_pushAvbryt_clicked() {
|
||||
QDialog::close();
|
||||
}
|
||||
|
||||
|
||||
void NyttProsjektDialog::on_pushLagre_clicked() {
|
||||
ProsjektFil nyttProsjekt;
|
||||
|
||||
nyttProsjekt.insert("prosjektnavn", ui->lineProsjektNavn->text());
|
||||
nyttProsjekt.insert("ordrenummer", ui->lineOrdrenummer->text().toInt());
|
||||
nyttProsjekt.insert("prosjektbeskrivelse", ui->textEditProsjektBeskrivelse->toHtml());
|
||||
nyttProsjekt.insert("varslestart", ui->checkVarsleStart->isChecked());
|
||||
nyttProsjekt.insert("varsleslutt", ui->checkVarsleSlutt->isChecked());
|
||||
|
||||
QDateTime prosjektStartDato = ui->dateStart->dateTime();
|
||||
quint64 mSekStart = prosjektStartDato.toMSecsSinceEpoch() + ui->timeStart->time().msecsSinceStartOfDay();
|
||||
|
||||
QDateTime prosjektSluttDato = ui->dateSlutt->dateTime();
|
||||
quint64 mSekSlutt = prosjektSluttDato.toMSecsSinceEpoch() + ui->timeSlutt->time().msecsSinceStartOfDay();
|
||||
|
||||
nyttProsjekt.insert("prosjektstart", mSekStart);
|
||||
nyttProsjekt.insert("prosjektslutt", mSekSlutt);
|
||||
|
||||
int dognVarselStart = ui->spinBoxAntallDognVarslingStart->value();
|
||||
int timerVarselStart = ui->spinBoxTimerForStart->value();
|
||||
quint64 epochVarselDognStart = dognVarselStart * 24 * 60 * 60 * 1000;
|
||||
quint64 epochVarselTimerStart = timerVarselStart * 60 * 60 * 1000;
|
||||
quint64 epochVarselStart = epochVarselDognStart + epochVarselTimerStart;
|
||||
|
||||
int dognVarselSlutt = ui->spinBoxAntallDognVarslingSlutt->value();
|
||||
int timerVarselSlutt = ui->spinBoxTimerForSlutt->value();
|
||||
quint64 epochVarselDognSlutt = dognVarselSlutt * 24 * 60 * 60 * 1000;
|
||||
quint64 epochVarselTimerSlutt = timerVarselSlutt * 60 * 60 * 1000;
|
||||
quint64 epochVarselSlutt = epochVarselDognSlutt + epochVarselTimerSlutt;
|
||||
|
||||
nyttProsjekt.insert("varselstart", epochVarselStart);
|
||||
nyttProsjekt.insert("varselslutt", epochVarselSlutt);
|
||||
nyttProsjekt.insert("dognvarselstart", ui->spinBoxAntallDognVarslingStart->value());
|
||||
nyttProsjekt.insert("dognvarselslutt", ui->spinBoxAntallDognVarslingSlutt->value());
|
||||
nyttProsjekt.insert("timervarselstart", ui->spinBoxTimerForStart->value());
|
||||
nyttProsjekt.insert("timercarselslutt", ui->spinBoxTimerForSlutt->value());
|
||||
|
||||
nyttProsjekt.insert("active", true);
|
||||
nyttProsjekt.insert("ferdig", false);
|
||||
|
||||
emit leggTilProsjekt(nyttProsjekt);
|
||||
}
|
||||
|
||||
|
||||
void NyttProsjektDialog::on_checkVarsleStart_clicked() {
|
||||
endreVarselStatus();
|
||||
}
|
||||
|
||||
|
||||
void NyttProsjektDialog::on_checkVarsleSlutt_clicked() {
|
||||
endreVarselStatus();
|
||||
}
|
||||
|
||||
void NyttProsjektDialog::endreVarselStatus() {
|
||||
ui->spinBoxAntallDognVarslingSlutt->setEnabled(ui->checkVarsleSlutt->isChecked());
|
||||
ui->spinBoxTimerForSlutt->setEnabled(ui->checkVarsleSlutt->isChecked());
|
||||
ui->spinBoxAntallDognVarslingStart->setEnabled(ui->checkVarsleStart->isChecked());
|
||||
ui->spinBoxTimerForStart->setEnabled(ui->checkVarsleStart->isChecked());
|
||||
}
|
||||
|
|
@ -1,37 +1,37 @@
|
|||
#ifndef NYTTPROSJEKTDIALOG_H
|
||||
#define NYTTPROSJEKTDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "datatypes.h"
|
||||
|
||||
namespace Ui {
|
||||
class NyttProsjektDialog;
|
||||
}
|
||||
|
||||
class NyttProsjektDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit NyttProsjektDialog(QWidget *parent = nullptr);
|
||||
~NyttProsjektDialog();
|
||||
|
||||
void opprettOrdreNr(int ordreNr);
|
||||
void fokusStart();
|
||||
|
||||
signals:
|
||||
void leggTilProsjekt(ProsjektFil prosjekt);
|
||||
|
||||
private slots:
|
||||
void on_pushAvbryt_clicked();
|
||||
void on_pushLagre_clicked();
|
||||
void on_checkVarsleStart_clicked();
|
||||
void on_checkVarsleSlutt_clicked();
|
||||
|
||||
private:
|
||||
Ui::NyttProsjektDialog *ui;
|
||||
|
||||
void endreVarselStatus();
|
||||
};
|
||||
|
||||
#endif // NYTTPROSJEKTDIALOG_H
|
||||
#ifndef NYTTPROSJEKTDIALOG_H
|
||||
#define NYTTPROSJEKTDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "datatypes.h"
|
||||
|
||||
namespace Ui {
|
||||
class NyttProsjektDialog;
|
||||
}
|
||||
|
||||
class NyttProsjektDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit NyttProsjektDialog(QWidget *parent = nullptr);
|
||||
~NyttProsjektDialog();
|
||||
|
||||
void opprettOrdreNr(int ordreNr);
|
||||
void fokusStart();
|
||||
|
||||
signals:
|
||||
void leggTilProsjekt(ProsjektFil prosjekt);
|
||||
|
||||
private slots:
|
||||
void on_pushAvbryt_clicked();
|
||||
void on_pushLagre_clicked();
|
||||
void on_checkVarsleStart_clicked();
|
||||
void on_checkVarsleSlutt_clicked();
|
||||
|
||||
private:
|
||||
Ui::NyttProsjektDialog *ui;
|
||||
|
||||
void endreVarselStatus();
|
||||
};
|
||||
|
||||
#endif // NYTTPROSJEKTDIALOG_H
|
||||
File diff suppressed because it is too large
Load Diff
21
src/uidialogs/widgetdialogs/prosjekt/prosjektdialoger.pri
Normal file
21
src/uidialogs/widgetdialogs/prosjekt/prosjektdialoger.pri
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
INCLUDEPATH += \
|
||||
$$PWD/../../core \
|
||||
$$PWD/../../mainwidgets
|
||||
DEPENDPATH += \
|
||||
$$PWD/../../core \
|
||||
$$PWD/../../mainwidgets
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/nyttprosjektdialog.cpp \
|
||||
$$PWD/redigerprosjektdialog.cpp
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/nyttprosjektdialog.h \
|
||||
$$PWD/redigerprosjektdialog.h
|
||||
|
||||
FORMS += \
|
||||
$$PWD/nyttprosjektdialog.ui \
|
||||
$$PWD/redigerprosjektdialog.ui
|
||||
|
||||
RESOURCES += \
|
||||
$$PWD/../../../../resources.qrc
|
||||
|
|
@ -1,111 +1,111 @@
|
|||
#include "redigerprosjektdialog.h"
|
||||
#include "ui_redigerprosjektdialog.h"
|
||||
|
||||
RedigerProsjektDialog::RedigerProsjektDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::RedigerProsjektDialog) {
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
RedigerProsjektDialog::~RedigerProsjektDialog() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void RedigerProsjektDialog::settProsjektFil(ProsjektFil prosjekt) {
|
||||
prosjektFil = prosjekt;
|
||||
fyllSkjemaElementer();
|
||||
}
|
||||
|
||||
void RedigerProsjektDialog::fyllSkjemaElementer() {
|
||||
ui->lineProsjektNavn->setText(prosjektFil.value("prosjektnavn").toString());
|
||||
ui->lineOrdrenummer->setText(prosjektFil.value("ordrenummer").toString());
|
||||
ui->textEditProsjektBeskrivelse->setHtml(prosjektFil.value("prosjektbeskrivelse").toString());
|
||||
ui->checkVarsleStart->setChecked(prosjektFil.value("varslestart").toBool());
|
||||
ui->checkVarsleSlutt->setChecked(prosjektFil.value("varsleslutt").toBool());
|
||||
endreVarselStatus();
|
||||
|
||||
quint64 prosjektStart = prosjektFil.value("prosjektstart").toULongLong();
|
||||
quint64 prosjektSlutt = prosjektFil.value("prosjektslutt").toULongLong();
|
||||
QDateTime tProsjektStart(QDateTime::fromMSecsSinceEpoch(prosjektStart));
|
||||
QDateTime tProsjektSlutt(QDateTime::fromMSecsSinceEpoch(prosjektSlutt));
|
||||
|
||||
ui->dateStart->setDateTime(tProsjektStart);
|
||||
ui->dateSlutt->setDateTime(tProsjektSlutt);
|
||||
ui->timeStart->setDateTime(tProsjektStart);
|
||||
ui->timeSlutt->setDateTime(tProsjektSlutt);
|
||||
|
||||
ui->spinBoxAntallDognVarslingStart->setValue(prosjektFil.value("dognvarselstart").toInt());
|
||||
ui->spinBoxAntallDognVarslingSlutt->setValue(prosjektFil.value("dognvarselslutt").toInt());
|
||||
ui->spinBoxTimerForStart->setValue(prosjektFil.value("timervarselstart").toInt());
|
||||
ui->spinBoxTimerForSlutt->setValue(prosjektFil.value("timercarselslutt").toInt());
|
||||
}
|
||||
|
||||
void RedigerProsjektDialog::on_checkVarsleStart_clicked() {
|
||||
endreVarselStatus();
|
||||
}
|
||||
|
||||
|
||||
void RedigerProsjektDialog::on_checkVarsleSlutt_clicked() {
|
||||
endreVarselStatus();
|
||||
}
|
||||
|
||||
void RedigerProsjektDialog::endreVarselStatus() {
|
||||
ui->spinBoxAntallDognVarslingSlutt->setEnabled(ui->checkVarsleSlutt->isChecked());
|
||||
ui->spinBoxTimerForSlutt->setEnabled(ui->checkVarsleSlutt->isChecked());
|
||||
ui->spinBoxAntallDognVarslingStart->setEnabled(ui->checkVarsleStart->isChecked());
|
||||
ui->spinBoxTimerForStart->setEnabled(ui->checkVarsleStart->isChecked());
|
||||
}
|
||||
|
||||
|
||||
void RedigerProsjektDialog::on_pushAvbryt_clicked() {
|
||||
QDialog::close();
|
||||
}
|
||||
|
||||
|
||||
void RedigerProsjektDialog::on_pushLagre_clicked() {
|
||||
ProsjektFil nyttProsjekt;
|
||||
|
||||
nyttProsjekt.insert("prosjektnavn", ui->lineProsjektNavn->text());
|
||||
nyttProsjekt.insert("ordrenummer", ui->lineOrdrenummer->text().toInt());
|
||||
nyttProsjekt.insert("prosjektbeskrivelse", ui->textEditProsjektBeskrivelse->toHtml());
|
||||
nyttProsjekt.insert("varslestart", ui->checkVarsleStart->isChecked());
|
||||
nyttProsjekt.insert("varsleslutt", ui->checkVarsleSlutt->isChecked());
|
||||
|
||||
QDateTime prosjektStartDato = ui->dateStart->dateTime();
|
||||
quint64 mSekStart = prosjektStartDato.toMSecsSinceEpoch() + ui->timeStart->time().msecsSinceStartOfDay();
|
||||
|
||||
QDateTime prosjektSluttDato = ui->dateSlutt->dateTime();
|
||||
quint64 mSekSlutt = prosjektSluttDato.toMSecsSinceEpoch() + ui->timeSlutt->time().msecsSinceStartOfDay();
|
||||
|
||||
nyttProsjekt.insert("prosjektstart", mSekStart);
|
||||
nyttProsjekt.insert("prosjektslutt", mSekSlutt);
|
||||
|
||||
int dognVarselStart = ui->spinBoxAntallDognVarslingStart->value();
|
||||
int timerVarselStart = ui->spinBoxTimerForStart->value();
|
||||
quint64 epochVarselDognStart = dognVarselStart * 24 * 60 * 60 * 1000;
|
||||
quint64 epochVarselTimerStart = timerVarselStart * 60 * 60 * 1000;
|
||||
quint64 epochVarselStart = epochVarselDognStart + epochVarselTimerStart;
|
||||
|
||||
int dognVarselSlutt = ui->spinBoxAntallDognVarslingSlutt->value();
|
||||
int timerVarselSlutt = ui->spinBoxTimerForSlutt->value();
|
||||
quint64 epochVarselDognSlutt = dognVarselSlutt * 24 * 60 * 60 * 1000;
|
||||
quint64 epochVarselTimerSlutt = timerVarselSlutt * 60 * 60 * 1000;
|
||||
quint64 epochVarselSlutt = epochVarselDognSlutt + epochVarselTimerSlutt;
|
||||
|
||||
nyttProsjekt.insert("varselstart", epochVarselStart);
|
||||
nyttProsjekt.insert("varselslutt", epochVarselSlutt);
|
||||
nyttProsjekt.insert("dognvarselstart", ui->spinBoxAntallDognVarslingStart->value());
|
||||
nyttProsjekt.insert("dognvarselslutt", ui->spinBoxAntallDognVarslingSlutt->value());
|
||||
nyttProsjekt.insert("timervarselstart", ui->spinBoxTimerForStart->value());
|
||||
nyttProsjekt.insert("timercarselslutt", ui->spinBoxTimerForSlutt->value());
|
||||
|
||||
nyttProsjekt.insert("active", true);
|
||||
nyttProsjekt.insert("ferdig", false);
|
||||
|
||||
emit lagreProsjekt(nyttProsjekt);
|
||||
}
|
||||
|
||||
void RedigerProsjektDialog::fokusStart() {
|
||||
ui->lineProsjektNavn->setFocus();
|
||||
ui->lineProsjektNavn->selectAll();
|
||||
}
|
||||
#include "redigerprosjektdialog.h"
|
||||
#include "ui_redigerprosjektdialog.h"
|
||||
|
||||
RedigerProsjektDialog::RedigerProsjektDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::RedigerProsjektDialog) {
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
RedigerProsjektDialog::~RedigerProsjektDialog() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void RedigerProsjektDialog::settProsjektFil(ProsjektFil prosjekt) {
|
||||
prosjektFil = prosjekt;
|
||||
fyllSkjemaElementer();
|
||||
}
|
||||
|
||||
void RedigerProsjektDialog::fyllSkjemaElementer() {
|
||||
ui->lineProsjektNavn->setText(prosjektFil.value("prosjektnavn").toString());
|
||||
ui->lineOrdrenummer->setText(prosjektFil.value("ordrenummer").toString());
|
||||
ui->textEditProsjektBeskrivelse->setHtml(prosjektFil.value("prosjektbeskrivelse").toString());
|
||||
ui->checkVarsleStart->setChecked(prosjektFil.value("varslestart").toBool());
|
||||
ui->checkVarsleSlutt->setChecked(prosjektFil.value("varsleslutt").toBool());
|
||||
endreVarselStatus();
|
||||
|
||||
quint64 prosjektStart = prosjektFil.value("prosjektstart").toULongLong();
|
||||
quint64 prosjektSlutt = prosjektFil.value("prosjektslutt").toULongLong();
|
||||
QDateTime tProsjektStart(QDateTime::fromMSecsSinceEpoch(prosjektStart));
|
||||
QDateTime tProsjektSlutt(QDateTime::fromMSecsSinceEpoch(prosjektSlutt));
|
||||
|
||||
ui->dateStart->setDateTime(tProsjektStart);
|
||||
ui->dateSlutt->setDateTime(tProsjektSlutt);
|
||||
ui->timeStart->setDateTime(tProsjektStart);
|
||||
ui->timeSlutt->setDateTime(tProsjektSlutt);
|
||||
|
||||
ui->spinBoxAntallDognVarslingStart->setValue(prosjektFil.value("dognvarselstart").toInt());
|
||||
ui->spinBoxAntallDognVarslingSlutt->setValue(prosjektFil.value("dognvarselslutt").toInt());
|
||||
ui->spinBoxTimerForStart->setValue(prosjektFil.value("timervarselstart").toInt());
|
||||
ui->spinBoxTimerForSlutt->setValue(prosjektFil.value("timercarselslutt").toInt());
|
||||
}
|
||||
|
||||
void RedigerProsjektDialog::on_checkVarsleStart_clicked() {
|
||||
endreVarselStatus();
|
||||
}
|
||||
|
||||
|
||||
void RedigerProsjektDialog::on_checkVarsleSlutt_clicked() {
|
||||
endreVarselStatus();
|
||||
}
|
||||
|
||||
void RedigerProsjektDialog::endreVarselStatus() {
|
||||
ui->spinBoxAntallDognVarslingSlutt->setEnabled(ui->checkVarsleSlutt->isChecked());
|
||||
ui->spinBoxTimerForSlutt->setEnabled(ui->checkVarsleSlutt->isChecked());
|
||||
ui->spinBoxAntallDognVarslingStart->setEnabled(ui->checkVarsleStart->isChecked());
|
||||
ui->spinBoxTimerForStart->setEnabled(ui->checkVarsleStart->isChecked());
|
||||
}
|
||||
|
||||
|
||||
void RedigerProsjektDialog::on_pushAvbryt_clicked() {
|
||||
QDialog::close();
|
||||
}
|
||||
|
||||
|
||||
void RedigerProsjektDialog::on_pushLagre_clicked() {
|
||||
ProsjektFil nyttProsjekt;
|
||||
|
||||
nyttProsjekt.insert("prosjektnavn", ui->lineProsjektNavn->text());
|
||||
nyttProsjekt.insert("ordrenummer", ui->lineOrdrenummer->text().toInt());
|
||||
nyttProsjekt.insert("prosjektbeskrivelse", ui->textEditProsjektBeskrivelse->toHtml());
|
||||
nyttProsjekt.insert("varslestart", ui->checkVarsleStart->isChecked());
|
||||
nyttProsjekt.insert("varsleslutt", ui->checkVarsleSlutt->isChecked());
|
||||
|
||||
QDateTime prosjektStartDato = ui->dateStart->dateTime();
|
||||
quint64 mSekStart = prosjektStartDato.toMSecsSinceEpoch() + ui->timeStart->time().msecsSinceStartOfDay();
|
||||
|
||||
QDateTime prosjektSluttDato = ui->dateSlutt->dateTime();
|
||||
quint64 mSekSlutt = prosjektSluttDato.toMSecsSinceEpoch() + ui->timeSlutt->time().msecsSinceStartOfDay();
|
||||
|
||||
nyttProsjekt.insert("prosjektstart", mSekStart);
|
||||
nyttProsjekt.insert("prosjektslutt", mSekSlutt);
|
||||
|
||||
int dognVarselStart = ui->spinBoxAntallDognVarslingStart->value();
|
||||
int timerVarselStart = ui->spinBoxTimerForStart->value();
|
||||
quint64 epochVarselDognStart = dognVarselStart * 24 * 60 * 60 * 1000;
|
||||
quint64 epochVarselTimerStart = timerVarselStart * 60 * 60 * 1000;
|
||||
quint64 epochVarselStart = epochVarselDognStart + epochVarselTimerStart;
|
||||
|
||||
int dognVarselSlutt = ui->spinBoxAntallDognVarslingSlutt->value();
|
||||
int timerVarselSlutt = ui->spinBoxTimerForSlutt->value();
|
||||
quint64 epochVarselDognSlutt = dognVarselSlutt * 24 * 60 * 60 * 1000;
|
||||
quint64 epochVarselTimerSlutt = timerVarselSlutt * 60 * 60 * 1000;
|
||||
quint64 epochVarselSlutt = epochVarselDognSlutt + epochVarselTimerSlutt;
|
||||
|
||||
nyttProsjekt.insert("varselstart", epochVarselStart);
|
||||
nyttProsjekt.insert("varselslutt", epochVarselSlutt);
|
||||
nyttProsjekt.insert("dognvarselstart", ui->spinBoxAntallDognVarslingStart->value());
|
||||
nyttProsjekt.insert("dognvarselslutt", ui->spinBoxAntallDognVarslingSlutt->value());
|
||||
nyttProsjekt.insert("timervarselstart", ui->spinBoxTimerForStart->value());
|
||||
nyttProsjekt.insert("timercarselslutt", ui->spinBoxTimerForSlutt->value());
|
||||
|
||||
nyttProsjekt.insert("active", true);
|
||||
nyttProsjekt.insert("ferdig", false);
|
||||
|
||||
emit lagreProsjekt(nyttProsjekt);
|
||||
}
|
||||
|
||||
void RedigerProsjektDialog::fokusStart() {
|
||||
ui->lineProsjektNavn->setFocus();
|
||||
ui->lineProsjektNavn->selectAll();
|
||||
}
|
||||
|
|
@ -1,38 +1,38 @@
|
|||
#ifndef REDIGERPROSJEKTDIALOG_H
|
||||
#define REDIGERPROSJEKTDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "datatypes.h"
|
||||
|
||||
namespace Ui {
|
||||
class RedigerProsjektDialog;
|
||||
}
|
||||
|
||||
class RedigerProsjektDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RedigerProsjektDialog(QWidget *parent = nullptr);
|
||||
~RedigerProsjektDialog();
|
||||
void settProsjektFil(ProsjektFil prosjekt);
|
||||
void fokusStart();
|
||||
|
||||
signals:
|
||||
void lagreProsjekt(ProsjektFil prosjekt);
|
||||
|
||||
private slots:
|
||||
void on_checkVarsleStart_clicked();
|
||||
void on_checkVarsleSlutt_clicked();
|
||||
void endreVarselStatus();
|
||||
void on_pushAvbryt_clicked();
|
||||
void on_pushLagre_clicked();
|
||||
|
||||
private:
|
||||
Ui::RedigerProsjektDialog *ui;
|
||||
ProsjektFil prosjektFil;
|
||||
|
||||
void fyllSkjemaElementer();
|
||||
};
|
||||
|
||||
#endif // REDIGERPROSJEKTDIALOG_H
|
||||
#ifndef REDIGERPROSJEKTDIALOG_H
|
||||
#define REDIGERPROSJEKTDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "datatypes.h"
|
||||
|
||||
namespace Ui {
|
||||
class RedigerProsjektDialog;
|
||||
}
|
||||
|
||||
class RedigerProsjektDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RedigerProsjektDialog(QWidget *parent = nullptr);
|
||||
~RedigerProsjektDialog();
|
||||
void settProsjektFil(ProsjektFil prosjekt);
|
||||
void fokusStart();
|
||||
|
||||
signals:
|
||||
void lagreProsjekt(ProsjektFil prosjekt);
|
||||
|
||||
private slots:
|
||||
void on_checkVarsleStart_clicked();
|
||||
void on_checkVarsleSlutt_clicked();
|
||||
void endreVarselStatus();
|
||||
void on_pushAvbryt_clicked();
|
||||
void on_pushLagre_clicked();
|
||||
|
||||
private:
|
||||
Ui::RedigerProsjektDialog *ui;
|
||||
ProsjektFil prosjektFil;
|
||||
|
||||
void fyllSkjemaElementer();
|
||||
};
|
||||
|
||||
#endif // REDIGERPROSJEKTDIALOG_H
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user