mirror of https://github.com/PurpleI2P/i2pd.git
I2P: End-to-End encrypted and anonymous Internet
https://i2pd.website/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
940 B
33 lines
940 B
#ifndef WIDGETLOCK_H |
|
#define WIDGETLOCK_H |
|
|
|
#include <QWidget> |
|
#include <QObject> |
|
#include <QPushButton> |
|
#include <QApplication> |
|
|
|
class widgetlock : public QObject { |
|
Q_OBJECT |
|
|
|
private: |
|
QWidget* widget; |
|
QPushButton* lockButton; |
|
public slots: |
|
void lockButtonClicked(bool) { |
|
bool wasEnabled = widget->isEnabled(); |
|
widget->setEnabled(!wasEnabled); |
|
lockButton->setText(widget->isEnabled()?lockButton->tr("Lock"):lockButton->tr("Edit")); |
|
} |
|
|
|
public: |
|
widgetlock(QWidget* widget_, QPushButton* lockButton_): widget(widget_),lockButton(lockButton_) { |
|
widget->setEnabled(false); |
|
lockButton->setText(lockButton->tr("Edit")); |
|
QObject::connect(lockButton,SIGNAL(clicked(bool)), this, SLOT(lockButtonClicked(bool))); |
|
} |
|
virtual ~widgetlock() { |
|
QObject::disconnect(lockButton,SIGNAL(clicked(bool)), this, SLOT(lockButtonClicked(bool))); |
|
} |
|
}; |
|
|
|
#endif // WIDGETLOCK_H
|
|
|