add: connect interface
This commit is contained in:
parent
6f2593d298
commit
e1c8ce23c5
@ -20,18 +20,25 @@ set(MAIN_SOURCES
|
|||||||
view/main_window.cpp
|
view/main_window.cpp
|
||||||
view/main_window.h
|
view/main_window.h
|
||||||
|
|
||||||
|
view/about_dialog.cpp
|
||||||
|
view/formula_dialog.cpp
|
||||||
|
view/update_dialog.cpp
|
||||||
|
view/printer_settings.cpp
|
||||||
|
view/add_preset.cpp
|
||||||
|
view/delete_preset.cpp
|
||||||
|
view/edit_preset.cpp
|
||||||
|
|
||||||
view/ui/about.ui
|
view/ui/about.ui
|
||||||
view/ui/main_window.ui
|
view/ui/main_window.ui
|
||||||
view/ui/del_preset.ui
|
view/ui/del_preset.ui
|
||||||
view/ui/edit_preset.ui
|
view/ui/edit_preset.ui
|
||||||
view/ui/formula.ui
|
view/ui/formula.ui
|
||||||
view/ui/settings_preset.ui
|
view/ui/settings_preset.ui
|
||||||
view/ui/settings.ui
|
view/ui/printer_settings.ui
|
||||||
view/ui/updates.ui
|
view/ui/updates.ui
|
||||||
view/ui/add_printer.ui
|
view/ui/add_preset.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
||||||
qt_add_executable(Calc3D
|
qt_add_executable(Calc3D
|
||||||
MANUAL_FINALIZATION
|
MANUAL_FINALIZATION
|
||||||
@ -43,6 +50,12 @@ else()
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
qt_add_resources(Calc3D "app_resources"
|
||||||
|
PREFIX "/"
|
||||||
|
FILES
|
||||||
|
view/resources.qrc
|
||||||
|
)
|
||||||
|
|
||||||
target_link_libraries(Calc3D PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Core)
|
target_link_libraries(Calc3D PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Core)
|
||||||
|
|
||||||
set_target_properties(Calc3D PROPERTIES
|
set_target_properties(Calc3D PROPERTIES
|
||||||
|
10
src/view/about_dialog.cpp
Normal file
10
src/view/about_dialog.cpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include "about_dialog.h"
|
||||||
|
#include "ui/ui_about.h"
|
||||||
|
|
||||||
|
AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent), ui(new Ui::About) {
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
setWindowIcon(QIcon("img/logo-1.png"));
|
||||||
|
}
|
||||||
|
|
||||||
|
AboutDialog::~AboutDialog() { delete ui; }
|
21
src/view/about_dialog.h
Normal file
21
src/view/about_dialog.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#ifndef ABOUTDIALOG_H
|
||||||
|
#define ABOUTDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class About;
|
||||||
|
}
|
||||||
|
|
||||||
|
class AboutDialog : public QDialog {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit AboutDialog(QWidget *parent = nullptr);
|
||||||
|
~AboutDialog();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::About *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ABOUTDIALOG_H
|
28
src/view/add_preset.cpp
Normal file
28
src/view/add_preset.cpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#include "add_preset.h"
|
||||||
|
|
||||||
|
#include "ui/ui_add_preset.h"
|
||||||
|
|
||||||
|
AddPresetDialog::AddPresetDialog(QWidget *parent)
|
||||||
|
: QDialog(parent), ui(new Ui::AddPrinter) {
|
||||||
|
ui->setupUi(this);
|
||||||
|
setWindowIcon(QIcon("img/logo-1.png"));
|
||||||
|
// TODO validators
|
||||||
|
// setupValidators();
|
||||||
|
|
||||||
|
connect(ui->pushButton, &QPushButton::clicked, this, [this]() {
|
||||||
|
// TODO save new printer settings
|
||||||
|
qDebug() << "SAVE SETTINGS";
|
||||||
|
});
|
||||||
|
connect(ui->pushButton_2, &QPushButton::clicked, this, &QDialog::reject);
|
||||||
|
}
|
||||||
|
|
||||||
|
AddPresetDialog::~AddPresetDialog() { delete ui; }
|
||||||
|
|
||||||
|
void AddPresetDialog::setupValidators() {
|
||||||
|
// TODO make validators
|
||||||
|
qDebug() << "SET VALIDATORS";
|
||||||
|
// ui->input_power_3->setValidator(SMTH); // Мощность
|
||||||
|
// ui->input_power->setValidator(SMTH); // Срок службы
|
||||||
|
|
||||||
|
// ui->input_power_2->setValidator(SMTH); // Стоимость
|
||||||
|
}
|
38
src/view/add_preset.h
Normal file
38
src/view/add_preset.h
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#ifndef ADDPRINTERDIALOG_H
|
||||||
|
#define ADDPRINTERDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QDoubleValidator>
|
||||||
|
#include <QIntValidator>
|
||||||
|
|
||||||
|
#include "ui/ui_add_preset.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class AddPrinter;
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddPresetDialog : public QDialog {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit AddPresetDialog(QWidget *parent = nullptr);
|
||||||
|
~AddPresetDialog();
|
||||||
|
|
||||||
|
QString getPresetName() const { return ui->textEdit->toPlainText(); }
|
||||||
|
|
||||||
|
int getPower() const { return ui->input_power_3->toPlainText().toInt(); }
|
||||||
|
|
||||||
|
int getLifespan() const { return ui->input_power->toPlainText().toInt(); }
|
||||||
|
|
||||||
|
double getPrinterCost() const {
|
||||||
|
return ui->input_power_2->toPlainText().toDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void setupValidators();
|
||||||
|
Ui::AddPrinter *ui;
|
||||||
|
// QIntValidator *intValidator;
|
||||||
|
// QDoubleValidator *doubleValidator;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ADDPRINTERDIALOG_H
|
64
src/view/delete_preset.cpp
Normal file
64
src/view/delete_preset.cpp
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#include "delete_preset.h"
|
||||||
|
#include "ui/ui_del_preset.h"
|
||||||
|
|
||||||
|
DeletePresetDialog::DeletePresetDialog(QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::DelPreset)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
setWindowIcon(QIcon("img/logo-1.png"));
|
||||||
|
|
||||||
|
setupTable();
|
||||||
|
|
||||||
|
connect(ui->pushButton_3, &QPushButton::clicked, this, &DeletePresetDialog::onDeleteClicked);
|
||||||
|
connect(ui->pushButton, &QPushButton::clicked, this, &DeletePresetDialog::onEditClicked);
|
||||||
|
connect(ui->pushButton_2, &QPushButton::clicked, this, &QDialog::reject);
|
||||||
|
}
|
||||||
|
|
||||||
|
DeletePresetDialog::~DeletePresetDialog() {
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeletePresetDialog::setupTable() {
|
||||||
|
ui->tableWidget->setColumnCount(2);
|
||||||
|
ui->tableWidget->setHorizontalHeaderLabels({"Название", "Мощность"});
|
||||||
|
ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
|
ui->tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
|
ui->tableWidget->horizontalHeader()->setStretchLastSection(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeletePresetDialog::loadPresets(const QList<QStringList> &data) {
|
||||||
|
ui->tableWidget->setRowCount(data.size());
|
||||||
|
|
||||||
|
for(int row = 0; row < data.size(); ++row) {
|
||||||
|
const QStringList &rowData = data[row];
|
||||||
|
for(int col = 0; col < rowData.size(); ++col) {
|
||||||
|
ui->tableWidget->setItem(row, col, new QTableWidgetItem(rowData[col]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString DeletePresetDialog::getSelectedPreset() const {
|
||||||
|
const int row = getSelectedRow();
|
||||||
|
return row >= 0 ? ui->tableWidget->item(row, 0)->text() : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
int DeletePresetDialog::getSelectedRow() const {
|
||||||
|
return ui->tableWidget->currentRow();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeletePresetDialog::onDeleteClicked() {
|
||||||
|
const int row = getSelectedRow();
|
||||||
|
if(row >= 0) {
|
||||||
|
emit deleteRequested(row);
|
||||||
|
ui->tableWidget->removeRow(row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeletePresetDialog::onEditClicked() {
|
||||||
|
const int row = getSelectedRow();
|
||||||
|
if(row >= 0) {
|
||||||
|
emit editRequested(row);
|
||||||
|
accept();
|
||||||
|
}
|
||||||
|
}
|
35
src/view/delete_preset.h
Normal file
35
src/view/delete_preset.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#ifndef DELPRESETDIALOG_H
|
||||||
|
#define DELPRESETDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QTableWidgetItem>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class DelPreset;
|
||||||
|
}
|
||||||
|
|
||||||
|
class DeletePresetDialog : public QDialog {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit DeletePresetDialog(QWidget *parent = nullptr);
|
||||||
|
~DeletePresetDialog();
|
||||||
|
|
||||||
|
void loadPresets(const QList<QStringList> &data);
|
||||||
|
QString getSelectedPreset() const;
|
||||||
|
int getSelectedRow() const;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void deleteRequested(int row);
|
||||||
|
void editRequested(int row);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void onDeleteClicked();
|
||||||
|
void onEditClicked();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void setupTable();
|
||||||
|
Ui::DelPreset *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DELPRESETDIALOG_H
|
17
src/view/edit_preset.cpp
Normal file
17
src/view/edit_preset.cpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include "edit_preset.h"
|
||||||
|
|
||||||
|
#include "ui/ui_edit_preset.h"
|
||||||
|
|
||||||
|
EditPresetDialog::EditPresetDialog(QWidget *parent)
|
||||||
|
: QDialog(parent), ui(new Ui::EditPreset) {
|
||||||
|
ui->setupUi(this);
|
||||||
|
setWindowIcon(QIcon("img/logo-1.png"));
|
||||||
|
|
||||||
|
connect(ui->pushButton, &QPushButton::clicked, this, [this]() {
|
||||||
|
// TODO save new printer settings
|
||||||
|
qDebug() << "SAVE SETTINGS";
|
||||||
|
});
|
||||||
|
connect(ui->pushButton_2, &QPushButton::clicked, this, &QDialog::reject);
|
||||||
|
}
|
||||||
|
|
||||||
|
EditPresetDialog::~EditPresetDialog() { delete ui; }
|
21
src/view/edit_preset.h
Normal file
21
src/view/edit_preset.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#ifndef EDITPRESETDIALOG_H
|
||||||
|
#define EDITPRESETDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class EditPreset;
|
||||||
|
}
|
||||||
|
|
||||||
|
class EditPresetDialog : public QDialog {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit EditPresetDialog(QWidget *parent = nullptr);
|
||||||
|
~EditPresetDialog();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::EditPreset *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // EDITPRESETDIALOG_H
|
15
src/view/formula_dialog.cpp
Normal file
15
src/view/formula_dialog.cpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include "formula_dialog.h"
|
||||||
|
|
||||||
|
#include "ui/ui_formula.h"
|
||||||
|
|
||||||
|
FormulaDialog::FormulaDialog(QWidget *parent)
|
||||||
|
: QDialog(parent), ui(new Ui::Formula) {
|
||||||
|
ui->setupUi(this);
|
||||||
|
setWindowIcon(QIcon("img/logo-1.png"));
|
||||||
|
|
||||||
|
connect(ui->pushButton, &QPushButton::clicked, this, &FormulaDialog::close);
|
||||||
|
}
|
||||||
|
|
||||||
|
FormulaDialog::~FormulaDialog() { delete ui; }
|
||||||
|
|
||||||
|
void FormulaDialog::on_pushButton_clicked() { close(); }
|
24
src/view/formula_dialog.h
Normal file
24
src/view/formula_dialog.h
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#ifndef FORMULADIALOG_H
|
||||||
|
#define FORMULADIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class Formula;
|
||||||
|
}
|
||||||
|
|
||||||
|
class FormulaDialog : public QDialog {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit FormulaDialog(QWidget *parent = nullptr);
|
||||||
|
~FormulaDialog();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_pushButton_clicked();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::Formula *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FORMULADIALOG_H
|
@ -1,40 +1,55 @@
|
|||||||
#include "main_window.h"
|
#include "main_window.h"
|
||||||
|
|
||||||
#include "ui/ui_about.h"
|
|
||||||
#include "ui/ui_add_printer.h"
|
|
||||||
#include "ui/ui_del_preset.h"
|
|
||||||
#include "ui/ui_edit_preset.h"
|
|
||||||
#include "ui/ui_formula.h"
|
|
||||||
#include "ui/ui_main_window.h"
|
#include "ui/ui_main_window.h"
|
||||||
#include "ui/ui_settings.h"
|
|
||||||
#include "ui/ui_settings_preset.h"
|
|
||||||
#include "ui/ui_updates.h"
|
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent), ui(new Ui::MainWindow) {
|
||||||
, ui(new Ui::MainWindow)
|
ui->setupUi(this);
|
||||||
{
|
|
||||||
setWindowTitle("Calc3D");
|
|
||||||
setFixedSize(373, 471);
|
setFixedSize(373, 471);
|
||||||
// menu_window = new MenuWindow(this);
|
|
||||||
// game_window = new GameWindow(this);
|
|
||||||
// controller = new s21::GameController();
|
|
||||||
|
|
||||||
// lay_out = new QStackedLayout(this);
|
progInfo = new AboutDialog(this);
|
||||||
// setLayout(lay_out);
|
formulaInfo = new FormulaDialog(this);
|
||||||
// lay_out->addWidget(menu_window);
|
updateInfo = new UpdatesDialog(this);
|
||||||
// lay_out->addWidget(game_window);
|
printerSettings = new PrinterSettingsDialog(this);
|
||||||
|
addPresetDialog = new AddPresetDialog(this);
|
||||||
|
deletePresetDialog = new DeletePresetDialog(this);
|
||||||
|
editPresetDialog = new EditPresetDialog(this);
|
||||||
|
// <!-- <property name="styleSheet"> // бледно серый для тепскта
|
||||||
|
// <string>color: rgb(146, 152, 159);</string>
|
||||||
|
// </property> -->
|
||||||
|
|
||||||
// menu_window->setFocus();
|
// Action with menu "Файл"
|
||||||
|
connect(ui->settings_2, &QAction::triggered, this,
|
||||||
|
[this]() { printerSettings->exec(); });
|
||||||
|
connect(ui->add_preset, &QAction::triggered, this,
|
||||||
|
[this]() { addPresetDialog->exec(); });
|
||||||
|
connect(ui->edit_printer, &QAction::triggered, this,
|
||||||
|
[this]() { editPresetDialog->exec(); });
|
||||||
|
connect(ui->del_printer, &QAction::triggered, this,
|
||||||
|
[this]() { deletePresetDialog->exec(); });
|
||||||
|
connect(ui->action_3, &QAction::triggered, this, [this]() {
|
||||||
|
//! smth will be saved?
|
||||||
|
qDebug() << "SMTH NEEDS TO SAVE?";
|
||||||
|
close();
|
||||||
|
});
|
||||||
|
|
||||||
// connect(menu_window, &MenuWindow::signalGame, this,
|
// Action with menu "Помощь"
|
||||||
// &DesktopView::slotShowGame); connect(menu_window, &MenuWindow::signalExit,
|
connect(ui->check_update, &QAction::triggered, this,
|
||||||
// this, &DesktopView::slotExit); connect(game_window,
|
[this]() { updateInfo->exec(); });
|
||||||
// &GameWindow::signalExit, this, &DesktopView::slotShowMenu);
|
connect(ui->formula, &QAction::triggered, this,
|
||||||
ui->setupUi(this);
|
[this]() { formulaInfo->exec(); });
|
||||||
|
connect(ui->about, &QAction::triggered, this, [this]() { progInfo->exec(); });
|
||||||
|
|
||||||
|
// Action with buttons
|
||||||
|
connect(ui->get_result_btn, &QPushButton::clicked, this, [this]() {
|
||||||
|
// TODO отправляет на расчет
|
||||||
|
qDebug() << "SMTH COUNT";
|
||||||
|
});
|
||||||
|
connect(ui->exit_btn, &QPushButton::clicked, this, [this]() {
|
||||||
|
//! smth will be saved?
|
||||||
|
qDebug() << "SMTH NEEDS TO SAVE?";
|
||||||
|
close();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow() { delete ui; }
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
|
@ -2,6 +2,16 @@
|
|||||||
#define MAINWINDOW_H
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include "about_dialog.h"
|
||||||
|
#include "formula_dialog.h"
|
||||||
|
#include "update_dialog.h"
|
||||||
|
#include "printer_settings.h"
|
||||||
|
#include "delete_preset.h"
|
||||||
|
#include "add_preset.h"
|
||||||
|
#include "edit_preset.h"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
@ -9,15 +19,21 @@ class MainWindow;
|
|||||||
}
|
}
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
class MainWindow : public QMainWindow
|
class MainWindow : public QMainWindow {
|
||||||
{
|
Q_OBJECT
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainWindow(QWidget *parent = nullptr);
|
MainWindow(QWidget *parent = nullptr);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
|
AboutDialog *progInfo;
|
||||||
|
FormulaDialog *formulaInfo;
|
||||||
|
UpdatesDialog *updateInfo;
|
||||||
|
PrinterSettingsDialog *printerSettings;
|
||||||
|
AddPresetDialog *addPresetDialog;
|
||||||
|
DeletePresetDialog *deletePresetDialog;
|
||||||
|
EditPresetDialog *editPresetDialog;
|
||||||
};
|
};
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
30
src/view/printer_settings.cpp
Normal file
30
src/view/printer_settings.cpp
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#include "printer_settings.h"
|
||||||
|
|
||||||
|
#include "ui/ui_printer_settings.h"
|
||||||
|
|
||||||
|
PrinterSettingsDialog::PrinterSettingsDialog(QWidget *parent)
|
||||||
|
: QDialog(parent), ui(new Ui::PrinterSettingsDialog) {
|
||||||
|
ui->setupUi(this);
|
||||||
|
setWindowIcon(QIcon("img/logo-1.png"));
|
||||||
|
|
||||||
|
// TODO валидаторы
|
||||||
|
// setupValidators(SMTH);
|
||||||
|
|
||||||
|
connect(ui->save, &QPushButton::clicked, this, [this]() {
|
||||||
|
// TODO save new printer settings
|
||||||
|
qDebug() << "SAVE SETTINGS";
|
||||||
|
});
|
||||||
|
connect(ui->exit, &QPushButton::clicked, this, &QDialog::reject);
|
||||||
|
}
|
||||||
|
|
||||||
|
PrinterSettingsDialog::~PrinterSettingsDialog() { delete ui; }
|
||||||
|
|
||||||
|
void PrinterSettingsDialog::setupValidators() {
|
||||||
|
// TODO make validators
|
||||||
|
qDebug() << "SET VALIDATORS";
|
||||||
|
|
||||||
|
// ui->input_tarif->setValidator(SMTH);
|
||||||
|
// ui->input_q_trash->setValidator(SMTH);
|
||||||
|
// ui->input_price_pastik->setValidator(SMTH);
|
||||||
|
// ui->input_overprice->setValidator(SMTH);
|
||||||
|
}
|
70
src/view/printer_settings.h
Normal file
70
src/view/printer_settings.h
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
#ifndef PrinterSettingsDialog_H
|
||||||
|
#define PrinterSettingsDialog_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QDoubleValidator>
|
||||||
|
|
||||||
|
#include "ui/ui_printer_settings.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class PrinterSettingsDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
class PrinterSettingsDialog : public QDialog {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit PrinterSettingsDialog(QWidget *parent = nullptr);
|
||||||
|
~PrinterSettingsDialog();
|
||||||
|
|
||||||
|
// Методы доступа к данным
|
||||||
|
inline double getTariff() const {
|
||||||
|
return ui->input_tarif->toPlainText().toDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline double getRejectCoefficient() const {
|
||||||
|
return ui->input_q_trash->toPlainText().toDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline double getFilamentCost() const {
|
||||||
|
return ui->input_price_pastik->toPlainText().toDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline double getMarkupPercent() const {
|
||||||
|
return ui->input_overprice->toPlainText().toDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int getFilamentWeight() const {
|
||||||
|
return ui->plastik_menu->currentText().toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Методы установки значений
|
||||||
|
inline void setTariff(double value) {
|
||||||
|
ui->input_tarif->setPlainText(QString::number(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void setRejectCoefficient(double value) {
|
||||||
|
ui->input_q_trash->setPlainText(QString::number(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void setFilamentCost(double value) {
|
||||||
|
ui->input_price_pastik->setPlainText(QString::number(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void setMarkupPercent(double value) {
|
||||||
|
ui->input_overprice->setPlainText(QString::number(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void setFilamentWeight(int value) {
|
||||||
|
int index = ui->plastik_menu->findText(QString::number(value));
|
||||||
|
if (index != -1) ui->plastik_menu->setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::PrinterSettingsDialog *ui;
|
||||||
|
|
||||||
|
// QDoubleValidator *doubleValidator;
|
||||||
|
void setupValidators();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // PrinterSettingsDialog_H
|
15
src/view/resources.qrc
Normal file
15
src/view/resources.qrc
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<RCC>
|
||||||
|
<qresource prefix="/">
|
||||||
|
<file>img/calc.png</file>
|
||||||
|
<file>img/exit.png</file>
|
||||||
|
<file>img/rubl.png</file>
|
||||||
|
<file>img/logo-1.png</file>
|
||||||
|
<file>img/logo-2.png</file>
|
||||||
|
<file>img/logo-3.png</file>
|
||||||
|
<file>img/logo-4.png</file>
|
||||||
|
<file>img/logo-5.png</file>
|
||||||
|
<file>img/logo-6.png</file>
|
||||||
|
<file>img/logo-7.png</file>
|
||||||
|
<file>img/logo-8.png</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
@ -1,7 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>About</class>
|
<class>About</class>
|
||||||
<widget class="QDialog" name="About">
|
<widget class="QDialog" name="progInfo">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">
|
||||||
|
background-color: rgb(42, 45, 46);
|
||||||
|
color: white;
|
||||||
|
</string>
|
||||||
|
</property>
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
@ -11,7 +17,7 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>О прграмме</string>
|
<string>О программе</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowIcon">
|
<property name="windowIcon">
|
||||||
<iconset>
|
<iconset>
|
||||||
|
@ -2,6 +2,12 @@
|
|||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>AddPrinter</class>
|
<class>AddPrinter</class>
|
||||||
<widget class="QDialog" name="AddPrinter">
|
<widget class="QDialog" name="AddPrinter">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">
|
||||||
|
background-color: rgb(42, 45, 46);
|
||||||
|
color: white;
|
||||||
|
</string>
|
||||||
|
</property>
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
@ -2,6 +2,12 @@
|
|||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>DelPreset</class>
|
<class>DelPreset</class>
|
||||||
<widget class="QDialog" name="DelPreset">
|
<widget class="QDialog" name="DelPreset">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">
|
||||||
|
background-color: rgb(42, 45, 46);
|
||||||
|
color: white;
|
||||||
|
</string>
|
||||||
|
</property>
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
|
@ -2,6 +2,12 @@
|
|||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>EditPreset</class>
|
<class>EditPreset</class>
|
||||||
<widget class="QDialog" name="EditPreset">
|
<widget class="QDialog" name="EditPreset">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">
|
||||||
|
background-color: rgb(42, 45, 46);
|
||||||
|
color: white;
|
||||||
|
</string>
|
||||||
|
</property>
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
|
@ -2,6 +2,12 @@
|
|||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>Formula</class>
|
<class>Formula</class>
|
||||||
<widget class="QDialog" name="Formula">
|
<widget class="QDialog" name="Formula">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">
|
||||||
|
background-color: rgb(42, 45, 46);
|
||||||
|
color: white;
|
||||||
|
</string>
|
||||||
|
</property>
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
@ -31,6 +37,9 @@
|
|||||||
<pointsize>9</pointsize>
|
<pointsize>9</pointsize>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">color: white;</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>## Формула расчета</string>
|
<string>## Формула расчета</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -35,6 +35,12 @@
|
|||||||
<set>QMainWindow::DockOption::AllowTabbedDocks|QMainWindow::DockOption::AnimatedDocks</set>
|
<set>QMainWindow::DockOption::AllowTabbedDocks|QMainWindow::DockOption::AnimatedDocks</set>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralwidget">
|
<widget class="QWidget" name="centralwidget">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">
|
||||||
|
background-color: rgb(42, 45, 46);
|
||||||
|
color: white;
|
||||||
|
</string>
|
||||||
|
</property>
|
||||||
<widget class="QLabel" name="quantity">
|
<widget class="QLabel" name="quantity">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
@ -132,6 +138,9 @@
|
|||||||
<height>25</height>
|
<height>25</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">alternate-background-color: rgb(77, 77, 77);</string>
|
||||||
|
</property>
|
||||||
<property name="acceptDrops">
|
<property name="acceptDrops">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
@ -152,12 +161,12 @@
|
|||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Ender3/Ender3pro</string>
|
<string>None</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>FlyBeer</string>
|
<string>Checked</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
@ -316,6 +325,9 @@
|
|||||||
<height>17</height>
|
<height>17</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgb(0, 0, 0);</string>
|
||||||
|
</property>
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<pointsize>10</pointsize>
|
<pointsize>10</pointsize>
|
||||||
@ -883,7 +895,7 @@
|
|||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Пресеты принтера</string>
|
<string>Пресеты принтера</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="add_printer"/>
|
<addaction name="add_preset"/>
|
||||||
<addaction name="edit_printer"/>
|
<addaction name="edit_printer"/>
|
||||||
<addaction name="del_printer"/>
|
<addaction name="del_printer"/>
|
||||||
</widget>
|
</widget>
|
||||||
@ -939,7 +951,7 @@
|
|||||||
<string>Настройки</string>
|
<string>Настройки</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="add_printer">
|
<action name="add_preset">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Добавить принтер</string>
|
<string>Добавить принтер</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1,7 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>Settings</class>
|
<class>PrinterSettingsDialog</class>
|
||||||
<widget class="QDialog" name="Settings">
|
<widget class="QDialog" name="PrinterSettingsDialog">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">
|
||||||
|
background-color: rgb(42, 45, 46);
|
||||||
|
color: white;
|
||||||
|
</string>
|
||||||
|
</property>
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
@ -2,6 +2,12 @@
|
|||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>SettingsPreset</class>
|
<class>SettingsPreset</class>
|
||||||
<widget class="QDialog" name="SettingsPreset">
|
<widget class="QDialog" name="SettingsPreset">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">
|
||||||
|
background-color: rgb(42, 45, 46);
|
||||||
|
color: white;
|
||||||
|
</string>
|
||||||
|
</property>
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
|
@ -2,6 +2,12 @@
|
|||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>Updates</class>
|
<class>Updates</class>
|
||||||
<widget class="QDialog" name="Updates">
|
<widget class="QDialog" name="Updates">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">
|
||||||
|
background-color: rgb(42, 45, 46);
|
||||||
|
color: white;
|
||||||
|
</string>
|
||||||
|
</property>
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
|
36
src/view/update_dialog.cpp
Normal file
36
src/view/update_dialog.cpp
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#include "update_dialog.h"
|
||||||
|
#include "ui/ui_updates.h"
|
||||||
|
#include <QDesktopServices>
|
||||||
|
|
||||||
|
UpdatesDialog::UpdatesDialog(QWidget *parent)
|
||||||
|
: QDialog(parent),
|
||||||
|
ui(new Ui::Updates)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
setWindowIcon(QIcon("img/logo-1.png"));
|
||||||
|
|
||||||
|
connect(ui->pushButton_2, &QPushButton::clicked, this, &UpdatesDialog::onCloseClicked);
|
||||||
|
connect(ui->pushButton, &QPushButton::clicked, this, &UpdatesDialog::onVisitWebsiteClicked);
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdatesDialog::~UpdatesDialog() {
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdatesDialog::setCurrentVersion(const QString &version) {
|
||||||
|
ui->label_3->setText(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdatesDialog::setLatestVersion(const QString &version) {
|
||||||
|
ui->label_4->setText(version);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdatesDialog::onCloseClicked() {
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdatesDialog::onVisitWebsiteClicked() {
|
||||||
|
// TODO занести сайт
|
||||||
|
QDesktopServices::openUrl(WEBSITE_URL);
|
||||||
|
}
|
31
src/view/update_dialog.h
Normal file
31
src/view/update_dialog.h
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#ifndef UPDATESDIALOG_H
|
||||||
|
#define UPDATESDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QUrl>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class Updates;
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdatesDialog : public QDialog {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit UpdatesDialog(QWidget *parent = nullptr);
|
||||||
|
~UpdatesDialog();
|
||||||
|
|
||||||
|
// Методы для обновления информации о версиях
|
||||||
|
void setCurrentVersion(const QString &version);
|
||||||
|
void setLatestVersion(const QString &version);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void onCloseClicked();
|
||||||
|
void onVisitWebsiteClicked();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::Updates *ui;
|
||||||
|
const QUrl WEBSITE_URL = QUrl("https://your-update-website.com");
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // UPDATESDIALOG_H
|
Loading…
x
Reference in New Issue
Block a user