|  |  | @ -1,5 +1,6 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | #pragma once |  |  |  | #pragma once | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | #include <QButtonGroup> | 
			
		
	
		
		
			
				
					
					|  |  |  | #include <QFrame> |  |  |  | #include <QFrame> | 
			
		
	
		
		
			
				
					
					|  |  |  | #include <QHBoxLayout> |  |  |  | #include <QHBoxLayout> | 
			
		
	
		
		
			
				
					
					|  |  |  | #include <QLabel> |  |  |  | #include <QLabel> | 
			
		
	
	
		
		
			
				
					|  |  | @ -60,7 +61,7 @@ public: | 
			
		
	
		
		
			
				
					
					|  |  |  | public slots: |  |  |  | public slots: | 
			
		
	
		
		
			
				
					
					|  |  |  |   void showDescription() { |  |  |  |   void showDescription() { | 
			
		
	
		
		
			
				
					
					|  |  |  |     description->setVisible(true); |  |  |  |     description->setVisible(true); | 
			
		
	
		
		
			
				
					
					|  |  |  |   }; |  |  |  |   } | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | signals: |  |  |  | signals: | 
			
		
	
		
		
			
				
					
					|  |  |  |   void showDescriptionEvent(); |  |  |  |   void showDescriptionEvent(); | 
			
		
	
	
		
		
			
				
					|  |  | @ -106,7 +107,7 @@ signals: | 
			
		
	
		
		
			
				
					
					|  |  |  |   void clicked(); |  |  |  |   void clicked(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | public slots: |  |  |  | public slots: | 
			
		
	
		
		
			
				
					
					|  |  |  |   void setEnabled(bool enabled) { btn.setEnabled(enabled); }; |  |  |  |   void setEnabled(bool enabled) { btn.setEnabled(enabled); } | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | private: |  |  |  | private: | 
			
		
	
		
		
			
				
					
					|  |  |  |   QPushButton btn; |  |  |  |   QPushButton btn; | 
			
		
	
	
		
		
			
				
					|  |  | @ -163,7 +164,7 @@ public: | 
			
		
	
		
		
			
				
					
					|  |  |  |   void setConfirmation(bool _confirm, bool _store_confirm) { |  |  |  |   void setConfirmation(bool _confirm, bool _store_confirm) { | 
			
		
	
		
		
			
				
					
					|  |  |  |     confirm = _confirm; |  |  |  |     confirm = _confirm; | 
			
		
	
		
		
			
				
					
					|  |  |  |     store_confirm = _store_confirm; |  |  |  |     store_confirm = _store_confirm; | 
			
		
	
		
		
			
				
					
					|  |  |  |   }; |  |  |  |   } | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   void setActiveIcon(const QString &icon) { |  |  |  |   void setActiveIcon(const QString &icon) { | 
			
		
	
		
		
			
				
					
					|  |  |  |     active_icon_pixmap = QPixmap(icon).scaledToWidth(80, Qt::SmoothTransformation); |  |  |  |     active_icon_pixmap = QPixmap(icon).scaledToWidth(80, Qt::SmoothTransformation); | 
			
		
	
	
		
		
			
				
					|  |  | @ -175,11 +176,11 @@ public: | 
			
		
	
		
		
			
				
					
					|  |  |  |       toggle.togglePosition(); |  |  |  |       toggle.togglePosition(); | 
			
		
	
		
		
			
				
					
					|  |  |  |       setIcon(state); |  |  |  |       setIcon(state); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |   }; |  |  |  |   } | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   void showEvent(QShowEvent *event) override { |  |  |  |   void showEvent(QShowEvent *event) override { | 
			
		
	
		
		
			
				
					
					|  |  |  |     refresh(); |  |  |  |     refresh(); | 
			
		
	
		
		
			
				
					
					|  |  |  |   }; |  |  |  |   } | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | private: |  |  |  | private: | 
			
		
	
		
		
			
				
					
					|  |  |  |   void setIcon(bool state) { |  |  |  |   void setIcon(bool state) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -188,7 +189,7 @@ private: | 
			
		
	
		
		
			
				
					
					|  |  |  |     } else if (!icon_pixmap.isNull()) { |  |  |  |     } else if (!icon_pixmap.isNull()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |       icon_label->setPixmap(icon_pixmap); |  |  |  |       icon_label->setPixmap(icon_pixmap); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |   }; |  |  |  |   } | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   std::string key; |  |  |  |   std::string key; | 
			
		
	
		
		
			
				
					
					|  |  |  |   Params params; |  |  |  |   Params params; | 
			
		
	
	
		
		
			
				
					|  |  | @ -201,76 +202,50 @@ class ButtonParamControl : public AbstractControl { | 
			
		
	
		
		
			
				
					
					|  |  |  |   Q_OBJECT |  |  |  |   Q_OBJECT | 
			
		
	
		
		
			
				
					
					|  |  |  | public: |  |  |  | public: | 
			
		
	
		
		
			
				
					
					|  |  |  |   ButtonParamControl(const QString ¶m, const QString &title, const QString &desc, const QString &icon, |  |  |  |   ButtonParamControl(const QString ¶m, const QString &title, const QString &desc, const QString &icon, | 
			
		
	
		
		
			
				
					
					|  |  |  |                      std::vector<QString> button_texts, std::vector<int> button_widths) : AbstractControl(title, desc, icon) { |  |  |  |                      const std::vector<QString> &button_texts) : AbstractControl(title, desc, icon) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     select_style = (R"( |  |  |  |     const QString style = R"( | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         padding: 0; |  |  |  |       QPushButton { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         border-radius: 50px; |  |  |  |         border-radius: 50px; | 
			
		
	
		
		
			
				
					
					|  |  |  |         font-size: 45px; |  |  |  |         font-size: 40px; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         font-weight: 500; |  |  |  |         font-weight: 500; | 
			
		
	
		
		
			
				
					
					|  |  |  |         color: #E4E4E4; |  |  |  |         height:100px; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         background-color: #33Ab4C; |  |  |  |         padding: 0 25 0 25; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |       )"); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     unselect_style = (R"( |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         padding: 0; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         border-radius: 50px; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         font-size: 45px; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         font-weight: 350; |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         color: #E4E4E4; |  |  |  |         color: #E4E4E4; | 
			
		
	
		
		
			
				
					
					|  |  |  |         background-color: #393939; |  |  |  |         background-color: #393939; | 
			
		
	
		
		
			
				
					
					|  |  |  |       )"); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     key = param.toStdString(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     for (int i = 0; i < button_texts.size(); i++) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       QPushButton *button = new QPushButton(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       button->setText(button_texts[i]); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       hlayout->addWidget(button); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       button->setFixedSize(button_widths[i], 100); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       button->setStyleSheet(unselect_style); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       buttons.push_back(button); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       QObject::connect(button, &QPushButton::clicked, [=]() { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         params.put(key, (QString::number(i)).toStdString()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         refresh(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       }); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       } |  |  |  |       } | 
			
		
	
		
		
			
				
					
					|  |  |  |     refresh(); |  |  |  |       QPushButton:pressed { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         background-color: #4a4a4a; | 
			
		
	
		
		
			
				
					
					|  |  |  |       } |  |  |  |       } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       QPushButton:checked { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         background-color: #33Ab4C; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     )"; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     key = param.toStdString(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     int value = atoi(params.get(key).c_str()); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   void read_param() { |  |  |  |     QButtonGroup *button_group = new QButtonGroup(this); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     auto value = params.get(key); |  |  |  |     button_group->setExclusive(true); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     if (!value.empty()) { |  |  |  |     for (int i = 0; i < button_texts.size(); i++) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |       param_value = std::stoi(value); |  |  |  |       QPushButton *button = new QPushButton(button_texts[i], this); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       button->setCheckable(true); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       button->setChecked(i == value); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       button->setStyleSheet(style); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       hlayout->addWidget(button); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |       button_group->addButton(button, i); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |   }; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   void set_param(int new_value) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     QString values = QString::number(new_value); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     params.put(key, values.toStdString()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     refresh(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   }; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   void refresh() { |  |  |  |     QObject::connect(button_group, QOverload<int, bool>::of(&QButtonGroup::buttonToggled), [=](int id, bool checked) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     read_param(); |  |  |  |       if (checked) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     for (int i = 0; i < buttons.size(); i++) { |  |  |  |         params.put(key, std::to_string(id)); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |       buttons[i]->setStyleSheet(unselect_style); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |       if (param_value == i) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         buttons[i]->setStyleSheet(select_style); |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |       } |  |  |  |       } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     }); | 
			
		
	
		
		
			
				
					
					|  |  |  |   } |  |  |  |   } | 
			
		
	
		
		
			
				
					
					|  |  |  |   }; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   void showEvent(QShowEvent *event) override { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     refresh(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   }; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | private: |  |  |  | private: | 
			
		
	
		
		
			
				
					
					|  |  |  |   std::string key; |  |  |  |   std::string key; | 
			
		
	
		
		
			
				
					
					|  |  |  |   std::vector<QPushButton*> buttons; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   QString unselect_style; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   QString select_style; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |   Params params; |  |  |  |   Params params; | 
			
		
	
		
		
			
				
					
					|  |  |  |   int param_value = 0; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | }; |  |  |  | }; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | class ListWidget : public QWidget { |  |  |  | class ListWidget : public QWidget { | 
			
		
	
		
		
			
				
					
					|  |  |  |   Q_OBJECT |  |  |  |   Q_OBJECT | 
			
		
	
		
		
			
				
					
					|  |  |  |  public: |  |  |  |  public: | 
			
		
	
	
		
		
			
				
					|  |  | @ -310,7 +285,7 @@ class LayoutWidget : public QWidget { | 
			
		
	
		
		
			
				
					
					|  |  |  | public: |  |  |  | public: | 
			
		
	
		
		
			
				
					
					|  |  |  |   LayoutWidget(QLayout *l, QWidget *parent = nullptr) : QWidget(parent) { |  |  |  |   LayoutWidget(QLayout *l, QWidget *parent = nullptr) : QWidget(parent) { | 
			
		
	
		
		
			
				
					
					|  |  |  |     setLayout(l); |  |  |  |     setLayout(l); | 
			
		
	
		
		
			
				
					
					|  |  |  |   }; |  |  |  |   } | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | }; |  |  |  | }; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | class ClickableWidget : public QWidget { |  |  |  | class ClickableWidget : public QWidget { | 
			
		
	
	
		
		
			
				
					|  |  | 
 |