Better UX add adblock add sub dialog.
This commit is contained in:
parent
32be2d38e9
commit
d019fccceb
@ -20,12 +20,10 @@
|
||||
#include "network-web/adblock/adblockaddsubscriptiondialog.h"
|
||||
|
||||
#include "definitions/definitions.h"
|
||||
#include "gui/guiutilities.h"
|
||||
#include "miscellaneous/application.h"
|
||||
#include "miscellaneous/iconfactory.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
|
||||
AdBlockAddSubscriptionDialog::AdBlockAddSubscriptionDialog(QWidget* parent)
|
||||
: QDialog(parent), m_ui(new Ui::AdBlockAddSubscriptionDialog) {
|
||||
m_ui->setupUi(this);
|
||||
@ -55,13 +53,15 @@ AdBlockAddSubscriptionDialog::AdBlockAddSubscriptionDialog(QWidget* parent)
|
||||
m_ui->m_cmbPresets->addItem(subscription.m_title);
|
||||
}
|
||||
|
||||
connect(m_ui->m_cmbPresets, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
||||
&AdBlockAddSubscriptionDialog::indexChanged);
|
||||
connect(m_ui->m_cbUsePredefined, &QCheckBox::toggled, this, &AdBlockAddSubscriptionDialog::presetsEnabledChanged);
|
||||
connect(m_ui->m_cmbPresets, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &AdBlockAddSubscriptionDialog::indexChanged);
|
||||
connect(m_ui->m_cbUsePredefined, &QCheckBox::toggled, this,
|
||||
&AdBlockAddSubscriptionDialog::presetsEnabledChanged);
|
||||
|
||||
m_ui->m_cbUsePredefined->setChecked(true);
|
||||
indexChanged(0);
|
||||
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint);
|
||||
setWindowIcon(qApp->icons()->miscIcon(ADBLOCK_ICON_ACTIVE));
|
||||
GuiUtilities::applyDialogProperties(*this,
|
||||
qApp->icons()->miscIcon(ADBLOCK_ICON_ACTIVE),
|
||||
tr("Add subscription"));
|
||||
}
|
||||
|
||||
QString AdBlockAddSubscriptionDialog::title() const {
|
||||
@ -89,13 +89,16 @@ void AdBlockAddSubscriptionDialog::indexChanged(int index) {
|
||||
void AdBlockAddSubscriptionDialog::presetsEnabledChanged(bool enabled) {
|
||||
m_ui->m_txtTitle->setEnabled(!enabled);
|
||||
m_ui->m_txtUrl->setEnabled(!enabled);
|
||||
m_ui->m_cmbPresets->setEnabled(enabled);
|
||||
|
||||
if (!enabled) {
|
||||
// Presets are disabled, clear txts.
|
||||
m_ui->m_txtTitle->clear();
|
||||
m_ui->m_txtUrl->clear();
|
||||
m_ui->m_txtTitle->setFocus();
|
||||
}
|
||||
else {
|
||||
indexChanged(m_ui->m_cmbPresets->currentIndex());
|
||||
}
|
||||
}
|
||||
|
||||
AdBlockAddSubscriptionDialog::~AdBlockAddSubscriptionDialog() {
|
||||
|
@ -6,13 +6,10 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>557</width>
|
||||
<width>440</width>
|
||||
<height>145</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Add subscription</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
@ -69,16 +66,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
@ -92,6 +79,16 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="m_buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
@ -103,7 +100,7 @@
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<sender>m_buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>AdBlockAddSubscriptionDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
@ -119,7 +116,7 @@
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<sender>m_buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>AdBlockAddSubscriptionDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
|
@ -36,7 +36,7 @@ AdBlockTreeWidget::AdBlockTreeWidget(AdBlockSubscription* subscription, QWidget*
|
||||
setLayoutDirection(Qt::LeftToRight);
|
||||
setIndentation(5);
|
||||
|
||||
connect(this, &AdBlockTreeWidget::customContextMenuRequested, this, &AdBlockTreeWidget::contextMenuRequested);
|
||||
connect(this, &QWidget::customContextMenuRequested, this, &AdBlockTreeWidget::contextMenuRequested);
|
||||
connect(this, &AdBlockTreeWidget::itemChanged, this, &AdBlockTreeWidget::itemChanged);
|
||||
connect(m_subscription, &AdBlockSubscription::subscriptionUpdated, this, &AdBlockTreeWidget::subscriptionUpdated);
|
||||
connect(m_subscription, &AdBlockSubscription::subscriptionError, this, &AdBlockTreeWidget::subscriptionError);
|
||||
|
Loading…
x
Reference in New Issue
Block a user