mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-27 19:27:49 +02:00
general settings widget ui revolution for convenience + widget locks: fixed #927
This commit is contained in:
parent
3d5fb07ca8
commit
7738eae4b0
13 changed files with 3060 additions and 2849 deletions
33
qt/i2pd_qt/widgetlock.h
Normal file
33
qt/i2pd_qt/widgetlock.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
#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
|
Loading…
Add table
Add a link
Reference in a new issue