diff --git a/app/gui/oven_control/config.cpp b/app/gui/oven_control/config.cpp new file mode 100644 index 0000000..ecc9730 --- /dev/null +++ b/app/gui/oven_control/config.cpp @@ -0,0 +1,6 @@ +#include "config.h" + +Config::Config(QObject *parent) : QObject(parent) +{ + +} diff --git a/app/gui/oven_control/config.h b/app/gui/oven_control/config.h new file mode 100644 index 0000000..fcaf62f --- /dev/null +++ b/app/gui/oven_control/config.h @@ -0,0 +1,31 @@ +#ifndef CONFIG_H +#define CONFIG_H + + +#include <QObject> + +namespace Define +{ + enum ConfigType { + + }; +} + +class Config : public QObject +{ + Q_OBJECT + + explicit Config(QObject *parent = 0); + + static Config *instance; + +public: + static Config *getInstance(); + static void init(); + +signals: + +public slots: +}; + +#endif // CONFIG_H diff --git a/app/gui/oven_control/configpanelbutton.cpp b/app/gui/oven_control/configpanelbutton.cpp new file mode 100644 index 0000000..903e787 --- /dev/null +++ b/app/gui/oven_control/configpanelbutton.cpp @@ -0,0 +1,90 @@ +#include "configpanelbutton.h" +#include "ui_configpanelbutton.h" + +#include <QPixmap> +#include <QPainter> + +ConfigPanelButton::ConfigPanelButton(QWidget *parent) : + QWidget(parent), + ui(new Ui::ConfigPanelButton) +{ + ui->setupUi(this); + + showingFavoriteButton = false; + ui->favoriteButton->hide(); + + textRect = QRect(20, 0, 556, 65); + valueRect = QRect(556, 0, 265, 65); + connect(ui->pushButton, SIGNAL(pressed()), SIGNAL(pressed())); + connect(ui->pushButton, SIGNAL(released()), SIGNAL(released())); + connect(ui->pushButton, SIGNAL(clicked()), SIGNAL(clicked())); +} + +ConfigPanelButton::~ConfigPanelButton() +{ + delete ui; +} + +void ConfigPanelButton::setText(const QString &text) +{ + if (text_ == text) + return; + + text_ = text; + + updateIcon(); +} + +void ConfigPanelButton::setValue(const QString &value) +{ + if (value_ == value) + return; + + value_ = value; + + updateIcon(); +} + +void ConfigPanelButton::showFavoriteButton() +{ + if (showingFavoriteButton) + return; + + showingFavoriteButton = true; + ui->favoriteButton->show(); + + textRect = QRect(20 + 77, 0, 556 - 77, 65); + updateIcon(); +} + +void ConfigPanelButton::hideFavoriteButton() +{ + if (!showingFavoriteButton) + return; + + showingFavoriteButton = false; + ui->favoriteButton->hide(); + + textRect = QRect(20, 0, 556, 65); + updateIcon(); +} + +void ConfigPanelButton::updateIcon() +{ + QPixmap pixmap(ui->pushButton->size()); + pixmap.fill(Qt::transparent); + + QFont font = ui->pushButton->font(); + font.setPixelSize(30); + + QPainter painter(&pixmap); + painter.setFont(font); + painter.setPen(Qt::white); + painter.drawText(textRect, Qt::AlignLeft | Qt::AlignVCenter, text_); + painter.setPen(Qt::gray); + painter.drawText(valueRect, Qt::AlignCenter, value_); + + QIcon icon(pixmap); + ui->pushButton->setIcon(icon); + ui->pushButton->setIconSize(pixmap.size()); +} diff --git a/app/gui/oven_control/configpanelbutton.h b/app/gui/oven_control/configpanelbutton.h new file mode 100644 index 0000000..0b5f3de --- /dev/null +++ b/app/gui/oven_control/configpanelbutton.h @@ -0,0 +1,48 @@ +#ifndef CONFIGPANELBUTTON_H +#define CONFIGPANELBUTTON_H + +#include <QWidget> + +namespace Ui { +class ConfigPanelButton; +} + +class ConfigPanelButton : public QWidget +{ + Q_OBJECT + +public: + explicit ConfigPanelButton(QWidget *parent = 0); + ~ConfigPanelButton(); + + const QString &text() { return text_; } + const QString &value() { return value_; } + +public slots: + void setText(const QString &text); + void setValue(const QString &value); + void showFavoriteButton(); + void hideFavoriteButton(); + +private: + Ui::ConfigPanelButton *ui; + + QString text_; + QString value_; + + QRect textRect; + QRect valueRect; + + bool showingFavoriteButton; + bool isFavorited; + +private slots: + void updateIcon(); + +signals: + void pressed(); + void released(); + void clicked(); +}; + +#endif // CONFIGPANELBUTTON_H diff --git a/app/gui/oven_control/configpanelbutton.ui b/app/gui/oven_control/configpanelbutton.ui new file mode 100644 index 0000000..b5a209d --- /dev/null +++ b/app/gui/oven_control/configpanelbutton.ui @@ -0,0 +1,100 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>ConfigPanelButton</class> + <widget class="QWidget" name="ConfigPanelButton"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>821</width> + <height>65</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>821</width> + <height>65</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>821</width> + <height>65</height> + </size> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <property name="styleSheet"> + <string notr="true">QPushButton { +background-position: center; +background-repeat: no-repeat; +border: none; +}</string> + </property> + <widget class="QPushButton" name="pushButton"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>821</width> + <height>65</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>821</width> + <height>65</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>821</width> + <height>65</height> + </size> + </property> + <property name="font"> + <font> + <family>Roboto</family> + <pointsize>11</pointsize> + </font> + </property> + <property name="styleSheet"> + <string notr="true">QPushButton { background-image: url(:/images/config/pannel.png); } +QPushButton:pressed { background-image: url(:/images/config/pannel_ov.png); } +QPushButton:focus { background-image: url(:/images/config/pannel_ov.png); }</string> + </property> + <property name="text"> + <string/> + </property> + </widget> + <widget class="QPushButton" name="favoriteButton"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>77</width> + <height>65</height> + </rect> + </property> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> + <property name="styleSheet"> + <string notr="true">QPushButton { background-image: url(:/images/config/088_fava_02.png); } +QPushButton:pressed { background-image: url(:/images/config/088_fava_01.png); }</string> + </property> + <property name="text"> + <string/> + </property> + </widget> + </widget> + <resources/> + <connections/> +</ui> diff --git a/app/gui/oven_control/configwindow.cpp b/app/gui/oven_control/configwindow.cpp index f7893f1..90870e0 100644 --- a/app/gui/oven_control/configwindow.cpp +++ b/app/gui/oven_control/configwindow.cpp @@ -11,6 +11,8 @@ ConfigWindow::ConfigWindow(QWidget *parent) : ui->clockContainer->setParent(ui->upperStack); setAttribute(Qt::WA_DeleteOnClose); + + } ConfigWindow::~ConfigWindow() @@ -20,7 +22,10 @@ ConfigWindow::~ConfigWindow() void ConfigWindow::on_pushButton_clicked() { - FunctionTestWindow *w = new FunctionTestWindow(this); - w->setAttribute((Qt::WA_DeleteOnClose)); - w->showFullScreen(); + +} + +void ConfigWindow::on_backButton_clicked() +{ + close(); } diff --git a/app/gui/oven_control/configwindow.h b/app/gui/oven_control/configwindow.h index 1f4794c..1e31be6 100644 --- a/app/gui/oven_control/configwindow.h +++ b/app/gui/oven_control/configwindow.h @@ -20,6 +20,8 @@ public: private slots: void on_pushButton_clicked(); + void on_backButton_clicked(); + private: Ui::ConfigWindow *ui; }; diff --git a/app/gui/oven_control/configwindow.ui b/app/gui/oven_control/configwindow.ui index 5fb72f8..ab8ddf9 100644 --- a/app/gui/oven_control/configwindow.ui +++ b/app/gui/oven_control/configwindow.ui @@ -14,9 +14,20 @@ <string>MainWindow</string> </property> <property name="styleSheet"> - <string notr="true">QWidget#centralwidget { -background-image: url(:/images/images/config/001_01_background_all.png); -}</string> + <string notr="true">#centralwidget { background-image: url(:/images/background/config.png); } +#bottomBar { background-image: url(:/images/bottom_bar/background.png); } + +QPushButton[style="type"] { +background-repeat: no-repeat; +background-position: center; +background-origin: margin; + +border-top: 140px; +border-style: hidden; +color: white; +font-size: 30px; +} +</string> </property> <widget class="QWidget" name="centralwidget"> <widget class="QStackedWidget" name="upperStack"> @@ -45,26 +56,346 @@ background-image: url(:/images/images/config/001_01_background_all.png); </widget> <widget class="QWidget" name="page_2"/> </widget> - <widget class="QPushButton" name="pushButton"> + <widget class="QWidget" name="verticalLayoutWidget"> <property name="geometry"> <rect> - <x>740</x> - <y>710</y> - <width>69</width> - <height>90</height> + <x>0</x> + <y>426</y> + <width>900</width> + <height>421</height> </rect> </property> - <property name="styleSheet"> - <string notr="true">QPushButton { - border-image: url(:/images/images/config/050_setting_btn_08.png); -} -QPushButton:pressed { - border-image: url(:/images/images/config/050_setting_btn_08_ov.png); -}</string> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>0</number> + </property> + <item> + <layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0,1,0,1,0,1"> + <item> + <widget class="QPushButton" name="pushButton"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="styleSheet"> + <string notr="true">QPushButton { background-image: url(:/images/config/050_setting_btn_01.png); } +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/config/050_setting_btn_01_ov.png); }</string> + </property> + <property name="text"> + <string>즐겨찾기</string> + </property> + <property name="style" stdset="0"> + <string>type</string> + </property> + </widget> + </item> + <item> + <widget class="Line" name="line"> + <property name="maximumSize"> + <size> + <width>1</width> + <height>171</height> + </size> + </property> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pushButton_8"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="styleSheet"> + <string notr="true">QPushButton { background-image: url(:/images/config/050_setting_btn_02.png); } +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/config/050_setting_btn_02_ov.png); }</string> + </property> + <property name="text"> + <string>설정</string> + </property> + <property name="style" stdset="0"> + <string>type</string> + </property> + </widget> + </item> + <item> + <widget class="Line" name="line_2"> + <property name="maximumSize"> + <size> + <width>1</width> + <height>170</height> + </size> + </property> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pushButton_7"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="styleSheet"> + <string notr="true">QPushButton { background-image: url(:/images/config/050_setting_btn_03.png); } +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/config/050_setting_btn_03_ov.png); }</string> + </property> + <property name="text"> + <string>음향 관리</string> + </property> + <property name="style" stdset="0"> + <string>type</string> + </property> + </widget> + </item> + <item> + <widget class="Line" name="line_3"> + <property name="maximumSize"> + <size> + <width>1</width> + <height>170</height> + </size> + </property> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pushButton_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="styleSheet"> + <string notr="true">QPushButton { background-image: url(:/images/config/050_setting_btn_04.png); } +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/config/050_setting_btn_04_ov.png); }</string> + </property> + <property name="text"> + <string>시스템 관리</string> + </property> + <property name="style" stdset="0"> + <string>type</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QPushButton" name="pushButton_4"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="styleSheet"> + <string notr="true">QPushButton { background-image: url(:/images/config/050_setting_btn_05.png); } +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/config/050_setting_btn_05_ov.png); }</string> + </property> + <property name="text"> + <string>에너지 관리</string> + </property> + <property name="style" stdset="0"> + <string>type</string> + </property> + </widget> + </item> + <item> + <widget class="Line" name="line_4"> + <property name="maximumSize"> + <size> + <width>1</width> + <height>170</height> + </size> + </property> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pushButton_5"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="styleSheet"> + <string notr="true">QPushButton { background-image: url(:/images/config/050_setting_btn_06.png); } +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/config/050_setting_btn_06_ov.png); }</string> + </property> + <property name="text"> + <string>전문가 설정</string> + </property> + <property name="style" stdset="0"> + <string>type</string> + </property> + </widget> + </item> + <item> + <widget class="Line" name="line_5"> + <property name="maximumSize"> + <size> + <width>1</width> + <height>170</height> + </size> + </property> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pushButton_6"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="styleSheet"> + <string notr="true">QPushButton { background-image: url(:/images/config/050_setting_btn_07.png); } +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/config/050_setting_btn_07_ov.png); }</string> + </property> + <property name="text"> + <string>화면 관리</string> + </property> + <property name="style" stdset="0"> + <string>type</string> + </property> + </widget> + </item> + <item> + <widget class="Line" name="line_6"> + <property name="maximumSize"> + <size> + <width>1</width> + <height>170</height> + </size> + </property> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pushButton_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="styleSheet"> + <string notr="true">QPushButton { background-image: url(:/images/config/050_setting_btn_08.png); } +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/config/050_setting_btn_08_ov.png); }</string> + </property> + <property name="text"> + <string>서비스</string> + </property> + <property name="style" stdset="0"> + <string>type</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <widget class="Line" name="line_7"> + <property name="geometry"> + <rect> + <x>16</x> + <y>636</y> + <width>868</width> + <height>1</height> + </rect> + </property> + <property name="maximumSize"> + <size> + <width>868</width> + <height>16777215</height> + </size> </property> - <property name="text"> - <string/> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + <widget class="QWidget" name="bottomBar" native="true"> + <property name="geometry"> + <rect> + <x>0</x> + <y>1450</y> + <width>900</width> + <height>150</height> + </rect> </property> + <widget class="QPushButton" name="backButton"> + <property name="geometry"> + <rect> + <x>288</x> + <y>26</y> + <width>97</width> + <height>97</height> + </rect> + </property> + <property name="styleSheet"> + <string notr="true">QPushButton { border-image: url(:/images/bottom_bar/back.png); } +QPushButton:pressed { border-image: url(:/images/bottom_bar/back_ov.png); }</string> + </property> + <property name="text"> + <string/> + </property> + </widget> + <widget class="QPushButton" name="washButton"> + <property name="geometry"> + <rect> + <x>402</x> + <y>26</y> + <width>97</width> + <height>97</height> + </rect> + </property> + <property name="styleSheet"> + <string notr="true">QPushButton { border-image: url(:/images/bottom_bar/wash.png); } +QPushButton:pressed { border-image: url(:/images/bottom_bar/wash_ov.png); }</string> + </property> + <property name="text"> + <string/> + </property> + </widget> + <widget class="QPushButton" name="helpButton"> + <property name="geometry"> + <rect> + <x>515</x> + <y>26</y> + <width>97</width> + <height>97</height> + </rect> + </property> + <property name="styleSheet"> + <string notr="true">QPushButton { border-image: url(:/images/bottom_bar/help.png); } +QPushButton:pressed { border-image: url(:/images/bottom_bar/help_ov.png); }</string> + </property> + <property name="text"> + <string/> + </property> + </widget> </widget> </widget> </widget> diff --git a/app/gui/oven_control/cook.h b/app/gui/oven_control/cook.h index 47b09ee..5abadad 100644 --- a/app/gui/oven_control/cook.h +++ b/app/gui/oven_control/cook.h @@ -5,7 +5,7 @@ struct CookConfig { - Define::ConfigType type; + Define::CookConfigType type; int maximum; int current; }; diff --git a/app/gui/oven_control/define.cpp b/app/gui/oven_control/define.cpp index 5b30b87..cd2b3a4 100644 --- a/app/gui/oven_control/define.cpp +++ b/app/gui/oven_control/define.cpp @@ -1,6 +1,6 @@ #include "define.h" -Define::ConfigType Define::identifyConfigType(QString type) +Define::CookConfigType Define::identifyConfigType(QString type) { if (type == "brightness") return Brightness; @@ -178,7 +178,7 @@ QString Define::icon(Define::CookType type) } } -QString Define::icon(Define::ConfigType type) +QString Define::icon(Define::CookConfigType type) { switch (type) { @@ -213,7 +213,7 @@ QString Define::icon(Define::ConfigType type) } } -QString Define::iconOverlay(Define::ConfigType type) +QString Define::iconOverlay(Define::CookConfigType type) { switch (type) { @@ -248,7 +248,7 @@ QString Define::iconOverlay(Define::ConfigType type) } } -QString Define::minimum(Define::ConfigType type) +QString Define::minimum(Define::CookConfigType type) { switch (type) { @@ -283,7 +283,7 @@ QString Define::minimum(Define::ConfigType type) } } -QString Define::maximum(Define::ConfigType type) +QString Define::maximum(Define::CookConfigType type) { switch (type) { diff --git a/app/gui/oven_control/define.h b/app/gui/oven_control/define.h index a0962b9..b1306a5 100644 --- a/app/gui/oven_control/define.h +++ b/app/gui/oven_control/define.h @@ -19,7 +19,7 @@ namespace Define QString icon(CookType type); - enum ConfigType + enum CookConfigType { InvalidConfig, ConfigNotUsed, @@ -37,11 +37,11 @@ namespace Define Thermometer }; - ConfigType identifyConfigType(QString type); - QString icon(ConfigType type); - QString iconOverlay(ConfigType type); - QString minimum(ConfigType type); - QString maximum(ConfigType type); + CookConfigType identifyConfigType(QString type); + QString icon(CookConfigType type); + QString iconOverlay(CookConfigType type); + QString minimum(CookConfigType type); + QString maximum(CookConfigType type); enum StepClass { diff --git a/app/gui/oven_control/mainwindow.cpp b/app/gui/oven_control/mainwindow.cpp index 6ba8a60..c0723ed 100644 --- a/app/gui/oven_control/mainwindow.cpp +++ b/app/gui/oven_control/mainwindow.cpp @@ -101,10 +101,14 @@ void MainWindow::on_washButton_clicked() void MainWindow::on_configButton_clicked() { - EngineerMenuWindow *w = new EngineerMenuWindow(this); + ConfigWindow *w = new ConfigWindow(this); w->setWindowModality(Qt::WindowModal); w->showFullScreen(); w->raise(); +// EngineerMenuWindow *w = new EngineerMenuWindow(this); +// w->setWindowModality(Qt::WindowModal); +// w->showFullScreen(); +// w->raise(); } void MainWindow::on_helpButton_clicked() diff --git a/app/gui/oven_control/oven_control.pro b/app/gui/oven_control/oven_control.pro index b7c4052..d62a218 100644 --- a/app/gui/oven_control/oven_control.pro +++ b/app/gui/oven_control/oven_control.pro @@ -62,7 +62,9 @@ SOURCES += main.cpp\ soundplayer.cpp \ servicedata.cpp \ adjustmentwindow.cpp \ - yesnopopupdlg.cpp + yesnopopupdlg.cpp \ + configpanelbutton.cpp \ + config.cpp HEADERS += mainwindow.h \ cook.h \ @@ -114,7 +116,9 @@ HEADERS += mainwindow.h \ soundplayer.h \ servicedata.h \ adjustmentwindow.h \ - yesnopopupdlg.h + yesnopopupdlg.h \ + configpanelbutton.h \ + config.h FORMS += mainwindow.ui \ manualcookwindow.ui \ @@ -145,7 +149,8 @@ FORMS += mainwindow.ui \ realtimepartswindow.ui \ realtimesensorwindow.ui \ adjustmentwindow.ui \ - yesnopopupdlg.ui + yesnopopupdlg.ui \ + configpanelbutton.ui RESOURCES += \ resources.qrc