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