Skip to content

Commit 457d45a

Browse files
committed
Plugin: add what this
1 parent 1b641dc commit 457d45a

7 files changed

Lines changed: 162 additions & 99 deletions

File tree

Src/Database/ParameterDatabaseUI.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ CParameterDatabaseUI::CParameterDatabaseUI(QWidget *parent)
3030
setWindowTitle(tr("Database"));
3131

3232
ui->leDatabaseName->installEventFilter(this);
33+
QString szUrl;
34+
szUrl = "<a href=https://github.com/KangLin/RabbitRemoteControl/wiki/UserManual#sharing-operation-parameters>" + tr("Sharing \"Operation Parameters\"") + "</a>";
35+
ui->gpSaveOperateSettings->setWhatsThis(szUrl);
36+
ui->gpSaveOperateSettings->installEventFilter(this);
37+
ui->rbSaveSettingsToDatabase->setWhatsThis(szUrl);
38+
ui->rbSaveSettingsToDatabase->installEventFilter(this);
39+
ui->rbSaveSettingsToLocal->setWhatsThis(szUrl);
40+
ui->rbSaveSettingsToLocal->installEventFilter(this);
41+
3342
ui->pbBrowser->setVisible(false);
3443

3544
QStringList drivers = QSqlDatabase::drivers();
@@ -180,13 +189,11 @@ void CParameterDatabaseUI::on_pbBrowser_clicked()
180189

181190
bool CParameterDatabaseUI::eventFilter(QObject *watched, QEvent *event)
182191
{
183-
if(ui->leDatabaseName == watched) {
184-
if(event->type() == QEvent::WhatsThisClicked) {
185-
QWhatsThisClickedEvent* e = (QWhatsThisClickedEvent*)event;
186-
if(e) {
187-
qDebug(log) << e->href();
188-
return QDesktopServices::openUrl(e->href());
189-
}
192+
if(event->type() == QEvent::WhatsThisClicked) {
193+
QWhatsThisClickedEvent* e = (QWhatsThisClickedEvent*)event;
194+
if(e) {
195+
qDebug(log) << e->href();
196+
return QDesktopServices::openUrl(e->href());
190197
}
191198
}
192199
return QWidget::eventFilter(watched, event);

Src/Database/ParameterDatabaseUI.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
</layout>
109109
</item>
110110
<item row="6" column="0">
111-
<widget class="QGroupBox" name="groupBox_3">
111+
<widget class="QGroupBox" name="gpSaveOperateSettings">
112112
<property name="title">
113113
<string>Save operate settings to:</string>
114114
</property>

Src/ParameterCompone/ParameterPluginUI.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// Author: Kang Lin <kl222@126.com>
22

3+
#include <QWhatsThisClickedEvent>
4+
#include <QDesktopServices>
35
#include <QMessageBox>
46
#include <QFileDialog>
57
#include <QLoggingCategory>
@@ -16,6 +18,7 @@ CParameterPluginUI::CParameterPluginUI(QWidget *parent) :
1618
m_pPara(nullptr)
1719
{
1820
ui->setupUi(this);
21+
1922
setWindowTitle(tr("Plugin"));
2023
if(RabbitCommon::CTools::HasAdministratorPrivilege()) {
2124
ui->cbPromptAdminPrivilege->setText("");
@@ -25,7 +28,21 @@ CParameterPluginUI::CParameterPluginUI(QWidget *parent) :
2528
tr("Prompt administrator privilege"));
2629
ui->cbPromptAdminPrivilege->show();
2730
}
31+
2832
ui->pbEncryptKey->setToolTip(tr("Enable view password"));
33+
34+
QString szPasswordUrl;
35+
szPasswordUrl = "<a href=https://github.com/KangLin/RabbitRemoteControl/wiki/UserManual#password-security>" + tr("Password Security") + "</a>";
36+
ui->gbPassword->setWhatsThis(szPasswordUrl);
37+
ui->gbPassword->installEventFilter(this);
38+
ui->pbEncryptKey->setWhatsThis(szPasswordUrl);
39+
ui->pbEncryptKey->installEventFilter(this);
40+
ui->cbSystemCredential->setWhatsThis(szPasswordUrl);
41+
ui->cbSystemCredential->installEventFilter(this);
42+
ui->leEncryptKey->setWhatsThis(szPasswordUrl);
43+
ui->leEncryptKey->installEventFilter(this);
44+
ui->gpEncryptKey->setWhatsThis(szPasswordUrl);
45+
ui->gpEncryptKey->installEventFilter(this);
2946
}
3047

3148
CParameterPluginUI::~CParameterPluginUI()
@@ -198,3 +215,15 @@ void CParameterPluginUI::on_cbCaptureAllKeyboard_checkStateChanged(const Qt::Che
198215
{
199216
ui->gpDesktopShortcutsSctipt->setEnabled(Qt::CheckState::Checked == arg1);
200217
}
218+
219+
bool CParameterPluginUI::eventFilter(QObject *watched, QEvent *event)
220+
{
221+
if(event->type() == QEvent::WhatsThisClicked) {
222+
QWhatsThisClickedEvent* e = (QWhatsThisClickedEvent*)event;
223+
if(e) {
224+
qDebug(log) << e->href();
225+
return QDesktopServices::openUrl(e->href());
226+
}
227+
}
228+
return QWidget::eventFilter(watched, event);
229+
}

Src/ParameterCompone/ParameterPluginUI.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,8 @@ private slots:
3535
void on_pbDesktopShortcutsDisable_clicked();
3636
void on_pbDesktopShortcutsRestore_clicked();
3737
void on_cbCaptureAllKeyboard_checkStateChanged(const Qt::CheckState &arg1);
38+
39+
// QObject interface
40+
public:
41+
virtual bool eventFilter(QObject *watched, QEvent *event) override;
3842
};

Src/ParameterCompone/ParameterPluginUI.ui

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
</layout>
106106
</item>
107107
<item row="5" column="0">
108-
<widget class="QGroupBox" name="groupBox">
108+
<widget class="QGroupBox" name="gbPassword">
109109
<property name="title">
110110
<string>Password</string>
111111
</property>
@@ -114,6 +114,9 @@
114114
<layout class="QHBoxLayout" name="horizontalLayout_5">
115115
<item>
116116
<widget class="QCheckBox" name="cbSavePassword">
117+
<property name="statusTip">
118+
<string/>
119+
</property>
117120
<property name="text">
118121
<string>Enable save password</string>
119122
</property>

0 commit comments

Comments
 (0)