2020-04-23 17:38:15 +03:00
|
|
|
/*
|
|
|
|
This file is part of Kotatogram Desktop,
|
|
|
|
the unofficial app based on Telegram Desktop.
|
|
|
|
|
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/kotatogram/kotatogram-desktop/blob/dev/LEGAL
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "boxes/abstract_box.h"
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class RadiobuttonGroup;
|
|
|
|
class Radiobutton;
|
|
|
|
class FlatLabel;
|
|
|
|
} // namespace Ui
|
|
|
|
|
|
|
|
namespace Kotato {
|
|
|
|
|
|
|
|
class RadioBox : public Ui::BoxContent {
|
|
|
|
public:
|
2021-03-31 12:33:13 +04:00
|
|
|
RadioBox(QWidget* parent, const QString &title, int currentValue, int valueCount, Fn<QString(int)> labelGetter, Fn<void(int)> saveCallback, bool warnRestart = false);
|
|
|
|
RadioBox(QWidget* parent, const QString &title, const QString &description, int currentValue, int valueCount, Fn<QString(int)> labelGetter, Fn<void(int)> saveCallback, bool warnRestart = false);
|
2020-04-23 17:38:15 +03:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void prepare() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void save();
|
|
|
|
|
|
|
|
QString _title;
|
|
|
|
QString _description;
|
|
|
|
int _startValue;
|
2021-03-31 12:33:13 +04:00
|
|
|
int _valueCount;
|
|
|
|
Fn<QString(int)> _labelGetter;
|
2020-04-23 17:38:15 +03:00
|
|
|
Fn<void(int)> _saveCallback;
|
|
|
|
bool _warnRestart = false;
|
|
|
|
std::shared_ptr<Ui::RadiobuttonGroup> _group;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Kotato
|